Search completed in 1.71 seconds.
nsIPlacesImportExportService
toolkit/components/places/nsIPlacesIm
portEx
portService.idlScriptable Provides methods for ex
porting Places data. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) In the past, this interface also offered methods for im
porting Places data, but those methods are now part of the BookmarkHTMLUtils.jsm JavaScript code module. The interface name has been kept for compatibility reasons for code using the ex
port service. ...
... Inherits from: nsISup
ports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) In the past, this interface also offered methods for im
porting Places data, but those methods are now part of the BookmarkHTMLUtils.jsm JavaScript code module. The interface name has been kept for compatibility reasons for code using the ex
port service. ...
...Inherits from: nsISup
ports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) In the past, this interface also offered methods for im
porting Places data, but those methods are now part of the BookmarkHTMLUtils.jsm JavaScript code module. The interface name has been kept for compatibility reasons for code using the ex
port service. ...
...And 20 more matches
RTCDtlsTransport.iceTransport - Web APIs
The read-only RTCDtlsTrans
port property iceTrans
port contains a reference to the underlying RTCIceTrans
port. Syntax var iceTrans
port = rtcDtlsTrans
port.iceTrans
port; Value The underlying RTCIceTrans
port instance. Examples TBD Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCDtlsTrans
port.iceTrans
port' in that specification. Candidate Recommendation Initial definition. ...
TypeScript support in Svelte - Learn web development
At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: Learn how to configure and use TypeScript when developing Svelte applications. Note that our application is fully functional and
porting it to TypeScript is completely optional. There are different opinions about it, and in this chapter we will talk briefly about the pros and cons of using TypeScript. Even if you are not planning to adopt it, this article will be useful for allowing you to learn what it has to offer and help you make your own decision. If you are not interested at all in TypeScript, you can skip to the next cha...
...ed at all in TypeScript, you can skip to the next chapter, where we will look at different options for deploying our Svelte applications, further resources, and more. Code along with us Git Clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git Then to get to the current app state, run cd mdn-svelte-tutorial/07-typescript-sup
port Or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/07-typescript-sup
port Remember to run npm install && npm run dev to start your app in development mode. REPL Unfortunately, TypeScript sup
port is not yet available in the REPL. TypeScript: optional static typing for JavaScript TypeScript is a superset of JavaScript that provides features such as optional stati...
...be able to run everywhere JavaScript can run. How is that possible? TypeScript "transpiles" our code to vainilla JavaScript. That means that it parses TypeScript code and produces the equivalent vanilla JavaScript code for browsers to run. Note: If you are curious about how TypeScript transpiles our code to JavaScript you can have a look at the TypeScript Playground. First class TypeScript sup
port has been Svelte's most requested feature for quite some time. Thanks to the hard work of the Svelte team, together with many contributors, we have an official solution ready to be put to the test. In this section we'll show you how to setup a Svelte project With TypeScript sup
port to give it a try. Why TypeScript? Recently TypeScript has seen enormous growth. From last year's GitHub octoverse r...
...And 63 more matches
@supports - CSS: Cascading Style Sheets
Precedence of operators can be defined with parentheses. ...
...Precedence of operators can be defined with parentheses. ...
...Precedence of operators can be defined with parentheses. ...
...And 61 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
t. This article reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. Quick Tip If you must determine if a visitor is using a Gecko-based browser, simply test navigator.product == 'Gecko' or look for the string 'Gecko/' in the navigator.userAgent. Note that some other browsers such as Safari are re
porting (like Gecko) in their user agent strings and can confuse simple tests. Introduction In an ideal world, we could author HTML, XML, CSS and JavaScript and only worry about the W3C and ECMA standards. However, we don't quite live in such a world yet. Due to bugs, incomplete implementations of the standards and legacy browsers, web developers must be able to determine which browser a visitor is ...
...DOM, and ECMAScript (JavaScript) standards. It also includes compatibility features which allow it to reasonably handle legacy content which was developed for earlier generations of browsers such as Netscape Navigator 4 as well as features which provide compatibility with Internet Explorer 5 and 6. Unlike other browsers, Gecko is truly cross platform and provides consistent behavior across all sup
ported operating systems. The easiest way to sup
port Gecko is to create content which follows web standards. Unfortunately, no other browser sup
ports web standards as completely as Gecko. This means web developers and authors are forced to continue to sup
port other browsers which do not comply with the standards as fully. Fortunately, other browsers such as Opera (versions 7 & later) and to a lesser ...
...s to create content which follows web standards. Unfortunately, no other browser sup
ports web standards as completely as Gecko. This means web developers and authors are forced to continue to sup
port other browsers which do not comply with the standards as fully. Fortunately, other browsers such as Opera (versions 7 & later) and to a lesser extent, Internet Explorer (versions 5.5 & later) also sup
port the standards to a degree. These other browsers appear to be moving towards more complete sup
port for the standards and there is hope that in the future web developers and authors will be able to dispense with browser detection at least with regard to features governed by standards. ...
...And 48 more matches
export - JavaScript
The ex
port statement is used when creating JavaScript modules to ex
port live bindings to functions, objects, or primitive values from the module so they can be used by other programs with the im
port statement. Bindings that are ex
ported can still be modified locally; when im
ported, although they can only be read by the im
porting module the value updates whenever it is updated by the ex
porting module. Ex
ported modules are in strict mode whether you declare them as such or not. The ex
port statement cannot be used in embedded scripts. ...
... programs with the im
port statement. Bindings that are ex
ported can still be modified locally; when im
ported, although they can only be read by the im
porting module the value updates whenever it is updated by the ex
porting module. Ex
ported modules are in strict mode whether you declare them as such or not. The ex
port statement cannot be used in embedded scripts. ...
... im
port statement. Bindings that are ex
ported can still be modified locally; when im
ported, although they can only be read by the im
porting module the value updates whenever it is updated by the ex
porting module. Ex
ported modules are in strict mode whether you declare them as such or not. The ex
port statement cannot be used in embedded scripts. ...
...And 37 more matches
SubtleCrypto.exportKey() - Web APIs
It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format. spki: SubjectPublicKeyInfo format. ...
...It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format. spki: SubjectPublicKeyInfo format. ...
...It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format. spki: SubjectPublicKeyInfo format. ...
...And 33 more matches
import - JavaScript
The static im
port statement is used to im
port read only live bindings which are ex
ported by another module. Im
ported modules are in strict mode whether you declare them as such or not. The im
port statement cannot be used in embedded scripts unless such script has a type="module". Bindings im
ported are called live bindings because they are updated by the module that ex
ported the binding. There is also a function-like dynamic im
port(), which does not require scripts of type="module". Backward compatibility can be ensured using attribute nomodule on the <script> tag. ...
... The im
port statement cannot be used in embedded scripts unless such script has a type="module". Bindings im
ported are called live bindings because they are updated by the module that ex
ported the binding. There is also a function-like dynamic im
port(), which does not require scripts of type="module". Backward compatibility can be ensured using attribute nomodule on the <script> tag. ...
...atement cannot be used in embedded scripts unless such script has a type="module". Bindings im
ported are called live bindings because they are updated by the module that ex
ported the binding. There is also a function-like dynamic im
port(), which does not require scripts of type="module". Backward compatibility can be ensured using attribute nomodule on the <script> tag. ...
...And 29 more matches
Reporting API - Web APIs
Concepts and usage There are a number of different features and problems on the web platform that generate information useful to web developers when they are trying to fix bugs or improve their websites in other ways. Such information can include: Content Security Policy violations. Feature-Policy violations. Deprecated feature usage (when you are using something that will stop working soon in browsers). Occurrence of crashes. ...
...: Content Security Policy violations. Feature-Policy violations. Deprecated feature usage (when you are using something that will stop working soon in browsers). Occurrence of crashes. Occurrence of user-agent interventions (when the browser blocks something your code is trying to do because it is deemed a security risk for example, or just plain annoying, like auto-playing audio). ...
...olicy violations. Deprecated feature usage (when you are using something that will stop working soon in browsers). Occurrence of crashes. Occurrence of user-agent interventions (when the browser blocks something your code is trying to do because it is deemed a security risk for example, or just plain annoying, like auto-playing audio). ...
...And 26 more matches
SubtleCrypto.importKey() - Web APIs
It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format. spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. keyData is an ArrayBuffer, a TypedArray, a DataView, or a JSONWebKey object containing the key in the given format. ...
...It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format. spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. keyData is an ArrayBuffer, a TypedArray, a DataView, or a JSONWebKey object containing the key in the given format. ...
... input a key in an external,
portable format and gives you a CryptoKey object that you can use in the Web Crypto API. The function accepts several im
port formats: see Sup
ported formats for details. Syntax const result = crypto.subtle.im
portKey( format, keyData, algorithm, extractable, usages ); Parameters format is a string describing the data format of the key to im
port. It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format. spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. keyData is an ArrayBuffer, a TypedArray, a DataView, or a JSONWebKey object containing the key in the given format. algorithm is a dictionary object defining the type of key to im
port and providing extra algorithm-specific parameters. F...
...And 25 more matches
Viewport concepts - CSS: Cascading Style Sheets
This article explains the concept of the view
port -- what it is, its impact in terms of CSS, SVG, and mobile devices -- and differentiates between the visual view
port and the layout view
port. What is a view
port? A view
port represents the area in computer graphics being currently viewed. In web browser terms, it is generally the same as the browser window, excluding the UI, menu bar, etc. That is, the part of the document you are viewing. Documents like this article may be very long. Your view
port is everything that is currently visible, notably, the "what is a view
port section", and perhaps some of the navigation menu. The size of the view
port depends on the size of the screen, whether the browser is in fullscreen mode or not, and whether or not the user zoomed in. Content outside the view...
...he part of the document you are viewing. Documents like this article may be very long. Your view
port is everything that is currently visible, notably, the "what is a view
port section", and perhaps some of the navigation menu. The size of the view
port depends on the size of the screen, whether the browser is in fullscreen mode or not, and whether or not the user zoomed in. Content outside the view
port, such as the See Also section in this document, is likely to not be visible onscreen until scrolled into view. On larger monitors where applications aren't necessarily full screen, the view
port is the size of the browser window. ...
...fullscreen mode or not, and whether or not the user zoomed in. Content outside the view
port, such as the See Also section in this document, is likely to not be visible onscreen until scrolled into view. On larger monitors where applications aren't necessarily full screen, the view
port is the size of the browser window. On most mobile devices and when the browser is in fullscreen mode, the view
port is the entire screen. In fullscreen mode, the view
port is the device screen, the window is the browser window, which can be as big as the view
port or smaller, and the document is the website, which can be much taller or wider than the view
port. ...
...And 23 more matches
Mozilla’s UAAG evaluation report
he UAAG is not the basis for any government accessibility regulations at this time. This document is based on the September 12, 2001 Candidate Recommendation of UAAG 1.0. This may be different from the most recent version, check for updates on the User Agent Working Group home page. Look to the "techniques" document for real-world implementation examples of each checkpoint. This UAAG evaluation re
port covers nightly builds of the Mozilla web browser itself, running on Windows 2000, as of February 20, 2002. We are claiming to sup
port HTML 4, CSS 2, PNG, JPG and GIF. This evaluation does not cover Mailnews or Composer. There may be accessibility and customizability features not listed here. A very good resource is The Customizing Document. When filing Mozilla bugs based on UAAG requirements, ple...
...re claiming to sup
port HTML 4, CSS 2, PNG, JPG and GIF. This evaluation does not cover Mailnews or Composer. There may be accessibility and customizability features not listed here. A very good resource is The Customizing Document. When filing Mozilla bugs based on UAAG requirements, please use bug 24413 as the UAAG meta bug. ...
... here. A very good resource is The Customizing Document. When filing Mozilla bugs based on UAAG requirements, please use bug 24413 as the UAAG meta bug. Checkpoint Information (Same scaled used on W3C's UAAG implementation re
ports pages) Rating Scale C: Complete Implementation VG: Very Good Implementation, almost all requirements satisfied G: Good Implementation, most im
portant requirements satisfied P: Poor Implementation, some requirements satisfied and/or difficult for user to access feature NI: Not Implemented NR: Not Rated NA: Not Applicable Document under construction Guideline 1. Sup
port input and output device-independence. Checkpoint Title Status Notes/plans 1.1 Full keyboard access. (P1) VG We...
...And 22 more matches
Communicating using "port" - Archive of obsolete content
This page is now obsolete, and its content has been incorporated into the main page on content scripts. To enable add-on scripts and content scripts to communicate with each other, each end of the conversation has access to a
port object. to send messages from one side to the other, use
port.emit() to receive messages sent from the other side, use
port.on() Messages are asynchronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing. ...
...h end of the conversation has access to a
port object. to send messages from one side to the other, use
port.emit() to receive messages sent from the other side, use
port.on() Messages are asynchronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing. ...
...ges from one side to the other, use
port.emit() to receive messages sent from the other side, use
port.on() Messages are asynchronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing. Here's a simple add-on that sends a message to a content script using
port: var tabs = require("sdk/tabs"); var alertContentScript = "self.
port.on('alert', function(message) {" + " window.alert(message);" + "})"; tabs.on("ready", function(tab) { worker = tab.attach({ contentScript: alertContentScript }); worker.
port.emit("alert", "Message from the add-on"); }); tabs.open("http://www.mozilla.org"); In total, the
port object defines four functions: emit(): emit a message. ...
...And 21 more matches
nsIMemoryReporterManager
xpcom/base/nsIMemoryRe
porter.idlScriptable A service that provides methods for managing nsIMemoryRe
porter objects. Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Implemented by @mozilla.org/memory-re
porter-manager;1 as a service: var re
porterManager = Components.classes["@mozilla.org/memory-re
porter-manager;1"] .getService(Components.interfaces.nsIMemoryRe
porterManager); Each memory re
porter object, which implements nsiMemoryRe
porter interface, provides information for a given code area. Each code area is identified by a unique path string, which is displayed in about:memory. ...
...mozilla.org/memory-re
porter-manager;1"] .getService(Components.interfaces.nsIMemoryRe
porterManager); Each memory re
porter object, which implements nsiMemoryRe
porter interface, provides information for a given code area. Each code area is identified by a unique path string, which is displayed in about:memory. ...
... .getService(Components.interfaces.nsIMemoryRe
porterManager); Each memory re
porter object, which implements nsiMemoryRe
porter interface, provides information for a given code area. Each code area is identified by a unique path string, which is displayed in about:memory. ...
...And 20 more matches
Components.utils.exportFunction
This function provides a safe way to expose a function from a privileged scope to a less-privileged scope. In this way privileged code, such as an extension, can share code with less-privileged code like a normal web page script. A function ex
ported from privileged to less-privileged code can be called from the less privileged code's context. The function has access to its surrounding closure just as if it were being called in the privileged context. The ex
ported function does not have to be added to the less privileged code's global window object: it can be ex
ported to any object in the target scope. ex
portFunction() is made available as a global in sandboxes which have the wantEx
portHelpers option set in the Sandbox() constructor. This includes Add-on SDK content scripts. To...
... targetScope : object The object to attach the function to. ...
... targetScope : object The object to attach the function to. ...
...And 19 more matches
Mozilla Port Blocking
Warning: The content of this article may be out of date. Background On 08/15/2001, Cert issued a Vulnerability Note VU#476267 for a "Cross-Protocol" scripting attack, known as the HTML Form Protocol Attack which allowed sending arbitrary data to most TCP
ports. A simple exploit of this hole allows an attacker to send forged unsigned mail through a mail server behind your firewall: A really nasty hole. Mozilla responded by modifying how protocols can access
ports. By default, Mozilla now blocks access to specific
ports which are used by vulnerable services in order to prevent security vulnerabilites due to "Cross-Protocol Scripting". Each protocol's handler can override this blocking for itself in order to enable the required access for that protocol. Potential Problems caused by...
...ly nasty hole. Mozilla responded by modifying how protocols can access
ports. By default, Mozilla now blocks access to specific
ports which are used by vulnerable services in order to prevent security vulnerabilites due to "Cross-Protocol Scripting". Each protocol's handler can override this blocking for itself in order to enable the required access for that protocol. Potential Problems caused by
Port Blocking
Port blocking can cause problems if a site or web application requires access to one of the
ports which is blocked in Mozilla. If a user attempts to access a URI on a blocked
port, Mozilla shows one of the following alerts to the user or in the Error Console. "Access to the
port number given has been disabled for security reasons." "Establishing a connection to an unsafe or otherwise ban...
...cking
Port blocking can cause problems if a site or web application requires access to one of the
ports which is blocked in Mozilla. If a user attempts to access a URI on a blocked
port, Mozilla shows one of the following alerts to the user or in the Error Console. "Access to the
port number given has been disabled for security reasons." "Establishing a connection to an unsafe or otherwise banned
port was prohibited" "0x804b0013 (NS_ERROR_
PORT_ACCESS_NOT_ALLOWED)" If your product or web site uses a
port which is blocked by Mozilla's default
port blocking rules, you can either change the
port of your service to a unblocked value (recommended if possible) or ask your Mozilla users to enable the
port. For details on which
ports are blocked and how to override the blocking see below. Modifying Moz...
...And 18 more matches
nsISupportsPrimitive
xpcom/ds/nsISup
portsPrimitives.idlScriptable This interface serves as a base interface for all of the nsISup
ports* family of interfaces. Inherits from: nsISup
ports Last changed in Gecko 1.7 Attributes Attribute Type Description type unsigned short This attribute provides access to the type represented by the nsISup
portsPrimitive instance. Constants Constant Value Description TYPE_ID 1 Corresponding to nsISup
portsID. TYPE_CSTRING 2 Corresponding to nsISup
portsCString. TYPE_STRING 3 Corresponding to nsISup
portsString. TYPE_PRBOOL 4 Corresponding to nsISup
portsPRBool. TYPE_PRUINT8 5 Corresponding to nsISup
portsPRUint8. TYPE_PRUINT16 6 Corresponding to nsISup
portsPRUint16. TYPE_PRUINT32 7 Corresponding to nsISup
portsPRUint32. TYPE_PRUINT64 8 Corresponding...
... 1 Corresponding to nsISup
portsID. TYPE_CSTRING 2 Corresponding to nsISup
portsCString. TYPE_STRING 3 Corresponding to nsISup
portsString. TYPE_PRBOOL 4 Corresponding to nsISup
portsPRBool. TYPE_PRUINT8 5 Corresponding to nsISup
portsPRUint8. TYPE_PRUINT16 6 Corresponding to nsISup
portsPRUint16. TYPE_PRUINT32 7 Corresponding to nsISup
portsPRUint32. TYPE_PRUINT64 8 Corresponding to nsISup
portsPRUint64. TYPE_PRTIME 9 Corresponding to nsISup
portsPRTime. TYPE_CHAR 10 Corresponding to nsISup
portsChar. TYPE_PRINT16 11 Corresponding to nsISup
portsPRInt16. TYPE_PRINT32 12 Corresponding to nsISup
portsPRInt32. TYPE_PRINT64 13 Corresponding to nsISup
portsPRInt64. TYPE_FLOAT 14 Corresponding to nsISup
portsFloat. TYPE_DOUBLE 15 Corresponding to nsISup
portsDouble. TYPE_VOID 16 Corr...
...RTIME 9 Corresponding to nsISup
portsPRTime. TYPE_CHAR 10 Corresponding to nsISup
portsChar. TYPE_PRINT16 11 Corresponding to nsISup
portsPRInt16. TYPE_PRINT32 12 Corresponding to nsISup
portsPRInt32. TYPE_PRINT64 13 Corresponding to nsISup
portsPRInt64. TYPE_FLOAT 14 Corresponding to nsISup
portsFloat. TYPE_DOUBLE 15 Corresponding to nsISup
portsDouble. TYPE_VOID 16 Corresponding to nsISup
portsVoid. TYPE_INTERFACE_POINTER 17 Corresponding to nsISup
portsInterfacePointer. Remarks This interface was frozen for Gecko 1.2. See bug 166426 for details. From Gecko 2.0 interfaces are no longer frozen. ...
...And 17 more matches
DeprecationReportBody - Web APIs
anticipatedRemoval A Date object (rendered as a string) representing the date when the feature is expected to be removed from the current browser. If the date is not known, this property will return null. ...
... anticipatedRemoval A Date object (rendered as a string) representing the date when the feature is expected to be removed from the current browser. If the date is not known, this property will return null. ...
... anticipatedRemoval A Date object (rendered as a string) representing the date when the feature is expected to be removed from the current browser. If the date is not known, this property will return null. ...
...And 17 more matches
PushManager.supportedContentEncodings - Web APIs
Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 17 more matches
Supporting older browsers - Learn web development
Previous Overview: CSS layout Next In this module, we recommend using Flexbox and Grid as the main layout methods for your designs. However, there will be visitors to your site who use older browsers, or browsers which do not sup
port the methods you have used. This will always be the case on the web -- as new features are developed, different browsers will prioritise different things. This article explains how to use modern web techniques without locking out users of older technology. Prerequisites: HTML basics (study Introduction to HTML), and an idea of how CSS works (study Introduction to CSS and Styling boxes.) Objective: To understand how to provide sup
port for your layouts on older browsers that might not sup
port the features you want to use. Wha...
...than an average number of mobile devices. Accessibility and people using assistive technology should always be considered, but for some sites that may be even more critical. In my experience, developers are often very worried about the experience of 1% of users in an old version of Internet Explorer, while not considering at all the far greater number who have accessibility needs. What is the sup
port for the features you want to use? Once you know the browsers that come to your site, you can assess any technology that you want to use against how well it is sup
ported and how easily you can provide an alternative for visitors who do not have that technology available. We are trying to make this easy for you at MDN, by providing browser compatibility information on each page detailing a CSS pro...
... how easily you can provide an alternative for visitors who do not have that technology available. We are trying to make this easy for you at MDN, by providing browser compatibility information on each page detailing a CSS property. For example, take a look at the page for grid-template-columns. At the bottom of this page is a table, which lists major browsers along with the version they began sup
porting this property. Another popular way to find out about how well a feature is sup
ported is the Can I Use website. This site lists the majority of Web Platform features with information about their browser sup
port status. You can view usage statistics by location -- useful if you work on a site that has users mostly for a specific area of the world. You can even link your Google Analytics accou...
...And 16 more matches
JSErrorReport
If NULL, the error is local to the script in the current HTML page. lineno unsigned Line number in the source that caused the error. column unsigned zero-based column index in line in the source that caused the error. isMuted bool The Web Platform allows scripts to be loaded from arbitrary cross-origin sources. ...
...e generated syntax errors (via a window.onerror handler) for juicy morsels of its contents. To counter this attack, HTML5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded. Callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in JSErrorRe
ports. linebuf const char * Text of the line that caused the error, minus the trailing newline character. tokenptr const char * Pointer to the error token in *linebuf. uclinebuf const char16_t * Unicode line buffer. This is the buffer that contains the original data. uctokenptr const char16_t * Pointer to the error token in *uclinebuf. ...
... character. tokenptr const char * Pointer to the error token in *linebuf. uclinebuf const char16_t * Unicode line buffer. This is the buffer that contains the original data. uctokenptr const char16_t * Pointer to the error token in *uclinebuf. ...
...And 16 more matches
nsISocketTransportService
netwerk/base/public/nsISocketTrans
portService.idlScriptable This interface provides a mapping between a socket type and its associated socket provider instance. One could also use the service manager directly. Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/network/socket-trans
port-service;1. ...
... netwerk/base/public/nsISocketTrans
portService.idlScriptable This interface provides a mapping between a socket type and its associated socket provider instance. One could also use the service manager directly. Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/network/socket-trans
port-service;1. ...
...able This interface provides a mapping between a socket type and its associated socket provider instance. One could also use the service manager directly. Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/network/socket-trans
port-service;1. ...
...And 16 more matches
WebAssembly.Module.exports() - JavaScript
The WebAssembly.Module.ex
ports() function returns an array containing descriptions of all the declared ex
ports of the given Module. Syntax WebAssembly.Module.ex
ports(module); Parameters module A WebAssembly.Module object. Return value An array containing objects representing the ex
ported functions of the given module. Exceptions If module is not a WebAssembly.Module object instance, a TypeError is thrown. Examples Using ex
ports The following example (see our index-compile.html demo on GitHub, and view it live also) compiles the loaded simple.wasm byte code using the WebAssembly.compileStreaming() method and then sends it to a worker using postMessage(). var worker = new Worker("wasm_worker.js"); WebAssembly.compileStreaming(fetch('simple.wasm')) .then(mod => worker.postMess...
...le (see our index-compile.html demo on GitHub, and view it live also) compiles the loaded simple.wasm byte code using the WebAssembly.compileStreaming() method and then sends it to a worker using postMessage(). ...
...= new Worker("wasm_worker.js"); WebAssembly.compileStreaming(fetch('simple.wasm')) .then(mod => worker.postMessage(mod) ); In the worker (see wasm_worker.js) we define an im
port object for the module to use, then set up an event handler to receive the module from the main thread. when the module is received, we create an instance from it using the WebAssembly.Instantiate() method, invoke an ex
ported function from inside it, then show how we can return information on the available ex
ports on a module using WebAssembly.Module.ex
ports. ...
...And 16 more matches
Using the viewport meta tag to control layout on mobile browsers
Background The browser's view
port is the area of the window in which web content can be seen. This is often not the same size as the rendered page, in which case the browser provides scrollbars for the user to scroll around and access all the content. Narrow screen devices (e.g. mobiles) render pages in a virtual window or view
port, which is usually wider than the screen, and then shrink the rendered result down so it can all be seen at once. Users can then pan and zoom to see different areas of the page. For example, if a mobile screen has a width of 640px, pages might be rendered with a virtual view
port of 980px, and then it will be shrunk down to fit into the 640px space. This is done because many pages are not mobile optimized, and break (or at least look bad) when rendered at a...
...esult down so it can all be seen at once. Users can then pan and zoom to see different areas of the page. For example, if a mobile screen has a width of 640px, pages might be rendered with a virtual view
port of 980px, and then it will be shrunk down to fit into the 640px space. This is done because many pages are not mobile optimized, and break (or at least look bad) when rendered at a small view
port width. This virtual view
port is a way to make non-mobile-optimized sites in general look better on narrow screen devices. ...
...has a width of 640px, pages might be rendered with a virtual view
port of 980px, and then it will be shrunk down to fit into the 640px space. This is done because many pages are not mobile optimized, and break (or at least look bad) when rendered at a small view
port width. This virtual view
port is a way to make non-mobile-optimized sites in general look better on narrow screen devices. Enter view
port meta tag However, this mechanism is not so good for pages that are optimized for narrow screens using media queries -- if the virtual view
port is 980px for example, media queries that kick in at 640px or 480px or less will never be used, limiting the effectiveness of such responsive design techniques. ...
...And 14 more matches
Memory reporting
tl;dr: You should read this document before writing a memory re
porter. And please ask nnethercote to co-review any memory re
porter patch. Mozilla code has infrastructure that lets different parts of the code re
port on their memory usage. This is most obviously used in about:memory and telemetry. This document describes things that you should know when writing a memory re
porter. Memory Re
porters A memory re
porter makes one or more memory measurements (a.k.a. re
ports). ...
...nnethercote to co-review any memory re
porter patch. Mozilla code has infrastructure that lets different parts of the code re
port on their memory usage. This is most obviously used in about:memory and telemetry. This document describes things that you should know when writing a memory re
porter. Memory Re
porters A memory re
porter makes one or more memory measurements (a.k.a. re
ports). Each re
porter implements a collectRe
ports function which takes a nsIMemoryRe
porterCallback argument; for each measurement the re
porter must pass in several values, including: a path (which identifies the re
port); an amount (the most im
portant thing); a unit (most commonly bytes, but sometimes a unitless count or percentage); a description of what is measured. ...
...
ports). Each re
porter implements a collectRe
ports function which takes a nsIMemoryRe
porterCallback argument; for each measurement the re
porter must pass in several values, including: a path (which identifies the re
port); an amount (the most im
portant thing); a unit (most commonly bytes, but sometimes a unitless count or percentage); a description of what is measured. See the nsIMemoryRe
porter documentation and nsIMemoryRe
porter.idl for full details. Making Measurements nsIMemoryRe
porter provides the high-level interface for a memory re
porter, but the heart of a memory re
porter is the measurement of the "amount". Two Ways to Measure Memory re
porters can be divided into the two following kinds. ...
...And 14 more matches
A guide to searching crash reports
Grouping You can cluster the results of each search into groups using the same criteria. To achieve full power and flexibility requires a good understanding of both of these functions. ...
... Grouping You can cluster the results of each search into groups using the same criteria. To achieve full power and flexibility requires a good understanding of both of these functions. ...
... Grouping You can cluster the results of each search into groups using the same criteria. To achieve full power and flexibility requires a good understanding of both of these functions. ...
...And 14 more matches
nsISupportsArray
xpcom/ds/nsISup
portsArray.idlScriptable Please add a summary to this article. ...
... xpcom/ds/nsISup
portsArray.idlScriptable Please add a summary to this article. ...
... xpcom/ds/nsISup
portsArray.idlScriptable Please add a summary to this article. ...
...And 14 more matches
RTCDtlsTransport - Web APIs
The RTCDtlsTrans
port interface provides access to information about the Datagram Trans
port Layer Security (DTLS) trans
port over which a RTCPeerConnection's RTP and RTCP packets are sent and received by its RTCRtpSender and RTCRtpReceiver objects. A DTLS trans
port is also used to provide information about SCTP packets transmitted and received by an connection's data channels. Features of the DTLS trans
port include the addition of security to the underlying trans
port; the RTCDtlsTrans
port interface can be used to obtain information about the underlying trans
port and the security added to it by the DTLS layer. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style=...
...ort and the security added to it by the DTLS layer. ...
... top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/RTCDtlsTrans
port" target="_top"><rect x="1" y="1" width="160" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">RTCDtlsTrans
port</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} PropertiesiceTrans
port Read only The read-only RTCDtlsTrans
port property iceTrans
port contains a reference to the underlying RTCIceTrans
port.state Read only The state read-only property of the RTCDtlsTrans
port interface provides information which describes a Datagram Trans
port Layer Security (DTLS) trans
port st...
...And 14 more matches
Report - Web APIs
The Re
port interface of the Re
porting API represents a single re
port. Re
ports can be accessed in a number of ways: Via the Re
portingObserver.takeRecords() method -- this returns all re
ports in an observer's re
port queue, and then empties the queue. Via the re
ports parameter of the callback function passed into the Re
portingObserver() constructor upon creation of a new observer instance. This contains the list of re
ports currently contained in the observer's re
port queue. By sending requests to the endpoints defined via the Re
port-To HTTP header. Properties Re
port.body Read only The body of the re
port, which is a Re
portBody object containing the detailed re
port information. Re
port.type Read only The type of re
port generated, e.g. ...
...stance. This contains the list of re
ports currently contained in the observer's re
port queue. By sending requests to the endpoints defined via the Re
port-To HTTP header. Properties Re
port.body Read only The body of the re
port, which is a Re
portBody object containing the detailed re
port information. Re
port.type Read only The type of re
port generated, e.g. deprecation or intervention. Re
port.url Read only The URL of the document that generated the re
port. Methods This interface has no methods defined on it. Events This interface has no events that fire on it. ...
...body of the re
port, which is a Re
portBody object containing the detailed re
port information. Re
port.type Read only The type of re
port generated, e.g. deprecation or intervention. Re
port.url Read only The URL of the document that generated the re
port. Methods This interface has no methods defined on it. Events This interface has no events that fire on it. ...
...And 14 more matches
BasicCardRequest.supportedNetworks - Web APIs
The sup
portedNetworks property of the BasicCardRequest dictionary contains an array of DOMStrings representing the card networks that the retailer sup
ports (e.g. amex, mastercard). Syntax sup
portedNetworks : [value [, ... value]] Value An array containing one or more DOMStrings, which describe the card networks the retailer sup
ports. Legal values are defined in the W3C's document Card Network Identifiers Approved for use with Payment Request API, and are currently: amex cartebancaire diners discover jcb mastercard mir unionpay visa Example The following example shows a sample definition of the first parameter of the PaymentRequest() constructor, the data property of which contains sup
portedNetworks and sup
portedTypes properties. ...
...in the W3C's document Card Network Identifiers Approved for use with Payment Request API, and are currently: amex cartebancaire diners discover jcb mastercard mir unionpay visa Example The following example shows a sample definition of the first parameter of the PaymentRequest() constructor, the data property of which contains sup
portedNetworks and sup
portedTypes properties. ...
...etwork Identifiers Approved for use with Payment Request API, and are currently: amex cartebancaire diners discover jcb mastercard mir unionpay visa Example The following example shows a sample definition of the first parameter of the PaymentRequest() constructor, the data property of which contains sup
portedNetworks and sup
portedTypes properties. ...
...And 12 more matches
@import - CSS: Cascading Style Sheets
The @im
port CSS at-rule is used to im
port style rules from other style sheets. Syntax @im
port url; @im
port url list-of-media-queries; @im
port url sup
ports( sup
ports-query ); @im
port url sup
ports( sup
ports-query ) list-of-media-queries; where: url Is a <string> or a <url> representing the location of the resource to im
port. The URL may be absolute or relative. Note that the URL for a Mozilla package need not actually specify a file; it can just specify the package name and part, and the appropriate file is chosen automatically (e.g. chrome://communicator/skin/). See here for more information. list-of-media-queries Is a comma-separated list of media queries conditioning the application of the CSS rules defined in the linked URL. ...
... that the URL for a Mozilla package need not actually specify a file; it can just specify the package name and part, and the appropriate file is chosen automatically (e.g. chrome://communicator/skin/). See here for more information. list-of-media-queries Is a comma-separated list of media queries conditioning the application of the CSS rules defined in the linked URL. ...
...le; it can just specify the package name and part, and the appropriate file is chosen automatically (e.g. chrome://communicator/skin/). See here for more information. list-of-media-queries Is a comma-separated list of media queries conditioning the application of the CSS rules defined in the linked URL. If the browser does not sup
port any these queries, it does not load the linked resource. sup
ports-query Is either a <sup
ports-condition> or a <declaration>. Description Im
ported rules must precede all other types of rules, except @charset rules; as it is not a nested statement, @im
port cannot be used inside conditional group at-rules. So that user agents can avoid retrieving resources for unsup
ported media types, authors may specify media-dependent @im
port rules. These conditional impor...
...And 12 more matches
Content-Security-Policy-Report-Only - HTTP
The HTTP Content-Security-Policy-Re
port-Only response header allows web developers to experiment with policies by monitoring (but not enforcing) their effects. These violation re
ports consist of JSON documents sent via an HTTP POST request to the specified URI. For more information, see also this article on Content Security Policy (CSP). Header type Response header Forbidden header name no This header is not sup
ported inside a <meta> element. Syntax Content-Security-Policy-Re
port-Only: <policy-directive>; <policy-directive> Directives The directives of the Content-Security-Policy header can also be applied to Content-Security-Policy-Re
port-Only. ...
...ontent Security Policy (CSP). Header type Response header Forbidden header name no This header is not sup
ported inside a <meta> element. Syntax Content-Security-Policy-Re
port-Only: <policy-directive>; <policy-directive> Directives The directives of the Content-Security-Policy header can also be applied to Content-Security-Policy-Re
port-Only. The CSP re
port-uri directive should be used with this header, otherwise this header will be an expensive no-op machine. Examples This header re
ports violations that would have occurred. You can use this to iteratively work on your content security policy. ...
...curity-Policy header can also be applied to Content-Security-Policy-Re
port-Only. The CSP re
port-uri directive should be used with this header, otherwise this header will be an expensive no-op machine. Examples This header re
ports violations that would have occurred. You can use this to iteratively work on your content security policy. You observe how your site behaves, watching for violation re
ports, or malware redirects, then choose the desired policy enforced by the Content-Security-Policy header. Content-Security-Policy-Re
port-Only: default-src https:; re
port-uri /csp-violation-re
port-endpoint/ If you still want to receive re
porting, but also want to enforce a policy, use the Content-Security-Policy header with the re
port-uri directive. Content-Security-Policy: default-src https:; rep...
...And 12 more matches
WebAssembly.Instance.prototype.exports - JavaScript
The ex
ports readonly property of the WebAssembly.Instance object prototype returns an object containing as its members all the functions ex
ported from the WebAssembly module instance, to allow them to be accessed and used by JavaScript. instance.ex
ports Examples Using ex
ports After fetching some WebAssembly bytecode using fetch, we compile and instantiate the module using the WebAssembly.instantiateStreaming() function, im
porting a JavaScript function into the WebAssembly Module in the process. We then call an Ex
ported WebAssembly function that is ex
ported by the Instance. ...
...w them to be accessed and used by JavaScript. instance.ex
ports Examples Using ex
ports After fetching some WebAssembly bytecode using fetch, we compile and instantiate the module using the WebAssembly.instantiateStreaming() function, im
porting a JavaScript function into the WebAssembly Module in the process. We then call an Ex
ported WebAssembly function that is ex
ported by the Instance. var im
portObject = { im
ports: { im
ported_func: function(arg) { console.log(arg); } } }; WebAssembly.instantiateStreaming(fetch('simple.wasm'), im
portObject) .then(obj => obj.instance.ex
ports.ex
ported_func()); Note: You can also find this example as instantiate-streaming.html on GitHub (view it live also). Specifications Specification WebAssembly JavaScript Inter...
... Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 12 more matches
WebAssembly.Module.imports() - JavaScript
The WebAssembly.im
ports() function returns an array containing descriptions of all the declared im
ports of the given Module. Syntax WebAssembly.Module.im
ports(module); Parameters module A WebAssembly.Module object. Return value An array containing objects representing the im
ported functions of the given module. Exceptions If module is not a WebAssembly.Module object instance, a TypeError is thrown. Examples Using im
ports The following example (see im
ports.html source code; see it live also) compiles the loaded simple.wasm module. This module is then queried for its im
ports. ...
...the im
ported functions of the given module. Exceptions If module is not a WebAssembly.Module object instance, a TypeError is thrown. Examples Using im
ports The following example (see im
ports.html source code; see it live also) compiles the loaded simple.wasm module. This module is then queried for its im
ports. WebAssembly.compileStreaming(fetch('simple.wasm')) .then(function(mod) { var im
ports = WebAssembly.Module.im
ports(mod); console.log(im
ports[0]); }); The output looks like this: { module: "im
ports", name: "im
ported_func", kind: "function" } Specifications Specification WebAssembly JavaScript InterfaceThe definition of 'im
ports()' in that specification. Browser compatibility The compatibility table on this page is generated from structured dat...
... Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
ReportingObserver - Web APIs
The Re
portingObserver interface of the Re
porting API allows you to collect and access re
ports. Constructor Re
portingObserver() Creates a new Re
portingObserver object instance, which can be used to collect and access re
ports. Properties This interface has no properties defined on it. Methods Re
portingObserver.disconnect() Stops a re
porting observer that had previously started observing from collecting re
ports. Re
portingObserver.observe() Instructs a re
porting observer to start collecting re
ports in its re
port queue. Re
portingObserver.takeRecords() Returns the current list of re
ports contained in the observer's re
port queue, and empties the queue. Events This interface has no events that fire on it. ...
...ver that had previously started observing from collecting re
ports. Re
portingObserver.observe() Instructs a re
porting observer to start collecting re
ports in its re
port queue. Re
portingObserver.takeRecords() Returns the current list of re
ports contained in the observer's re
port queue, and empties the queue. Events This interface has no events that fire on it. ...
...g from collecting re
ports. Re
portingObserver.observe() Instructs a re
porting observer to start collecting re
ports in its re
port queue. Re
portingObserver.takeRecords() Returns the current list of re
ports contained in the observer's re
port queue, and empties the queue. Events This interface has no events that fire on it. ...
...And 10 more matches
VisualViewport - Web APIs
The VisualView
port interface of the Visual View
port API represents the visual view
port for a given window. For a page containing iframes, each iframe, as well as the containing page, will have a unique window object. Each window on a page will have a unique VisualView
port representing the properties associated with that window. You can get a window's visual view
port using Window.visualView
port. Note: Only the top-level window has a visual view
port that's distinct from the layout view
port. Therefore, it's generally only the VisualView
port object of the top-level window that's useful. For an <iframe>, visual view
port metrics like VisualView
port.width always correspond to layout view
port metrics like document.documentElement.clientWidth. ...
...ing Window.visualView
port. Note: Only the top-level window has a visual view
port that's distinct from the layout view
port. Therefore, it's generally only the VisualView
port object of the top-level window that's useful. For an <iframe>, visual view
port metrics like VisualView
port.width always correspond to layout view
port metrics like document.documentElement.clientWidth. Properties VisualView
port also inherits properties from its parent, EventTarget. VisualView
port.offsetLeft Read only Returns the offset of the left edge of the visual view
port from the left edge of the layout view
port in CSS pixels. VisualView
port.offsetTop Read only Returns the offset of the top edge of the visual view
port from the top edge of the layout view
port in CSS pixels. ...
...operties VisualView
port also inherits properties from its parent, EventTarget. VisualView
port.offsetLeft Read only Returns the offset of the left edge of the visual view
port from the left edge of the layout view
port in CSS pixels. VisualView
port.offsetTop Read only Returns the offset of the top edge of the visual view
port from the top edge of the layout view
port in CSS pixels. VisualView
port.pageLeft Read only Returns the x coordinate of the visual view
port relative to the initial containing block origin of the top edge in CSS pixels. VisualView
port.pageTop Read only Returns the y coordinate of the visual view
port relative to the initial containing block origin of the top edge in CSS pixels. ...
...And 10 more matches
port - Archive of obsolete content
This article documents the
port object, which is used to communicate between a content script and the main add-on code. The
port object provides message sending and receiving API enabling conversations between a content script and the main add-on code. Each end of the conversation has access to a
port: the content script via the global self property, and the main add-on code via a worker object associated with the SDK module you've used to attach the content script, such as page-mod or page-worker. For an overview of content scripts, see the main article.
port Methods emit() The
port.emit() function sends a message from one side to the other. It may be called with any number of parameters, but is most likely to be called with a name for the message and an optional payload. The payload...
... It takes two parameters: the name of the message and a function to handle it. ...
... most likely to be called with a name for the message and an optional payload. The payload can be any value that is serializable to JSON. ...
...And 9 more matches
JS_ReportErrorNumber
Re
port an error with an application-defined error code. ...
... Re
port an error with an application-defined error code. ...
... Re
port an error with an application-defined error code. ...
...And 9 more matches
AT APIs Support
Introduction Documentation is in progress still. But in the meantime it more up-to-date and contains more details than existed analogues for AT-SPI and MSAA This documentation explains how makers of screen readers, voice dictation packages, onscreen keyboards, magnification software and other assitive technologies can sup
port Gecko-based software. We provide for them the sup
port of these products on Windows, Linux/Unix and OS X platforms. Accessible Gecko Gecko is a rendering engine that Firefox, SeaMonkey, Netscape and yelp use. Gecko can render a variety of content, not just HTML and sup
ports key web standards such as Cascading Style Sheets, Javascript and the W3C DOM. Gecko also handles the users keystrokes and mouse clicks. Gecko is the core architecture that we are adding acce...
...and OS X platforms. Accessible Gecko Gecko is a rendering engine that Firefox, SeaMonkey, Netscape and yelp use. Gecko can render a variety of content, not just HTML and sup
ports key web standards such as Cascading Style Sheets, Javascript and the W3C DOM. Gecko also handles the users keystrokes and mouse clicks. Gecko is the core architecture that we are adding accessibility to, in order to sup
port basic accessibility in all applications that are based on it. Gecko Based Applications Gecko can be used in two ways to create application: Embedded Clients Embedded clients use Gecko only in the content window, at the moment for HTML and generic XML only. They typically use standard Windows controls for their user interface -- the area outside of the client content window, plus the context m...
...UL Applications XUL applications make full use of the Gecko architecture, not only for HTML content, but also for the entire user interface. Widgets such as menus, tab panels, tree views and dialogs are provided via an XML language called XUL (eXtensible User-interface Language). None of the user interface contains standard OS controls. This is done to ensure a common look and feel across all sup
ported platforms, and to allow for different skins (appearances). Developing a XUL window is not that different from developing a web page, but the elements available to add widgets are more powerful and designed to be similar to desktop widgets. Examples of XUL applications: Firefox - web-browser Thunderbird - email client Seamonkey - web-browser, advanced e-mail and newsgroup client, IRC chat ...
...And 9 more matches
nsIMacDockSupport
Method summary void activateApplication(in boolean aIgnoreOtherApplications); Attributes Attribute Type Description badgeText AString Text to display in a badge on the application's dock icon. ...
...Method summary void activateApplication(in boolean aIgnoreOtherApplications); Attributes Attribute Type Description badgeText AString Text to display in a badge on the application's dock icon. ...
...he Dock on Mac OS X. 1.0 66 Introduced Gecko 2.0 Inherits from: nsIMacDockSup
port Last changed in Gecko 11.0 (Firefox 11.0 / Thunderbird 11.0 / SeaMonkey 2.8) Implemented by: @mozilla.org/cookie-monster;1. To create an instance, use: var dock = Components.classes["@mozilla.org/widget/macdocksup
port;1"] .getService(Components.interfaces.nsIMacDockSup
port); See Working with the Mac OS X Dock for details and examples. Method summary void activateApplication(in boolean aIgnoreOtherApplications); Attributes Attribute Type Description badgeText AString Text to display in a badge on the application's dock icon. This can be used, for example, to display the number of unread messages in an email client. ...
...And 9 more matches
nsIMemoryReporter
This includes the about:memory page. Note: This interface is undergoing heavy development, and is subject to rapid changes. ...
...This includes the about:memory page. Note: This interface is undergoing heavy development, and is subject to rapid changes. ...
...This includes the about:memory page. Note: This interface is undergoing heavy development, and is subject to rapid changes. ...
...And 9 more matches
Visual Viewport API - Web APIs
The Visual View
port API provides an explicit mechanism for querying and modifying the properties of the window's visual view
port. The visual view
port is the visual
portion of a screen excluding on-screen keyboards, areas outside of a pinch-zoom area, or any other on-screen artifact that doesn't scale with the dimensions of a page. Visual View
port concepts and usage The mobile web contains two view
ports, the layout view
port and the visual view
port. The layout view
port covers all the elements on a page and the visual view
port is what is actually visible on the screen. When the user pinch-zooms into the page, the visual view
port shrinks but the layout view
port is unchanged. ...
...For example, what if you need a set of image controls to remain on screen regardless of the pinch zoom level of the device? ...
...For example, what if you need a set of image controls to remain on screen regardless of the pinch zoom level of the device? ...
...And 9 more matches
nsISocketTransport
netwerk/base/public/nsISocketTrans
port.idlScriptable This interface specializes nsITrans
port for communication over network sockets. It provides methods to open blocking or non-blocking, buffered or unbuffered streams between two end-point in a IP based network. Inherits from: nsITrans
port Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Note: Connection setup is triggered by opening an input or output stream, it does not start on its own. Completion of the connection setup is indicated by a STATUS_CONNECTED_TO notification to the event sink (if set). ...
...d-point in a IP based network. Inherits from: nsITrans
port Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Note: Connection setup is triggered by opening an input or output stream, it does not start on its own. Completion of the connection setup is indicated by a STATUS_CONNECTED_TO notification to the event sink (if set). ...
...etwork. Inherits from: nsITrans
port Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Note: Connection setup is triggered by opening an input or output stream, it does not start on its own. Completion of the connection setup is indicated by a STATUS_CONNECTED_TO notification to the event sink (if set). ...
...And 8 more matches
MediaTrackSupportedConstraints.logicalSurface - Web APIs
Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). ...
... Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). ...
... Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). ...
...And 8 more matches
MessagePort: messageerror event - Web APIs
The messageerror event is fired on a Message
Port object when it receives a message that can't be deserialized. ...
... The messageerror event is fired on a Message
Port object when it receives a message that can't be deserialized. ...
... it receives a message that can't be deserialized. ...
...And 8 more matches
RTCIceTransport: selectedcandidatepairchange event - Web APIs
A selectedcandidatepairchange event is sent to an RTCIceTrans
port when the ICE agent selects a new pair of candidates that describe the endpoints of a viable connection. The pair of candidates is in turn described by an RTCIceCandidatePair object which contains one RTCIceCandidate representing the local end of the connection, and another representing the remote end of the connection. Together, the candidates can be used to establish a connection to be used by the RTCIceTrans
port, and, by extension, by an RTCPeerConnection. Bubbles No Cancelable No Interface Event Event handler property onselectedcandidatepairchange Examples This example creates an event handler for selectedcandidatepairchange that updates a display providing the user i...
...by an RTCPeerConnection. Bubbles No Cancelable No Interface Event Event handler property onselectedcandidatepairchange Examples This example creates an event handler for selectedcandidatepairchange that updates a display providing the user information about the progress of the ICE negotiation for an RTCPeerConnection called pc. ...
... Bubbles No Cancelable No Interface Event Event handler property onselectedcandidatepairchange Examples This example creates an event handler for selectedcandidatepairchange that updates a display providing the user information about the progress of the ICE negotiation for an RTCPeerConnection called pc. ...
...And 8 more matches
XRWebGLLayer.getViewport() - Web APIs
The XRWebGLLayer interface's getView
port() method returns the XRView
port that should be used to render the specified XRView into the WebGL layer. For WebXR devices which use a single framebuffer for both the left and right eyes, the returned view
port represents the region of the framebuffer into which the scene should be rendered for the eye represented by the view. Syntax let view
port = xrWebGLLayer.getView
port(view); Parameters view An XRView object indicating the view for which the view
port is to be returned. Return value A XRView
port object representing the view
port which will restrict drawing to the
portion of the layer corresponding to the specified view. Exceptions InvalidStateError Either the specified view is not in an active XRFrame or that XRFrame and the XRWebGLLa...
...iew
port which will restrict drawing to the
portion of the layer corresponding to the specified view. Exceptions InvalidStateError Either the specified view is not in an active XRFrame or that XRFrame and the XRWebGLLayer are not part of the same WebXR session. Example This example demonstrates in part what the callback for the requestAnimationFrame() function might look like, using getView
port() to get the view
port so that drawing can be constrained to the area set aside for the eye whose viewpoint is currently being rendered. This works because the set of views returned by an XRViewerPose each represent one eye's perspective on the scene. ...
...stAnimationFrame() function might look like, using getView
port() to get the view
port so that drawing can be constrained to the area set aside for the eye whose viewpoint is currently being rendered. This works because the set of views returned by an XRViewerPose each represent one eye's perspective on the scene. Since the framebuffer is split in half, one half for each eye, setting the WebGL view
port to match the WebXR layer's view
port will ensure that when rendering the scene for the current eye's pose, it is rendered into the correct half of the framebuffer. <<<--- add link to appropriate section in the Cameras and views article --->>> function drawFrame(time, frame) { let session = frame.session; let pose = frame.getViewerPose(mainReferenceSpace); if (pose) { let glLayer = se...
...And 8 more matches
JS_SetErrorReporter
Obsolete since JSAPI 52This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Get or specify the error re
porting mechanism for an application. Syntax JSErrorRe
porter JS_GetErrorRe
porter(JSRuntime *rt); JSErrorRe
porter JS_SetErrorRe
porter(JSRuntime *rt, JSErrorRe
porter er); Name Type Description cx JSRuntime * Pointer to a JS runtime whose errors should be re
ported via your function. ...
...e. Try to avoid using it. Get or specify the error re
porting mechanism for an application. Syntax JSErrorRe
porter JS_GetErrorRe
porter(JSRuntime *rt); JSErrorRe
porter JS_SetErrorRe
porter(JSRuntime *rt, JSErrorRe
porter er); Name Type Description cx JSRuntime * Pointer to a JS runtime whose errors should be re
ported via your function. er JSErrorRe
porter The user-defined error re
porting function to use in your application, described below. Callback Syntax typedef void (* JSErrorRe
porter)(JSContext *cx, const char *message, JSErrorRe
port *re
port); Name Type Description cx JSContext * The context in which the error happened. ...
... JSErrorRe
porter The user-defined error re
porting function to use in your application, described below. Callback Syntax typedef void (* JSErrorRe
porter)(JSContext *cx, const char *message, JSErrorRe
port *re
port); Name Type Description cx JSContext * The context in which the error happened. message const char * An error message. re
port JSErrorRe
port * An error re
port record containing additional details about the error. Description JS_SetErrorRe
porter enables you to define and use your own error re
porting mechanism in your applications. The re
porter you define is automatically passed a JSErrorRe
port structure when an error occurs and has been parsed by JS_Re
portError. ...
...And 7 more matches
Xptcall Porting Guide
Overview xptcall is a library that sup
ports both invoking methods on arbitrary xpcom objects and implementing classes whose objects can impersonate any xpcom interface. It does this using platform specific assembly language code. This code needs to be
ported to all platforms that want to sup
port xptcall (and thus mozilla). ...
... Overview xptcall is a library that sup
ports both invoking methods on arbitrary xpcom objects and implementing classes whose objects can impersonate any xpcom interface. It does this using platform specific assembly language code. This code needs to be
ported to all platforms that want to sup
port xptcall (and thus mozilla). ...
... This code needs to be
ported to all platforms that want to sup
port xptcall (and thus mozilla). The tree mozilla/xpcom/reflect/xptcall +--public // ex
ported headers +--src // core source | \--md // platform specific parts | +--mac // mac ppc | +--unix // all unix | \--win32 // win32 | +--test // simple tests to get started \--tests // full tests via api
Porters are free to create subdirectories under the base md directory for their given platforms and to integrate into the build system as appropriate for their platform. Theory of operation There are really two pieces of functionality: invoke and stubs... The invoke functionality requires the implementation of the following on each platform (from xptcall/public/xptcall.h): XPTC_PUBLIC_API(nsresult) N...
...And 7 more matches
RTCIceCandidate.relatedPort - Web APIs
The RTCIceCandidate interface's read-only related
Port property indicates the
port number of reflexive or relay candidates. If the candidate is a host candidate (that is, its ip is in fact the real IP address of the remote peer), related
Port is null. The related
Port field's value is set when the RTCIceCandidate() constructor is used. You can't specify the value of related
Port in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-
port field. ...
... in fact the real IP address of the remote peer), related
Port is null. The related
Port field's value is set when the RTCIceCandidate() constructor is used. You can't specify the value of related
Port in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-
port field. The related address (relatedAddress) and
port are not used at all by ICE itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. Syntax var rel
Port = RTCIceCandidate.related
Port; Value An unsigned 16-bit value containing the candidate's related
port number, if any. For both peer and server reflexive candidates, the related ...
...d at all by ICE itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. Syntax var rel
Port = RTCIceCandidate.related
Port; Value An unsigned 16-bit value containing the candidate's related
port number, if any. For both peer and server reflexive candidates, the related address and
port describe the base for that candidate. For relay candidates, the related address and
port provide the mapped address selected by the TURN server. For host candidates, related
Port is null, meaning the field is not included in the candidate's a-line. Usage notes The related address and
port are not used by ICE itself, and are only present for diagnostic and Quality-of-Service purposes. They may i...
...And 7 more matches
XRSystem: isSessionSupported() - Web APIs
The XRSystem method isSessionSup
ported() returns a promise which resolves to true if the specified WebXR session mode is sup
ported by the user's WebXR device. Otherwise, the promise resolves with false. If the no devices are available or the browser doesn't have permission to use the XR device, the promise is rejected with an appropriate DOMException. Syntax var isSup
portedPromise = xr.isSessionSup
ported(xrSessionMode) Parameters xrSessionMode A DOMString specifying the WebXR session mode for which sup
port is to be checked. This string must be one of inline (to present the WebXR content inline within the context of an HTML document) or immersive-vr for a fully-immersive virtual experience. ...
... SecurityError The document's origin does not have permission to use the xr-spatial-tracking feature policy. ...
...or which sup
port is to be checked. This string must be one of inline (to present the WebXR content inline within the context of an HTML document) or immersive-vr for a fully-immersive virtual experience. Return value A Promise that resolves to true if the specified session mode is sup
ported; otherwise the promise resolves to false. Exceptions Rather than throwing true exceptions, isSessionSup
ported() rejects the returned promise, passing to the rejection handler a DOMException whose name is one of the following strings. SecurityError The document's origin does not have permission to use the xr-spatial-tracking feature policy. ...
...And 7 more matches
XRViewport - Web APIs
Usage notes Currently, the only type of surface available is the XRWebGLLayer. ...
... Usage notes Currently, the only type of surface available is the XRWebGLLayer. ...
... Usage notes Currently, the only type of surface available is the XRWebGLLayer. ...
...And 7 more matches
Strict-Transport-Security - HTTP
The HTTP Strict-Trans
port-Security response header (often abbreviated as HSTS) lets a web site tell browsers that it should only be accessed using HTTPS, instead of using HTTP. Header type Response header Forbidden header name no Syntax Strict-Trans
port-Security: max-age=<expire-time> Strict-Trans
port-Security: max-age=<expire-time>; includeSubDomains Strict-Trans
port-Security: max-age=<expire-time>; preload Directives max-age=<expire-time> The time, in seconds, that the browser should remember that a site is only to be accessed using HTTPS. includeSubDomains Optional If this optional parameter is specified, this rule applies to all of the site's subdomains as well. preload Optional See Preloading Strict Trans
port Security for details. Not part of th...
...ns as well. preload Optional See Preloading Strict Trans
port Security for details. Not part of the specification. Description If a website accepts a connection through HTTP and redirects to HTTPS, visitors may initially communicate with the non-encrypted version of the site before being redirected, if, for example, the visitor types http://www.foo.com/ or even just foo.com. This creates an op
portunity for a man-in-the-middle attack. The redirect could be exploited to direct visitors to a malicious site instead of the secure version of the original site. ...
...ects to HTTPS, visitors may initially communicate with the non-encrypted version of the site before being redirected, if, for example, the visitor types http://www.foo.com/ or even just foo.com. This creates an op
portunity for a man-in-the-middle attack. The redirect could be exploited to direct visitors to a malicious site instead of the secure version of the original site. The HTTP Strict Trans
port Security header informs the browser that it should never load a site using HTTP and should automatically convert all attempts to access the site using HTTP to HTTPS requests instead. Note: The Strict-Trans
port-Security header is ignored by the browser when your site is accessed using HTTP; this is because an attacker may intercept HTTP connections and inject the header or remove it. When your si...
...And 7 more matches
How to get a stacktrace for a bug report
If you file a bug re
port in Bugzilla about a crash you should include a stacktrace (call stack) in your re
port. A stacktrace will tell Mozilla developers what crashed and provide a starting point for investigating its cause. This article describes how to use the Mozilla Crash Re
porter (Breakpad) to get a crash ID, which our engineers can use to get a stacktrace, and alternative ways to get a stacktrace if you can't get a crash ID. Requirements You need a binary build of Firefox from Mozilla.org. SeaMonkey and Thunderbird also sup
port crash re
porting. Mozilla's crash re
port server currently only has debug information for Mozilla builds and thus the crash re
porter cannot work if you use a build from a Linux distribution or if you compile from source code. In these cases you will need ...
...Firefox from Mozilla.org. SeaMonkey and Thunderbird also sup
port crash re
porting. Mozilla's crash re
port server currently only has debug information for Mozilla builds and thus the crash re
porter cannot work if you use a build from a Linux distribution or if you compile from source code. In these cases you will need to use one of the alternative methods listed below. Note: When filing a crash re
port, it is im
portant to know whether the crash occurs with Firefox safe mode. This helps engineers determine whether a particular extension or plugin is the cause of the crash. How to get a crash ID with the Mozilla Crash Re
porter 1. Crash and submit a re
port to the system. The Mozilla Crash Re
porter window should automatically come up after Firefox crashes. If you have any addit...
...system. The Mozilla Crash Re
porter window should automatically come up after Firefox crashes. If you have any additional information about the crash, such as additional detail on what you were doing at the time that may have triggered the crash, please enter it into the comments box. Be sure that you check the "Tell Mozilla about this crash" checkbox and click the restart button. The crash re
porter should now submit the crash re
port and Firefox should open again. The "Details" button gives additional data about the incident, however this is not useful in a bug re
port. 2. Tell us the ID of the re
port you submitted. To access all of your submitted re
ports type "about:crashes" into the Firefox address bar and press enter. Firefox should open a ...
...And 6 more matches
How to Report a Hung Firefox
Note: This article is intended for developers and technically-knowledgeable users. If that's not you, or you just want to fix a Firefox hang without re
porting it, see Firefox hangs or is not responding - How to fix. Is your Firefox not responding? Or are you regularly seeing the "Firefox is running but is not responding..." dialog? This usually means that something in Firefox is hung. This may be because of a code error within Firefox itself, such as a deadlock or infinite loop, or it may be caused by 3rd-party software such as a Firefox extension, antivirus software, or even malware or a virus on your computer. What information to include in a bug re
port As usual, following Bug writing guidelines will make your re
port much more likely to lead to a fix in Firefox. Check the CPU...
... writing guidelines will make your re
port much more likely to lead to a fix in Firefox. Check the CPU usage of the Firefox process(es): is it idle, using 100% of a core (which may show up as 50%, 25% in your monitoring tool if you have a multi-core processor) or neither? (If you're experiencing high CPU usage and Firefox eventually recovers from a hang, you should try the instructions at Re
porting a Performance Problem instead.) Is the rest of your system busy (high CPU or memory usage, or high disk activity)? ...
...essor) or neither? (If you're experiencing high CPU usage and Firefox eventually recovers from a hang, you should try the instructions at Re
porting a Performance Problem instead.) Is the rest of your system busy (high CPU or memory usage, or high disk activity)? If Firefox is truly hung, please note the approximate amount of time you waited before forcing a crash (below) in the bug re
port. If you suspect a hang (as opposed to slow performance), wait one minute on an idle system before getting the stack trace. The crash re
port link for a hang, obtained by following the steps below. Submit a crash re
port for a hung Firefox The easiest way to help the Firefox stability team to debug these kinds of hangs is to make the hung Firefox crash and submit a crash re
port. Then file a bug ...
...And 6 more matches
MessagePort: message event - Web APIs
The message event is fired on a Message
Port object when a message arrives on that channel. ...
... The message event is fired on a Message
Port object when a message arrives on that channel. ...
...sage
Port object when a message arrives on that channel. ...
...And 6 more matches
RTCDtlsTransport.state - Web APIs
The state read-only property of the RTCDtlsTrans
port interface provides information which describes a Datagram Trans
port Layer Security (DTLS) trans
port state. Syntax let myState = dtlsTrans
port.state; Value A string whose value is taken from the RTCDtlsTrans
portState enumerated type. Its value is one of the following: new The initial state when DTLS has not started negotiating yet. connecting DTLS is in the process of negotiating a secure connection and verifying the remote fingerprint. connected DTLS has completed negotiation of a secure connection and verified the remote fingerprint. closed The trans
port has been closed intentionally as the result of receipt of a close_notify alert, or calling RTCPeerConnection.close(). ...
...not started negotiating yet. connecting DTLS is in the process of negotiating a secure connection and verifying the remote fingerprint. connected DTLS has completed negotiation of a secure connection and verified the remote fingerprint. closed The trans
port has been closed intentionally as the result of receipt of a close_notify alert, or calling RTCPeerConnection.close(). failed The trans
port has failed as the result of an error (such as receipt of an error alert or failure to validate the remote fingerprint). Examples This example presents a function, tallySenders(), which iterates over an RTCPeerConnection's RTCRtpSenders, tallying up how many of them are in various states. The function returns an object containing properties whose values indicate how many of the senders are in e...
...le presents a function, tallySenders(), which iterates over an RTCPeerConnection's RTCRtpSenders, tallying up how many of them are in various states. The function returns an object containing properties whose values indicate how many of the senders are in each state. let pc = new RTCPeerConnection({ bundlePolicy: "max-bundle" }); /* ... ...
...And 6 more matches
RTCIceTransport.onselectedcandidatepairchange - Web APIs
This event will occur at least once, and may occur more than once if the ICE agent continues to identify candidate pairs that will work better, more closely match the requested parameters, and so forth. ...
...This event will occur at least once, and may occur more than once if the ICE agent continues to identify candidate pairs that will work better, more closely match the requested parameters, and so forth. ...
...o be called to handle the selectedcandidatepairchange event, which is fired when the ICE agent selects a new candidate pair to be used for the connection. Syntax RTCIceTrans
port.onselectedcandidatepairchange = candidatePairHandler; Value This propoerty should be set to reference an event handler function to be called by the ICE agent when it discovers a new candidate pair that the RTCIceTrans
port will be using for communication with the remote peer. ...
...And 6 more matches
URLUtilsReadOnly.port - Web APIs
Living Standard Initial definition. Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... Living Standard Initial definition. Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...definition. Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
@viewport - CSS: Cascading Style Sheets
Note: See https://github.com/w3c/csswg-drafts/issues/4766 for discussion around @view
port's removal from the standards track. The @view
port CSS at-rule lets you configure the view
port through which the document is viewed. It's primarily used for mobile devices, but is also used by desktop browsers that sup
port features like "snap to edge" (such as Microsoft Edge). Lengths specified as percentages are calculated relative to the initial view
port, which is the view
port before any user agent or authored styles have had an op
portunity to adjust the view
port. This is typically based on the size of the window on desktop browsers that aren't in full screen mode. ...
...Microsoft Edge). Lengths specified as percentages are calculated relative to the initial view
port, which is the view
port before any user agent or authored styles have had an op
portunity to adjust the view
port. This is typically based on the size of the window on desktop browsers that aren't in full screen mode. On mobile devices (or desktop devices that are in full screen mode), the initial view
port is usually the
portion of a device's screen that is available for application use. ...
... screen mode), the initial view
port is usually the
portion of a device's screen that is available for application use. This may be either the full screen or the full screen area minus areas controlled by the operating system (such as a taskbar) or the application-available screen area (either the full screen or the screen minus any areas owned by the operating system or other applications). @view
port { width: 100vw; /*Sets the width of the actual view
port to the device width*/ } Note: The use of <meta name="view
port"> tag overrides @view
port Syntax The at-rule contains a set of nested descriptors in a CSS block that is delimited by curly braces. A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out. ...
...And 6 more matches
Components.utils.import
Components.utils.im
port was introduced in Firefox 3 and is used for sharing code between different scopes easily. For example, you can im
port XPCOMUtils.jsm to avoid copy/pasting long XPCOM component registration boilerplate in your component files. See Using JavaScript code modules for more details. Note: Prior to Gecko 2.0, JavaScript code modules could only be loaded using file: or resource: URLs. Gecko 2.0 adds sup
port for loading modules from chrome: URLs, even those inside JAR archives. Syntax Components.utils.im
port(url [, scope]); // Or, if you use a tool such as jslint which re
ports compiler errors for the above, Components.utils["im
port"](url [, scope]); Parameters url A string of the URL of the script to be loaded. The URL must point to a file on the disk, possibly in ...
... Under Boot2Gecko, the scope is not optional. If your code is meant to work on all platforms, you should always provide a scope. In case of doubt, this is generally a good scope. return value the module's global object. ...
...ed, the global object is used. Under Boot2Gecko, the scope is not optional. If your code is meant to work on all platforms, you should always provide a scope. In case of doubt, this is generally a good scope. return value the module's global object. use of the return value is discouraged since it grants access to the module's internal properties which are not part of its public API. ...
...And 5 more matches
Components.utils.importGlobalProperties
Im
ports various objects into a system scope. System scopes such as JSMs and frame scripts don't have certain objects, such as indexedDB and XMLHttpRequest, that are available to DOM window globals. Using this API you can im
port these objects into such a system scope. This function is not intended for sandboxes but for system-privileged scopes. To im
port these objects into a sandbox, use the wantGlobalProperties option in the Sandbox constructor. This function is passed an array of strings. Each string is the name of an object to im
port, and will be defined on the im
porting scope's global. ...
... these objects into such a system scope. This function is not intended for sandboxes but for system-privileged scopes. To im
port these objects into a sandbox, use the wantGlobalProperties option in the Sandbox constructor. This function is passed an array of strings. Each string is the name of an object to im
port, and will be defined on the im
porting scope's global. ...
...Provider TextDecoder TextEncoder URL URLSearchParams XMLHttpRequest nsIXMLHttpRequest Obsolete since Gecko 60 For string/object in table without a minimum firefox version, it is not exactly known since when it was available, however it is guranteed available from Firefox 28 and up. ...
...And 5 more matches
nsITransport
netwerk/base/public/nsITrans
port.idlScriptable This interface provides a common way of accessing i/o streams connected to some resource. This interface does not in any way specify the resource. Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) This interface provides methods to open blocking or non-blocking, buffered or unbuffered streams to the resource. The name "trans
port" is meant to connote the inherent data transfer implied by this interface (that is, data is being transfered in some fashion via the streams exposed by this interface). A trans
port can have an event sink associated with it. The event sink receives trans
port-specific events as the transfer is occurring. ...
...blocking, buffered or unbuffered streams to the resource. The name "trans
port" is meant to connote the inherent data transfer implied by this interface (that is, data is being transfered in some fashion via the streams exposed by this interface). A trans
port can have an event sink associated with it. The event sink receives trans
port-specific events as the transfer is occurring. For a socket trans
port, these events can include status about the connection. See nsISocketTrans
port for more info about socket trans
port specifics. Method overview void close(in nsresult aReason); nsIInputStream openInputStream(in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount); nsIOutputStream openOutputStream(in unsigned long aFlags, in unsigned long aSegmentSize, in unsig...
...See nsISocketTrans
port for more info about socket trans
port specifics. Method overview void close(in nsresult aReason); nsIInputStream openInputStream(in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount); nsIOutputStream openOutputStream(in unsigned long aFlags, in unsigned long aSegmentSize, in unsigned long aSegmentCount); void setEventSink(in nsITrans
portEventSink aSink, in nsIEventTarget aEventTarget); Constants Open flags. Constant Value Description OPEN_BLOCKING 1<<0 Open flags. OPEN_UNBUFFERED 1<<1 Generic nsITrans
portEventSink status codes. nsITrans
port implementations may override these status codes with their own more specific status codes (for example, see nsISocketTrans
port). Constant Value Description STATUS_READING 0...
...And 5 more matches
MediaTrackSupportedConstraints.frameRate - Web APIs
The MediaTrackSup
portedConstraints dictionary's frameRate property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the frameRate constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. The frameRate constraint can be used to establish acceptable upper and lower bounds on the video frame rate for a new video track, or to specify an exact frame rate that must be provided for the request to succeed. Checking the value of this property lets you determine if the user agent allows constraining the video track configuration by frame rate. See the example to see how this can be used. ...
...be used to establish acceptable upper and lower bounds on the video frame rate for a new video track, or to specify an exact frame rate that must be provided for the request to succeed. Checking the value of this property lets you determine if the user agent allows constraining the video track configuration by frame rate. See the example to see how this can be used. ...
...stablish acceptable upper and lower bounds on the video frame rate for a new video track, or to specify an exact frame rate that must be provided for the request to succeed. Checking the value of this property lets you determine if the user agent allows constraining the video track configuration by frame rate. See the example to see how this can be used. ...
...And 5 more matches
RTCIceTransport: gatheringstatechange event - Web APIs
A gatheringstatechange event is sent to an RTCIceTrans
port when its ICE candidate gathering state changes. The gathering state, whose actual status can be found in the trans
port object's gatheringState property, indicates whether or not the ICE agent has begun gathering candidates, and if so, if it has finished doing so. Bubbles No Cancelable No Interface Event Event handler property ongatheringstatechange The key difference between gatheringstatechange and icegatheringstatechange is that the latter represents the overall state of the connection including every RTCIceTrans
port used by every RTCRtpSender and every RTCRtpReceiver on the entire connection. In contrast, gatheringstatechange represents changes to the candidate gathering state...
...r property ongatheringstatechange The key difference between gatheringstatechange and icegatheringstatechange is that the latter represents the overall state of the connection including every RTCIceTrans
port used by every RTCRtpSender and every RTCRtpReceiver on the entire connection. In contrast, gatheringstatechange represents changes to the candidate gathering state for a single trans
port. Examples This example creates a handler for gatheringstatechange events on each RTCRtpSender associated with a given RTCPeerConnection. ...
...on. In contrast, gatheringstatechange represents changes to the candidate gathering state for a single trans
port. Examples This example creates a handler for gatheringstatechange events on each RTCRtpSender associated with a given RTCPeerConnection. ...
...And 5 more matches
RTCIceTransport.state - Web APIs
The read-only RTCIceTrans
port property state returns the current state of the ICE trans
port, so you can determine the state of ICE gathering in which the ICE agent currently is operating. This differs from the gatheringState, which only indicates whether or not ICE gathering is currently underway. Syntax iceState = iceTrans
port.state; Value A DOMString, whose value is one of those found in the enumerated type RTCIceTrans
portState, which indicates the stage of ICE gathering that's currently underway. Its value will be one of the following: "new" The RTCIceTrans
port is currently gathering local candidates, or is waiting for the remote device to begin to transmit the remote candidates, or both. In this state, checking of candidates to look for those which might be acceptable has not ye...
...rrently underway. Its value will be one of the following: "new" The RTCIceTrans
port is currently gathering local candidates, or is waiting for the remote device to begin to transmit the remote candidates, or both. In this state, checking of candidates to look for those which might be acceptable has not yet begun. "checking" At least one remote candidate has been received, and the RTCIceTrans
port has begun examining pairings of remote and local candidates in order to attempt to identify viable pairs that could be used to establish a connection. Keep in mind that gathering of local candidates may still be underway, and, similarly, the remote device also may still be gathering candidates of its own. ...
...
port has begun examining pairings of remote and local candidates in order to attempt to identify viable pairs that could be used to establish a connection. Keep in mind that gathering of local candidates may still be underway, and, similarly, the remote device also may still be gathering candidates of its own. "connected" A viable candidate pair has been found and selected, and the RTCIceTrans
port has connected the two peers together using that pair. However, there are still candidates pairings to consider, and there may still be gathering underway on one or both of the two devices. ...
...And 5 more matches
RTCIceTransport - Web APIs
gatheringState Read only A DOMString indicating which gathering state the ICE agent is currently in. The value is one of those included in the RTCIceGathererState enumerated type: "new", "gathering", or "complete". ...
... gatheringState Read only A DOMString indicating which gathering state the ICE agent is currently in. The value is one of those included in the RTCIceGathererState enumerated type: "new", "gathering", or "complete". ...
... gatheringState Read only A DOMString indicating which gathering state the ICE agent is currently in. The value is one of those included in the RTCIceGathererState enumerated type: "new", "gathering", or "complete". ...
...And 5 more matches
RTCIceTransportState - Web APIs
The RTCIceTrans
portState enumerated type defines the string values which may be returned by the state property on RTCIceTrans
port objects. The trans
port state indicates which stage of the candidate gathering process is currently underway. Values "new" The RTCIceTrans
port is currently gathering local candidates, or is waiting for the remote device to begin to transmit the remote candidates, or both. In this state, checking of candidates to look for those which might be acceptable has not yet begun. "checking" At least one remote candidate has been received, and the RTCIceTrans
port has begun examining pairings of remote and local candidates in order to attempt to identify viable pairs that could be used to establish a connection. Keep in mind that gathering of local candidates may still ...
...
port has begun examining pairings of remote and local candidates in order to attempt to identify viable pairs that could be used to establish a connection. Keep in mind that gathering of local candidates may still be underway, and, similarly, the remote device also may still be gathering candidates of its own. "connected" A viable candidate pair has been found and selected, and the RTCIceTrans
port has connected the two peers together using that pair. However, there are still candidates pairings to consider, and there may still be gathering underway on one or both of the two devices. ...
...ay still be underway, and, similarly, the remote device also may still be gathering candidates of its own. "connected" A viable candidate pair has been found and selected, and the RTCIceTrans
port has connected the two peers together using that pair. However, there are still candidates pairings to consider, and there may still be gathering underway on one or both of the two devices. ...
...And 5 more matches
RTCSctpTransport - Web APIs
Possibly the most useful property on this interface is its maxMessageSize property, which you can use to determine the upper limit on the size of messages you can send over a data channel on the peer connection. ...
... Possibly the most useful property on this interface is its maxMessageSize property, which you can use to determine the upper limit on the size of messages you can send over a data channel on the peer connection. ...
... Possibly the most useful property on this interface is its maxMessageSize property, which you can use to determine the upper limit on the size of messages you can send over a data channel on the peer connection. ...
...And 5 more matches
RTCStatsReport - Web APIs
Calling getStats() on an RTCPeerConnection lets you specify whether you wish to obtain statistics for outbound, inbound, or all streams on the connection. The RTCRtpReceiver and RTCRtpSender versions of getStats() specifically only return statistics available to the incoming or outgoing stream on which you call them. The statistics objects For each category of statistic information, there is a dictionary whose properties provide the relevant information. ...
...ntains, taken from the enum type RTCStatsType. The statistic categories The type gives the name of the statistic category represented by the object, and is how you locate the specific type of data you need. The statistic category names are members of the enumerated type RTCStatsType, as follows: candidate-pair An RTCIceCandidatePairStats object providing statistics related to an RTCIceTrans
port. Candidate pairs other than the currently active pair for the trans
port are deleted when the RTCPeerConnection changes its RTCPeerConnection.iceGatheringState to new during an ICE restart. The active candidate pair is deleted after the trans
port switches to another candidate pair; this change cannot be detected otherwise. certificate An RTCCertificateStats object providing statistics related to...
... codec An RTCCodecStats object containing statistics about a codec currently being used by RTP streams to send or receive data for the RTCPeerConnection. csrc An RTCContributingSourceStats object which contains statistics related to a contributing source (CSRC) that contributed to an inbound RTP stream. ...
...And 5 more matches
WebGLRenderingContext.viewport() - Web APIs
Default value: height of the canvas. Return value None. ...
...Default value: height of the canvas. Return value None. ...
...Default value: height of the canvas. Return value None. ...
...And 5 more matches
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
The more time lag there is between one user saying something and another hearing it, the more likely there is to be episodes of cross-talking and other forms of confusion. ...
...The more time lag there is between one user saying something and another hearing it, the more likely there is to be episodes of cross-talking and other forms of confusion. ...
...IETF standard protocol to enable real-time connectivity for exchanging data that needs real-time priority. This article provides an overview of what RTP is and how it functions in the context of WebRTC. Note: WebRTC actually uses SRTP (Secure Real-time Trans
port Protocol) to ensure that the exchanged data is secure and authenticated as appropriate. Keeping latency to a minimum is especially im
portant for WebRTC, since face-to-face communication needs to be performed with as little latency as possible. The more time lag there is between one user saying something and another hearing it, the more likely there is to be episodes of cross-talking and other forms of confusion. Key features of RTP Before examining RTP's use in WebRTC contexts, it's useful to have a general idea of what RTP does ...
...And 5 more matches
import.meta - JavaScript
The im
port.meta object exposes context-specific metadata to a JavaScript module. It contains information about the module, like the module's URL. Syntax im
port.meta Description The syntax consists of the keyword im
port, a dot, and the identifier meta. Normally the left-hand side of the dot is the object on which property access is performed, but here im
port is not really an object. The im
port.meta object is created by the ECMAScript implementation, with a null prototype. The object is extensible, and its properties are writable, configurable, and enumerable. Examples Using im
port.meta Given a module my-module.js <script type="module" src="my-module.js"></script> you can access meta information about the module using the im
port.meta object. ...
...This will either be the URL from which the script was obtained, for external scripts, or the document base URL of the containing document, for inline scripts. Note that this will include query parameters and/or hash (i.e., following the ? or #). ...
....js" } It returns an object with a url property indicating the base URL of the module. This will either be the URL from which the script was obtained, for external scripts, or the document base URL of the containing document, for inline scripts. Note that this will include query parameters and/or hash (i.e., following the ? or #). ...
...And 5 more matches
Exported WebAssembly functions - WebAssembly
Ex
ported WebAssembly functions are how WebAssembly functions are represented in JavaScript. This article describes what they are in a little more detail. Ex
ported... what? ...
... Ex
ported WebAssembly functions are how WebAssembly functions are represented in JavaScript. This article describes what they are in a little more detail. Ex
ported... what? ...
...ers that represent WebAssembly functions in JavaScript. When you call them, you get some activity in the background to convert the arguments into types that wasm can work with (for example converting JavaScript numbers to Int32), the arguments are passed to the function inside your wasm module, the function is invoked, and the result is converted and passed back to JavaScript. ...
...And 5 more matches
nsICrashReporter
xpcom/system/nsICrashRe
porter.idlScriptable Provides access to crash re
porting functionality. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview void annotateCrashRe
port(in ACString key, in ACString data); void appendAppNotesToCrashRe
port(in ACString data); void appendObjCExceptionInfoToAppNotes(in voidPtr aException); Native code only! void writeMinidumpForException(in voidPtr aExceptionInfo); Native code only! Attributes Attribute Type Description enabled boolean Enable or disable the crashre
porter at runtime. minidumpPath nsILocalFile Get or set the path on the local system to which minidumps will be written when a crash happens. Exceptio...
...ception); Native code only! void writeMinidumpForException(in voidPtr aExceptionInfo); Native code only! Attributes Attribute Type Description enabled boolean Enable or disable the crashre
porter at runtime. minidumpPath nsILocalFile Get or set the path on the local system to which minidumps will be written when a crash happens. Exceptions thrown NS_ERROR_NOT_INITIALIZED If crash re
porting is not initialized. serverURL nsIURL Get or set the URL to which crash re
ports will be submitted. Only https and http URLs are allowed, as the submission is handled by OS-native networking libraries. Exceptions thrown NS_ERROR_FAILURE On get if no URL is set. NS_ERROR_INVALID_ARG On set if a non-http(s) URL is assigned. NS_ERROR_NOT_INITIALIZED If crash re
porting is not initialized. ...
...data Data to be added. ...
...And 4 more matches
nsIMemoryMultiReporter
xpcom/base/nsIMemoryRe
porter.idlScriptable Re
ports multiple memory measurements using a callback function that gets called once for each measurement. 1.0 66 Introduced Gecko 7.0 Inherits from: nsISup
ports Last changed in Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9) If you want to gather multiple measurements in a single operation (such as a single traversal of a large data structure), you can use a multi-re
porter to do so. The callback, which must implement the nsIMemoryMultiRe
porterCallback interface, receives values that match the fields in the nsIMemoryRe
porter object. In order for a multi-re
porter to gather and generate re
ports, you need to call collectRe
ports(). ...
...(such as a single traversal of a large data structure), you can use a multi-re
porter to do so. The callback, which must implement the nsIMemoryMultiRe
porterCallback interface, receives values that match the fields in the nsIMemoryRe
porter object. In order for a multi-re
porter to gather and generate re
ports, you need to call collectRe
ports(). This will call the specified callback's nsIMemoryMultiRe
porterCallback.callback() method once for each re
port. This will trigger any needed computation work. Note: This differs from the behavior of nsIMemoryRe
porter, which lets all fields except amount be accessed without triggering computation. ...
...llback's nsIMemoryMultiRe
porterCallback.callback() method once for each re
port. This will trigger any needed computation work. Note: This differs from the behavior of nsIMemoryRe
porter, which lets all fields except amount be accessed without triggering computation. Attributes Attribute Type Description explicitNonHeap PRInt64 The sum of all of this multi-re
porter's measurements that have a path that starts with "explicit" and are of the kind KIND_NONHEAP. Note: This is a hack that makes nsIMemoryRe
porterManager.explicit more efficient. This is im
portant; multi-re
porters can special-case this operation so it's much faster than gathering all the re
ports, filtering out the unneeded ones, and adding up the rest. Method overview ...
...And 4 more matches
Document.importNode() - Web APIs
The Document object's im
portNode() method creates a copy of a Node or DocumentFragment from another document, to be inserted into the current document later. The im
ported node is not yet included in the document tree. To include it, you need to call an insertion method such as appendChild() or insertBefore() with a node that is currently in the document tree. Unlike document.adoptNode(), the original node is not removed from its original document. The im
ported node is a clone of the original. Syntax const im
portedNode = document.im
portNode(externalNode [, deep]); Parameters externalNode The external Node or DocumentFragment to im
port into the current document. deep Optional A Boolean which controls whether to include the entire DOM subtree of the externalNode in the im
port. If...
... Note: In the DOM4 specification, deep was an optional argument with a default value of true. This default has changed in the latest spec! The new default value is false. Best Practice: Though it's still an optional argument, you should always provide the deep argument for backward and forward compatibility. ...
...argument, you should always provide the deep argument for backward and forward compatibility. With Gecko 28.0 (Firefox 28 / Thunderbird 28 / SeaMonkey 2.25 / Firefox OS 1.3), the console warns developers not to omit the argument. Starting with Gecko 29.0 (Firefox 29 / Thunderbird 29 / SeaMonkey 2.26)), a shallow clone is defaulted instead of a deep clone. ...
...And 4 more matches
Location: port - Web APIs
Living Standard Initial definition. ...
... Living Standard Initial definition. ...
... Living Standard Initial definition. ...
...And 4 more matches
MediaSource.isTypeSupported() - Web APIs
This may include the codecs parameter to provide added details about the codecs used within the file. Return value A Boolean which is true if the browser feels that it can probably play media of the specified type. ...
...This may include the codecs parameter to provide added details about the codecs used within the file. Return value A Boolean which is true if the browser feels that it can probably play media of the specified type. ...
...This may include the codecs parameter to provide added details about the codecs used within the file. Return value A Boolean which is true if the browser feels that it can probably play media of the specified type. ...
...And 4 more matches
MediaTrackSupportedConstraints - Web APIs
The MediaTrackSup
portedConstraints dictionary establishes the list of constrainable properties recognized by the user agent or browser in its implementation of the MediaStreamTrack object. An object conforming to MediaTrackSup
portedConstraints is returned by MediaDevices.getSup
portedConstraints(). Because of the way interface definitions in WebIDL work, if a constraint is requested but not sup
ported, no error will occur. ...
... An actual constraint set is described using an object based on the MediaTrackConstraints dictionary. To learn more about how constraints work, see Capabilities, constraints, and settings. ...
...accepted. An actual constraint set is described using an object based on the MediaTrackConstraints dictionary. To learn more about how constraints work, see Capabilities, constraints, and settings. Properties Some combination--but not necessarily all--of the following properties will exist on the object. autoGainControl A Boolean whose value is true if the autoGainControl constraint is sup
ported in the current environment. width A Boolean value whose value is true if the width constraint is sup
ported in the current environment. height A Boolean value whose value is true if the height constraint is sup
ported in the current environment. aspectRatio A Boolean value whose value is true if the aspectRatio constraint is sup
ported in the current environment. frameRate A Boolean value ...
...And 4 more matches
MessagePort - Web APIs
The Message
Port interface of the Channel Messaging API represents one of the two
ports of a MessageChannel, allowing messages to be sent from one
port and listening out for them arriving at the other. Note: This feature is available in Web Workers. Methods Inherits methods from its parent, EventTarget postMessage() Sends a message from the
port, and optionally, transfers ownership of objects to other browsing contexts. start() Starts the sending of messages queued on the
port (only needed when using EventTarget.addEventListener; it is implied when using Message
Port.onmessage.) close() Disconnects the
port, so it is no longer active. Event handlers Inherits event handlers from its parent, EventTarget onmessage An EventListener called when MessageEvent of type message is fired...
... onmessageerror An EventListener called when a MessageEvent of type MessageError is fired--that is, when it receives a message that cannot be deserialized. Events message Fired when a Message
Port object receives a message. Also available via the onmessage property. ...
... onmessageerror An EventListener called when a MessageEvent of type MessageError is fired--that is, when it receives a message that cannot be deserialized. Events message Fired when a Message
Port object receives a message. Also available via the onmessage property. ...
...And 4 more matches
RTCIceTransport.getSelectedCandidatePair() - Web APIs
Return value A RTCIceCandidatePair object describing the configurations of the currently-selected candidate pair's two endpoints. local describes the configuration of the local end of the connection, while remote describes the remote peer's configuration. The return value is null if no pair of candidates has been selected yet. Usage notes As the ICE agent performs negotiation of a RTCPeerConnection, it gathers and analyzes candidate configurations from each the two peers. ...
...ion. The return value is null if no pair of candidates has been selected yet. Usage notes As the ICE agent performs negotiation of a RTCPeerConnection, it gathers and analyzes candidate configurations from each the two peers. As soon as it finds an acceptable matching pair of candidates, meeting the requirements for the connection, a selectedcandidatepairchange event is fired at the RTCIceTrans
port. From that time forward, the best matching pair of candidates will always be available by calling getSelectedCandidatePair(). As ICE negotiation continues, any time a pair of candidates is discovered that is better than the currently-selected pair, the new pair is selected, replacing the previous pairing, and the selectedcandidatepairchange event is fired again. Note: It's possible for one of ...
... pairing, and the selectedcandidatepairchange event is fired again. Note: It's possible for one of the configurations in the selected candidate pair to remain unchanged when a new pairing is chosen. Example In this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair. ...
...And 4 more matches
RTCIceTransport: statechange event - Web APIs
A statechange event occurs when the RTCIceTrans
port changes state. The state can be used to determine how far through the process of examining, verifying, and selecting a valid candidate pair is prior to successfully connecting the two peers for WebRTC communications. Bubbles No Cancelable No Interface Event Event handler property RTCIceTrans
port.onstatechange Examples Given an RTCPeerConnection, pc, the following code creates an event handler that calls a function named handleFailure() if the ICE trans
port enters a failure state. ...
...cessfully connecting the two peers for WebRTC communications. Bubbles No Cancelable No Interface Event Event handler property RTCIceTrans
port.onstatechange Examples Given an RTCPeerConnection, pc, the following code creates an event handler that calls a function named handleFailure() if the ICE trans
port enters a failure state. ...
...ers for WebRTC communications. Bubbles No Cancelable No Interface Event Event handler property RTCIceTrans
port.onstatechange Examples Given an RTCPeerConnection, pc, the following code creates an event handler that calls a function named handleFailure() if the ICE trans
port enters a failure state. ...
...And 4 more matches
URL.port - Web APIs
Living Standard Initial definition. ...
... Living Standard Initial definition. ...
... Living Standard Initial definition. ...
...And 4 more matches
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
Browsers typically render the contents in bold type. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, must have both a start tag and an end tag. Permitted parents Any element that accepts phrasing content, or any element that accepts flow content. ...
... and an end tag. Permitted parents Any element that accepts phrasing content, or any element that accepts flow content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes The <strong> element is for content that is of "strong im
portance," including things of great seriousness or urgency (such as warnings). This could be a sentence that is of great im
portance to the whole page, or you could merely try to point out that some words are of greater im
portance compared to nearby content. Typically this element is rendered by default using a bold font weight. However, it should not be used simply to apply bold styling; use the CSS...
...Use the <em> element to mark text that has stress emphasis. Another accepted use for <strong> is to denote the labels of paragraphs which represent notes or warnings within the text of a page. <b> vs. ...
...And 4 more matches
Public-Key-Pins-Report-Only - HTTP
Note: Public Key Pinning mechanism was deprecated in favor of Certificate Transparency and Expect-CT header. The HTTP Public-Key-Pins-Re
port-Only response header was used to send re
ports of pinning violation to the re
port-uri specified in the header but, unlike Public-Key-Pins still allows browsers to connect to the server if the pinning is violated. The header is silently ignored in modern browsers as sup
port for HPKP has been removed. Use Certificate Transparency and the Expect-CT header instead. For more information, see the Public-Key-Pins header reference page and the HTTP Public Key Pinning article. ...
...if the pinning is violated. The header is silently ignored in modern browsers as sup
port for HPKP has been removed. Use Certificate Transparency and the Expect-CT header instead. For more information, see the Public-Key-Pins header reference page and the HTTP Public Key Pinning article. Header type Response header Forbidden header name no Syntax Public-Key-Pins-Re
port-Only: pin-sha256="<pin-value>"; max-age=<expire-time>; includeSubDomains; re
port-uri="<uri>" Directives pin-sha256="<pin-value>" The quoted string is the Base64 encoded Subject Public Key Information (SPKI) fingerprint. It is possible to specify multiple pins for different public keys. Some browsers might ...
...This directive should be used with this header, otherwise this header will be a no-op. ...
...And 4 more matches
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
For the general form of the locales argument, see the Intl page. options Optional. ...
...For the general form of the locales argument, see the Intl page. options Optional. ...
...For the general form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. ...
...And 4 more matches
Intl.RelativeTimeFormat.supportedLocalesOf() - JavaScript
For the general form of the locales argument, see the Intl page. options Optional. ...
...For the general form of the locales argument, see the Intl page. options Optional. ...
...For the general form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. ...
...And 4 more matches
Transport Layer Security - Web security
Applications that use TLS can choose their security parameters, which can have a substantial impact on the security and reliability of data. ...
...Applications that use TLS can choose their security parameters, which can have a substantial impact on the security and reliability of data. ...
...nology needed to be specified to ensure interoperability among all web browsers and servers. The Internet Engineering Task Force (IETF) specified TLS 1.0 in RFC 2246 in January, 1999. The current version of TLS is 1.3 (RFC 8446). Despite the fact that the web now uses TLS for encryption, many people still refer to it as "SSL" out of habit. Although TLS can be used on top of any low-level trans
port protocol, the original goal of the protocol was to encrypt HTTP traffic. HTTP encrypted using TLS is commonly referred to as HTTPS. TLS-encrypted web traffic is by convention exchanged on
port 443 by default, while unencrypted HTTP uses
port 80 by default. HTTPS remains an im
portant use case for TLS. HTTP over TLS TLS provides three primary services that help ensure the safety and security of d...
...And 4 more matches
Environment variables affecting crash reporting - Archive of obsolete content
The Breakpad crash re
porting used in Mozilla projects sup
ports some environment variables, primarily for testing purposes. The following environment variables affect crash re
porting: MOZ_CRASHRE
PORTER_URL Sets the URL that the crash re
porter will submit re
ports to. MOZ_CRASHRE
PORTER_FULLDUMP Store full application memory in the minidump, so you can open it in a Microsoft debugger. Don't submit it to the server. (Windows only.) MOZ_CRASHRE
PORTER_NO_DELETE_DUMP Don't delete the crash re
port dump file after submitting it to the server. Minidumps will still be moved to the "Crash Re
ports/pending" directory. MOZ_CRASHRE
PORTER_NO_RE
PORT Save the minidump file but don't launch the crash re
porting UI or send the re
port to the server. Minidumps will be stored in the user's profile directory,...
...ER_NO_DELETE_DUMP Don't delete the crash re
port dump file after submitting it to the server. Minidumps will still be moved to the "Crash Re
ports/pending" directory. MOZ_CRASHRE
PORTER_NO_RE
PORT Save the minidump file but don't launch the crash re
porting UI or send the re
port to the server. Minidumps will be stored in the user's profile directory, in a subdirectory named "minidumps". MOZ_CRASHRE
PORTER_DISABLE Disable Breakpad crash re
porting completely. You can use this if you would rather use the JIT debugger on Windows with the symbol server, for example. MOZ_CRASHRE
PORTER_SHUTDOWN Save the minidump and then force the application to close. This is useful for content crashes that don't normally close the chrome (main application) processes. This variable would cause the application to cl...
...You must use this to enable crash re
porting on Linux debug builds. ...
...And 3 more matches
Porting NSPR to Unix Platforms - Archive of obsolete content
For certain more "standard" Unix platforms, this may be all you have to do. On other platforms, you may need to do extra work to deal with their idiosyncrasies.
Porting Instructions You can use different threading packages to implement NSPR threads. ...
...For certain more "standard" Unix platforms, this may be all you have to do. On other platforms, you may need to do extra work to deal with their idiosyncrasies.
Porting Instructions You can use different threading packages to implement NSPR threads. ...
...ntime (NSPR) to. However, if you are not familiar with the structure of the NSPR source tree and its build system, it may take you extra time. Therefore I write this article to document the more mechanical part of the Unix
porting task. For certain more "standard" Unix platforms, this may be all you have to do. On other platforms, you may need to do extra work to deal with their idiosyncrasies.
Porting Instructions You can use different threading packages to implement NSPR threads. NSPR has a user-level threading library where thread context switches are done by <tt>setjmp/longjmp</tt> or <tt>sigsetjmp/siglongjmp</tt>. This is called the local threads only version of classic NSPR. You should attempt to do a local threads only
port first. The classic NSPR source files are in <tt>mozilla/nspr...
...And 3 more matches
Supporting private browsing mode - Archive of obsolete content
Firefox 3.5 introduced private browsing mode, in which potentially private information is not recorded. This includes cookies, history information, download information, and so forth. When private browsing mode is enabled, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated. The temporary cookie and local storage databases start out empty. ...
...e above example, we only save the user's private information if not in private browsing mode. Note: Private browsing mode may only be detected by chrome code, such as extensions; web content cannot detect whether or not private browsing is in effect. Detecting whether private browsing mode is permanent Requires Gecko 2.0(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Firefox 4 added sup
port for having private browsing mode permanently enabled. The theme looks different in this scenario. To determine whether or not the browser is permanently in private browsing mode, you can look at the privatebrowsingmode attribute on the document root. Its value is "permanent" if private browsing is permanently enabled for the session, "temporary" if private browsing is temporarily enabled, or not ...
...Using the helper The helper described above is very easy to use. Simply instantiate the helper, then you can use its inPrivateBrowsing flag to detect whether or not private browsing is currently enabled, as shown here: var listener = new PrivateBrowsingL...
...And 3 more matches
DTLS (Datagram Transport Layer Security) - MDN Web Docs Glossary: Definitions of Web-related terms
Datagram Trans
port Layer Security (DTLS) is a protocol used to secure datagram-based communications. It's based on the stream-focused Trans
port Layer Security (TLS), providing a similar level of security. As a datagram protocol, DTLS doesn't guarantee the order of message delivery, or even that messages will be delivered at all. However, DTLS gains the benefits of datagram protocols, too; in particular, the lower overhead and reduced latency. These features are especially useful for one of the most common areas in which DTLS comes into play: WebRTC. All of the WebRTC related protocols are required to encrypt their communications using DTLS; this includes SCTP, SRTP, and STUN. ...
...ever, DTLS gains the benefits of datagram protocols, too; in particular, the lower overhead and reduced latency. These features are especially useful for one of the most common areas in which DTLS comes into play: WebRTC. All of the WebRTC related protocols are required to encrypt their communications using DTLS; this includes SCTP, SRTP, and STUN. ...
...lower overhead and reduced latency. These features are especially useful for one of the most common areas in which DTLS comes into play: WebRTC. All of the WebRTC related protocols are required to encrypt their communications using DTLS; this includes SCTP, SRTP, and STUN. ...
...And 3 more matches
Layout viewport - MDN Web Docs Glossary: Definitions of Web-related terms
The layout view
port is the view
port into which the browser draws a web page. Essentially, it represents what is available to be seen, while the visual view
port represents what is currently visible on the user's display device. This becomes im
portant, for example, on mobile devices, where a pinching gesture can usually be used to zoom in and out on a site's contents. The rendered document doesn't change in any way, so the layout view
port remains the same as the user adjusts the zoom level. Instead, the visual view
port is updated to indicate the area of the page that they can see. ...
... becomes im
portant, for example, on mobile devices, where a pinching gesture can usually be used to zoom in and out on a site's contents. The rendered document doesn't change in any way, so the layout view
port remains the same as the user adjusts the zoom level. Instead, the visual view
port is updated to indicate the area of the page that they can see. ...
...tant, for example, on mobile devices, where a pinching gesture can usually be used to zoom in and out on a site's contents. The rendered document doesn't change in any way, so the layout view
port remains the same as the user adjusts the zoom level. Instead, the visual view
port is updated to indicate the area of the page that they can see. ...
...And 3 more matches
Visual Viewport - MDN Web Docs Glossary: Definitions of Web-related terms
The
portion of the view
port that is currently visible is called the visual view
port. This can be smaller than the layout view
port, such as when the user has pinched-zoomed. The visual view
port is the visual
portion of a screen excluding on-screen keyboards, areas outside of a pinch-zoom area, or any other on-screen artifact that doesn't scale with the dimensions of a page. ...
...ew
port that is currently visible is called the visual view
port. This can be smaller than the layout view
port, such as when the user has pinched-zoomed. The visual view
port is the visual
portion of a screen excluding on-screen keyboards, areas outside of a pinch-zoom area, or any other on-screen artifact that doesn't scale with the dimensions of a page. ...
... currently visible is called the visual view
port. This can be smaller than the layout view
port, such as when the user has pinched-zoomed. The visual view
port is the visual
portion of a screen excluding on-screen keyboards, areas outside of a pinch-zoom area, or any other on-screen artifact that doesn't scale with the dimensions of a page. ...
...And 3 more matches
Viewport - MDN Web Docs Glossary: Definitions of Web-related terms
A view
port represents a polygonal (normally rectangular) area in computer graphics that is currently being viewed. In web browser terms, it refers to the part of the document you're viewing which is currently visible in its window (or the screen, if the document is being viewed in full screen mode). Content outside the view
port is not visible onscreen until scrolled into view. The
portion of the view
port that is currently visible is called the visual view
port. This can be smaller than the layout view
port, such as when the user has pinched-zoomed. The layout view
port remains the same, but the visual view
port became smaller. ...
...d in full screen mode). Content outside the view
port is not visible onscreen until scrolled into view. The
portion of the view
port that is currently visible is called the visual view
port. This can be smaller than the layout view
port, such as when the user has pinched-zoomed. The layout view
port remains the same, but the visual view
port became smaller. ...
...en mode). Content outside the view
port is not visible onscreen until scrolled into view. The
portion of the view
port that is currently visible is called the visual view
port. This can be smaller than the layout view
port, such as when the user has pinched-zoomed. The layout view
port remains the same, but the visual view
port became smaller. ...
...And 3 more matches
Crash reporting
Firefox ships with an open-source crash re
porting system. This system is combination of projects: Google Breakpad client and server libraries Mozilla-specific crash re
porting user interface and bootstrap code Socorro Collection and re
porting server Where did my crash get submitted? Crash data submitted using the Mozilla Crash Re
porter is located on crash-stats. If you want to find a specific crash that you submitted, you first need to find the Crash ID that the server has assigned your crash. Type about:crashes into your location bar to get a page listing both submitted and unsubmitted crash re
ports. For more information, see How to get a stacktrace for a bug re
port. Re
ports and queries crash-stats has built-in re
ports of "topcrashes" for each release grouped by signature. Th...
... release grouped by signature. There is also a custom query tool which allows users to limit searches on more precise information. Finally, a set of Mozilla employees have access to directly query the underlying data in either SQL summary or using mapreduce on the storage cluster. ...
... is also a custom query tool which allows users to limit searches on more precise information. Finally, a set of Mozilla employees have access to directly query the underlying data in either SQL summary or using mapreduce on the storage cluster. ...
...And 3 more matches
PR ImportTCPSocket
Im
ports a native TCP socket into NSPR. Syntax #include "private/pprio.h" PRFileDesc* PR_Im
portTCPSocket(PROsfd osfd); Parameters The function has the following parameters: osfd The native file descriptor for the TCP socket to im
port. On POSIX systems, this is an int. On Windows, this is a SOCKET. Returns The function returns one of the following values: Upon successful completion, a pointer to the PRFileDesc object created for the newly im
ported native TCP socket. If the im
port of the native TCP socket failed, NULL. Description A native TCP socket osfd can be im
ported into NSPR with PR_Im
portTCPSocket. The caller gives up control of the native TCP socket osfd and should use the PRFileDesc* returned by PR_Im
portTCPSocket instead. ...
...The caller needs to understand what NSPR will do to the native file descriptor and make sure that NSPR can use the native file descriptor successfully. ...
...The caller needs to understand what NSPR will do to the native file descriptor and make sure that NSPR can use the native file descriptor successfully. ...
...And 3 more matches
JS_ReportError
Create a formatted error or warning message to pass to a user-defined error re
porting function. This function can also raise a JavaScript exception which a currently executing script can catch. Syntax void JS_Re
portError(JSContext *cx, const char *format, ...); bool JS_Re
portWarning(JSContext *cx, const char *format, ...); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. format const char * Format string to convert into an error message using JS_vsmprintf. ... ... ...
...on cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. format const char * Format string to convert into an error message using JS_vsmprintf. ... ... Error message variables to insert into the format string. ...
...S context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. format const char * Format string to convert into an error message using JS_vsmprintf. ... ... Error message variables to insert into the format string. Description JS_Re
portError is the simplest JSAPI function for re
porting errors. First it builds an error message from the given sprintf-style format string and any additional arguments passed after it. The resulting error message is passed to the context's JSErrorRe
porter callback, if any. If the caller is in a JSAPI callback, JS_Re
portError also creates a new JavaScript Error object and sets it to be the pending exception on cx. The callback must then return JS_F...
...And 3 more matches
nsIMemoryMultiReporterCallback
xpcom/base/nsIMemoryRe
porter.idlScriptable Implement this interface to handle callbacks from nsIMemoryMultiRe
porter instances. 1.0 66 Introduced Gecko 7.0 Inherits from: nsISup
ports Last changed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) Method overview void callback(in ACString process, in AUTF8String path, in PRInt32 kind, in PRInt32 units, in PRInt64 amount, in AUTF8String description, in nsISup
ports closure); Methods callback() Called to provide information from a multi-re
porter. Implement this method to handle the re
port information. ...
...PRInt32 kind, in PRInt32 units, in PRInt64 amount, in AUTF8String description, in nsISup
ports closure); Methods callback() Called to provide information from a multi-re
porter. Implement this method to handle the re
port information. void callback( in ACString process, in AUTF8String path, in PRInt32 kind, in PRInt32 units, in PRInt64 amount, in AUTF8String description, in nsISup
ports closure ); Parameters process The value of the process attribute for the memory re
porter. path The value of the path attribute. kind The value of the kind attribute. units The value of the units attribute. amount The value of the amount attribute. ...
...iption, in nsISup
ports closure ); Parameters process The value of the process attribute for the memory re
porter. path The value of the path attribute. kind The value of the kind attribute. units The value of the units attribute. amount The value of the amount attribute. description The value of the description attribute. closure An nsISup
ports object providing any additional data the callback might need; you provide this when you call nsIMemoryMultiRe
porter.collectRe
ports(). It will be null if no additional data was provided. ...
...And 3 more matches
AudioWorkletProcessor.port - Web APIs
Examples To demonstrate bidirectional communication capabilities, we'll create an AudioWorkletProcessor, which will output silence and respond to ping requests from its AudioWorkletNode. First, we need to define a custom AudioWorkletProcessor, and register it. ...
... Examples To demonstrate bidirectional communication capabilities, we'll create an AudioWorkletProcessor, which will output silence and respond to ping requests from its AudioWorkletNode. First, we need to define a custom AudioWorkletProcessor, and register it. ...
... Examples To demonstrate bidirectional communication capabilities, we'll create an AudioWorkletProcessor, which will output silence and respond to ping requests from its AudioWorkletNode. First, we need to define a custom AudioWorkletProcessor, and register it. ...
...And 3 more matches
AuthenticatorAttestationResponse.getTransports() - Web APIs
getTrans
ports() is a method of the AuthenticatorAttestationResponse interface that returns an Array containing strings describing the different trans
ports which may be used by the authenticator. Such trans
ports may be USB, NFC, BLE or internal (applicable when the authenticator is not removable from the device). Note: An AuthenticatorAttestationResponse instance is available on PublicKeyCredential.response after calling navigator.credentials.create(). Note: This method may only be used in top-level contexts and will not be available in an <iframe> for example. Syntaxe arrTrans
ports = authenticatorAttestationResponse.getTrans
ports() Parameters None. ...
... An AuthenticatorAttestationResponse instance is available on PublicKeyCredential.response after calling navigator.credentials.create(). Note: This method may only be used in top-level contexts and will not be available in an <iframe> for example. Syntaxe arrTrans
ports = authenticatorAttestationResponse.getTrans
ports() Parameters None. Return value An Array containing the different trans
ports sup
ported by the authenticator or nothing if this information is not available.of the processing of the different extensions by the client. The elements of this array are supposed to be in lexicographical order. Their values may be : "usb": the authenticator can be contacted via a removable USB link "nfc": the authenticator may be used over NFC (Near Field Communication) "ble": the authenti...
... Rec...
...And 3 more matches
CSSSupportsRule - Web APIs
It has no specific methods. ...
...It has no specific methods. ...
... Syntax The syntax is described using the WebIDL format. interface CSSSup
portsRule : CSSConditionRule { } Properties As a CSSConditionRule and therefore a CSSRule and a CSSGroupingRule, CSSSup
portsRule also implements the properties of these interfaces. It has no specific properties. ...
...And 3 more matches
InterventionReportBody - Web APIs
The InterventionRe
portBody interface of the Re
porting API represents the body of an intervention re
port (the return value of its Re
port.body property). An intervention re
port is generated when usage of a feature in a web document has been blocked by the browser for reasons such as security, performance, or user annoyance. So for example, a script was been stopped because it was significantly slowing down the browser, or the browser's autoplay policy blocked audio from playing without a user gesture to trigger it. Properties id A string representing the intervention that generated the re
port. This can be used to group re
ports by deprecated feature. message A string containing a human-readable description of the intervention, including information such how the intervention cou...
...tion occurred, if known, or null otherwise. lineNumber A number representing the line in the source file in which the intervention occurred, if known, or null otherwise. columnNumber A number representing the column in the source file in which the intervention occurred, if known, or null otherwise. ...
... null otherwise. lineNumber A number representing the line in the source file in which the intervention occurred, if known, or null otherwise. columnNumber A number representing the column in the source file in which the intervention occurred, if known, or null otherwise. ...
...And 3 more matches
RTCIceTransport.component - Web APIs
This value of RTCIceComponent corresponds to the component ID 2. ...
...This value of RTCIceComponent corresponds to the component ID 2. ...
...This value of RTCIceComponent corresponds to the component ID 2. ...
...And 3 more matches
Detecting CSS animation support - CSS: Cascading Style Sheets
CSS animations make it possible to do creative animations of content using nothing but CSS. However, there are likely to be times when this feature isn't available, and you may wish to handle that case by using JavaScript code to simulate a similar effect. This article, based on this blog post by Chris Heilmann, demonstrates a technique for doing this. ...
...reative animations of content using nothing but CSS. However, there are likely to be times when this feature isn't available, and you may wish to handle that case by using JavaScript code to simulate a similar effect. This article, based on this blog post by Chris Heilmann, demonstrates a technique for doing this. ...
...animation === false ) { for( var i = 0; i < domPrefixes.length; i++ ) { if( elem.style[ domPrefixes[i] + 'AnimationName' ] !== undefined ) { pfx = domPrefixes[ i ]; animationstring = pfx + 'Animation'; keyframeprefix = '-' + pfx.toLowerCase() + '-'; animation = true; break; } } } For starters we define a few variables. ...
...And 3 more matches
WAI ARIA Live Regions/API Support - Developer guides
As always, we're open to questions and suggestions for changes in community forums. ...
...As always, we're open to questions and suggestions for changes in community forums. ...
...As always, we're open to questions and suggestions for changes in community forums. ...
...And 3 more matches
CSP: report-to - HTTP
The Content-Security-Policy Re
port-To HTTP response header field instructs the user agent to store re
porting endpoints for an origin. Content-Security-Policy: ...; re
port-to groupname The directive has no effect in and of itself, but only gains meaning in combination with other directives. CSP version 1 Directive type Re
porting directive This directive is not sup
ported in the <meta> element. Syntax Content-Security-Policy: re
port-to <json-field-value>; Examples See Content-Security-Policy-Re
port-Only for more information and examples. ...
...directive has no effect in and of itself, but only gains meaning in combination with other directives. CSP version 1 Directive type Re
porting directive This directive is not sup
ported in the <meta> element. Syntax Content-Security-Policy: re
port-to <json-field-value>; Examples See Content-Security-Policy-Re
port-Only for more information and examples. ...
...type Re
porting directive This directive is not sup
ported in the <meta> element. Syntax Content-Security-Policy: re
port-to <json-field-value>; Examples See Content-Security-Policy-Re
port-Only for more information and examples. ...
...And 3 more matches
Intl.Collator.supportedLocalesOf() - JavaScript
For the general form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. ...
...For the general form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. ...
...m of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
...And 3 more matches
Intl.NumberFormat.supportedLocalesOf() - JavaScript
For the general form of the locales argument, see the Intl page. options Optional. ...
...For the general form of the locales argument, see the Intl page. options Optional. ...
...For the general form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. ...
...And 3 more matches
Supporting search suggestions in search plugins - Archive of obsolete content
Firefox sup
ports search suggestions in OpenSearch plugins; as the user types in the search bar, Firefox queries the URL specified by the search plugin to fetch live search suggestions. Once the list has been retrieved, it's displayed in a popup box that appears under the search bar, which lets the user select a suggested search term. If the user continues to type, a new set of suggestions is requested from the search engine, and the displayed list is refreshed. Implementing suggestion sup
port in the search plugin To sup
port search suggestions, a search plugin needs to define an extra <Url> element with its type attribute set to "application/x-suggestions+json". ...
...elect a suggested search term. If the user continues to type, a new set of suggestions is requested from the search engine, and the displayed list is refreshed. Implementing suggestion sup
port in the search plugin To sup
port search suggestions, a search plugin needs to define an extra <Url> element with its type attribute set to "application/x-suggestions+json". ...
...bar, then pauses, Firefox inserts "fir" in place of {searchTerms} and queries that URL: <Url type="application/x-suggestions+json" template="http://ff.search.yahoo.com/gossip?output=fxjson&command=fir"/> The results are used to construct the suggestion list box. See Creating OpenSearch plugins for Firefox to learn more about how to implement a search plugin. Implementing search suggestion sup
port on the server The majority of the work in handling search suggestions is actually implemented on the server side. If you're a web site designer, and want to sup
port search suggestions, you need to implement sup
port for returning the suggestions in JavaScript Object Notation (JSON) given a search term. When the browser wants to fetch possible matches for a search term, it then sends an HTTP GET ...
...And 2 more matches
nsISupports proxies
arbitrary threads, and compiled code can use compiled runnable to achieve the same effect in a much simpler manner. For more information about alternatives, see Making cross-thread calls using runnables. The following interface is now obsolete: nsIProxyObjectManager. About XPCOM proxies A proxy, in this context, is a stub object which enables a method of any class which is derived from nsISup
ports and has a typelib to be called on any in-process thread. The main reason for nsISup
ports Proxies is that JavaScript and UI are on a single thread. When one is busy, the other is blocked. A good example of this is the old install.js scripts that were used in XPInstall in older Mozilla versions. They from the majority of JavaScript code, which is small and can be quickly run. XPInstall installat...
...oduct would appear frozen until the script was complete. This is definitely bad. Because of this, XPInstall was moved to its own thread. Now XPInstall can do its installations while the product renders, but now XPInstall can not access UI elements such as a progress meter or a confirmation dialog. How can a separate non-UI thread act as if it was on the UI thread? Herein lays the utility of nsISup
ports Proxies. I believe that other people working on Mozilla need similar solutions. In this document, I will try to explain how to use nsISup
ports Proxies. How do I use it? The API has changed in Mozilla 1.9, but the prose below hasn't been updated yet. See xpcom/proxy/public/nsIProxyObjectManager.idl for the updated interface and its documentation. See also . From a users point of view, you n...
...but the prose below hasn't been updated yet. See xpcom/proxy/public/nsIProxyObjectManager.idl for the updated interface and its documentation. See also . From a users point of view, you need only to look at the nsIProxyObjectManager. It has two entry points: NS_IMETHOD GetProxyForObject(nsIEventQueue *destQueue, const nsIID & iid, nsISup
ports *object, PRInt32 proxyType, void * *result); NS_IMETHOD GetProxy(nsIEventQueue *destQueue, const nsIID & cid, nsISup
ports *aOuter, const nsIID & iid, PRInt32 proxyType, void * *result); The two APIs are essentially the same. The only dif...
...And 2 more matches
AudioWorkletNode.port - Web APIs
Examples To demonstrate bidirectional communication capabilities, we'll create an AudioWorkletProcessor, which will output silence and respond to ping requests from its AudioWorkletNode. First, we need to define a custom AudioWorkletProcessor, and register it. Note that that this should be done in a separate file. ...
... Examples To demonstrate bidirectional communication capabilities, we'll create an AudioWorkletProcessor, which will output silence and respond to ping requests from its AudioWorkletNode. First, we need to define a custom AudioWorkletProcessor, and register it. Note that that this should be done in a separate file. ...
... Examples To demonstrate bidirectional communication capabilities, we'll create an AudioWorkletProcessor, which will output silence and respond to ping requests from its AudioWorkletNode. ...
...And 2 more matches
CSS.supports() - Web APIs
The CSS.sup
ports() method returns a Boolean value indicating if the browser sup
ports a given CSS feature, or not. Syntax CSS.sup
ports(propertyName, value); CSS.sup
ports(sup
portCondition); Parameters There are two distinct sets of parameters. The first one allows to test the sup
port of a pair property-value: propertyName A DOMString containing the name of the CSS property to check. value A DOMString containing the value of the CSS property to check. The second syntax takes one parameter matching the condition of @sup
ports: sup
portCondition A DOMString containing the condition to check. Return value true if the browser sup
ports the rule, otherwise false. ...
...alue: propertyName A DOMString containing the name of the CSS property to check. value A DOMString containing the value of the CSS property to check. The second syntax takes one parameter matching the condition of @sup
ports: sup
portCondition A DOMString containing the condition to check. Return value true if the browser sup
ports the rule, otherwise false. ...
... the CSS property to check. value A DOMString containing the value of the CSS property to check. The second syntax takes one parameter matching the condition of @sup
ports: sup
portCondition A DOMString containing the condition to check. Return value true if the browser sup
ports the rule, otherwise false. ...
...And 2 more matches
CrashReportBody - Web APIs
The CrashRe
portBody interface of the Re
porting API represents the body of a crash re
port (the return value of its Re
port.body property). A crash re
port is generated when a document becomes unusable due to the browser (or one of its processes) crashing. For security reasons, no details of the crash are communicated in the body except for a general crash reason. Properties reason A string representing the reason for the crash. Current possible reasons are: oom: The browser ran out of memory. unresponsive: The page was killed due to being unresponsive. Examples Crash re
ports are generally only retrievable via endpoints set up using the Re
port-To header. ...
... in the body except for a general crash reason. Properties reason A string representing the reason for the crash. Current possible reasons are: oom: The browser ran out of memory. unresponsive: The page was killed due to being unresponsive. Examples Crash re
ports are generally only retrievable via endpoints set up using the Re
port-To header. ...
...except for a general crash reason. Properties reason A string representing the reason for the crash. Current possible reasons are: oom: The browser ran out of memory. unresponsive: The page was killed due to being unresponsive. Examples Crash re
ports are generally only retrievable via endpoints set up using the Re
port-To header. ...
...And 2 more matches
MediaDevices.getSupportedConstraints() - Web APIs
The getSup
portedConstraints() method of the MediaDevices interface returns an object based on the MediaTrackSup
portedConstraints dictionary, whose member fields each specify one of the constrainable properties the user agent understands. Syntax var sup
portedConstraints = navigator.mediaDevices.getSup
portedConstraints(); Parameters None. Return value A new object based on the MediaTrackSup
portedConstraints dictionary listing the constraints sup
ported by the user agent. Because only constraints sup
ported by the user agent are included in the list, each of these Boolean properties has the value true. Example This example outputs a list of the constraints sup
ported by your browser. ...
...eturn value A new object based on the MediaTrackSup
portedConstraints dictionary listing the constraints sup
ported by the user agent. Because only constraints sup
ported by the user agent are included in the list, each of these Boolean properties has the value true. Example This example outputs a list of the constraints sup
ported by your browser. ...
...ncluded in the list, each of these Boolean properties has the value true. Example This example outputs a list of the constraints sup
ported by your browser. ...
...And 2 more matches
MediaTrackSupportedConstraints.displaySurface - Web APIs
The MediaTrackSup
portedConstraints dictionary's displaySurface property indicates whether or not the displaySurface constraint is sup
ported by the user agent and the device on which the content is being used. The sup
ported constraints list is obtained by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax isDisplaySurfaceSup
ported = sup
portedConstraints.displaySurface; Value A Boolean value which is true if the displaySurface constraint is sup
ported by the device and user agent. Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). It adds the displaySurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be sup
ported by the browser. Capturing is then started by calling getDispl...
...aints object specifying the options for the call to getDisplayMedia(). It adds the displaySurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be sup
ported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
...to getDisplayMedia(). It adds the displaySurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be sup
ported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
...And 2 more matches
MediaTrackSupportedConstraints.volume - Web APIs
The MediaTrackSup
portedConstraints dictionary's volume property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the volume constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax volumeConstraintSup
ported = sup
portedConstraintsDictionary.volume; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the volume constraint. ...
...be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax volumeConstraintSup
ported = sup
portedConstraintsDictionary.volume; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the volume constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...
ports the volume constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...And 2 more matches
MessageChannel.port1 - Web APIs
The handleMessage handler then responds to a message being sent back from the <iframe> (using Message
Port.onmessage), putting it into a paragraph. ...
...The handleMessage handler then responds to a message being sent back from the <iframe> (using Message
Port.onmessage), putting it into a paragraph. ...
... The
port1 read-only property of the MessageChannel interface returns the first
port of the message channel -- the
port attached to the context that originated the channel. Note: This feature is available in Web Workers. Syntax channel.
port1; Value A Message
Port object, the first
port of the channel, that is the
port attached to the context that originated the channel. Example In the following code block, you can see a new channel being created using the MessageChannel() constructor. When the <iframe> has loaded, we pass MessageChannel.
port2 to the <iframe> using Message
Port.postMessage along with a message. The handleMessage handler then responds to a message being sent back from the <iframe> (using Message
Port.onmessage), putting it into a paragraph. The handleMessage method is associ...
...And 2 more matches
MessagePort.start() - Web APIs
This method is only needed when using EventTarget.addEventListener; it is implied when using MessageChannel.onmessage. Note: This feature is available in Web Workers. Syntax
port.start() Returns Void. Parameters None. ...
... The start() method of the Message
Port interface starts the sending of messages queued on the
port. This method is only needed when using EventTarget.addEventListener; it is implied when using MessageChannel.onmessage. Note: This feature is available in Web Workers. Syntax
port.start() Returns Void. Parameters None. ...
...d on the
port. This method is only needed when using EventTarget.addEventListener; it is implied when using MessageChannel.onmessage. Note: This feature is available in Web Workers. Syntax
port.start() Returns Void. Parameters None. ...
...And 2 more matches
Intl.DisplayNames.supportedLocalesOf() - JavaScript
The Intl.DisplayNames.sup
portedLocalesOf() method returns an array containing those of the provided locales that are sup
ported in date and time formatting without having to fall back to the runtime's default locale. Syntax Intl.DisplayNames.sup
portedLocalesOf(locales[, options]) Parameters locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
...m of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
.... For information about this option, see the Intl page. Return value An array of strings representing a subset of the given locale tags that are sup
ported in date and time formatting without having to fall back to the runtime's default locale. Description Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime sup
ports a locale in date and time formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. ...
...And 2 more matches
Intl.ListFormat.supportedLocalesOf() - JavaScript
The Intl.ListFormat.sup
portedLocalesOf() method returns an array containing those of the provided locales that are sup
ported in date and time formatting without having to fall back to the runtime's default locale. Syntax Intl.ListFormat.sup
portedLocalesOf(locales[, options]) Parameters locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
...m of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
.... For information about this option, see the Intl page. Return value An array of strings representing a subset of the given locale tags that are sup
ported in date and time formatting without having to fall back to the runtime's default locale. Description Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime sup
ports a locale in date and time formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. ...
...And 2 more matches
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
SVG 2 is the next major version of the SVG standard, which is a complete rework of the SVG 1.2 draft. Version 2 contains a lot of changes regarding the last stable version SVG 1.1. Those changes are listed below including their sup
port status within Mozilla applications. General Change Notes length attribute and indexed property for list interfaces Implementation status unknown <script> element in content model of all elements Implementation status unknown initialize(), appendItem(), replaceItem(), and insertItemBefore() on list objects making a copy of any list item being inserted that is already in another list Implementation status unknown crossorigin attribute for <image> and <script> elements Not implemented yet...
...able and SVGTransformable Implementation status unknown SVGGeometryElement with SVGGeometryElement.isPointInFill() and SVGGeometryElement.isPointInStroke() methods Partially implemented (bug 1239100). The methods isPointInFill() and isPointInStroke() are not implemented yet (bug 1325319). ...
...ures attribute removed Implementation status unknown SVGSVGElement.currentView and SVGSVGElement.useCurrentView removed SVGSVGElement.currentView was never implemented, SVGSVGElement.useCurrentView not removed yet (bug 1174097) SVGUnknownElement Not implemented (bug 1239218) lang attribute without namespace Implemented (bug 721920) SVGSVGElement.view
port removed Never implemented xml:base attribute removed Implementation status unknown Reorder descendent elements of <switch> having systemLanguage attribute according to allowReorder SMIL attribute Implementation status unknown Made <tspan> and <textPath> graphics elements Implementation status unknown Allow x, y, width, and height on <symbol> Impl...
...And 2 more matches
Porting the Library Detector - Archive of obsolete content
This example walks through the process of
porting a XUL-based add-on to the SDK. It's a very simple add-on and a good candidate for
porting because there are suitable SDK APIs for all its features. The add-on is Paul Bakaus's Library Detector. The Library Detector tells you which JavaScript frameworks the current web page is using. It does this by checking whether particular objects that those libraries add to the global window object are defined. For example, if window.jQuery is defined, then the page has loaded jQuery. For each library that it finds, the library detector adds an icon representing that library to the status bar. It adds a tooltip to each icon, which contains the library name and version. You can browse and run the
ported version in the SDK's examples directory. How th...
...chLibraries() function constructs a XUL statusbarpanel element for each library it found, populates it with the icon at the corresponding chrome:// URL, and adds it to the box. Finally, it listens to gBrowser's TabSelect event, to update the contents of the box for that window. Content Script Separation The test objects in the original script need access to the DOM window object, so in the SDK
port, they need to run in a content script. In fact, they need access to the un-proxied DOM window, so they can see the objects added by libraries, so we'll need to use the experimental unsafeWindow. The main add-on script, main.js, will use a page-mod to inject the content script into every new page. The content script, which we'll call library-detector.js, will keep most of the logic of the test f...
...ector displayed the detailed information about each library on mouseover in a tooltip: we can't do this using a widget, so instead will use a panel. ...
...ame('img'); for (var i = 0; i < elements.length; i++) { elements[i].addEventListener('mouseover', setLibraryInfo, false); } one in the panel, which updates the panel's content with the library information: self.on("message", function(libraryInfo) { window.document.body.innerHTML = libraryInfo; }); Finally main.js relays the library information from the widget to the panel: widget.
port.on('setLibraryInfo', function(libraryInfo) { widget.panel.postMessage(libraryInfo); }); ...
Extensions support in SeaMonkey 2 - Archive of obsolete content
Starting with SeaMonkey 2 Alpha 1 SeaMonkey sup
ports toolkit/-style extensions. These type of extensions have many advantages for both users and developers compared to the old xpinstall/-style extensions. The Basics To sup
port SeaMonkey 2 as a target application, you need to add it to the list of target applications in the extension's install.rdf file. The code for that will look something like this: <em:targetApplication> <!-- SeaMonkey --> <Description> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:minVersion>2.0</em:minVersion> <em:maxVersion>2.*</em:maxVersion> </Description> </em:targetApplication> The install.js is not sup
ported any more and should be removed. Differences as compared to other toolkit/-based applications You need to overlay/open d...
...marksPanel.xul chrome://communicator/content/bookmarks/bm-panel.xul chrome://browser/content/places/places.xul chrome://communicator/content/bookma...rksManager.xul Thunderbird uses mostly the same chrome URLs for overlaying as SeaMonkey. There are exceptions, but these are few and far between. SeaMonkey also uses different IDs for the menu items. ...
...tus bar, like this: <vbox id="browser-bottombox"> <something insertbefore="status-bar" /> </vbox> Use the following technique to make your overlay work on both SeaMonkey 2 and Firefox 3: <window id="main-window"> <vbox id="browser-bottombox" insertbefore="status-bar"> <something insertbefore="status-bar" /> </vbox> </window> Thunderbird 3 gFolderDisplay API SeaMonkey 2.0 only sup
ports a reduced set of methods: selectedCount selectedMessage selectedMessageIsFeed selectedMessageIsImap selectedMessageIsNews selectedMessageIsExternal selectedIndices selectedMessages selectedMessageUris messageDisplay gMessageDisplay API SeaMonkey 2.0 only sup
ports a reduced set of methods: displayedMessage visible JavaScript Tweaks Firefox sup
ports some shorthand in various ...
...geIsExternal selectedIndices selectedMessages selectedMessageUris messageDisplay gMessageDisplay API SeaMonkey 2.0 only sup
ports a reduced set of methods: displayedMessage visible JavaScript Tweaks Firefox sup
ports some shorthand in various places. These are so commonly available that developers often forget that they are not built-ins. SeaMonkey on the other hand defaults to not sup
port them so they either need to be expanded to their proper forms or matching constants/variables need to be defined in custom code. Shorthand Expansion Cc Components.classes Ci Components.interfaces Cr Components.results Cu Components.utils Multi-browser compatibility To make an extension compatible with SeaMonkey as well as Firefo...
importUserCertificates - Archive of obsolete content
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. DeprecatedThis feature has been removed from the Web standards. Though some browsers may still sup
port it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. Warning: The features mentioned in this article are deleted proprietary Mozilla extensions, and are not sup
ported in any other browser. They won't work i...
...e the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. Warning: The features mentioned in this article are deleted proprietary Mozilla extensions, and are not sup
ported in any other browser. They won't work in Firefox 34 or later. Use <keygen> or the future Web Crypto API instead. resultString = crypto.im
portUserCertificates("nicknameString","certString",forceBackup); Argument Description "nicknameString" This is the nickname that will be used to describe the certificate in the client's certificate management UI. It should serve to uniquely identify the certificate to the user. For example, "John Smith's VeriSign Class 3 Digital ID" or "John Smith's Ford ID Cer...
...er Name> ID</tt>. "certRepString" This string is the CMMF Certification Response from the CA that contains the user's certificate(s). The response is base-64 encoded. forceBackup This is a Boolean argument. It allows the CA or RA to indicate to the client whether to force the user to back up a newly issued certificate (PKCS #12). The im
portUserCertificates() method is used to im
port newly issued certificates for the user. The private key for the certificates must already reside in the user's personal private key database. The request ID in the response being im
ported must match the request ID in the associated Certification Request or Recovery Request. If the im
port operation succeeds, an empty string will be returned. If it fails, ...
...he user's personal private key database. The request ID in the response being im
ported must match the request ID in the associated Certification Request or Recovery Request. If the im
port operation succeeds, an empty string will be returned. ...
Supporting per-window private browsing - Archive of obsolete content
Firefox 20 introduced per-window private browsing mode, in which private user data is stored and accessed concurrently with public user data from another window. Detecting private browsing mode Determining whether or not a given DOM window is private is simple: im
port resource://gre/modules/PrivateBrowsingUtils.jsm and use PrivateBrowsingUtils.isWindowPrivate(window). You can then take action based on this value, as any data or actions originating from this window should be considered private. try { // Firefox 20+ Components.utils.im
port("resource://gre/modules/PrivateBrowsingUtils.jsm"); if (!PrivateBrowsingUtils.isWindowPrivate(window)) { ... } } catch(e) { // pre Firefox 20 (if you do not have access to a ...
...hen instead) try { var inPrivateBrowsing = Components.classes["@mozilla.org/privatebrowsing;1"]. getService(Components.interfaces.nsIPrivateBrowsingService). privateBrowsingEnabled; if (!inPrivateBrowsing) { ... } } catch(e) { Components.utils.re
portError(e); return; } } Obtaining an nsILoadContext for privacy-sensitive APIs Some APIs (such as nsITransferable and nsIWebBrowserPersist) take nsILoadContext arguments that are used to determine whether they should be classed as private or not (for example, whether the URI being persisted by saveURI should be added to the permanent download history). To do this, impo...
...ast-pb-context-exited", false); Preventing a private session from ending If there are unfinished transactions involving private data, where the transactions will be terminated by the ending of a private session, an add-on can vote to prevent the session from ending (prompting the user is recommended). ...
...ng the user is recommended). To do this, observe the last-pb-context-exiting notification and set the data field of the nsISup
portsPRBool subject to true. ...
JS_ReportOutOfMemory
Re
ports a memory allocation error. Syntax void JS_Re
portOutOfMemory(JSContext *cx); void JS_Re
portAllocationOverflow(JSContext *cx); // Added in SpiderMonkey 1.8 Name Type Description cx JSContext * The context in which to re
port the error. Description Call JS_Re
portOutOfMemory to re
port that an operation failed because the system is out of memory. When the JavaScript engine tries to allocate memory and allocation fails, it re
ports an error as though by calling this function. Call JS_Re
portAllocationOverflow if an operation fails because it tries to use more memory (or more of some other resource) than the application is designed to handle. When a script tries to grow an array beyond 230-1 elements, for example, or concatenate strings such that th...
... re
ports an error as though by calling this function. Call JS_Re
portAllocationOverflow if an operation fails because it tries to use more memory (or more of some other resource) than the application is designed to handle. When a script tries to grow an array beyond 230-1 elements, for example, or concatenate strings such that the result is more than 229-1 characters long, the JavaScript engine re
ports an error as though by calling this function. See JS_Re
portError and JS_SetErrorRe
porter for more information about error handling in the JSAPI. ...
... application is designed to handle. When a script tries to grow an array beyond 230-1 elements, for example, or concatenate strings such that the result is more than 229-1 characters long, the JavaScript engine re
ports an error as though by calling this function. ...
... a script tries to grow an array beyond 230-1 elements, for example, or concatenate strings such that the result is more than 229-1 characters long, the JavaScript engine re
ports an error as though by calling this function. ...
Components.utils.reportError
Components.utils.re
portError re
ports a JavaScript Error object to the Error Console, and returns. It is meant for use by extension developers who have exception handler blocks which want to "eat" an exception, but still want to re
port it to the console. It must be called with one parameter, usually an object which was caught by an exception handler. If it is not a JavaScript error object, the parameter is converted to a string and re
ported as a new error. This means you can use Components.utils.re
portError to re
port debugging messages to the Error Console, just like dump() can be used to print messages to the native console. However you should use nsIConsoleService for logging, as it logs the messages with normal severity, unlike re
portError. function myDump(aMessage) { var consol...
...Console will not display chrome errors by default. To show them, set the preference 'javascript.options.showInConsole' to true, or use nsConsoleService instead to show a message. ...
...splay chrome errors by default. To show them, set the preference 'javascript.options.showInConsole' to true, or use nsConsoleService instead to show a message. ...
... use nsConsoleService instead to show a message. Firefox 4: The preference 'javascript.options.showInConsole' is set to true by default in this version. ...
nsSupportsWeakReference
<< XPCOM API Reference Summary Inherit from this C++ class to add canonical sup
port for nsISup
portsWeakReference. See Weak reference for detailed description of weak references. #include "nsWeakReference.h" class nsSup
portsWeakReference { ... }; Remarks In addition to inheriting from this class, you will need to ensure that your nsISup
ports::QueryInterface implementation exposes nsISup
portsWeakReference as a sup
ported interface. To use this class, you must link your component or application against the XPCOM Glue library. Example code // Sup
porting weak references to a hypothetical implementation // of the nsIFoo interface... ...
...nsISup
ports::QueryInterface implementation exposes nsISup
portsWeakReference as a sup
ported interface. To use this class, you must link your component or application against the XPCOM Glue library. Example code // Sup
porting weak references to a hypothetical implementation // of the nsIFoo interface... #include "nsWeakReference.h" #include "nsIFoo.h" class MyFoo : public nsIFoo, public nsSup
portsWeakReference { public: NS_DECL_ISUP
PORTS NS_DECL_NSIFOO ... }; NS_IMPL_ISUP
PORTS2(MyFoo, nsIFoo, nsISup
portsWeakReference) ... ...
...gainst the XPCOM Glue library. Example code // Sup
porting weak references to a hypothetical implementation // of the nsIFoo interface... #include "nsWeakReference.h" #include "nsIFoo.h" class MyFoo : public nsIFoo, public nsSup
portsWeakReference { public: NS_DECL_ISUP
PORTS NS_DECL_NSIFOO ... }; NS_IMPL_ISUP
PORTS2(MyFoo, nsIFoo, nsISup
portsWeakReference) ... ...
... Example code // Sup
porting weak references to a hypothetical implementation // of the nsIFoo interface... #include "nsWeakReference.h" #include "nsIFoo.h" class MyFoo : public nsIFoo, public nsSup
portsWeakReference { public: NS_DECL_ISUP
PORTS NS_DECL_NSIFOO ... }; NS_IMPL_ISUP
PORTS2(MyFoo, nsIFoo, nsISup
portsWeakReference) ... ...
Xptcall Porting Status
What is this? This is a status page for the multiplatform
porting of xptcall. xptcall has a FAQ and a
Porting Guide. This is being maintained by John Bandhauer <jband@netscape.com>. Feel free to email me with questions or to volunteer to contribute xptcall code for any platform. Mike Shaver <shaver@mozilla.org> is the best contact regarding 'nix (Unix, Linux, Finux, etc.)
ports of xptcall. Status Status Platform Contributors and <font color="red">?</font> Possible Contributors Notes <font color="white">Done</font> Win32 x86 John Bandhauer <jband@netscape.com> win32 <font color="white">Done</font> Linux x86 John Bandhauer <jband@netscape.com> Ulrich Drepper <drepper@cygnus.com> unix <font color="white">Done</font> FreeBSD and NetBSD x86 Christoph Toshok <toshok@hungry.com>,...
...uk> I never heard exactly who did what. But mozilla has been working on OS/2 for a long time now. <font color="white">Done</font> OpenVMS Alpha Colin R. Blake <colin@theblakes.com> Colin says this is passing all the tests on OpenVMS Alpha! <font color="white">Done</font> NT Alpha bob meader <bob@guiduck.com> bob writes: Enclosed is xptcall for alpha/nt target.. It is a variation of the IRIS
port (only targeted for win32). Notice the last 2 files (the change to mozilla\xpcom\build\makefile.win and mozilla\xpcom\build) are needed because I was unable to figure how to do a "declspecex
port" from the assembler ASAXP ... if some knows how to do that then those last 2 files won't be needed. I have had someone look over this code at bridge.com (the entry point to compaq/gem compiler team) and th...
...pilers and the code will need minor modifications in order to work properly. I am not sure how much of the code can be used for OpenVMS Alpha and/or Digital UNIX. Currently the code is dependent on the g++ name mangling convention and a few GNU extensions so I'm not sure how useful it will be for the other systems. Hopefully the comments in the code are detailed enough to help people attempting a
port. <font color="white">Done</font> SunOS x86 Arthur Jones <aljones@lbl.gov> <font color="red">?</font> Philip Pokorny <ppokorny@mindspring.com> The word I hear is that this is working and done <font color="white">Done</font> HP-UX Thomas Wang <wang@cup.hp.com> Mike Gleeson <mgleeson1@netscape.com> I hear that this code is checked in and working. Though, there is some doubt - see bug #17997...
... Hunt <evanh@sco.com> Recent (Feb-2001) email from jkj@sco.com suggests that work will be occuring soon. <font color="black">Works</font> NetBSD/m68k Dave Huang <khym@bga.com> Dave's changes are in the tree. Waiting for verification that it is really finished. <font color="black">Partially Working</font> NetBSD/arm32 Mike Pumford <mpumford@black-star.demon.co.uk> Mike writes: I have started
porting to the platform based on the code for Linux ARM. The InvokeByIndex code works correctly when used with TestXPTCInvoke. I am currently working on making TestXPC function correctly. I am doing the
porting work with egcs-1.1.2 on NetBSD 1.4P (NetBSD-current snapshot from a couple of days ago). <font color="white">Done</font> Linux ia64 HP Ulrich Drepper <drepper@redhat.com> bug 40950 comment...
MediaRecorder.isTypeSupported - Web APIs
If the value is false, the user agent is incapable of recording the specified format. ...
...If the value is false, the user agent is incapable of recording the specified format. ...
...If the value is false, the user agent is incapable of recording the specified format. ...
...f the value is false, the user agent is incapable of recording the specified format. Example var types = ["video/webm", "audio/webm", "video/webm\;codecs=vp8", "video/webm\;codecs=daala", "video/webm\;codecs=h264", "audio/webm\;codecs=opus", "video/mpeg"]; for (var i in types) { console.log( "Is " + types[i] + " sup
ported? " + (MediaRecorder.isTypeSup
ported(types[i]) ? "Maybe!" : "Nope :(")); } Specifications Specification Status Comment MediaStream RecordingThe definition of 'isTypeSup
ported()' in that specification. Working Draft Initial definition. ...
MediaTrackSupportedConstraints.autoGainControl - Web APIs
The MediaTrackSup
portedConstraints dictionary's autoGainControl property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the autoGainControl constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). The autoGainControl constraint indicates whether or not the browser offers the ability to automatically control the gain (volume) on media tracks; this obviously is contingent on whether or not the individual device sup
ports automatic gain control as well; it's typically a feature provided by microphones. Syntax...
...dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). The autoGainControl constraint indicates whether or not the browser offers the ability to automatically control the gain (volume) on media tracks; this obviously is contingent on whether or not the individual device sup
ports automatic gain control as well; it's typically a feature provided by microphones. Syntax autoGainSup
ported = sup
portedConstraintsDictionary.autoGainControl; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the autoGainControl constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example This example simply displays whether or...
...intsDictionary.autoGainControl; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the autoGainControl constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example This example simply displays whether or not your browser sup
ports the autoGainControl constraint. ...
...rted constraints dictionary, and you'll get undefined if you try to look at its value. Example This example simply displays whether or not your browser sup
ports the autoGainControl constraint. HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().autoGainControl) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'autoGainControl' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.cursor - Web APIs
The MediaTrackSup
portedConstraints dictionary's cursor property indicates whether or not the cursor constraint is sup
ported by the user agent and the device on which the content is being used. The sup
ported constraints list is obtained by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax isCursorSup
ported = sup
portedConstraints.cursor; Value A Boolean value which is true if the cursor constraint is sup
ported by the device and user agent. Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). It adds the cursor constraint only if it is known to be sup
ported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem.
...user agent. Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). It adds the cursor constraint only if it is known to be sup
ported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
...straints object specifying the options for the call to getDisplayMedia(). It adds the cursor constraint only if it is known to be sup
ported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
...ted by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. async function captureWithCursor() { let sup
portedConstraints = navigator.mediaDevices.getSup
portedConstraints(); let displayMediaOptions = { video: { displaySurface: "browser" }, audio: false; }; if (sup
portedConstraints.cursor) { displayMediaOptions.video.cursor = "always"; } try { videoElem.srcObject = await navigator.mediaDevices.getDisplayMedia(displayMediaOptions); } catch(err) { /* handle the error */ } } Specifications Specification Status Comment Screen CaptureThe definition of 'MediaTrackSup
portedConstraints.cursor' in that specification. Un...
MediaTrackSupportedConstraints.height - Web APIs
The MediaTrackSup
portedConstraints dictionary's height property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the height constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax heightConstraintSup
ported = sup
portedConstraintsDictionary.height; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the height constraint. ...
...be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax heightConstraintSup
ported = sup
portedConstraintsDictionary.height; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the height constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
... Candidate Recommendation Initial specification. ...
...ent, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().height) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'height' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.noiseSuppression - Web APIs
The MediaTrackSup
portedConstraints dictionary's noiseSuppression property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the noiseSuppression constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). The noiseSuppression constraint indicates whether or not the browser offers the ability to automatically control the gain (volume) on media tracks; this obviously is contingent on whether or not the individual device sup
ports automatic gain control as well. ...
...You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). The noiseSuppression constraint indicates whether or not the browser offers the ability to automatically control the gain (volume) on media tracks; this obviously is contingent on whether or not the individual device sup
ports automatic gain control as well. Syntax noiseSuppressionSup
ported = sup
portedConstraintsDictionary.noiseSuppression; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the noiseSuppression constraint (and therefore sup
ports noise suppression on audio tracks). ...
...ice sup
ports automatic gain control as well. Syntax noiseSuppressionSup
ported = sup
portedConstraintsDictionary.noiseSuppression; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the noiseSuppression constraint (and therefore sup
ports noise suppression on audio tracks). If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example This example simply displays whether or not your browser sup
ports the noiseSuppression constraint. HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSupp...
...look at its value. Example This example simply displays whether or not your browser sup
ports the noiseSuppression constraint. HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().noiseSuppression) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'noiseSuppression' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.width - Web APIs
The MediaTrackSup
portedConstraints dictionary's width property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the width constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax widthConstraintSup
ported = sup
portedConstraintsDictionary.width; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the width constraint. ...
...er be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax widthConstraintSup
ported = sup
portedConstraintsDictionary.width; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the width constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
... Candidate Recommendation Initial specification. ...
...sent, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().width) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'width' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidate.port - Web APIs
The RTCIceCandidate interface's read-only
port property contains the
port number on the device at the address given by ip at which the candidate's peer can be reached. As is the case with most of RTCIceCandidate's properties, the value of
port is extracted from the candidate a-line string specified when creating the RTCIceCandidate. The a-line string is obtained either from the RTCIceCandidateInit property candidate or from a-line string passed into the constructor upon using new RTCIceCandidate(). Syntax var
port = RTCIceCandidate.
port; Value A 16-bit number indicating the
port number on the device at the address indicated by ip at which the candidate's peer can be reached. ...
... specified when creating the RTCIceCandidate. The a-line string is obtained either from the RTCIceCandidateInit property candidate or from a-line string passed into the constructor upon using new RTCIceCandidate(). Syntax var
port = RTCIceCandidate.
port; Value A 16-bit number indicating the
port number on the device at the address indicated by ip at which the candidate's peer can be reached.
port is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed propertly. Note: If
port is null, passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. This applies only if the candidate implements
port. Usage notes Consider this SDP attribute line (a-line) which describes an ICE candidate: a=candidate:42349973...
... candidate, or if the candidate string can't be parsed propertly. Note: If
port is null, passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. This applies only if the candidate implements
port. Usage notes Consider this SDP attribute line (a-line) which describes an ICE candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The
port number is found in the sixth field, which is "44323". In this case, the value of
port will be 44323. Example This code snippet fetches the IP address and
port number of the candidate, storing them into an object for future use. ...
...a-line) which describes an ICE candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The
port number is found in the sixth field, which is "44323". In this case, the value of
port will be 44323. Example This code snippet fetches the IP address and
port number of the candidate, storing them into an object for future use. var candidateLoc = { address: candidate.ip,
port: candidate.
port } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate.
port' in that specification. Candidate Recommendation Initial definition. ...
RTCIceTransport.getRemoteCandidates() - Web APIs
The RTCIceTrans
port method getRemoteCandidates() returns an array which contains one RTCIceCandidate for each of the candidates that have been received from the remote peer so far during the current ICE gathering session. Each time your signaling code calls RTCPeerConnection.addIceCandidate() to add a received candidate to the ICE session, the ICE agent places it in the list returned by this function. Syntax remoteCandidates = RTCIceTrans
port.getRemoteCandidates(); Parameters None. Return value An array containing one RTCIceCandidate object for each candidate that has been received so far from the remote peer during the current ICE candidate gathering session. It's im
portant to keep in mind that there's no way to correlate these remote candidates with compatible local candidates. To f...
...tRemoteCandidates(); Parameters None. Return value An array containing one RTCIceCandidate object for each candidate that has been received so far from the remote peer during the current ICE candidate gathering session. It's im
portant to keep in mind that there's no way to correlate these remote candidates with compatible local candidates. To find the best match found so far, call RTCIceTrans
port.getSelectedCandidatePair(). ...
...didate that has been received so far from the remote peer during the current ICE candidate gathering session. It's im
portant to keep in mind that there's no way to correlate these remote candidates with compatible local candidates. To find the best match found so far, call RTCIceTrans
port.getSelectedCandidatePair(). Example This simple example gets the remote candidate list from the RTCIceTrans
port for the first RTCRtpSender on the RTCPeerConnection, then outputs to the console all of the candidates in the list. ...
...elate these remote candidates with compatible local candidates. To find the best match found so far, call RTCIceTrans
port.getSelectedCandidatePair(). Example This simple example gets the remote candidate list from the RTCIceTrans
port for the first RTCRtpSender on the RTCPeerConnection, then outputs to the console all of the candidates in the list. var remoteCandidates = pc.getSenders()[0].trans
port.trans
port.getRemoteCandidates(); remoteCandidates.forEach(function(candidate, index)) { console.log("Candidate " + index + ": " + candidate.candidate); }); Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate.getRemoteCandidates()' in that specification. Candidate Recommendation Initia...
RTCIceTransport.getRemoteParameters() - Web APIs
Return value An RTCIceParameters object indicating the usernameFragment and password which uniquely identify the remote peer for the duration of the ICE session. Returns null if the parameters haven't been received yet. ...
... Return value An RTCIceParameters object indicating the usernameFragment and password which uniquely identify the remote peer for the duration of the ICE session. Returns null if the parameters haven't been received yet. ...
... Return value An RTCIceParameters object indicating the usernameFragment and password which uniquely identify the remote peer for the duration of the ICE session. Returns null if the parameters haven't been received yet. ...
...; Parameters None. Return value An RTCIceParameters object indicating the usernameFragment and password which uniquely identify the remote peer for the duration of the ICE session. Returns null if the parameters haven't been received yet. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceTrans
port.getRemoteParameters' in that specification. Candidate Recommendation Initial specification. ...
RTCIceTransport.ongatheringstatechange - Web APIs
The ongatheringstatechange event handler for the RTCIceTrans
port interface specifies an event handler that is to be called when the gatheringstatechange event occurs on the trans
port. This event is delivered whenever the trans
port's gatheringState property changes. Syntax RTCIceTrans
port.ongatheringstatechange = stateChangeHandler; Value A function to be called when the RTCIceTrans
port object's gathering state changes. To determine the new state, examine the value of gatheringState. The gathering state indicates whether or not the ICE agent has begun gathering candidates, and if so, whether or not gathering has finished. ...
...s
port.ongatheringstatechange = stateChangeHandler; Value A function to be called when the RTCIceTrans
port object's gathering state changes. To determine the new state, examine the value of gatheringState. The gathering state indicates whether or not the ICE agent has begun gathering candidates, and if so, whether or not gathering has finished. Its possible values are: "new" The RTCIceTrans
port is newly created and has not yet started to gather ICE candidates. "gathering" The trans
port is in the process of gathering candidates. "complete" The trans
port has finished gathering ICE candidates and has sent the end-of-candidates indicator to the remote device. ...
...ing candidates, and if so, whether or not gathering has finished. Its possible values are: "new" The RTCIceTrans
port is newly created and has not yet started to gather ICE candidates. "gathering" The trans
port is in the process of gathering candidates. "complete" The trans
port has finished gathering ICE candidates and has sent the end-of-candidates indicator to the remote device. The trans
port won't gather any further candidates unless an ICE restart occurs, at which point the gathering process starts over from scratch. ...
...e trans
port won't gather any further candidates unless an ICE restart occurs, at which point the gathering process starts over from scratch. Example This snippet establishes a handler for the gatheringstatechange event that checks to see if the state has changed to "complete", indicating that all ICE candidates from both the local and remote peers have been received and processed. var iceTrans
port = pc.getSenders()[0].trans
port.trans
port; iceTrans
port.ongatheringstatechange = function(event) { if (iceTrans
port.gatheringState == "complete") { allCandidatesReceived(pc); } } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceTrans
port.ongatheringstatechange' in that specification. ...
WebGLRenderingContext.getSupportedExtensions() - Web APIs
] See also the WebGLRenderingContext.getExtension() method to get a specific extension object. WebGL extensions Extensions for the WebGL API are registered in the WebGL Extension Registry. ...
...] See also the WebGLRenderingContext.getExtension() method to get a specific extension object. WebGL extensions Extensions for the WebGL API are registered in the WebGL Extension Registry. ...
...] See also the WebGLRenderingContext.getExtension() method to get a specific extension object. WebGL extensions Extensions for the WebGL API are registered in the WebGL Extension Registry. ...
... Recommendation Initial definition. ...
viewport-fit - CSS: Cascading Style Sheets
The view
port-fit CSS @view
port descriptor controls how a document's view
port fills the screen. Syntax /* Keyword values */ view
port-fit: auto; view
port-fit: contain; view
port-fit: cover; Values auto This value doesn't affect the initial layout view
port, and the whole web page is viewable. contain The view
port is scaled to fit the largest rectangle inscribed within the display. cover The view
port is scaled to fill the device display. It is highly recommended to make use of the safe area inset variables to ensure that im
portant content doesn't end up outside the display. This descriptor hasn't been added to https://github.com/mdn/data/blob/master/css/at-rules.json yet. ...
...fit the largest rectangle inscribed within the display. cover The view
port is scaled to fill the device display. It is highly recommended to make use of the safe area inset variables to ensure that im
portant content doesn't end up outside the display. This descriptor hasn't been added to https://github.com/mdn/data/blob/master/css/at-rules.json yet. Accessibility concerns When using the view
port-fit descriptor, one must keep in mind that not all device displays are rectangular, and should therefore make use of the safe area inset variables. ...
... Working Draft Initial definition. ...
...thub.com/mdn/data/blob/master/css/at-rules.json yet. Accessibility concerns When using the view
port-fit descriptor, one must keep in mind that not all device displays are rectangular, and should therefore make use of the safe area inset variables. Formal definition Related at-rule@view
portInitial valueautoComputed valueas specified Formal syntax auto | contain | cover Examples Scaling view
port to fit device display @view
port { view
port-fit: cover; } Specifications Specification Status Comment CSS Round Display Level 1The definition of '"view
port-fit" descriptor' in that specification. Working Draft Initial definition. ...
CSP: report-uri - HTTP
The deprecated HTTP Content-Security-Policy (CSP) re
port-uri directive instructs the user agent to re
port attempts to violate the Content Security Policy. These violation re
ports consist of JSON documents sent via an HTTP POST request to the specified URI. Though the re
port-to directive is intended to replace the deprecated re
port-uri directive, re
port-to isn't sup
ported in most browsers yet. So for compatibility with current browsers while also adding forward compatibility when browsers get re
port-to sup
port, you can specify both re
port-uri and re
port-to: Content-Security-Policy: ...; re
port-uri https://endpoint.com; re
port-to groupname In browsers that sup
port re
port-to, the re
port-uri directive will be ignored. The directive has no effect in and of itself, but only gains meaning in...
...s get re
port-to sup
port, you can specify both re
port-uri and re
port-to: Content-Security-Policy: ...; re
port-uri https://endpoint.com; re
port-to groupname In browsers that sup
port re
port-to, the re
port-uri directive will be ignored. The directive has no effect in and of itself, but only gains meaning in combination with other directives. CSP version 1 Directive type Re
porting directive This directive is not sup
ported in the <meta> element. Syntax Content-Security-Policy: re
port-uri <uri>; Content-Security-Policy: re
port-uri <uri> <uri>; <uri> A URI where to POST the re
port to. Examples See Content-Security-Policy-Re
port-Only for more information and examples. ...
...1 Directive type Re
porting directive This directive is not sup
ported in the <meta> element. Syntax Content-Security-Policy: re
port-uri <uri>; Content-Security-Policy: re
port-uri <uri> <uri>; <uri> A URI where to POST the re
port to. Examples See Content-Security-Policy-Re
port-Only for more information and examples. Content-Security-Policy: default-src https:; re
port-uri /csp-violation-re
port-endpoint/ /csp-violation-re
port-endpoint/ could for example run a PHP something like the following that logs the JSON detailing the violation and, if the violation is the first one added to the log file, sends an email to an administrator: <?php // Start configure $log_file = dirname(__FILE__) . '/csp-violations.log'; $log_file_size_limit = 1000000; // bytes - once ex...
...d:\n\n" . $log_file; mail($email_address, $email_subject, $message, 'Content-Type: text/plain;charset=utf-8'); } else if (filesize($log_file) > $log_file_size_limit) { exit(0); } file_put_contents($log_file, $json_data, FILE_APPEND | LOCK_EX); } Specifications Specification Status Comment Content Security Policy Level 3The definition of 're
port-uri' in that specification. Working Draft No changes. Content Security Policy Level 2The definition of 're
port-uri' in that specification. Recommendation Initial definition. ...
Intl.PluralRules.supportedLocalesOf() - JavaScript
The Intl.PluralRules.sup
portedLocalesOf() method returns an array containing those of the provided locales that are sup
ported in plural formatting without having to fall back to the runtime's default locale. Syntax Intl.PluralRules.sup
portedLocalesOf(locales[, options]) Parameters locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. Possible values are lookup and best fit; the default is best fit. For information about this option, see the Intl page. ...
...al form of the locales argument, see the Intl page. options Optional. An object that may have the following property: localeMatcher The locale matching algorithm to use. Possible values are lookup and best fit; the default is best fit. For information about this option, see the Intl page. Return value An array of strings representing a subset of the given locale tags that are sup
ported in plural formatting without having to fall back to the runtime's default locale. Description Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime sup
ports a locale in plural formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. Examples ...
...al formatting without having to fall back to the runtime's default locale. Description Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime sup
ports a locale in plural formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. Examples Using sup
portedLocalesOf() Assuming a runtime that sup
ports Indonesian and German but not Balinese in plural formatting, sup
portedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to plural formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be sup
ported. Note the specification of the lookup algorithm he...
...likely to be sup
ported. Note the specification of the lookup algorithm here -- a best fit matcher might decide that Indonesian is an adequate match for Balinese since most Balinese speakers also understand Indonesian, and therefore return the Balinese language tag as well. var locales = ['ban', 'id-u-co-pinyin', 'de-ID']; var options = { localeMatcher: 'lookup' }; console.log(Intl.PluralRules.sup
portedLocalesOf(locales, options).join(', ')); // -> "id-u-co-pinyin, de-ID" Specifications Specification ECMAScript Internationalization API (ECMA-402)The definition of 'Intl.PluralRules.sup
portedLocalesOf' in that specification. ...
NP_Port - Archive of obsolete content
<< Gecko Plugin API Reference << Plug-in Side Plug-in API Summary Used on Mac OS only Contains information required by the window field of an NPWindow structure. Syntax typedef struct NP_
Port { CGrafPtr
port; /* Graf
port */ int32
portx; /* position inside the topmost window */ int32
porty; } NP_
Port; Fields The data structure has the following fields:
port Standard Mac OS
port into which the plug-in should draw.
portx,
porty Top-left corner of the plug-in rectangle in
port coordinates (taking the scroll position into account). ...
...2
portx; /* position inside the topmost window */ int32
porty; } NP_
Port; Fields The data structure has the following fields:
port Standard Mac OS
port into which the plug-in should draw.
portx,
porty Top-left corner of the plug-in rectangle in
port coordinates (taking the scroll position into account). Description On Mac OS, the window field of an NPWindow structure points to an NP_
Port object, which is allocated by the browser. The NP_
Port is valid for the lifetime of the NPWindow, that is, until NPP_SetWindow is called again with a different value or the instance is destroyed. Since the
port is shared between the plug-in and other plug-ins and the browser, the plug-in should always do the following: Draw only within the area designated by the NPWindow. Save the current
port...
... the browser. The NP_
Port is valid for the lifetime of the NPWindow, that is, until NPP_SetWindow is called again with a different value or the instance is destroyed. Since the
port is shared between the plug-in and other plug-ins and the browser, the plug-in should always do the following: Draw only within the area designated by the NPWindow. Save the current
port settings before changing the
port for drawing. Set the desired
port settings before drawing. Restore the previous
port settings after drawing. See Also NPP_SetWindow, NPWindow ...
Updating an extension to support multiple Mozilla applications - Archive of obsolete content
t it side-by-side with the article, or to use it as a basis for your own extension. Download the sample Updating the install manifest The first step is to revise the extension's install manifest to indicate that it can be installed in Thunderbird and Sunbird. ...
...After insertin...
...After inserting this code, you can successfully install the extension into any (or all) of Firefox, Thunderbird, and Sunbird, but you won't see any effect in Thunderbird and Sunbird. ...
Window.importDialog() - Archive of obsolete content
There may also be large incompatibilities between implementations and the behavior may change in the future. ObsoleteThis feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. ...
...wsers, its use is discouraged since it could be removed at any time. Try to avoid using it. This function was only available in the original, XUL-based version of Firefox for Android, which is no longer sup
ported; for that reason, this function is obsolete and should never be used. Summary Because opening windows on mobile isn't necessarily appropriate, the Firefox Mobile team designed the im
portDialog() method to replace window.openDialog(). Instead of opening a new window, it merges the specified XUL dialog into the main window. Syntax newDialog = im
portDialog(aParent, aSrc, aArguments) newDialog The opened window aParent The dialog's parent; can be null. aSrc The chrome URL of the XUL dialog. aArguments A JavaScript object containing data to pass to the dialog. Example ...
... to replace window.openDialog(). Instead of opening a new window, it merges the specified XUL dialog into the main window. Syntax newDialog = im
portDialog(aParent, aSrc, aArguments) newDialog The opened window aParent The dialog's parent; can be null. aSrc The chrome URL of the XUL dialog. aArguments A JavaScript object containing data to pass to the dialog. Example var dialog = im
portDialog(null, "chrome://myextension/content/dialog.xul", myObject); Notes The XUL passed to im
portDialog() is very similar to XUL passed to window.openDialog(), with some limitations and caveats: Only <dialog> top level elements are permitted. Scripts are loaded via an attribute on the <dialog> element, not via the <script> tag. The XUL is merged into the existing window, almost like a XUL...
CSS -moz-bool-pref() @supports function
The -moz-bool-pref() @sup
ports condition is available to Gecko chrome and UA stylesheets to check if a boolean preference is enabled. Syntax -moz-bool-pref( <string> ) Parameters <string> The preference name Returns Evaluates to true if the preference is enabled, false otherwise. Example Warning: This will only work when loaded from a Gecko chrome stylesheet. HTML <div id="pref-test"> This will have a green background if the <code>test</code> preference is enabled. ...
...lean preference is enabled. ...
...string> The preference name Returns Evaluates to true if the preference is enabled, false otherwise. ...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
An Internationalized Domain Name (IDN) is a domain/host name which uses non-ASCII characters. Until recently domain names allowed only a subset of 7-bit ASCII characters. As the Internet has spread to non-English speaking people around the world, it has become increasingly clear that forcing them to use domain names written only in a subset of the Latin Alphabet is not ideal. Many of the European languages use the basic Latin Alphabet with additional accented characters for writing but they were not able to use them in domain names. ...
...s. There are many languages whose writing scripts are not based on Latin Alphabet at all. Speakers of these languages were not able to use familiar names in their native languages as part of Internet domain/host names. For the past few years, there have been a flurry of IETF activities to standardize the protocols involved in domain names to handle non-ASCII characters. In March of 2003, three im
portant RFC's were approved by IETF. (Cf. RFC's 3490, 3491, 3492.) These new RFC's now make it possible for domain name servers to register non-ASCII domain names and application/client vendors to implement standardized sup
port for handling non-ASCII characters in domain names. How IDN Works When a browser sees a host name such as http://developer.mozilla.org, it passes a request to the DNS resolver...
...ing the right-mouse click menu New > Boolean. The name of the preference is: network.IDN_testbed. The value should be "true". Now access IDN sites under the .com and .net top domains. You should succeed in reaching the sample sites. Don't forget to set the value of these preferences to "default" once you are finished with testing! Caveats and Conclusions Netscape 7.1/Mozilla 1.4 has solid sup
port for Internationalized Domain Names and is the first browser with built-in sup
port for new RFC's for IDN established by IETF. This means that there is no longer any need to use a plug-in to process non-ASCII domain names. Netscape/Mozilla's sup
port for IDN is not without some bugs. One notable bug is that non-ASCII names are not always displayed correctly in some UI areas such as Preference panel...
JS_ReportPendingException
Forward the current pending exception in a given JSContext to the current JSErrorRe
porter callback. Syntax bool JS_Re
portPendingException(JSContext *cx); Name Type Description cx JSContext * The context in which the exception was thrown. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. Description If an exception is pending in the context cx, JS_Re
portPendingException converts the exception to a string and re
ports it to the current error re
porter. On success, it clears the exception as though by calling JS_ClearPendingException and returns true. If no exception is pending, or if a second error occurs while trying to re
port the first one, it returns false. This function can be used to catch exceptions thrown f...
...ngException converts the exception to a string and re
ports it to the current error re
porter. On success, it clears the exception as though by calling JS_ClearPendingException and returns true. If no exception is pending, or if a second error occurs while trying to re
port the first one, it returns false. This function can be used to catch exceptions thrown from scripts and send them to the error re
porter to be logged or ignored. Note that certain JSAPI functions automatically do this for uncaught exceptions; see "Automatic handling of uncaught exceptions" in the JSAPI User Guide. ...
..., or if a second error occurs while trying to re
port the first one, it returns false. This function can be used to catch exceptions thrown from scripts and send them to the error re
porter to be logged or ignored. Note that certain JSAPI functions automatically do this for uncaught exceptions; see "Automatic handling of uncaught exceptions" in the JSAPI User Guide. ...
nsITransportEventSink
netwerk/base/public/nsITrans
port.idlScriptable Implemented by clients that wish to receive trans
port events. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview void onTrans
portStatus(in nsITrans
port aTrans
port, in nsresult aStatus, in unsigned long long aProgress, in unsigned long long aProgressMax); Methods onTrans
portStatus() Trans
port status notification. void onTrans
portStatus( in nsITrans
port aTrans
port, in nsresult aStatus, in unsigned long long aProgress, in unsigned long long aProgressMax ); Parameters aTrans
port The trans
port sending this status notification. aStatus The trans
port status (resolvable to a string using nsIErrorService). See nsISocketTrans
port for socket specific status codes and more comments. aProgress The amount of dat...
...ns
port status (resolvable to a string using nsIErrorService). See nsISocketTrans
port for socket specific status codes and more comments. aProgress The amount of data either read or written depending on the value of the status code. this value is relative to aProgressMax. aProgressMax The maximum amount of data that will be read or written. if unknown, 0xFFFFFFFF will be passed. ...
...lvable to a string using nsIErrorService). See nsISocketTrans
port for socket specific status codes and more comments. aProgress The amount of data either read or written depending on the value of the status code. this value is relative to aProgressMax. aProgressMax The maximum amount of data that will be read or written. if unknown, 0xFFFFFFFF will be passed. ...
LDAP Support
It is not intended as an introduction to LDAP and Mozilla products. It assumes you are already familiar with configuring preferences for deployed builds in addition to setting up Thunderbird to use an LDAP directory. It should be noted that all of this information applies to both Thunderbird and the SeaMonkey application suite. Mail Compose Typedown In mail compose, when typing a partial mail address, a typedown window appears listing possible matches against address books and LDAP directories. ...
...See Bug #119291 for more details. Original Document Information Author(s): Scott MacGregor Copyright Information:
Portions of this content are (C) 1998-2010 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
... ...
BasicCardRequest.supportedTypes - Web APIs
The obsolete sup
portedTypes property of the BasicCardRequest dictionary can optionally be provided to specify an array of DOMStrings representing the card types that the retailer sup
ports (e.g. credit, debit, prepaid). This property is obsolete and should no longer be used. Instead of making the web app or site worry about this, the onus has been transferred to the payment processor. Syntax basicCardRequest.sup
portedTypes = [cardType1...cardTypeN]; Value An array containing one or more DOMStrings, which describe the card types the retailer sup
ports. Legal values are defined in BasicCardType enum, and are currently: credit debit prepaid Example The following example shows a sample definition of the first parameter of the PaymentRequest() constructor, the data property of which ...
...t.sup
portedTypes = [cardType1...cardTypeN]; Value An array containing one or more DOMStrings, which describe the card types the retailer sup
ports. Legal values are defined in BasicCardType enum, and are currently: credit debit prepaid Example The following example shows a sample definition of the first parameter of the PaymentRequest() constructor, the data property of which contains sup
portedNetworks and sup
portedTypes properties. var sup
portedInstruments = [{ sup
portedMethods: 'basic-card', data: { sup
portedNetworks: ['visa', 'mastercard', 'amex', 'jcb', 'diners', 'discover', 'mir', 'unionpay'], sup
portedTypes: ['credit', 'debit'] } }]; var details = { ... }; var options = { ... ...
... which contains sup
portedNetworks and sup
portedTypes properties. var sup
portedInstruments = [{ sup
portedMethods: 'basic-card', data: { sup
portedNetworks: ['visa', 'mastercard', 'amex', 'jcb', 'diners', 'discover', 'mir', 'unionpay'], sup
portedTypes: ['credit', 'debit'] } }]; var details = { ... }; var options = { ... ...
DOMTokenList.supports() - Web APIs
The sup
ports() method of the DOMTokenList interface returns true if a given token is in the associated attribute's sup
ported tokens. This method is intended to sup
port feature detection. Syntax let trueOrFalse = element.sup
ports(token) Parameters token A DOMString containing the token to query for. Returns A Boolean indicating whether the token was found. ...
...e returns true if a given token is in the associated attribute's sup
ported tokens. This method is intended to sup
port feature detection. Syntax let trueOrFalse = element.sup
ports(token) Parameters token A DOMString containing the token to query for. Returns A Boolean indicating whether the token was found. ...
...e associated attribute's sup
ported tokens. This method is intended to sup
port feature detection. Syntax let trueOrFalse = element.sup
ports(token) Parameters token A DOMString containing the token to query for. Returns A Boolean indicating whether the token was found. Example let iframe = document.getElementById('display'); if (iframe.sandbox.sup
ports('an-upcoming-feature')) { // sup
port code for mystery future feature } else { // fallback code } if (iframe.sandbox.sup
ports('allow-scripts')) { // instruct frame to run JavaScript // // (NOTE: This feature is well-sup
ported; this is just an example!) // } Specifications Specification Status Comment Credential Management Level 1 Working Draft Initial definition. ...
ExtendableMessageEvent.ports - Web APIs
The
ports read-only property of the ExtendableMessageEvent interface returns the array containing the Message
Port objects representing the
ports of the associated message channel (the channel the message is being sent through.) Syntax var my
Ports = extendableMessageEvent.
ports; Value An array of Message
Port objects. Examples When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. ...
...the channel the message is being sent through.) Syntax var my
Ports = extendableMessageEvent.
ports; Value An array of Message
Port objects. Examples When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. ...
...s When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. var
port; self.addEventListener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') {
port.postMessage(obj); } else if(obj.action === 'init' || obj.action === 'chatMsg') {
port.postMessage(obj); } }); self.onmessage = function(e) {
port = e.
ports[0]; } Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableMessageEvent.
ports' in that specification. Working Draft Initial definition. ...
MediaTrackSupportedConstraints.aspectRatio - Web APIs
The MediaTrackSup
portedConstraints dictionary's aspectRatio property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the aspectRatio constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax aspectConstraintSup
ported = sup
portedConstraintsDictionary.aspectRatio; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the aspectRatio constraint. ...
... You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax aspectConstraintSup
ported = sup
portedConstraintsDictionary.aspectRatio; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the aspectRatio constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
... the aspectRatio constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().aspectRatio) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'aspectRatio' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.channelCount - Web APIs
The MediaTrackSup
portedConstraints dictionary's channelCount property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the channelCount constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax channelCountConstraintSup
ported = sup
portedConstraintsDictionary.channelCount; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the channelCount constraint. ...
... access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax channelCountConstraintSup
ported = sup
portedConstraintsDictionary.channelCount; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the channelCount constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...the channelCount constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().channelCount) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'channelCount' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.deviceId - Web APIs
The MediaTrackSup
portedConstraints dictionary's deviceId property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the deviceId constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax deviceIdConstraintSup
ported = sup
portedConstraintsDictionary.deviceId; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the deviceId constraint. ...
...se. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax deviceIdConstraintSup
ported = sup
portedConstraintsDictionary.deviceId; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the deviceId constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...rts the deviceId constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().deviceId) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'deviceId' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.echoCancellation - Web APIs
The MediaTrackSup
portedConstraints dictionary's echoCancellation property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the echoCancellation constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax echoCancellationConstraintSup
ported = sup
portedConstraintsDictionary.echoCancellation; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the echoCancellation constraint. ...
...sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax echoCancellationConstraintSup
ported = sup
portedConstraintsDictionary.echoCancellation; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the echoCancellation constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...echoCancellation constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().echoCancellation) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'echoCancellation' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.facingMode - Web APIs
The MediaTrackSup
portedConstraints dictionary's facingMode property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the facingMode constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax facingModeConstraintSup
ported = sup
portedConstraintsDictionary.facingMode; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the facingMode constraint. ...
...ou can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax facingModeConstraintSup
ported = sup
portedConstraintsDictionary.facingMode; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the facingMode constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...f the user agent sup
ports the facingMode constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML <div id="result"> </div> CSS #result { font: 14px "Arial", sans-serif; } JavaScript let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().facingMode) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'facingMode' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.groupId - Web APIs
The MediaTrackSup
portedConstraints dictionary's groupId property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the groupId constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax groupIdConstraintSup
ported = sup
portedConstraintsDictionary.groupId; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the groupId constraint. ...
...false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax groupIdConstraintSup
ported = sup
portedConstraintsDictionary.groupId; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the groupId constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...orts the groupId constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().groupId) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'groupId' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.latency - Web APIs
The MediaTrackSup
portedConstraints dictionary's latency property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the latency constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax latencyConstraintSup
ported = sup
portedConstraintsDictionary.latency; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the latency constraint. ...
...false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax latencyConstraintSup
ported = sup
portedConstraintsDictionary.latency; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the latency constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...orts the latency constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().latency) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'latency' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.sampleRate - Web APIs
The MediaTrackSup
portedConstraints dictionary's sampleRate property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the sampleRate constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax sampleRateConstraintSup
ported = sup
portedConstraintsDictionary.sampleRate; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the sampleRate constraint. ...
...ou can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax sampleRateConstraintSup
ported = sup
portedConstraintsDictionary.sampleRate; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the sampleRate constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...s the sampleRate constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().sampleRate) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'sampleRate' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints.sampleSize - Web APIs
The MediaTrackSup
portedConstraints dictionary's sampleSize property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSup
portedConstraints() if and only if the user agent sup
ports the sampleSize constraint. If the constraint isn't sup
ported, it's not included in the list, so this value will never be false. You can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax sampleSizeConstraintSup
ported = sup
portedConstraintsDictionary.sampleSize; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the sampleSize constraint. ...
...ou can access the sup
ported constraints dictionary by calling navigator.mediaDevices.getSup
portedConstraints(). Syntax sampleSizeConstraintSup
ported = sup
portedConstraintsDictionary.sampleSize; Value This property is present in the dictionary (and its value is always true) if the user agent sup
ports the sampleSize constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. ...
...s the sampleSize constraint. If the property isn't present, this property is missing from the sup
ported constraints dictionary, and you'll get undefined if you try to look at its value. Example HTML content <div id="result"> </div> CSS content #result { font: 14px "Arial", sans-serif; } JavaScript content let result = document.getElementById("result"); if (navigator.mediaDevices.getSup
portedConstraints().sampleSize) { result.innerHTML = "Sup
ported!"; } else { result.innerHTML = "Not sup
ported!"; } Result Specifications Specification Status Comment Media Capture and StreamsThe definition of 'sampleSize' in that specification. Candidate Recommendation Initial specification. ...
MessageChannel.port2 - Web APIs
The
port2 read-only property of the MessageChannel interface returns the second
port of the message channel -- the
port attached to the context at the other end of the channel, which the message is initially sent to. Note: This feature is available in Web Workers. Syntax channel.
port2; Value A Message
Port object representing the second
port of the channel, the
port attached to the context at the other end of the channel. Example In the following code block, you can see a new channel being created using the MessageChannel.MessageChannel constructor. When the IFrame has loaded, we pass
port2 to the IFrame using Message
Port.postMessage along with a message. The handleMessage handler then responds to a message being sent back from the IFrame (using Message
Port.onmessage), putting it into a...
... Example In the following code block, you can see a new channel being created using the MessageChannel.MessageChannel constructor. When the IFrame has loaded, we pass
port2 to the IFrame using Message
Port.postMessage along with a message. The handleMessage handler then responds to a message being sent back from the IFrame (using Message
Port.onmessage), putting it into a paragraph. MessageChannel.
port1 is listened to, to check when the message arrives. ...
...it into a paragraph. MessageChannel.
port1 is listened to, to check when the message arrives. var channel = new MessageChannel(); var para = document.querySelector('p'); var ifr = document.querySelector('iframe'); var otherWindow = ifr.contentWindow; ifr.addEventListener("load", iframeLoaded, false); function iframeLoaded() { otherWindow.postMessage('Hello from the main page!', '*', [channel.
port2]); } channel.
port1.onmessage = handleMessage; function handleMessage(e) { para.innerHTML = e.data; } For a full working example, see our channel messaging basic demo on Github (run it live too). Specifications Specification Status Comment HTML Living StandardThe definition of '
port2' in that specification. Living Standard ...
MessagePort.onmessage - Web APIs
The handleMessage handler then responds to a message being sent back from the IFrame using onmessage, putting it into a paragraph -- MessageChannel.
port1 is listened to, to check when the message arrives. ...
...er, called whenever an MessageEvent of type message is fired on the
port -- that is, when the
port receives a message. Note: This feature is available in Web Workers. Syntax channel.onmessage = function() { ... }; Example In the following code block, you can see a new channel being created using the MessageChannel.MessageChannel constructor. When the IFrame has loaded, we pass MessageChannel.
port2 to the IFrame using Message
Port.postMessage along with a message. The handleMessage handler then responds to a message being sent back from the IFrame using onmessage, putting it into a paragraph -- MessageChannel.
port1 is listened to, to check when the message arrives. var channel = new MessageChannel(); var para = document.querySelector('p'); var ifr = document.querySelector('iframe'); var o...
... into a paragraph -- MessageChannel.
port1 is listened to, to check when the message arrives. var channel = new MessageChannel(); var para = document.querySelector('p'); var ifr = document.querySelector('iframe'); var otherWindow = ifr.contentWindow; ifr.addEventListener("load", iframeLoaded, false); function iframeLoaded() { otherWindow.postMessage('Hello from the main page!', '*', [channel.
port2]); } channel.
port1.onmessage = handleMessage; function handleMessage(e) { para.innerHTML = e.data; } For a full working example, see our channel messaging basic demo on Github (run it live too). Specifications Specification Status Comment HTML Living StandardThe definition of 'onmessage' in that specification. Living Standard ...
MessagePort.postMessage() - Web APIs
Note: This feature is available in Web Workers. Syntax
port.postMessage(message, transferList); Returns Void. Parameters message The message you want to send through the channel. This can be of any basic data type. Multiple data items can be sent as an array. transferList Optional Transferable objects to be transferred -- these objects have their ownership transferred to the receiving browsing context, so are no longer usable by the sending browsing context. ...
... an array. transferList Optional Transferable objects to be transferred -- these objects have their ownership transferred to the receiving browsing context, so are no longer usable by the sending browsing context. Example In the following code block, you can see a new channel being created using the MessageChannel.MessageChannel constructor. When the IFrame has loaded, we pass MessageChannel.
port2 to the IFrame using window.postMessage along with a message. The handleMessage handler then responds to a message being sent back from the IFrame using onmessage, putting it into a paragraph -- MessageChannel.
port1 is listened to, to check when the message arrives. var channel = new MessageChannel(); var para = document.querySelector('p'); var ifr = document.querySelector('iframe'); var otherW...
... into a paragraph -- MessageChannel.
port1 is listened to, to check when the message arrives. var channel = new MessageChannel(); var para = document.querySelector('p'); var ifr = document.querySelector('iframe'); var otherWindow = ifr.contentWindow; ifr.addEventListener("load", iframeLoaded, false); function iframeLoaded() { otherWindow.postMessage('Hello from the main page!', '*', [channel.
port2]); } channel.
port1.onmessage = handleMessage; function handleMessage(e) { para.innerHTML = e.data; } For a full working example, see our channel messaging basic demo on Github (run it live too). Specifications Specification Status Comment HTML Living StandardThe definition of 'postMessage()' in that specification. Living Standard ...
Node.isSupported() - Web APIs
The Node.isSup
ported()returns a Boolean flag containing the result of a test whether the DOM implementation implements a specific feature and this feature is sup
ported by the specific node. Syntax boolValue = element.isSup
ported(feature, version) Parameters feature Is a DOMString containing the name of the feature to test. This is the same name which can be passed to the method hasFeature on DOMImplementation. Possible values defined within the core DOM specification are listed on the DOM Level 2 Conformance Section. version Is a DOMString containing the version number of the feature to test. In DOM Level 2, version 1, this is the string 2.0. If the version is not specified, sup
porting any version of the feature will cause the method to return true. Example <div id="doc"> </div>...
...re DOM specification are listed on the DOM Level 2 Conformance Section. version Is a DOMString containing the version number of the feature to test. In DOM Level 2, version 1, this is the string 2.0. If the version is not specified, sup
porting any version of the feature will cause the method to return true. Example <div id="doc"> </div> <script> // Get an element and check to see if its sup
ports the DOM2 HTML Module. var main = document.getElementById('doc'); var output = main.isSup
ported('HTML', '2.0'); </script> Specifications Specification Status Comment Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.isSup
ported()' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Core Specification...
...rted('HTML', '2.0'); </script> Specifications Specification Status Comment Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.isSup
ported()' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Core Specification. Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Node.isSup
ported()' in that specification. Obsolete Initial definition. ...
RTCConfiguration.iceTransportPolicy - Web APIs
The WebRTC Device API dictionary RTCConfiguration's iceTrans
portPolicy property is a string indicating the trans
port selection policy the ICE agent should use during negotiation of connections. Its value must come from the RTCIceTrans
portPolicy enumerated type. If this property isn't included in the RTCConfiguration, the default value, all, is used. Syntax let rtcConfiguration = { iceTrans
portPolicy: policy }; rtcConfiguration.iceTrans
portPolicy = policy; let policy = rtcConfiguration.iceTrans
portPolicy; Value A DOMString which indicates what ICE candidate policy the ICE agent should use during the negotiation process, per the JSEP standard. The permitted values are: all The ICE agent is permitted to use any kind of candidate, including both local and relay candidates. The agent-...
...didates for reasons including privacy and security, as well as to simply limit the number of candidates. This is the default. relay The ICE agent only considers media relay candidates when evaluating candidates. This includes, for example, those candidates relayed by a STUN or TURN server. This can be used to prevent the remote endpoint from receiving the user's IP addresses, which may be im
portant in some security situations. For example, in a video calling application, the app may want to prevent unknown callers from learning the callee's IP addresses until the callee has agreed to receive the call. Examples In this example, a new connection is configured to only accept relay candidates. let config = { iceServers: [ { urls: [ "stun:stun.example.com" ] }, ], ic...
... some security situations. For example, in a video calling application, the app may want to prevent unknown callers from learning the callee's IP addresses until the callee has agreed to receive the call. Examples In this example, a new connection is configured to only accept relay candidates. let config = { iceServers: [ { urls: [ "stun:stun.example.com" ] }, ], iceTrans
portPolicy: "relay" }; let pc = new RTCPeerConnection(config); Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCCandidate.iceTrans
portPolicy' in that specification. Candidate Recommendation Initial definition. ...
RTCIceTransport.getLocalCandidates() - Web APIs
The RTCIceTrans
port method getLocalCandidates() returns an array of RTCIceCandidate objects, one for each of the candidates that have been gathered by the local device during the current ICE agent session. The local candidates are placed in this list by the ICE agent prior to being delivered to the local client's code in an icecandidate event so that the client can forward the candidates to the remote peer. Syntax localCandidates = RTCIceTrans
port.getLocalCandidates(); Parameters None. Return value A JavaScript Array containing one RTCIceCandidate object for each candidate that has been identified so far during the ICE candidate gathering session. You can't correlate these local candidates with matching remote candidates. ...
...o the remote peer. Syntax localCandidates = RTCIceTrans
port.getLocalCandidates(); Parameters None. Return value A JavaScript Array containing one RTCIceCandidate object for each candidate that has been identified so far during the ICE candidate gathering session. You can't correlate these local candidates with matching remote candidates. To find the best match found so far, call RTCIceTrans
port.getSelectedCandidatePair(). Example This simple example gets the local candidate list from the RTCIceTrans
port for the first RTCRtpSender on the RTCPeerConnection, then outputs to the console all of the candidates in the list. ...
...correlate these local candidates with matching remote candidates. To find the best match found so far, call RTCIceTrans
port.getSelectedCandidatePair(). Example This simple example gets the local candidate list from the RTCIceTrans
port for the first RTCRtpSender on the RTCPeerConnection, then outputs to the console all of the candidates in the list. var localCandidates = pc.getSenders()[0].trans
port.trans
port.getLocalCandidates(); localCandidates.forEach(function(candidate, index)) { console.log("Candidate " + index + ": " + candidate.candidate); }); Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate.getLocalCandidates()' in that specification. Candidate Recommendation Initial...
RTCIceTransport.onstatechange - Web APIs
The onstatechange event handler for the RTCIceTrans
port interface is a property which specifies a function to serve as the EventHandler for the statechange event that is fired whenever the trans
port's state changes. Syntax RTCIceTrans
port.onstatechange = stateChangeHandler; Value Set this property to reference a function you provide that is called by the WebRTC layer when the RTCIceTrans
port object's state changes. The event handler receives as its sole input an Event object describing the statechange event which occurred. To determine the new state, examine the value of state. ...
...is property to reference a function you provide that is called by the WebRTC layer when the RTCIceTrans
port object's state changes. The event handler receives as its sole input an Event object describing the statechange event which occurred. To determine the new state, examine the value of state. Example This snippet establishes a handler for the statechange event that looks to see if the trans
port has entered the "failed" state, which indicates that the connection has failed with no chance of being automatically restored. ...
...ndler receives as its sole input an Event object describing the statechange event which occurred. To determine the new state, examine the value of state. Example This snippet establishes a handler for the statechange event that looks to see if the trans
port has entered the "failed" state, which indicates that the connection has failed with no chance of being automatically restored. var iceTrans
port = pc.getSenders()[0].trans
port.iceTrans
port; iceTrans
port.onstatechange = function(event) { if (iceTrans
port.state == "failed") { handleFailure(pc); } } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceTrans
port.onstatechange' in that specification. Candidate Recommendation Initia...
ReportingObserver() - Web APIs
The Re
portingObserver() constructor of the Re
porting API creates a new Re
portingObserver object instance, which can be used to collect and access re
ports. Syntax new Re
portingObserver(callback[, options]); Parameters callback A callback function that runs when the observer starts to collect re
ports (i.e. via Re
portingObserver.observe()). The callback function is given two parameters: re
ports: A sequence of Re
port objects representing the re
ports collected in the observer's re
port queue. This is probably the most common way to retrieve the re
ports. observer: A reference to the same Re
portingObserver object, allowing for recursive re
port collection, etc. options Optional An Re
portingObserverOptions object allowing you to set the options for creating the object. The...
...he observer's re
port queue. This is probably the most common way to retrieve the re
ports. observer: A reference to the same Re
portingObserver object, allowing for recursive re
port collection, etc. options Optional An Re
portingObserverOptions object allowing you to set the options for creating the object. The available options are: types: An array of strings representing the types of re
port to be collected by this observer. Available types include deprecation, intervention, and crash (although this last type usually isn't retrievable via a Re
portingObserver). buffered: a boolean that defines whether the re
ports that were generated before the observer was able to be created should be observable (true) or not (false). Examples let options = { types: ['deprecation'], buffe...
... Available types include deprecation, intervention, and crash (although this last type usually isn't retrievable via a Re
portingObserver). buffered: a boolean that defines whether the re
ports that were generated before the observer was able to be created should be observable (true) or not (false). Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { re
portBtn.onclick = () => displayRe
ports(re
ports); }, options); Specifications Specification Status Comment Re
porting APIThe definition of 'Re
portingObserver()' in that specification. Editor's Draft ...
ServiceWorkerMessageEvent.ports - Web APIs
Examples When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... ...
... Im
portant: In modern browsers, this property has been deprecated. Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features. The
ports read-only property of the ServiceWorkerMessageEvent interface returns an array of Message
Port objects connected with the message channel the message is being sent through. Syntax var my
Ports = ServiceWorkerMessageEventInstance.
ports; Value An array of Message
Port objects. Examples When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... // set up a message channel to c...
...s When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... // set up a message channel to communicate with the SW var channel = new MessageChannel(); channel.
port1.onmessage = function(e) { console.log(e.
ports); handleChannelMessage(e.data); } mySW = reg.active; mySW.postMessage('hello', [channel.
port2]); }); ...
415 Unsupported Media Type - HTTP
The HTTP 415 Unsup
ported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsup
ported format. The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly. ...
... The HTTP 415 Unsup
ported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsup
ported format. The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly. ...
...or response code indicates that the server refuses to accept the request because the payload format is in an unsup
ported format. The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly. ...
505 HTTP Version Not Supported - HTTP
The HyperText Transfer Protocol (HTTP) 505 HTTP Version Not Sup
ported response status code indicates that the HTTP version used in the request is not sup
ported by the server. ...
... The HyperText Transfer Protocol (HTTP) 505 HTTP Version Not Sup
ported response status code indicates that the HTTP version used in the request is not sup
ported by the server. ...
... The HyperText Transfer Protocol (HTTP) 505 HTTP Version Not Sup
ported response status code indicates that the HTTP version used in the request is not sup
ported by the server. ...
Handling media support issues in web content - Web media technologies
with a variety of capabilities. The availability of choices is good for the user, in that they can choose the format that suits their needs best. There is a drawback, however: because there are so many to choose from, with so many different kinds of licenses and design principles involved, each web browser developer is left to its own devices when deciding which media file types and codecs to sup
port. This places a small, but reasonably easily overcome, burden on the web developer: to properly handle the situation when the user's browser can't handle a particular type of media. This guide covers techniques you can use to develop web content that meets your media needs while providing the most broadly compatible experience possible. Topics we will examine fallbacks, baseline media formats, an...
... very large and may take time to download (especially for slower devices or connections), you can offer a lower-resolution or alternate version that will be displayed until the full-quality version is available to be displayed. We'll look at both of these scenarios and how to implement them. Poster frames for video Progressive images Images--whether embedded using <img> or <picture>--don't sup
port a concept similar to poster frames. However, there are ways to present an image in low quality while it's still loading. This requires creating your images using progressive formats, such as progressive JPEG or interlaced PNG. Once your image has been converted to progressive form, you can simply use it as usual. <img src="/images/stafff-photo-huge-progressive.jpg" alt="Staff Photo, taken ...
... it loads--or after it's finished loading--to present it in full quality. Note: Progressive (or interlaced) images are inherently slightly larger than the non-progressive versions of the same images. Whether the interlacing will benefit your users is up to you to determine. Specifying multiple sources Checking compatibility in JavaScript HTMLMediaElement.canPlayType and MediaSource.isTypeSup
ported... Detecting playback errors Adapting presentation with CSS Memory management ...
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
You can find some basic examples of SVG syntax and usage in the W3C SVG test suite. Note: As of Gecko 2.0, Gecko sup
ports SVG animation using SMIL. See SVG animation with SMIL for a brief overview. Full documentation for SVG is forthcoming. Someday. There is also a description of the Mozilla sup
port of the changes in SVG 2. Element implementation status A quick overview of the SVG 1.1 elements and the current status of the native sup
port. Element Notes Structure Module svg Implemented. currentScale and currentTranslate DOM attributes are implemented, but there is no pan and zoom user interface. ...
... defs Implemented. desc Implemented. ...
... feConvolveMatrix Implemented. feDiffuseLighting Implemented. feDisplacementMap Implemented. feFlood Implemented. feGaussianBlur Implemented. feImage Implemented. Document fragments (bug 455986) aren't sup
ported in <svg:feImage>. feMerge Implemented. feMergeNode Implemented. feMorphology Implemented. feOffset Implemented. feSpecularLighting Implemented. feTile Implemented. feTurbulence ...
RTP (Real-time Transport Protocol) and SRTP (Secure RTP) - MDN Web Docs Glossary: Definitions of Web-related terms
The Real-time Trans
port Protocol (RTP) is a network protocol which described how to transmit various media (audio, video) from one endpoint to another in a real-time fashion. RTP is suitable for video-streaming application, telephony over IP like Skype and conference technologies. The secure version of RTP, SRTP, is used by WebRTC, and uses encryption and authentication to minimize the risk of denial-of-service attacks and security breaches. RTP is rarely used alone; instead, it is used in conjunction with other protocols like RTSP and SDP. ...
...tion, telephony over IP like Skype and conference technologies. ...
Transport Layer Security (TLS) - MDN Web Docs Glossary: Definitions of Web-related terms
Trans
port Layer Security (TLS), formerly known as Secure Sockets Layer (SSL), is a protocol used by applications to communicate securely across a network, preventing tampering with and eavesdropping on email, web browsing, messaging, and other protocols. Both SSL and TLS are client / server protocols that ensure communication privacy by using cryptographic protocols to provide security over a network. When a server and client communicate using TLS, it ensures that no third party can eavesdrop or tamper with any message. All modern browsers sup
port the TLS protocol, requiring the server to provide a valid digital certificate confirming its identity in order to establish a secure connection. It is possible for both the client and server to mutually authenticate each other, if both parti...
... party can eavesdrop or tamper with any message. All modern browsers sup
port the TLS protocol, requiring the server to provide a valid digital certificate confirming its identity in order to establish a secure connection. It is possible for both the client and server to mutually authenticate each other, if both parties provide their own individual digital certificates. Note: TLS 1.0 and 1.1 sup
port will be removed from all major browsers in early 2020; you'll need to make sure your web server sup
ports TLS 1.2 or 1.3 going forward. From version 74 onwards, Firefox will return a Secure Connection Failed error when connecting to servers using the older TLS versions (bug 1606734). ...
Installing headers using EXPORTS
Public headers and IDL files are copied during the ex
port phase of the build. This is accomplished by setting make variables telling the build system which module the headers are for (since headers are organized by module under <tt>dist/include</tt>), and which headers need to be created from IDL files by xpidl. For all <tt>Makefile.in</tt>s which ex
port public headers, you should set MODULE to the module name where the files should be copied to in <tt>dist/include</tt>. For normal headers that are to be ex
ported, you should set EX
PORTS to the list of headers to be ex
ported. They will be copied to <tt>dist/include/$(MODULE)</tt>. For XPIDL-generated headers, you should set XPIDLSRCS to the list of IDL files to ex
port. These IDL files will be copied to <tt>dist/idl</tt>, and the ge...
...DL files will be copied to <tt>dist/idl</tt>, and the generated headers will be copied to <tt>dist/include/$(MODULE)</tt>. For XPIDL-generated headers, you may also set XPIDL_MODULE to determine which typelib file is produced from the IDL files. The distinction between XPIDL_MODULE and MODULE is that each directory with IDL files must have a unique typelib file, but several directories may ex
port headers to the same location. Here is an example <tt>Makefile.in</tt> which has both C++ and IDL headers: MODULE = content XPIDL_MODULE = content_base EX
PORTS = \ nsIContent.h \ nsIDocument.h \ nsIStyleSheet.h \ $(NULL) XPIDLSRCS = \ nsIContentPolicy.idl \ nsISelectionController.idl \ $(NULL) include $(topsrcdir)/config/rules.mk ...
Reporting a Performance Problem
Enabling the Profiler toolbar button These steps only work in Firefox 75+. Visit https://profiler.firefox.com/ Click on "Enable Profiler Menu Button" The profiler toolbar button will show up in the top right of the URL bar as a small stopwatch icon You can right-click on the button and remove it from the toolbar when you're done with it. Using the Profiler When enabled, the profiler toolbar button is not recording by default. Recording can be done by clicking on the toolbar icon to open its panel. ...
...oing whatever it is that slows down Firefox while recording the profile. For example you might have one addon that slows down page load and another one that slows down tab switch. Your first reflex once you find what addon is slowing down the profile might be to disable it and search for alternatives. Before you do this, please share the performance profile with the addon authors through a bug re
port. Gecko profiler allows you to share a link with the profile. ...
nsIEditorIMESupport
editor/idl/nsIEditorIMESup
port.idlScriptable Please add a summary to this article. ...
... editor/idl/nsIEditorIMESup
port.idlScriptable Please add a summary to this article. ...
nsIEditorMailSupport
editor/idl/nsIEditorMailSup
port.idlScriptable Provides simple editing actions for the Thunderbird mail editor. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview nsISup
portsArray getEmbeddedObjects(); nsIDOMNode insertAsCitedQuotation(in AString aQuotedText, in AString aCitation, in boolean aInsertHTML); nsIDOMNode insertAsQuotation(in AString aQuotedText); void insertTextWithQuotations(in DOMString aStringToInsert); void pasteAsCitedQuotation(in AString aCitation, in long aSelectionType); void pasteAsQuotation(in long aSelectionType); void rewrap(in boolean aRespectNewlines); void stripCites(); Methods getEmbeddedObjects() Get a list of IMG and OBJECT tags in the current document. nsISup
portsArray getEmbeddedObjects(); Parameters None. Re...
...otations(in DOMString aStringToInsert); void pasteAsCitedQuotation(in AString aCitation, in long aSelectionType); void pasteAsQuotation(in long aSelectionType); void rewrap(in boolean aRespectNewlines); void stripCites(); Methods getEmbeddedObjects() Get a list of IMG and OBJECT tags in the current document. nsISup
portsArray getEmbeddedObjects(); Parameters None. Return value An nsISup
portsArray containing the IMG and OBJECT tags of the current document. insertAsCitedQuotation() Insert a string as quoted text (whose representation is dependent on the editor type), replacing the selected text (if any), including, if possible, a "cite" attribute. nsIDOMNode insertAsCitedQuotation( in AString aQuotedText, in AString aCitation, in boolean aInsertHTML ); Parameters aQuotedText T...
nsISupports
Last changed in Gecko 1.0 Method overview nsrefcnt AddRef();Violates the XPCOM interface guidelines void QueryInterface(in nsIIDRef uuid, [iid_is(uuid),retval] out nsQIResult result); nsrefcnt Release();Violates the XPCOM interface guidelines Methods Violates the XPCOM interface guidelines AddRef() Notifies the object that an interface pointer has been duplicated. nsrefcnt AddRef(); Parameters None. Return value An integer value that is generally ignored. QueryInterface() The QueryInterface method provides runtime type discovery. ...
...eters None. Return value An integer value that is generally ignored. Remarks The method descriptions above were taken from Essential COM by Don Box. The point of those descriptions is to highlight the fact that AddRef() and Release() do not necessarily correspond to incrementing and decrementing a counter, respectively, even though that is how they are usually implemented. On Win32 systems, nsISup
ports is ABI-compatible with Microsoft COM's IUnknown interface. ...
nsISupportsPriority
An implementation of this interface is free to define the side-effects of changing the priority of an object. In some cases, changing the priority of an object may be disallowed (resulting in an exception being thrown) or may simply be ignored. ...
...An implementation of this interface is free to define the side-effects of changing the priority of an object. In some cases, changing the priority of an object may be disallowed (resulting in an exception being thrown) or may simply be ignored. ...
nsISupportsVoid
Native code only! Methods toString() string toString(); Parameters None. Return value A string valued representation of the object. ...
...Native code only! Methods toString() string toString(); Parameters None. Return value A string valued representation of the object. ...
nsISupportsWeakReference
xpcom/base/nsIWeakReference.idlScriptable This interface is a factory interface, which produces appropriate instances of nsIWeakReference. Weak references in this scheme can only be produced for objects that implement this interface. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview nsIWeakReference GetWeakReference(); Methods GetWeakReference() Produces an appropriate instance of nsIWeakReference. nsIWeakReference GetWeakReference(); Parameters None. Return value The resulting nsIWeakReference instance. Remarks The XPCOM glue library provides nsSup
portsWeakReference, a canonical implementation of nsISup
portsWeakReference. This interface was frozen for Gecko 0.9.9. See bug 48726 for details. From Gecko 2.0 interfaces are no longer...
...erence. nsIWeakReference GetWeakReference(); Parameters None. Return value The resulting nsIWeakReference instance. Remarks The XPCOM glue library provides nsSup
portsWeakReference, a canonical implementation of nsISup
portsWeakReference. ...
nsITransportSecurityInfo
netwerk/socket/nsITrans
portSecurityInfo.idlScriptable This interface provides information about trans
port security, including the security state and any error message for the connection. Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Attributes Attribute Type Description errorMessage wstring Error message on connection failure. Read only. securityState unsigned long A flag detailing the security state of the connection. The possible values are defined in nsIWebProgressListener. Read only. shortSecurityDescription wstring For secure connections (SSL) gives the common name (CN) of the certifying authority. Read only. ...
...pe Description errorMessage wstring Error message on connection failure. Read only. securityState unsigned long A flag detailing the security state of the connection. The possible values are defined in nsIWebProgressListener. Read only. shortSecurityDescription wstring For secure connections (SSL) gives the common name (CN) of the certifying authority. Read only. See also nsISocketTrans
port ...
nsIWorkerMessagePort
void postMessage( in DOMString aMessage ); Parameters aMessage The message to post. ...
... void postMessage( in DOMString aMessage ); Parameters aMessage The message to post. ...
Document.queryCommandSupported() - Web APIs
The Document.queryCommandSup
ported() method re
ports whether or not the specified editor command is sup
ported by the browser. Syntax isSup
ported = document.queryCommandSup
ported(command); Parameters command The command for which to determine sup
port. Return value Returns a Boolean which is true if the command is sup
ported and false if the command isn't. ...
...and); Parameters command The command for which to determine sup
port. Return value Returns a Boolean which is true if the command is sup
ported and false if the command isn't. ...
EcKeyImportParams - Web APIs
The EcKeyIm
portParams dictionary of the Web Crypto API represents the object that should be passed as the algorithm parameter into SubtleCrypto.im
portKey() or SubtleCrypto.unwrapKey(), when generating any elliptic-curve-based key pair: that is, when the algorithm is identified as either of ECDSA or ECDH. Properties name A DOMString. This should be set to ECDSA or ECDH, depending on the algorithm you want to use. namedCurve A DOMString representing the name of the elliptic curve to use. This may be any of the following names for NIST-approved curves: P-256 P-384 P-521 Examples See the examples for SubtleCrypto.im
portKey(). ...
...ng on the algorithm you want to use. namedCurve A DOMString representing the name of the elliptic curve to use. This may be any of the following names for NIST-approved curves: P-256 P-384 P-521 Examples See the examples for SubtleCrypto.im
portKey(). Specifications Specification Status Comment Web Cryptography APIThe definition of 'SubtleCrypto.EcKeyIm
portParams' in that specification. Recommendation ...
File and Directory Entries API support in Firefox - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The original File System API was created to let browsers implement sup
port for accessing a sandboxed virtual file system on the user's storage device. Work to standardize the specification was abandoned back in 2012, but by that point, Google Chrome included its own implementation of the API. Over time, a number of popular sites and Web applications came to use it, often without providing any means of falling back to standard APIs or even checking to be sure the API is available before using it. Mozil...
... or FileSystemDirectoryEntry for files dropped on a drop zone. You can't use the LocalFileSystem.requestFileSystem() method to get access to a specified local file system. The LocalFileSystem.resolveLocalFileSystemURL() method isn't implemented. Only the asynchronous versions of the interfaces are implemented. Any interfaces with names that end in "Sync" aren't available. Firefox only sup
ports reading from files in the file system. You can't write to them. In particular, the FileSystemFileEntry.createWriter() method, used to create a FileWriter to handle writing to a file, is not implemented and will just treturn an error. Firefox doesn't sup
port the "filesystem:" URL scheme. ...
HmacImportParams - Web APIs
Properties name A DOMString. This should be set to HMAC. hash A DOMString representing the name of the digest function to use. The can take a value of SHA-256, SHA-384, or SHA-512. Warning: Although you can technically pass SHA-1 here, this is strongly discouraged as it is considered vulnerable. length Optional A Number representing the length in bits of the key. If this is omitted the length of the key is equal to the length of the digest generated by the digest function you have chosen. ...
...gly discouraged as it is considered vulnerable. length Optional A Number representing the length in bits of the key. If this is omitted the length of the key is equal to the length of the digest generated by the digest function you have chosen. Unless you have a good reason to use a different length, omit this property and use the default. Examples See the examples for SubtleCrypto.im
portKey(). Specifications Specification Status Comment Web Cryptography APIThe definition of 'SubtleCrypto.HmacIm
portParams' in that specification. Recommendation ...
MessageEvent.ports - Web APIs
The
ports read-only property of the MessageEvent interface is an array of Message
Port objects representing the
ports associated with the channel the message is being sent through (where appropriate, e.g. in channel messaging or when sending a message to a shared worker). Syntax var my
Ports = messageEvent.
ports; Value An array of Message
Port objects. Example onconnect = function(e) { var
port = e.
ports[0];
port.addEventListener('message', function(e) { var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
port.postMessage(workerResult); });
port.start(); // Required when using addEventListener. Otherwise called implicitly by onmessage setter. ...
...) { var
port = e.
ports[0];
port.addEventListener('message', function(e) { var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
port.postMessage(workerResult); });
port.start(); // Required when using addEventListener. Otherwise called implicitly by onmessage setter. } Specifications Specification Status Comment HTML Living StandardThe definition of '
ports' in that specification. Living Standard Initial definition ...
MessagePort.close() - Web APIs
This stops the flow of messages to that
port. Note: This feature is available in Web Workers. Syntax
port.close() Returns Void. Parameters None. Example In the following code block, you can see a handleMessage handler function, run when a message is sent back to this document using EventTarget.addEventListener. ...
...ssage
Port interface disconnects the
port, so it is no longer active. This stops the flow of messages to that
port. Note: This feature is available in Web Workers. Syntax
port.close() Returns Void. Parameters None. Example In the following code block, you can see a handleMessage handler function, run when a message is sent back to this document using EventTarget.addEventListener. channel.
port1.addEventListener('message', handleMessage, false); function handleMessage(e) { para.innerHTML = e.data; textInput.value = ''; } channel.
port1.start(); You could stop messages being sent at any time using channel.
port1.close(); Specifications Specification Status Comment HTML Living StandardThe definition of 'close()' in that specification. Living Standard ...
MessagePort.onmessageerror - Web APIs
Note: This feature is available in Web Workers. Syntax
port.onmessageerror = function() { ... ...
... The onmessageerror event handler of the Message
Port interface is an EventListener, called whenever an MessageEvent of type messageerror is fired on the
port--that is, when it receives a message that cannot be deserialized. Note: This feature is available in Web Workers. Syntax
port.onmessageerror = function() { ... }; Specifications Specification Status Comment HTML Living StandardThe definition of 'onmessageerror' in that specification. Living Standard ...
RTCIceTransport.gatheringState - Web APIs
The read-only RTCIceTrans
port property gatheringState returns a DOMString from the enumerated type RTCIceGathererState that indicates what gathering state the ICE agent is currently in: "new", "gathering", or "complete". Syntax gatherState = RTCIceTrans
port.gatheringState; Value A string from the RTCIceGathererState enumerated type whose value indicates the current state of the ICE agent's candidate gathering process: "new" The RTCIceTrans
port is newly created and has not yet started to gather ICE candidates. "gathering" The trans
port is in the process of gathering candidates. "complete" The trans
port has finished gathering ICE candidates and has sent the end-of-candidates indicator to the remote device. ...
...pe whose value indicates the current state of the ICE agent's candidate gathering process: "new" The RTCIceTrans
port is newly created and has not yet started to gather ICE candidates. "gathering" The trans
port is in the process of gathering candidates. "complete" The trans
port has finished gathering ICE candidates and has sent the end-of-candidates indicator to the remote device. The trans
port won't gather any further candidates unless an ICE restart occurs, at which point the gathering process starts over from scratch. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceTrans
port.gatheringState' in that specification. Candidate Recommendation Initial definition. ...
RTCIceTransport.getLocalParameters() - Web APIs
The RTCIceTrans
port method getLocalParameters() returns an RTCIceParameters object which provides information uniquely identifying the local peer for the duration of the ICE session. The local peer's parameters are obtained during ICE signaling and delivered to the trans
port when the client calls RTCPeerConnection.setLocalDescription(). Syntax parameters = RTCIceTrans
port.getLocalParameters(); Parameters None. Return value An RTCIceParameters object indicating the usernameFragment and password which uniquely identify the local peer for the duration of the ICE session. Returns null if the parameters have not yet been received. ...
...; Parameters None. Return value An RTCIceParameters object indicating the usernameFragment and password which uniquely identify the local peer for the duration of the ICE session. Returns null if the parameters have not yet been received. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceTrans
port.getLocalParameters' in that specification. Candidate Recommendation Initial specification. ...
RTCIceTransport.role - Web APIs
The read-only RTCIceTrans
port property role indicates which ICE role the trans
port is fulfilling: that of the controlling agent, or the agent that is being controlled. You can learn more about ICE roles in Choosing a candidate pair in WebRTC connectivity. Syntax iceRole = RTCIceTrans
port.role; Value A DOMString specifying whether the RTCIceTrans
port represents the controlling agent or the controlled agent. The value must be one of those found in the enumerated type RTCIceRole: "controlling" The RTCIceTrans
port object is serving as the controlling agent. "controlled" The trans
port is the controlled agent. ...
...rolling agent or the controlled agent. The value must be one of those found in the enumerated type RTCIceRole: "controlling" The RTCIceTrans
port object is serving as the controlling agent. "controlled" The trans
port is the controlled agent. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceTrans
port.role' in that specification. Candidate Recommendation Initial definition. ...
RTCRtpReceiver.transport - Web APIs
The read-only trans
port property of an RTCRtpReceiver object provides the RTCDtlsTrans
port object used to interact with the underlying trans
port over which the receiver is exchanging Real-time Trans
port Control Protocol (RTCP) packets. This trans
port is responsible for receiving the data for the media on the receiver's track. Syntax let trans
port = rtcRtpReceiver.trans
port; Value An RTCDtlsTrans
port object representing the underlying trans
port being used by the receiver to exchange packets with the remote peer, or null if the receiver isn't yet connected to a trans
port. Description When the RTCRtpReceiver is first created, the value of trans
port is null. This is replaced with an RTCDtlsTrans
port once the receiver's trans
port has been established. Note that when bundling is in effect--...
...t. Description When the RTCRtpReceiver is first created, the value of trans
port is null. This is replaced with an RTCDtlsTrans
port once the receiver's trans
port has been established. Note that when bundling is in effect--that is, when the RTCPeerConnection was created with an RTCConfiguration object whose bundlePolicy is max-compat or max-bundle--multiple receivers may be sharing the same trans
port; in this case, all of them are using the same connection to transmit and/or receive RTP and RTCP packets. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpReceiver.trans
port' in that specification. Candidate Recommendation ...
RTCRtpSender.transport - Web APIs
The read-only trans
port property of an RTCRtpSender object provides the RTCDtlsTrans
port object used to interact with the underlying trans
port over which the sender is exchanging Real-time Trans
port Control Protocol (RTCP) packets. This trans
port is responsible for receiving the data for the media on the sender's track. Syntax let trans
port = rtcRtpSender.trans
port; Value An RTCDtlsTrans
port object representing the underlying trans
port being used by the sender to exchange packets with the remote peer, or null if the sender isn't yet connected to a trans
port. Description When the RTCRtpSender is first created, the value of trans
port is null. This is replaced with an RTCDtlsTrans
port once the sender's trans
port has been established. Note that when bundling is in effect--that is, when th...
...ans
port. Description When the RTCRtpSender is first created, the value of trans
port is null. This is replaced with an RTCDtlsTrans
port once the sender's trans
port has been established. Note that when bundling is in effect--that is, when the RTCPeerConnection was created with an RTCConfiguration object whose bundlePolicy is max-compat or max-bundle--multiple senders may be sharing the same trans
port; in this case, all of them are using the same connection to transmit and/or receive RTP and RTCP packets. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpSender.trans
port' in that specification. Candidate Recommendation ...
Report.body - Web APIs
The body read-only property of the Re
port interface returns the body of the re
port, which is a Re
portBody object containing the detailed re
port information. Syntax let re
portBody = re
portInstance.body Returns A Re
portBody object containing the detailed re
port information. Depending on what type the Re
port is, the object returned will actually be a DeprecationRe
portBody, InterventionRe
portBody, CrashRe
portBody, or FeaturePolicyViolationRe
portBody. These all inherit from the base Re
portBody class -- study their reference pages for more information on what the particular re
port body types contain. ...
...the Re
port is, the object returned will actually be a DeprecationRe
portBody, InterventionRe
portBody, CrashRe
portBody, or FeaturePolicyViolationRe
portBody. These all inherit from the base Re
portBody class -- study their reference pages for more information on what the particular re
port body types contain. Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { let firstRe
port = re
ports[0]; // Log the first re
port's re
port body, i.e. a DeprecationRe
portBody object console.log(firstRe
port.body); }, options); Specifications Specification Status Comment Re
porting APIThe definition of 'Re
port.body' in that specification. Editor's Draft ...
ReportingObserver.disconnect() - Web APIs
The disconnect() method of the Re
portingObserver interface stops a re
porting observer that had previously started observing from collecting re
ports. After calling disconnect(), neither Re
portingObserver.takeRecords() nor the records parameter of the Re
portingObserver() callback will return any re
ports. The associated observer will no longer be active. Syntax re
portingObserverInstance.disconnect() Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { re
portBtn.onclick = () => displayRe
ports(re
ports); }, options); observer.observe() ... ...
...ll no longer be active. Syntax re
portingObserverInstance.disconnect() Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { re
portBtn.onclick = () => displayRe
ports(re
ports); }, options); observer.observe() ... observer.disconnect() Specifications Specification Status Comment Re
porting APIThe definition of 'Re
portingObserver.disconnect()' in that specification. Editor's Draft ...
ReportingObserverOptions - Web APIs
The Re
portingObserverOptions dictionary of the Re
porting API allows options to be set in the constructor when creating a Re
portingObserver. Properties types An array of strings representing the types of re
port to be collected by this observer. Available types include deprecation, intervention, and crash. buffered A boolean that defines whether the re
ports that were generated before the observer was able to be created should be observable (true) or not (false). ...
...ray of strings representing the types of re
port to be collected by this observer. Available types include deprecation, intervention, and crash. buffered A boolean that defines whether the re
ports that were generated before the observer was able to be created should be observable (true) or not (false). Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { re
portBtn.onclick = () => displayRe
ports(re
ports); }, options); Specifications Specification Status Comment Re
porting APIThe definition of 'Re
portingObserverOptions' in that specification. Editor's Draft ...
RsaHashedImportParams - Web APIs
The RsaHashedIm
portParams dictionary of the Web Crypto API represents the object that should be passed as the algorithm parameter into SubtleCrypto.im
portKey() or SubtleCrypto.unwrapKey(), when im
porting any RSA-based key pair: that is, when the algorithm is identified as any of RSASSA-PKCS1-v1_5, RSA-PSS, or RSA-OAEP. Properties name A DOMString. This should be set to RSASSA-PKCS1-v1_5, RSA-PSS, or RSA-OAEP, depending on the algorithm you want to use. hash A DOMString representing the name of the digest function to use. This can be one of SHA-256, SHA-384, or SHA-512. Warning: Although you can technically pass SHA-1 here, this is strongly discouraged as it is considered vulnerable. Examples See the examples for SubtleCrypto.im
portKey(). Specifications Specifica...
...ame of the digest function to use. This can be one of SHA-256, SHA-384, or SHA-512. Warning: Although you can technically pass SHA-1 here, this is strongly discouraged as it is considered vulnerable. Examples See the examples for SubtleCrypto.im
portKey(). Specifications Specification Status Comment Web Cryptography APIThe definition of 'SubtleCrypto.RsaHashedIm
portParams' in that specification. Recommendation ...
WEBGL_compressed_texture_astc.getSupportedProfiles() - Web APIs
Currently, this can be: "ldr": Low Dynamic Range. "hdr": High Dynamic Range. Dynamic range refers to ratio between the brightest and darkest parts of the scene. Low dynamic ranges are for example JPEG format images which won't exceed 255:1, or CRT monitors which won't exceed 100:1. An HDR image stores pixel values that span the whole tonal range of real-world scenes (100,000:1). ...
...amic Range. Dynamic range refers to ratio between the brightest and darkest parts of the scene. Low dynamic ranges are for example JPEG format images which won't exceed 255:1, or CRT monitors which won't exceed 100:1. An HDR image stores pixel values that span the whole tonal range of real-world scenes (100,000:1). Examples var ext = gl.getExtension('WEBGL_compressed_texture_astc'); ext.getSup
portedProfiles(); // ["ldr"] Specifications Specification Status Comment WEBGL_compressed_texture_astcThe definition of 'WEBGL_compressed_texture_astc' in that specification. Recommendation Initial definition. ...
WorkerGlobalScope.importScripts() - Web APIs
The im
portScripts() method of the WorkerGlobalScope interface synchronously im
ports one or more scripts into the worker's scope. Syntax self.im
portScripts('foo.js'); self.im
portScripts('foo.js', 'bar.js', ...); Parameters A comma-separated list of DOMString objects representing the scripts to be im
ported. These paths are relative to html document base URL. Return value None. Exceptions NetworkError Im
ported scripts were not served with a valid JavaScript MIME type (i.e. text/javascript). ...
...ed list of DOMString objects representing the scripts to be im
ported. These paths are relative to html document base URL. Return value None. Exceptions NetworkError Im
ported scripts were not served with a valid JavaScript MIME type (i.e. text/javascript). Example If you had some functionality written in a separate script called foo.js that you wanted to use inside worker.js, you could im
port it using the following line: im
portScripts('foo.js'); im
portScripts() and self.im
portScripts() are effectively equivalent -- both represent im
portScripts() being called from inside the worker's inner scope. Specifications Specification Status Comment HTML Living StandardThe definition of 'im
portScripts()' in that specification. Living Standard ...
XRViewport.y - Web APIs
The read-only XRView
port interface's y property indicates the offset from the bottom edge of the destination surface (typically a XRWebGLLayer to the bottom edge of the view
port within the surface into which WebXR content is to be rendered. The view
port's x property identifies the x component of the origin, and its is given by the width and height properties. Syntax y = xrView
port.y; Value The offset from the bottom edge of the rendering surface to the bottom edge of the view
port, in pixels. Note: Although other web APIs typically consider the y axis to begin at the top and grow larger progressing downward, WebGL reverses this, with y growing larger as it goes upward on the screen. Examples See the main XRView
port page for examples. Specifications Specification Status...
... edge of the view
port, in pixels. Note: Although other web APIs typically consider the y axis to begin at the top and grow larger progressing downward, WebGL reverses this, with y growing larger as it goes upward on the screen. Examples See the main XRView
port page for examples. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRView
port.y' in that specification. Working Draft Initial definition. ...
HTML Imports - Web Components
Obsolete since Google Chrome 73 This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Firefox will not ship HTML Im
ports in its current form. See this status update for more information. Until there is a consensus on the standard or alternative mechanisms are worked out, you can use a polyfill such as Google's webcomponents.js. HTML Im
ports is intended to be the packaging mechanism for web components, but you can also use HTML Im
ports by itself. ...
... Try to avoid using it. Firefox will not ship HTML Im
ports in its current form. See this status update for more information. Until there is a consensus on the standard or alternative mechanisms are worked out, you can use a polyfill such as Google's webcomponents.js. HTML Im
ports is intended to be the packaging mechanism for web components, but you can also use HTML Im
ports by itself. You im
port an HTML file by using a <link> tag in an HTML document like this: <link rel="im
port" href="myfile.html"> The im
port link type is new. Specification Specification Status Comment HTML Im
ports Working Draft Initial definition. ...
<xsl:import> - XSLT: Extensible Stylesheet Language Transformations
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The <xsl:im
port> element is a top-level element that serves to im
port the contents of one stylesheet into another stylesheet. Generally speaking, the contents of the im
ported stylesheet have a lower im
port precedence than that of the im
porting stylesheet. This is in contrast to <xsl:include> where the contents of the included stylesheet have exactly the same precedence as the contents of the including stylesheet. Syntax <xsl:im
port href=URI /> Required Attributes href Specifies the URI of the stylesheet to im
port. Optional Attributes None. Type Top-level, must appear before any other child of <xsl:stylesheet> or <xsl:transform> in the im
porting stylesheet. Defined XSLT, section 2.6...
...cluded stylesheet have exactly the same precedence as the contents of the including stylesheet. Syntax <xsl:im
port href=URI /> Required Attributes href Specifies the URI of the stylesheet to im
port. Optional Attributes None. Type Top-level, must appear before any other child of <xsl:stylesheet> or <xsl:transform> in the im
porting stylesheet. Defined XSLT, section 2.6.2. Gecko sup
port Mostly sup
ported with a few issues with top level variables and parameters as of Mozilla 1.0. ...
Using Crash Reporting in a XULRunner Application - Archive of obsolete content
XULRunner application authors who wish to use crash re
porting must run a crash re
porting server. Please see the Socorro project for more information. To enable crash re
porting on the client, set the following items in application.ini: [Crash Re
porter] Enabled=True ServerURL=https://your.server.url/submit Note: because crash re
ports can contain private data including passwords, in production environments they should only be sent via https. ...
reftest opportunities files - Archive of obsolete content
Introduction These are files in the Mozilla source that may be usable for reftest. It is not always clear why particular files were checked in, but one presumes that something needed to be checked. Many of these were checked with the Layout Regression test tool, which has been described as difficult to use and it apparently re
ported a lot of regressions that were not errors. If you can look at the HTML in one of these pages, and can see a way to get the same visual ouptut, then that is an obvious reftest op
portunity. For example, if some HTML is in an unexpected place and is supposed to be ignored, then we can match against an html file that is missing that extra mark-up. In other cases, the design of the reference page may take more subtlety. For now, create a bug in the Core product,...
-moz-scrollbar-thumb-proportional - Archive of obsolete content
Note: Since Firefox 58, this media feature is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). See bug 1396066 for more details. Syntax <integer> If the device's user interface displays the thumb of scrollbars pro
portionally (that is, sized based on the percentage of the document that is visible), this is 1. Otherwise it's 0. Media: media/visual Accepts min/max prefixes: no ...
ECMAScript 5 support in Mozilla - Archive of obsolete content
ECMAScript 5.1, an older version of the standard upon which JavaScript is based, was approved in June 2011. The JavaScript runtime used in the latest versions of Mozilla projects including both Firefox and Thunderbird has full sup
port for ECMAScript 5.1 features. This article covers the features sup
ported by different versions of Mozilla's JavaScript runtime. Sup
ported features Added in JavaScript 1.8.5 (Gecko 2, Firefox 4 and later) Firefox 4 has full ECMAScript 5 sup
port including the Object.* methods and strict mode. See New in JavaScript 1.8.5. Added in JavaScript 1.8.1 (Gecko 1.9.1, Firefox 3.5) Native JSON sup
port Object.getPrototypeOf() method. String.trim() method, which trims whitespace from both ends of the string. Gecko 1.9.1.4 updated the implementation of JSON.stringif...
Character sets supported by Gecko - Gecko Redirect 1
In Gecko-internal APIs, it is necessary to use particular (potentially) mixed-case names for the encodings. For encodings that have a compatibility name in the DOM Standard, except gbk, this is the compatibilty name. For other encodings, including gbk, this is the lower-case name from the Encoding Standard. ...
Port - MDN Web Docs Glossary: Definitions of Web-related terms
For a computer connected to a network with an IP address, a
port is a communication endpoint.
Ports are designated by numbers, and below 1024 each
port is associated by default with a specific protocol. For example, the default
port for the HTTP protocol is 80 and the default
port for the HTTPS protocol is 443, so a HTTP server waits for requests on those
ports. Each Internet protocol is associated with a default
port: SMTP (25), POP3 (110), IMAP (143), IRC (194), and so on. Learn more General knowledge
Port on Wikipedia ...
Script-supporting element - MDN Web Docs Glossary: Definitions of Web-related terms
In an HTML document, script-sup
porting elements are those elements that don't directly contribute to the appearance or layout of the page; instead, they're either scripts or contain information that's only used by scripts. These elements may be im
portant, but do not affect the displayed page unless the page's scripts explicitly cause them to do so. There are only two script-sup
porting elements: <script> and <template>. Technical reference To learn more, see Script-sup
porting elements in Kinds of HTML content. ...
Scrollport - MDN Web Docs Glossary: Definitions of Web-related terms
The scroll
port is the visual view
port of a scroll container in a document. A scroll container is created by applying overflow: scroll to a container, or overflow: auto when there is enough content to cause overflow. The scroll
port coincides with the padding box of that container and represents the content that can be seen as the box is scrolled. ...
nsISupportsPRUint16
Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. Remarks This interface was frozen for Gecko 1.2. See bug 166426 for details. From Gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRUint32
Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. Remarks This interface was frozen for Gecko 1.2. See bug 166426 for details. From Gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRUint64
Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. Remarks This interface was frozen for Gecko 1.2. See bug 166426 for details. From Gecko 2.0 interfaces are no longer frozen. ...
nsISupportsPRUint8
Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. Remarks This interface was frozen for Gecko 1.2. See bug 166426 for details. From Gecko 2.0 interfaces are no longer frozen. ...
nsISupportsString
Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. Remarks This interface was frozen for Gecko 1.2. See bug 166426 for details. From Gecko 2.0 interfaces are no longer frozen. ...
nsIWebappsSupport
void installApplication( in wstring title, in wstring uri, in wstring iconUri, in wstring iconData ); Parameters title The user-friendly name of the application. uri The uri of the web application. iconUri The uri of icon of the web application. ...
Measure a portion of the page - Firefox Developer Tools
Using the Measuring Tool you can measure a specific area of a web page. This tool is hidden by default. To enable its button: Go to the DevTools Settings. From the Available Toolbox Buttons check the Measure a
portion of the page checkbox. You will now see the Measure a
portion of the page button at the top right of the Toolbox, in the same place as the Settings/Options button. When you want to use the tool, click this button. Now when you mouse over the view
port, you'll see the mouse has a crosshair cursor with its current coordinates displayed beside it. When you hold the mouse button down and then drag, you'll start to draw a rectangle, with its x, y, and diagonal dimensions displayed. The units are in pixels. When you stop holding the mouse down, the rectangle that was displ...
HTMLFormElement.reportValidity() - Web APIs
The HTMLFormElement.re
portValidity() method returns true if the element's child controls satisfy their validation constraints. When false is returned, cancelable invalid events are fired for each invalid child and validation problems are re
ported to the user. Syntax HTMLFormElement.re
portValidity() Return value Boolean Example document.forms['myform'].addEventListener('submit', function() { document.forms['myform'].re
portValidity(); }, false); Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLFormElement.re
portValidity()' in that specification. Living Standard HTML 5.1The definition of 'HTMLFormElement.re
portValidity()' in that specification. Recommendation Initial definition ...
HTMLHyperlinkElementUtils.port - Web APIs
The HTMLHyperlinkElementUtils.
port property is a USVString containing the
port number of the URL. If the URL does not contain an explicit
port number, it will be set to ''. Syntax string = object.
port; object.
port = string; Examples // Let's an <a id="myAnchor" href="https://developer.mozilla.org:443/docs/HTMLHyperlinkElementUtils.
port"> element be in the document var anchor = document.getElementByID("myAnchor"); var result = anchor.
port; // Returns:'443' Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLHyperlinkElementUtils.
port' in that specification. Living Standard Initial definition. ...
RTCIceCandidatePairStats.transportId - Web APIs
The trans
portId property uniquely identifies the RTCIceTrans
port that was inspected to obtain the trans
port-related statistics contained in the RTCIceCandidatePairStats object. Syntax trans
portId = rtcIceCandidatePairStats.trans
portId; Value A DOMString which uniquely identifies the RTCIceTrans
port object from which the trans
port-related data was obtained for the statistics contained in this RTCIceCandidatePairStats object. The trans
port-related statistics come from the RTCTrans
portStats dictionary's properties. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCIceCandidatePairStats.trans
portId' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidateStats.mozLocalTransport - Web APIs
The non-standard Mozilla extension to the RTCIceCandidateStats dictionary, mozLocalTrans
port, has been supplanted by the standard relayProtocol property. Syntax Instead of using mozLocalTrans
port, you should use code like this: localTrans
port = rtcIceCandidateStats.relayProtocol; Specifications Not part of any specification. ...
RTCIceCandidateStats.port - Web APIs
The RTCIceCandidateStats dictionary's
port property specifies the network
port used by the candidate. Syntax candidate
Port = rtcIceCandidateStats.
port; Value An integer value indicating the network
port used by the RTCIceCandidate described by the RTCIceCandidateStats object. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCIceCandidateStats.
port' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidateStats.transportId - Web APIs
The RTCIceCandidateStats dictionary's trans
portId property is a string that uniquely identifies the trans
port that produced the RTCTrans
portStats from which information about this candidate was taken. Syntax trans
portID = rtcIceCandidateStats.trans
portId; Value A DOMString whose value uniquely identifies the trans
port from which any trans
port-related information accumulated in the RTCIceCandidateStats was taken. This can be used to compare candidates that would use the same trans
port, for example. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCIceCandidateStats.trans
portId' in that specification. Candidate Recommendation Initial specification. ...
RTCRemoteOutboundRtpStreamStats.reportsSent - Web APIs
The RTCRemoteOutboundRtpStreamStats dictionary's re
portsSent property provides the number of Sender Re
ports (SRs) the remote peer has transmitted to the local peer. Syntax let re
portCount = rtcRemoteOutboundRtpStreamStats.re
portsSent; Value An integer value which indicates the total number of RTCP Sender Re
ports so far sent by the remote peer to the local peer. Usage notes Sender re
ports, described in RFC 3550, section 6.4.1 with an overview in RFC 3550, section 6.4, are used by RTP to share data transmission quality feedback between the two peers. The data in these re
ports is used by WebRTC to fill out various fields within the statistics objects, and this property's value indicates how many times that information was shared. Examples <<<--- add an example --->>> ...
RTCRtpStreamStats.transportId - Web APIs
The RTCRtpStreamStats dictionary's trans
portId property is a string which uniquely identifies the object from which the statistics contained in the RTCTrans
portStats properties in the RTCStatsRe
port. Syntax var trans
portID = RTCRtpStreamStats.trans
portId; Value A DOMString uniquely identifying the source of the statistics contained the RTCTrans
portStats properties in the RTCStatsRe
port. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCRtpStreamStats.trans
portId' in that specification. Candidate Recommendation Initial definition. ...
RTCSctpTransport.state - Web APIs
The state read-only property of the RTCSctpTrans
port interface provides information which describes a Stream Control Transmission Protocol (SCTP) trans
port state. Syntax var myState = sctpTrans
port.state; Value A string whose value is taken from the RTCSctpTrans
portState enumerated type. Its value is one of the following: connecting The initial state when the connection is being estabilished. connected The connection is open for data transmission. closed The connection is closed and can no longer be used. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCSctpTrans
port.state' in that specification. Candidate Recommendation Initial definition. ...
Report.type - Web APIs
The type read-only property of the Re
port interface returns the type of re
port generated, e.g. deprecation or intervention. Syntax let re
portType = re
portInstance.type Returns A string representing the type of the re
port. Currently the available types are deprecation, intervention, and crash. Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { let firstRe
port = re
ports[0]; // Log the first re
port's re
port type, i.e. "deprecation" console.log(firstRe
port.type); }, options); Specifications Specification Status Comment Re
porting APIThe definition of 'Re
port.body' in that specification. Editor's Draft ...
Report.url - Web APIs
The url read-only property of the Re
port interface returns the URL of the document that generated the re
port. Syntax let re
portURL = re
portInstance.url Returns A string representing the URL of the document that generated the re
port. Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { let firstRe
port = re
ports[0]; // Log the URL of the document that generated the first re
port // e.g. "https://www.example.com/cats.html" console.log(firstRe
port.url); }, options); Specifications Specification Status Comment Re
porting APIThe definition of 'Re
port.url' in that specification. Editor's Draft ...
ReportingObserver.observe() - Web APIs
The observe() method of the Re
portingObserver interface instructs a re
porting observer to start collecting re
ports in its re
port queue. Syntax re
portingObserverInstance.observe() Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { re
portBtn.onclick = () => displayRe
ports(re
ports); }, options); observer.observe() Specifications Specification Status Comment Re
porting APIThe definition of 'Re
portingObserver.observe()' in that specification. Editor's Draft ...
ReportingObserver.takeRecords() - Web APIs
The takeRecords() method of the Re
portingObserver interface returns the current list of re
ports contained in the observer's re
port queue, and empties the queue. Syntax re
portingObserverInstance.takeRecords() Return value An array of Re
port objects. Examples let options = { types: ['deprecation'], buffered: true } let observer = new Re
portingObserver(function(re
ports, observer) { re
portBtn.onclick = () => displayRe
ports(re
ports); }, options); observer.observe() // ... let records = observer.takeRecords(); console.log(records); Specifications Specification Status Comment Re
porting APIThe definition of 'Re
portingObserver.takeRecords()' in that specification. Editor's Draft ...
SharedWorker.port - Web APIs
The
port property of the SharedWorker interface returns a Message
Port object used to communicate and control the shared worker. Syntax myWorker.
port; Value A Message
Port object. Example The following code snippet shows creation of a SharedWorker object using the SharedWorker() constructor. Multiple scripts can then access the worker through a Message
Port object accessed using the SharedWorker.
port property -- the
port is started using its start() method: var myWorker = new SharedWorker('worker.js'); myWorker.
port.start(); For a full example, see our Basic shared worker example (run shared worker.) Specifications Specification Status Comment HTML Living StandardThe definition of 'AbstractWorker.onerror' in that specification. Living Standard ...
StorageQuota.supportedTypes - Web APIs
The sup
portedTypes read-only property of the StorageQuota interface returns a list of the available storage types. Syntax var storageTypes = StorageQuota.sup
portedTypes Value A frozen Array of available storage types. Specifications Specification Status Comment Quota Management APIThe definition of 'sup
portedTypes' in that specification. Obsolete Initial definition. ...
VisualViewport.height - Web APIs
The height read-only property of the VisualView
port interface returns the height of the visual view
port, in CSS pixels. Syntax var height = VisualView
port.height Value A double. Specifications Specification Status Comment Visual View
port APIThe definition of 'height' in that specification. Draft Initial definition. ...
VisualViewport.offsetTop - Web APIs
The offsetTop read-only property of the VisualView
port interface returns the offset of the top edge of the visual view
port from the top edge of the layout view
port in CSS pixels. Syntax var offsetTop = VisualView
port.offsetTop Value A double. Specifications Specification Status Comment Visual View
port APIThe definition of 'offsetTop' in that specification. Draft Initial definition. ...
VisualViewport.offsetleft - Web APIs
The offsetLeft read-only property of the VisualView
port interface returns the offset of the left edge of the visual view
port from the left edge of the layout view
port in CSS pixels. Syntax var offsetLeft = VisualView
port.offsetLeft Value A double. Specifications Specification Status Comment Visual View
port APIThe definition of 'offsetLeft' in that specification. Draft Initial definition. ...
VisualViewport.onresize - Web APIs
The onresize event handler of the VisualView
port interface is called when a view
port is resized, i.e. when the resize event is fired. Syntax VisualView
port.onresize = function(e) { ... } Examples VisualView
port.onresize = function(e) { ... } Specifications Specification Status Comment Visual View
port APIThe definition of 'onresize' in that specification. Draft Initial definition. ...
VisualViewport.onscroll - Web APIs
The onscroll event handler of the VisualView
port interface is called when a view
port is scrolled, i.e. when the scroll event is fired. Syntax VisualView
port.onscroll = function(e) { ... } Examples VisualView
port.onscroll = function(e) { ... } Specifications Specification Status Comment Visual View
port APIThe definition of 'onscroll' in that specification. Draft Initial definition. ...
VisualViewport.pageLeft - Web APIs
The pageLeft read-only property of the VisualView
port interface returns the x coordinate of the left edge of the visual view
port relative to the initial containing block origin, in CSS pixels. Syntax var pageLeft = VisualView
port.pageLeft Value A double. Specifications Specification Status Comment Visual View
port APIThe definition of 'pageLeft' in that specification. Draft Initial definition. ...
VisualViewport.pageTop - Web APIs
The pageTop read-only property of the VisualView
port interface returns the y coordinate of the top edge of the visual view
port relative to the initial containing block origin, in CSS pixels. Syntax var pageTop = VisualView
port.pageTop Value A double. Specifications Specification Status Comment Visual View
port APIThe definition of 'pageTop' in that specification. Draft Initial definition. ...
VisualViewport: resize event - Web APIs
The resize event of the VisualView
port interface is fired when the visual view
port is resized. Bubbles No Cancelable No Interface Event Event handler property onresize Examples You can use the resize event in an addEventListener method: visualView
port.addEventListener('resize', function() { ... }); Or use the onresize event handler property: visualView
port.onresize = function() { ... }; Specifications Specification Status Comment Visual View
port APIThe definition of 'VisualView
port events' in that specification. Draft Initial definition ...
VisualViewport.scale - Web APIs
The scale read-only property of the VisualView
port interface returns the pinch-zoom scaling factor applied to the visual view
port. Syntax var scale = VisualView
port.scale Value A double. Specifications Specification Status Comment Visual View
port APIThe definition of 'scale' in that specification. Draft Initial definition. ...
VisualViewport: scroll event - Web APIs
The scroll event of the VisualView
port interface is fired when the visual view
port is scrolled. Bubbles No Cancelable No Interface Event Event handler property onscroll Examples You can use the scroll event in an addEventListener method: visualView
port.addEventListener('scroll', function() { ... }); Or use the onscroll event handler property: visualView
port.onscroll = function() { ... }; Specifications Specification Status Comment Visual View
port APIThe definition of 'VisualView
port events' in that specification. Draft Initial definition ...
VisualViewport.width - Web APIs
The width read-only property of the VisualView
port interface returns the width of the visual view
port, in CSS pixels. Syntax var width = VisualView
port.width Value A double. Specifications Specification Status Comment Visual View
port APIThe definition of 'width' in that specification. Draft Initial definition. ...
Window.visualViewport - Web APIs
The visualView
port read-only property of the Window interface returns a VisualView
port object representing the visual view
port for a given window. Syntax var visualView
port = Window.visualView
port Value A VisualView
port object. Specifications Specification Status Comment Visual View
port APIThe definition of 'visualView
port' in that specification. Draft Initial definition. ...
XRViewport.height - Web APIs
The read-only XRView
port property height specifies the height, in pixels, of the view
port onto the drawing surface within which the WebXR view is to be rendered. Along with width and the origin point given by x and y, this defines the area within which rendered content will be drawn. Syntax height = xrView
port.height; Value The view
port's height in pixels. Examples See the main XRView
port page for examples. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRView
port.height' in that specification. Working Draft Initial definition. ...
XRViewport.width - Web APIs
The read-only XRView
port property width specifies the width of the view
port, in pixels, onto the drawing surface the 3D scene is to be rendered into. This is defined using this property along with the view
port's height and its origin given by its properties x and y. Syntax width = xrView
port.width; Value The view
port's width in pixels. Examples See the main XRView
port page for examples. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRView
port.width' in that specification. Working Draft Initial definition. ...
XRViewport.x - Web APIs
The read-only XRView
port interface's x property indicates the offset from the left edge of the destination surface (typically a XRWebGLLayer to the left edge of the view
port within the surface into which WebXR content is to be rendered. The view
port's y property identifies the y component of the origin, and its is given by the width and height properties. Syntax x = xrView
port.x; Value The offset from the left edge of the rendering surface to the left edge of the view
port, in pixels. Examples See the main XRView
port page for examples. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRView
port.x' in that specification. Working Draft Initial definition. ...
Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’ - HTTP
To correct this problem on the client side, simply ensure that the credentials flag's value is false when issuing your CORS request. If the request is being issued using XMLHttpRequest, make sure you're not setting withCredentials to true. If using Server-sent events, make sure EventSource.withCredentials is false (it's the default value). If using the Fetch API, make sure Request.credentials is "omit". ...
<xsl:apply-imports> - XSLT: Extensible Stylesheet Language Transformations
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The <xsl:apply-im
ports> element is fairly arcane, used mostly in complex stylesheets. Im
port precedence requires that template rules in main stylesheets have higher precedence than template rules in im
ported stylesheets. Sometimes, however, it is useful to be able to force the processor to use a template rule from the (lower precedence) im
ported stylesheet rather than an equivalent rule in the main stylesheet. Syntax <xsl:apply-im
ports/> Required Attributes None. Optional Attributes None. Type Instruction, appears within a template. Defined XSLT, section 5.6. Gecko sup
port Sup
ported. ...
Index - Web APIs
property of the Accelerometer interface returns a double precision integer containing the acceleration of the device along the its z axis. 29 AddressErrors API, Address, AddressErrors, Dictionary, Errors, Interface, Payment Address, Payment Request, Payment Request API, Reference, payment, paymentAddress The AddressErrors dictionary is used by the Payment Request API to to re
port validation errors in a physical address (typically a billing address or a shipping address). 30 AddressErrors.addressLine API, AddressErrors, Error, Payment Request, Payment Request API, Property, Reference, Validation, addressLine, payment An object based on AddressErrors includes an addressLine property when validation of the address finds one or more errors in the array of...
...tart undefined. 121 AudioConfiguration API, Audio, AudioConfiguration, Experimental, Interface, Media Capabilities API, Reference, Video The AudioConfiguration dictionary of the Media Capabilities API defines the audio file being tested when calling MediaCapabilities.encodingInfo() or MediaCapabilities.decodingInfo() to query whether a specific audio configuration is sup
ported, smooth, and/or power efficient. 122 AudioContext API, Audio, AudioContext, Interface, Reference, Web Audio API, sound The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. 123 AudioContext() Audio, Audio Context, Audio Graph, AudioContext, Constructor, Context, Media, Media...
...roperty of the AudioParam interface represents the minimum possible value for the parameter's nominal (effective) range. 174 AudioParam.setTargetAtTime() API, AudioParam, Method, Reference, Web Audio API, setTargetAtTime The setTargetAtTime() method of the AudioParam interface schedules the start of a gradual change to the AudioParam value. This is useful for decay or release
portions of ADSR envelopes. 175 AudioParam.setValueAtTime() API, AudioParam, Method, Reference, Web Audio API, setValueAtTime The setValueAtTime() method of the AudioParam interface schedules an instant change to the AudioParam value at a precise time, as measured against AudioContext.currentTime. The new value is given in the value parameter. 176 AudioParam.setValueCur...
...And 389 more matches
IDBObjectStore - Web APIs
Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStor...
... compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 165 more matches
JavaScript modules - JavaScript
eeded, so large scripts were generally not needed. Fast forward a few years and we now have complete applications being run in browsers with a lot of JavaScript, as well as JavaScript being used in other contexts (Node.js, for example). It has therefore made sense in recent years to start thinking about providing mechanisms for splitting JavaScript programs up into separate modules that can be im
ported when needed. Node.js has had this ability for a long time, and there are a number of JavaScript libraries and frameworks that enable module usage (for example, other CommonJS and AMD-based module systems like RequireJS, and more recently Webpack and Babel). The good news is that modern browsers have started to sup
port module functionality natively, and this is what this article is all about. T...
... RequireJS, and more recently Webpack and Babel). The good news is that modern browsers have started to sup
port module functionality natively, and this is what this article is all about. This can only be a good thing -- browsers can optimize loading of modules, making it more efficient than having to use a library and do all of that extra client-side processing and extra round trips. ...
...ews is that modern browsers have started to sup
port module functionality natively, and this is what this article is all about. This can only be a good thing -- browsers can optimize loading of modules, making it more efficient than having to use a library and do all of that extra client-side processing and extra round trips. ...
...And 147 more matches
Fullscreen API - Web APIs
s) in full-screen mode, and to exit full-screen mode once it is no longer needed. This makes it possible to present desired content--such as an online game--using the user's entire screen, removing all browser user interface elements and other applications from the screen until full-screen mode is shut off. See the article Guide to the Fullscreen API for details on how to use the API. Note: Sup
port for this API varies somewhat across browsers, with many requiring vendor prefixes and/or not implementing the latest specification. See the Browser compatibility section below for details on sup
port for this API. You may wish to consider using a library such as Fscreen for vendor agnostic access to the Fullscreen API. Interfaces The Fullscreen API has no interfaces of its own. Instead, it augm...
...n() Asks the user agent to place the specified element (and, by extension, its descendants) into full-screen mode, removing all of the browser's UI elements as well as all other applications from the screen. Returns a Promise which is resolved once full-screen mode has been activated. Properties The Document interface provides properties that can be used to determine if full-screen mode is sup
ported and available, and if full-screen mode is currently active, which element is using the screen. DocumentOrShadowRoot.fullscreenElement The fullscreenElement property tells you the Element that's currently being displayed in full-screen mode on the DOM (or shadow DOM). If this is null, the document is not in full-screen mode. document.fullscreenEnabled The fullscreenEnabled property tells y...
...ing displayed in full-screen mode on the DOM (or shadow DOM). If this is null, the document is not in full-screen mode. document.fullscreenEnabled The fullscreenEnabled property tells you whether or not it is possible to engage full-screen mode. This is false if full-screen mode is not available for any reason (such as the "fullscreen" feature not being allowed, or full-screen mode not being sup
ported). Event handlers The Fullscreen API defines two events which can be used to detect when full-screen mode is turned on and off, as well as when errors occur during the process of changing between full-screen and windowed modes. Event handlers for these events are available on the Document and Element interfaces. Note: These event handler properties are not available as HTML content attribut...
...And 114 more matches
Selection API - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...b.com/mdn/browser-compat-data and send us a pull request. ...
...And 114 more matches
BluetoothCharacteristicProperties - Web APIs
at is true if reliable writes to the characteristic descriptor is permitted. writeRead only Returns a boolean that is true if the writing to the characteristic with response is permitted. writeWithoutResponseRead only Returns a boolean that is true if the writing to the characteristic without response is permitted. Examples The following example shows how tell if a GATT characteristic sup
ports value change notifications. let device = await navigator.bluetooth.requestDevice({ filters: [{services: ['heart_rate']}] }); let gatt = await device.gatt.connect(); let service = await gatt.getPrimaryService('heart_rate'); let characteristic = await service.getCharacteristic('heart_rate_measurement'); if (characteristic.properties.notify) { characteristics.addEventListener('characteristicva...
...e is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetBluetoothCharacteristicProperties ExperimentalChrome Full sup
port 56Notes Full sup
port 56Notes Notes ChromeOS and macOS only. Full sup
port 56Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). ...
... 56Notes Notes ChromeOS and macOS only. Full sup
port 56Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes EdgeOS and macOS only. ...
...And 104 more matches
Index - Archive of obsolete content
ftware. Or perhaps you're just curious about the history of an obsolete feature or API, and how it worked. 2 .htaccess ( hypertext access ) 301 redirect, Cache control, Custom Error pages, HTACCESS, Permanent Redirect, Redirect File Accessing : htaccess files can be opened using any text editor, like Windows Notepad, Vin, Sublime text editor or any other. Syntax highliting sup
port for .htaccess files less. 3 2015 MDN Fellowship Program 2015, Archive, fellowship No summary! 4 API API, Archive Archived documentation about obsolete web standards APIs. 5 Navigator API, Navigator Features that used to hang off the Navigator interface, but have since been removed. 6 Navigator.mozNotification API, Depre...
... 2015, Archive, fellowship No summary! 4 API API, Archive Archived documentation about obsolete web standards APIs. 5 Navigator API, Navigator Features that used to hang off the Navigator interface, but have since been removed. 6 Navigator.mozNotification API, Deprecated, Mobile, Non-standard, Property, Reference Provides sup
port for creating notification objects, which are used to display desktop notification alerts to the user. Currently, these are only sup
ported on Firefox Mobile and Firefox OS. See Displaying notifications for an example. 7 Window: deviceproximity event Sensors, events The deviceproximity event is fired when fresh data is available from a proximity sensor. 8 Window: use...
...fy the content of web pages. But the main add-on code doesn't get direct access to web content. Instead, SDK add-ons need to factor the code that gets access to web content into separate scripts that are called content scripts. This page describes how to develop and implement content scripts. 14 Communicating With Other Scripts No summary! 15 Communicating using "
port" To enable add-on scripts and content scripts to communicate with each other, each end of the conversation has access to a
port object. 16 Communicating using "postMessage" Add-on SDK No summary! 17 Cross-domain Content Scripts Add-on SDK, Add-ons, Extensions No summary! 18 Interacting with page scripts Add-on SDK, Add-ons, Exten...
...And 100 more matches
IDBIndex - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ease check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 98 more matches
Web video codec guide - Web media technologies
This guide introduces the video codecs you're most likely to encounter or consider using on the web, summaries of their capabilities and any compatibility and utility concerns, and advice to help you choose the right codec for your project's video. Common codecs The following video codecs are those which are most commonly used on the web. ...
...llowing video codecs are those which are most commonly used on the web. For each codec, the containers (file types) that can sup
port them are also listed. Each codec provides a link to a section below which offers additional details about the codec, including specific capabilities and compatibility issues you may need to be aware of. ...
...r of possibilities. It all depends on the underlying algorithms and mathematics. The potential effect of source video format and contents on the encoded video quality and size Feature Effect on quality Effect on size Color depth (bit depth) The higher the color bit depth, the higher the quality of color fidelity is achieved in the video. Additionally, in saturated
portions of the image (that is, where colors are pure and intense, such as a bright, pure red [rgba(255, 0, 0, 1)]), color depths below 10 bits per component (10-bit color) allow banding, where gradients cannot be represented without visible stepping of the colors. Depending on the codec, higher color depths may result in larger compressed file sizes. The determining factor is what internal storage...
...And 96 more matches
sslfnc.html
part of the SSL Reference that we are migrating into the format described in the MDN Style Guide. If you are inclined to help with this migration, your help would be very much appreciated. Upgraded documentation may be found in the Current NSS Reference SSL Functions Chapter 4 SSL Functions This chapter describes the core SSL functions. SSL Initialization Functions SSL Ex
port Policy Functions SSL Configuration Functions SSL Communication Functions SSL Functions Used by Callbacks SSL Handshake Functions NSS Shutdown Function Deprecated Functions SSL Initialization Functions This section describes the initialization functions that are specific to SSL. For a complete list of NSS initialization functions, see Initialization. Note that at least one of the f...
...nfiguration Functions SSL Communication Functions SSL Functions Used by Callbacks SSL Handshake Functions NSS Shutdown Function Deprecated Functions SSL Initialization Functions This section describes the initialization functions that are specific to SSL. For a complete list of NSS initialization functions, see Initialization. Note that at least one of the functions listed in SSL Ex
port Policy Functions must also be called during NSS initialization. NSS_Init NSS_InitReadWrite NSS_NoDB_Init SSL_OptionSetDefault SSL_OptionGetDefault SSL_CipherPrefSetDefault SSL_CipherPrefGetDefault SSL_ClearSessionCache SSL_ConfigServerSessionIDCache SSL_ConfigMPServerSIDCache SSL_InheritMPServerSIDCache NSS_Init Sets up configuration files and performs other tasks required to ...
...mple S/MIME operations such as adding a certificate, use NSS_InitReadWrite instead. Before calling NSS_Init, your program must call PR_Init. The policy flags for all cipher suites are turned off by default, disallowing all cipher suites. ...
...And 85 more matches
Index
cko is created. If the component uses only "frozen" XPCOM interfaces, there is a good chance the same binary component will work with different versions of Gecko (version 1.8 and 1.9, for example). The more likely case is that the component uses "unfrozen" interfaces and those interfaces can change between Gecko versions. This can create a difficult situation for extension developers trying to sup
port multiple Gecko versions (Firefox 2 and 3, for example). 6 Creating a Python XPCOM component Guide, NeedsHelp, PyXPCOM, XPCOM, XPCOM:Language Bindings Creating Applications with Mozilla already provides a tutorial for making a simple JavaScript or C++ component (implementing the nsISimple interface). Here is how to make the same component in Python using PyXPCOM. 7 ...
...uctured cloned back to the original context, unless it is native (for example, if it returns a DOM node, this is not structured cloned, because the original context will see that through an XrayWrapper already), so it's guaranteed to behave predictably. This is useful for privileged code, such as add-on code, to access variables and APIs defined in web content. 36 Components.utils.ex
portFunction API, Add-ons, Components, Extensions, Language Bindings, Method, Mozilla, Non-standard, Reference, WebExtensions, XPCOM This function provides a safe way to expose a function from a privileged scope to a less-privileged scope. 37 Components.utils.forceGC NeedsContent, XPCOM, XPCOM:Language Bindings, XPConnect Components.utils.forceGC lets scripts force a gar...
...rform garbage collection automatically when the JavaScript heap grows beyond a certain size. This mechanism doesn't account for any native (C++) XPCOM objects hanging off JavaScript objects though. In many cases a JavaScript application will have internal knowledge of JavaScript objects referencing large (trees of) XPCOM objects and know when they are no longer reachable. In this case it can be im
portant to be able to force a garbage collection cycle from JavaScript. 38 Components.utils.getGlobalForObject Add-ons, Developing Mozilla, Extensions, JavaScript, XPCOM:Language Bindings, XPConnect This method is used to determine the global object with which an object is associated. This is the global object in place at the time the object was created, which is to say the global...
...And 84 more matches
Web audio codec guide - Web media technologies
code and decode it is handled by an audio codec (COder/DECoder). In this article, we look at audio codecs used on the web to compress and decompress audio, what their capabilities and use cases are, and offer guidance when choosing audio codecs to use for your content. Additionally, WebRTC implementations generally use a subset of these codecs for their encoding and decoding of media, and may sup
port additional codecs as well, for optimal cross-platform sup
port of video and audio conferencing, and to integrate better with legacy telecommunication solutions. See Codecs used by WebRTC for details. For information about the fundamental concepts behind how digital audio works, see the article Digital audio concepts. Common codecs The list below denotes the codecs most commonly used on the web ...
...al cross-platform sup
port of video and audio conferencing, and to integrate better with legacy telecommunication solutions. See Codecs used by WebRTC for details. For information about the fundamental concepts behind how digital audio works, see the article Digital audio concepts. Common codecs The list below denotes the codecs most commonly used on the web and which containers (file types) sup
port them. If all you need to know is which codecs are even possible to use, this is for you. Of course, individual browsers may or may not choose to sup
port all of these codecs, and their sup
port for which container types can use them may vary as well. In addition, browsers may choose to sup
port additional codecs not included on this list. Codec name (short) Full codec name Container ...
...em. If all you need to know is which codecs are even possible to use, this is for you. Of course, individual browsers may or may not choose to sup
port all of these codecs, and their sup
port for which container types can use them may vary as well. In addition, browsers may choose to sup
port additional codecs not included on this list. ...
...And 79 more matches
@font-feature-values - CSS: Cascading Style Sheets
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet@font-feature-valuesChrome No sup
port NoEdge No sup
port NoFirefox Full sup
port 34 Full sup
port 34 Full sup
port 24Disabled Disabled From version 24: this feature is behind the layout.css.font-features.enabled preference (needs to be set to true). To change preferences in Firefox, visit about...
...irefox Full sup
port 34 Full sup
port 34 Full sup
port 24Disabled Disabled From version 24: this feature is behind the layout.css.font-features.enabled preference (needs to be set to true). ...
...And 76 more matches
Index
Found 353 pages: # Page Tags and summary 1 Network Security Services JSS, NSS, NeedsMigration Network Security Services (NSS) is a set of libraries designed to sup
port cross-platform development of security-enabled client and server applications. Applications built with NSS can sup
port SSL v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security standards. 2 An overview of NSS Internals API, Intermediate, Intro, NSS, Tools A High-Level Overview to the Internals of Network Security Services (NSS) Software developed by the Mozilla.org projects traditionally used its own implementation of security protocols and cryptographic algorithms, originally called Netscape Security Services, nowaday...
...Software developed by the Mozilla.org projects traditionally used its own implementation of security protocols and cryptographic algorithms, originally called Netscape Security Services, nowadays called Network Security Services (NSS). NSS is a library written in the C programming language. It's free and open source software, and many other software projects have decided to use it. In order to sup
port multiple operating systems (OS), it is based on a cross platform
portability layer, called the Netscape
Portable Runtime (NSPR), which provides cross platform application programming interfaces (APIs) for OS specific APIs like file system access, memory management, network communication, and multithreaded programming. NSS offers lots of functionality; we'll walk through the list of modules, de...
...tems (OS), it is based on a cross platform
portability layer, called the Netscape
Portable Runtime (NSPR), which provides cross platform application programming interfaces (APIs) for OS specific APIs like file system access, memory management, network communication, and multithreaded programming. NSS offers lots of functionality; we'll walk through the list of modules, design principles, and im
portant relevant standards. In order to allow interoperability between software and devices that perform cryptographic operations, NSS conforms to a standard called PKCS#11. ...
...And 75 more matches
Implementation Status - Archive of obsolete content
Mozilla XForms is not actively maintained any more since about 2010! Limitations and Extensions The extension has some limitations and custom extension to the XForms 1.1 specification. These can be found on the Mozilla XForms Specials page. Specification Chapter Index Here we give an overview of XForms 1.1 specification chapters and the current status of the Mozilla sup
port. ...
...aintained any more since about 2010! Limitations and Extensions The extension has some limitations and custom extension to the XForms 1.1 specification. These can be found on the Mozilla XForms Specials page. Specification Chapter Index Here we give an overview of XForms 1.1 specification chapters and the current status of the Mozilla sup
port. ...
...since about 2010! ...
...And 74 more matches
Choosing the right approach - Learn web development
can just use a single .catch() block to handle the errors for the entire chain. Async callbacks just aren't very graceful. Promise callbacks are always called in the strict order they are placed in the event queue; async callbacks aren't. Async callbacks lose full control of how the function will be executed when passed to a third-party library. Browser compatibility Really good general sup
port, although the exact sup
port for callbacks in APIs depends on the particular API. Refer to the reference documentation for the API you're using for more specific sup
port info. Further information Introducing asynchronous JavaScript, in particular Async callbacks setTimeout() setTimeout() is a method that allows you to run a function after an arbitrary amount of time has passed. Useful fo...
...s better to use recursive setTimeout() -- this will keep the time interval constant between executions regardless of how long the code takes to execute, and you won't get errors. ...
... interval constant between executions regardless of how long the code takes to execute, and you won't get errors. ...
...And 73 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
Practical Tips for Developers and How Mozilla Does It Contents This document is for developers working to sup
port MSAA in an application in order to make it accessible with 3rd party assistive technologies, as well as for hackers wishing to be involved in Mozilla's MSAA sup
port specifically. If you're implementing controls/widgets, you should also see the Accessible Toolkit Checklist. If you're interested in more about Gecko's MSAA implementation, read Gecko Info for Windows Accessibility Vendors to learn how MSAA clients can utilize Gecko's MSAA sup
port. Intro: What is MSAA? MSAA is the Microsoft Active Accessibility (MSAA) API, used on Windows operating systems to sup
port assistive technologies for users with disabilities. Third party assistive technology, such as screen reade...
...ve technologies for users with disabilities. Third party assistive technology, such as screen readers, screen magnifiers and voice input software, want to track what's happening inside Mozilla. They need to know about focus changes and other events, and it needs to know what objects are contained in the current document or dialog box. Using this information, a screen reader will speak out loud im
portant changes to the document or UI, and allow the user to track where they navigate. The screen reader user can navigate the web page using screen reader commands or browser commands, and the two pieces of software must remain in sync. Some screen readers can even show information on a refreshable braille display. Screen magnifiers will zoom to the focus, keeping it on the screen at all times, or e...
...hacks are more effective. For example, screen readers look for screen draws of a vertical blinking line, to determine the location of the caret. Without doing this, screen readers would not be able to let the user know where there caret has moved to in most programs, because so many applications do not use the system caret (Gecko does not). This is so commonly done, that no one even bothers to sup
port the MSAA caret, after all the hack is general solution works with pretty much all applications. MSAA provides information in several different ways: A COM interface (IAccessible) that allows applications to expose the tree of data nodes that make up each window in the user interface currently being interacted with and Custom interface extensions via interfaces via QueryInterface and QuerySer...
...And 66 more matches
BasicCardResponse - Web APIs
amples In the following example, the PaymentRequest() constructor is used to create a new payment request, which takes three objects as parameters -- one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options. ...
... containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options. The first of these three (sup
portedInstruments in the example below) contains a data property that has to conform to the structure defined by the BasicCardRequest dictionary. ...
...ayment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options. The first of these three (sup
portedInstruments in the example below) contains a data property that has to conform to the structure defined by the BasicCardRequest dictionary. ...
...And 65 more matches
BluetoothRemoteGATTDescriptor - Web APIs
f9b34fb' for theClient Characteristic Configuration descriptor. BluetoothRemoteGATTDescriptor.valueRead only Returns the currently cached descriptor value. This value gets updated when the value of the descriptor is read. Methods BluetoothRemoteGATTDescriptor.readValue() Returns a Promise that resolves to an ArrayBuffer holding a duplicate of the value property if it is available and sup
ported. Otherwise it throws an error. BluetoothRemoteGATTDescriptor.writeValue() Sets the value property to the bytes contained in an ArrayBuffer and returns a Promise. Specifications Specification Status Comment Web BluetoothThe definition of 'BluetoothRemoteGATTDescriptor' in that specification. Draft Initial definition. Browser Compatibility The compatibil...
... page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetBluetoothRemoteGATTDescriptor ExperimentalChrome Full sup
port 57Notes Full sup
port 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change pre...
...t 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. ...
...And 65 more matches
IDBDatabase - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 65 more matches
IDBTransaction - Web APIs
made in version 21). You should code defensively in case the object is not available anymore: var myIDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || { READ_WRITE: "readwrite" }; Examples In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database initialised.</li>'; // store the result of opening the database in the ...
...Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = tra...
...error = function(event) { note.innerHTML += '<li>Transaction not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); // add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of the request (this does not mean the item // has been stored successfully in the DB - for that you need transaction.oncomplete) note.innerHTML += '<li>Request successful.</li>'; }; }; Specifications Specification Status Comment Indexed Database API 2.0The definition of 'IDBTransaction' in that specification. Recommendation Initial defini...
...And 64 more matches
Permissions - Web APIs
The Permissions interface of the Permissions API provides the core Permission API functionality, such as methods for querying and revoking permissions Methods Permissions.query() Returns the user permission status for a given API. Permissions.request() Requests permission to use a given API. This is not currently sup
ported in any browser. Permissions.requestAll() Requests permission to use a given set of APIs. This is not currently sup
ported in any browser. Permissions.revoke() Revokes the permission currently set on a given API. Example navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state === 'granted') { showLocalNewsWithGeolocation(); } else if (result.state === 'prompt') { showButtonToEnableLocalNews(); } // Don't do an...
...f (result.state === 'granted') { showLocalNewsWithGeolocation(); } else if (result.state === 'prompt') { showButtonToEnableLocalNews(); } // Don't do anything if the permission was denied. }); Specification Specification Status Comment PermissionsThe definition of 'Permissions' in that specification. Working Draft Initial definition. Browser Sup
port The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetPermissionsChrome Full ...
...The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 64 more matches
Gecko info for Windows accessibility vendors
This FAQ explains how makers of Windows screen readers, voice dictation packages and magnification software can sup
port Gecko-based software. The base of our sup
port for these products is MSAA (Microsoft Active Accessibility), external readonly DOM sup
port, and the keyboard API/user interface. Definitions Here are some basic definitions that you'll need for this document to make sense: Gecko: The rendering engine for Firefox, Thunderbird, Nvu, Mozilla Seamonkey and other applications. Gecko is the internal engine that Mozilla uses to render any kind of web content. It sup
ports HTML, XHTML, Cascading Style Sheets (CSS) and the Document Object Model (DOM). Microsoft Active Accessibility (MSAA) an API devised by Microsoft so that acces...
...key and other applications. Gecko is the internal engine that Mozilla uses to render any kind of web content. It sup
ports HTML, XHTML, Cascading Style Sheets (CSS) and the Document Object Model (DOM). Microsoft Active Accessibility (MSAA) an API devised by Microsoft so that accessibility aids can track what's going on inside the user interface of any software package that sup
ports it. If you seriously need to understand MSAA, you'll need to read the docs on MSDN and play with the sample apps and code that come with MSAA SDK 1.3. (I recommend SDK 1.3 because the MSAA SDK 2.0 doesn't come with the source code to the testing tools. The other differences are not im
portant). DOM: Document Object Model This is the W3C's specification for how web content is...
...'s the relation? The MSAA tree and the DOM tree are parallel structures, although the MSAA tree is a subset of the DOM tree. QueryService() can be used to switch between the interfaces (IAccessible, ISimpleDOMDocument, ISimpleDOMNode and ISimpleDOMText). If there is no MSAA node for a DOM node, or vice-versa, QueryService() will return null. Anything that is focusable or conveys im
portant information about the structure of the document is exposed in the MSAA tree of IAccessibles. Windows Applications Based on the Gecko Layout Engine Gecko is a rendering engine that Mozilla, Netscape and other new browsers use. Gecko can render a variety of content, not just HTML and sup
ports key web standards such as Cascading Style Sheets, Javascript and the W3C DOM. Gecko also handles ...
...And 50 more matches
Python binding for NSS
Project Information python-nss is a Python binding for NSS (Network Security Services) and NSPR (Netscape
Portable Runtime). NSS provides cryptography services sup
porting SSL, TLS, PKI, PKIX, X509, PKCS*, etc. NSS is an alternative to OpenSSL and used extensively by major software projects. NSS is FIPS-140 certified. NSS is built upon NSPR because NSPR provides an abstraction of common operating system services, particularly in the areas of networking and process management. Python also provides an abstraction of common operating system services but because NSS and NSPR are tightly bound python-nss exposes elements of NSPR. For information on NSS and NSPR, see the following: Network Security Services (NSS). NSS project page. Netscape
Portable Runtime. NSPR project page. NSPR Re...
...d is exposed via the standard Python methodology. This documentation is available via the numerous Python documentation extraction tools. Also see the generated HTML documentation provided with each release. NSS/NSPR structs are exposed as Python objects. NSS/NSPR functions which operate on a NSS/NSPR object (i.e. struct) become methods of that object. NSS/NSPR objects which are collections sup
port the Python iteration protocol. In other words they can be iterated over, indexed by position, or used as slices. NSS/NSPR objects whose collection elements can be referenced by name sup
port associative indexing. NSS/NSPR objects which have "get" and "set" API function calls are exposed as Python properties. All NSS/NSPR Python objects can print their current value by evaluting the Python objec...
...The Python Global Interpreter Lock (GIL) is released prior to calling NSS/NSPR C functions and reaquired after the NSS/NSPR C function returns. This allows other Python threads to execute during the time a NSS/NSPR function is progress in another thread. ...
...And 50 more matches
min-width - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 49 more matches
<textarea> - HTML: Hypertext Markup Language
t for accessibility purposes A name attribute to set the name of the associated data point submitted to the server when the form is submitted. rows and cols attributes to allow you to specify an exact size for the <textarea> to take. Setting these is a good idea for consistency, as browser defaults can differ. Default content entered between the opening and closing tags. ...
...The non-deprecated values are available in iOS 5 and later. ...
...y The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternettextareaChrome Full sup
port YesEdge Full sup
port 12Firefox Full sup
port YesNotes Full sup
port YesNotes Notes Before Firefox 6, when a <textarea> was focused, the insertion point was placed at the end of the text by default. Other major browsers place the inserti...
...And 49 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
Reference The accessibility tree, or accessibility object model (AOM), contains accessibility-related information for most HTML elements. 13 Adobe Flash Adobe, CodingScripting, Flash, Glossary, Infrastructure Flash is an obsolescent technology developed by Adobe for viewing expressive web applications, multimedia content, and streaming media. Adobe Flash can run from sup
porting web browsers via a browser plug-in. 14 Ajax AJAX, CodingScripting, Glossary, Infrastructure, l10n:priority Ajax, which initially stood for Asynchronous JavaScript And XML, is a programming practice of building complex, dynamic webpages using a technology known as XMLHttpRequest. 15 Algorithm CodingScripting, Glossary An algorithm is a self-contained se...
... DOM (Document Object Model) CodingScripting, DOM, Glossary The DOM (Document Object Model) is an API that represents and interacts with any HTML or XML document. The DOM is a document model loaded in the browser and representing the document as a node tree, where each node represents part of the document (e.g. an element, text string, or comment). 103 DTLS (Datagram Trans
port Layer Security) DTLS, Intro Datagram Trans
port Layer Security (DTLS) is a protocol used to secure datagram-based communications. It's based on the stream-focused Trans
port Layer Security (TLS), providing a similar level of security. As a datagram protocol, DTLS doesn't guarantee the order of message delivery, or even that messages will be delivered at all. However, DTLS gains the benefi...
...ally return a value. A function in JavaScript is also an object. 162 Fuzz testing Firefox, Fuzzing, Mozilla, QA, Security, Testing Fuzzing is a technique for testing software using automated tools to provide invalid or unexpected input to a program or function in a program, then checking the results to see if the program crashes or otherwise acts inappropriately. This is an im
portant way to ensure that software is stable, reliable, and secure, and we use fuzzing a lot at Mozilla. 163 GIF Composing, Glossary GIF (Graphics Interchange Format) is an image format that uses lossless compression and can be used for animations. A GIF uses up to 8 bits per pixel and a maximum of 256 colors from the 24-bit color space. 164 GIJ Automation, CodingS...
...And 45 more matches
Media container formats (file types) - Web media technologies
well as their benefits, limitations, and ideal use cases. WebRTC does not use a container at all. Instead, it streams the encoded audio and video tracks directly from one peer to another using MediaStreamTrack objects to represent each track. See Codecs used by WebRTC for information about codecs commonly used for making WebRTC calls, as well as browser compatibility information around codec sup
port in WebRTC. Common container formats While there are a vast number of media container formats, the ones listed below are the ones you are most likely to encounter. Some sup
port only audio while others sup
port both audio and video. The MIME types and extensions for each are listed.The most commonly used containers for media on the web are probably MPEG-4 (MP4), QuickTime Movie (MOV), and the Wave...
...For example, an Ogg file with only an Opus audio track is sometimes referred to as an Opus file, and might even have the extension .opus. ...
...ncoded using MPEG-1 Audio Layer III encoding. These files use the audio/mp3 MIME type and the .mp3 extension, even though their containers are just MPEG. ...
...And 45 more matches
WebIDL bindings
e. All the generated code is placed in the mozilla::dom namespace. For each interface, a namespace whose name is the name of the interface with Binding appended is created, and all the things pertaining to that interface's binding go in that namespace. There are various helper objects and utility methods in dom/bindings that are also all in the mozilla::dom namespace and whose headers are all ex
ported into mozilla/dom (placed in $OBJDIR/dist/include by the build process). Adding WebIDL bindings to a class To add a WebIDL binding for interface MyInterface to a class mozilla::dom::MyInterface that's supposed to implement that interface, you need to do the following: If your interface doesn't inherit from any other interfaces, inherit from nsWrapperCache and hook up the class to the cyc...
... that's supposed to implement that interface, you need to do the following: If your interface doesn't inherit from any other interfaces, inherit from nsWrapperCache and hook up the class to the cycle collector so it will trace the wrapper cache properly. Note that you may not need to do this if your objects can only be created, never gotten from other objects. If you also inherit from nsISup
ports, make sure the nsISup
ports comes before the nsWrapperCache in your list of parent classes. If your interface does inherit from another interface, just inherit from the C++ type that the other interface corresponds to. If you do need to hook up cycle collection, it will look like this in the common case of also inheriting from nsISup
ports: // Add strong pointers your class holds here. If yo...
...so inheriting from nsISup
ports: // Add strong pointers your class holds here. If you do, change to using // NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE. NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(MyClass) NS_IMPL_CYCLE_COLLECTING_ADDREF(MyClass) NS_IMPL_CYCLE_COLLECTING_RELEASE(MyClass) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MyClass) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsISup
ports) NS_INTERFACE_MAP_END If your class doesn't inherit from a class that implements GetParentObject, then add a function of that name that, for a given instance of your class, returns the same object every time (unless you write explicit code that handles your parent object changing by reparenting JS wrappers, as nodes do). The idea is that walking the GetParentObject chain will eventually get y...
...And 41 more matches
Understanding WebAssembly text format - WebAssembly
ings that can be put inside function bodies, but we will start off simple for now, and you'll see a lot more examples as you go along. For a full list of the available opcodes, consult the webassembly.org Semantics reference. Calling the function Our function won't do very much on its own -- now we need to call it. ...
...e put inside function bodies, but we will start off simple for now, and you'll see a lot more examples as you go along. For a full list of the available opcodes, consult the webassembly.org Semantics reference. Calling the function Our function won't do very much on its own -- now we need to call it. ...
...ed to call it. How do we do that? ...
...And 41 more matches
sslerr.html
and SSL Error Codes Chapter 8 NSS and SSL Error Codes NSS error codes are retrieved using the NSPR function PR_GetError. In addition to the error codes defined by NSPR, PR_GetError retrieves the error codes described in this chapter. SSL Error Codes SEC Error Codes SSL Error Codes Table 8.1 Error codes defined in sslerr.h Constant Value Description SSL_ERROR_EX
PORT_ONLY_SERVER -12288 "Unable to communicate securely. Peer does not sup
port high-grade encryption." The local system was configured to sup
port the cipher suites permitted for domestic use. The remote system was configured to sup
port only the cipher suites permitted for ex
port use. SSL_ERROR_US_ONLY_SERVER -12287 "Unable to communicate securely. Peer requires high-...
... to communicate securely. Peer does not sup
port high-grade encryption." The local system was configured to sup
port the cipher suites permitted for domestic use. The remote system was configured to sup
port only the cipher suites permitted for ex
port use. SSL_ERROR_US_ONLY_SERVER -12287 "Unable to communicate securely. Peer requires high-grade encryption which is not sup
ported." The remote system was configured to sup
port the cipher suites permitted for domestic use. The local system was configured to sup
port only the cipher suites permitted for ex
port use. SSL_ERROR_NO_CYPHER_OVERLAP -12286 "Cannot communicate securely with peer: no common encryption algorithm(s)." The local and remote systems share no cipher suites in common.
...when none of the other more specific error codes defined in this file applies. SSL_ERROR_BAD_SERVER -12281 "The client has encountered bad data from the server." This error code should occur only on sockets that are acting as clients. It is a generic error, used when none of the other more specific error codes defined in this file applies. ...
...And 40 more matches
WebAssembly
existing web app. Loading and running WebAssembly code After you have a .wasm, this article covers how to fetch, compile and instantiate it, combining the WebAssembly JavaScript API with the Fetch or XHR APIs. Using the WebAssembly JavaScript API Once you've loaded a .wasm module, you'll want to use it. In this article we show you how to use WebAssembly via the WebAssembly JavaScript API. Ex
ported WebAssembly functions Ex
ported WebAssembly functions are the JavaScript reflections of WebAssembly functions which allow calling WebAssembly code from JavaScript. This article describes what they are. Understanding WebAssembly text format This article explains the wasm text format. This is the low-level textual representation of a .wasm module shown in browser developer tools when debugging.
...Converting WebAssembly text format to wasm This article provides a guide on how to convert a WebAssembly module written in the text format into a .wasm binary. API reference WebAssembly This object acts as the namespace for all WebAssembly related functionality. WebAssembly.Global() A WebAssembly.Global object represents a global variable instance, accessible from both JavaScript and im
portable/ex
portable across one or more WebAssembly.Module instances. This allows dynamic linking of multiple modules. WebAssembly.Module() A WebAssembly.Module object contains stateless WebAssembly code that has already been compiled by the browser and can be efficiently shared with Workers, and instantiated multiple times. WebAssembly.Instance() A WebAssembly.Instance object is a stateful, execut...
.... This allows dynamic linking of multiple modules. WebAssembly.Module() A WebAssembly.Module object contains stateless WebAssembly code that has already been compiled by the browser and can be efficiently shared with Workers, and instantiated multiple times. WebAssembly.Instance() A WebAssembly.Instance object is a stateful, executable instance of a Module. Instance objects contain all the Ex
ported WebAssembly functions that allow calling into WebAssembly code from JavaScript. WebAssembly.instantiateStreaming() The WebAssembly.instantiateStreaming() function is the primary API for compiling and instantiating WebAssembly code, returning both a Module and its first Instance. WebAssembly.Memory() A WebAssembly.Memory object is a resizable ArrayBuffer that holds the raw bytes of memory ac...
...And 40 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
Introduction When Netscape started the Mozilla browser, it made the conscious decision to sup
port W3C standards. As a result, Mozilla is not fully backwards-compatible with Netscape Navigator 4.x and Microsoft Internet Explorer legacy code; for example, Mozilla does not sup
port <layer> as I will discuss later. Browsers, like Internet Explorer 4, that were built before the conception of W3C standards inherited many quirks. In this article, I will describe Mozilla's quirks mode, which provides strong backwards HTML compatibility with Internet Explorer and other legacy browsers. I'll also cover nonstandard technologies, such as XMLHttpRequest and rich text editing, that Mozilla does sup
port because no W3C equivalent existed at the time. They include: HTML 4.01, XHTML 1.0 and XHTML 1.
...1.0 XML Path Language: XPath 1.0 Resource Description Framework: RDF Simple Object Access Protocol: SOAP 1.1 ECMA-262, revision 3 (JavaScript 1.5): ECMA-262 General cross-browser coding tips Even though Web standards do exist, different browsers behave differently (in fact, the same browser may behave differently depending on the platform). Many browsers, such as Internet Explorer, also sup
port pre-W3C APIs and have never added extensive sup
port for the W3C-compliant ones. Before I go into the differences between Mozilla and Internet Explorer, I'll cover some basic ways you can make a Web application extensible in order to add new browser sup
port later. Since different browsers sometimes use different APIs for the same functionality, you can often find multiple if() else() blocks thro...
...browsers sometimes use different APIs for the same functionality, you can often find multiple if() else() blocks throughout the code to differentiate between the browsers. The following code shows blocks designated for Internet Explorer: . . . ...
...And 39 more matches
Guide to the Fullscreen API - Web APIs
t (checking it prefixed with both moz, ms, or webkit). If it's null, the document is currently in windowed mode, so we need to switch to fullscreen mode. Switching to fullscreen mode is done by calling element.requestFullscreen(). If fullscreen mode is already active (fullscreenElement is non-null), we call document.exitFullscreen(). Prefixing Note: Currently, only Firefox 64 and Chrome 71 sup
ports this unprefixed. For the moment not all browsers are implementing the unprefixed version of the API (for vendor agnostic access to the Fullscreen API you can use Fscreen). Here is the table summarizing the prefixes and name differences between them: Standard WebKit (Safari) / Blink (Chrome & Opera) / Edge Gecko (Firefox) Internet Explorer Document.fullscreen ...
...ibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 39 more matches
WebAssembly - JavaScript
() constructors. Providing facilities to handle errors that occur in WebAssembly via the WebAssembly.CompileError()/WebAssembly.LinkError()/WebAssembly.RuntimeError() constructors. Constructor properties WebAssembly.CompileError() Indicates an error during WebAssembly decoding or validation. WebAssembly.Global() Represents a global variable instance, accessible from both JavaScript and im
portable/ex
portable across one or more WebAssembly.Module instances. This allows dynamic linking of multiple modules. WebAssembly.Instance() Is a stateful, executable instance of a WebAssembly.Module WebAssembly.LinkError() Indicates an error during module instantiation (besides traps from the start function). WebAssembly.Memory() An object whose buffer property is a resizable ArrayBuffer that h...
...mo on GitHub, and view it live also) directly streams a .wasm module from an underlying source then compiles and instantiates it, the promise fulfilling with a ResultObject. Because the instantiateStreaming() function accepts a promise for a Response object, you can directly pass it a WindowOrWorkerGlobalScope.fetch() call, and it will pass the response into the function when it fulfills. var im
portObject = { im
ports: { im
ported_func: arg => console.log(arg) } }; WebAssembly.instantiateStreaming(fetch('simple.wasm'), im
portObject) .then(obj => obj.instance.ex
ports.ex
ported_func()); The ResultObject's instance member is then accessed, and the contained ex
ported function invoked. Specifications Specification WebAssembly JavaScript InterfaceThe definition of 'WebAssemb...
...lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 39 more matches
Image file type and format guide - Web media technologies
In this guide, we'll cover the image file types generally sup
ported by web browsers, and provide insights that will help you select the most appropriate formats to use for your site's imagery. Common image file types There are many image file formats in the world. However, the ones listed below are generally recognized as usable on the Web, though BMP is generally not recommended as browser sup
port is potentially constrained; it should usually be avoided for web content. Abbreviation File format MIME type File extension(s) Browser compatibility APNG Animated
Portable Network Graphics image/apng .apng Chrome, Edge, Firefox, Opera, Safari BMP Bitmap file image/bmp .bmp Chrome, Edge, Firefox, Internet Explorer, Opera, Safari ...
... Interchange Format image/gif .gif Chrome, Edge, Firefox, Internet Explorer, Opera, Safari ICO Microsoft Icon image/x-icon .ico, .cur Chrome, Edge, Firefox, Internet Explorer, Opera, Safari JPEG Joint Photographic Expert Group image image/jpeg .jpg, .jpeg, .jfif, .pjpeg, .pjp Chrome, Edge, Firefox, Internet Explorer, Opera, Safari PNG
Portable Network Graphics image/png .png Chrome, Edge, Firefox, Internet Explorer, Opera, Safari SVG Scalable Vector Graphics image/svg+xml .svg Chrome, Edge, Firefox, Internet Explorer, Opera, Safari TIFF Tagged Image File Format image/tiff .tif, .tiff None built-in; add-ons required WebP Web Picture format image/webp .webp Chrom...
... In the tables below, the term bits per component refers to the number of bits used to represent each color component. For example, an RGB color depth of 8 indicates that each of the red, green, and...
...And 39 more matches
Starting WebLock
s a good way for objects to pass messages to each other without the objects having explicit knowledge of one another. Usually, there is one object notifying a group of observers. For example, an object may be created and have its observe method called at startup, or it may register to be notified prior to XPCOM shutdown. The method at the core of this interface is observe: void observe(in nsISup
ports aSubject, in string aTopic, in wstring aData); There aren't really any restrictions on what the three parameters (aSubject, aTopic and aData) may represent. These parameters are defined according to the event being observed. For example, in the case of the XPCOM shutdown observation, aSubject and aData are not defined, and aTopic is defined as the string "xpcom-shutdo...
...generic interface for passing messages between two or more objects without defining a specific frozen interface, and it's one of the ways in which extensibility is built into XPCOM. The implementation of the nsIObserver interface in the WebLock component is similar to the implementation for the nsIFactory interface. XXX what is Example 2?Following Example 2, you change the class definition to sup
port the nsIObserver interface and change NS_IMPL_ISUP
PORTS1 so that the QueryInterface implementation knows that the component also sup
ports nsIObserver. The WebLock class definition with sup
port for startup observation is below. class WebLock: public nsIObserver { public: WebLock(); virtual ~WebLock(); NS_DECL_ISUP
PORTS NS_DECL_NSIOBSERVER }; NS_IMPL_ISUP
PORTS1(WebLock, nsIObser...
...e event the object is expecting. When there is a match, you can handle the event any way you see fit. If the object has only registered for one notification, then you can ignore the aTopic string and simply handle the event as it occurs. In other words, the Observe method should never be called in response to some event for which the object is not registered. NS_IMETHODIMP WebLock::Observe(nsISup
ports *aSubject, const char *aTopic, const PRUnichar *aData) { return NS_OK; } Notification via the observer service is somewhat indirect. The only way to register directly for a notification via the observer service is to instantiate an nsIObserver object. This works for most cases, but consider the case when you have this notification create a component. Since t...
...And 38 more matches
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
Note: :matches() was renamed to :is() in CSSWG issue #3258. The :is() CSS pseudo-class function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list. This is useful for writing large selectors in a more compact form. Note that currently browsers sup
port this functionality as :matches(), or through an older, prefixed pseudo-class -- :any(), including older versions of Chrome, Firefox, and Safari. :any() works in exactly the same way as :matches()/:is(), except that it requires vendor prefixes and doesn't sup
port complex selectors. /* Selects any paragraph inside a header, main or footer element that is being hovered */ :is(header, main, footer) p:hover { color: red; cursor: pointer; } /* The above is equivalent ...
...For example, the following CSS: /* 3-deep (or more) uno...
... Difference between :is() and :where() The diffference between the two is that :is() counts towards the specificity...
...And 38 more matches
max-width - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 37 more matches
Modularization techniques - Archive of obsolete content
re C++ pure virtual interfaces. A pure virtual interface is simply a class where every method is defined as pure virtual, that is: virtual int foo(int bar) = 0; Pure virtual interfaces provide an easy mechanism for passing function tables between modules that may reside in separate, possibly dynamically loaded, libraries. Each interface is assigned a unique Interface Identifier, or IID. nsISup
ports The key interface in our model is the nsISup
ports interface, our equivalent to COM's IUnknown interface. nsISup
ports provides two key features, interface interrogation and reference counting. Interface interrogation is a simple, uniform mechanism for determining which interfaces a object sup
ports, and for hiding the the mechanics of how the object was implemented. Interface interrogation is pe...
... Reference counting is performed using the AddRef() and Release() methods. An objects reference count generally starts at zero. AddRef() increments that reference count, and Release() decrements it. ...
...ly free itself. A successful QueryInterface() will call AddRef() on the requested interface before returning. Both AddRef() and Release() return the resulting reference count. The convenience macros NS_ADDREF() and NS_RELEASE() are preferred over calling AddRef and Release directly. In debug builds, these macros provide useful reference counting logs. Use them wherever possible. /* * The nsISup
ports interface */ class nsISup
ports { public: NS_IMETHOD QueryInterface(const nsIID &aIID, void **aResult) = 0; NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; NS_IMETHOD_(nsrefcnt) Release(void) = 0; }; The NS_IMETHOD and NS_IMETHOD_(type) macros are basically shorthand for virtual nsresult and virtualtype. On Windows they expand to virtual nsresult __stdcall an...
...And 36 more matches
Mozilla Crypto FAQ - Archive of obsolete content
Note that this document is for your information only and is not intended as legal advice. If you wish to develop and distribute cryptographic software, particularly for commercial sale or distribution, then you should consult an attorney with expertise in the particular laws and regulations that apply in your jurisdiction. ...
...uld consult an attorney with expertise in the particular laws and regulations that apply in your jurisdiction. I've updated this version of the Mozilla Crypto FAQ to discuss the situation now that the RSA public key algorithm is in the public domain and a full open source crypto implementation is being added to the Mozilla code base. Information in the FAQ also reflects the new U.S. ...
...n the public domain and a full open source crypto implementation is being added to the Mozilla code base. Information in the FAQ also reflects the new U.S. encryption ex
port regulations published on January 14, 2000, the release on February 11, 2000, of source code for SSL, S/MIME, and general PKI functionality for use in the Mozilla project, and the "Bernstein advisory" issued by the Bureau of Ex
port Administration on February 17, 2000. The questions in this FAQ address Mozilla's sup
port for encryption and related security functionality, information im
portant to Mozilla contributors relating to encryption functionality in Mozilla, and general questions on U.S. regulation of encryption technology. Cryptographic functionality in Mozilla Have all the issues with Mozilla and crypto now been re...
...And 36 more matches
Browser Feature Detection - Archive of obsolete content
This article has generally never been more than a way to show off Firefox Web compatibility, rather than something truly informative in a broader sense. ...
... This article has generally never been more than a way to show off Firefox Web compatibility, rather than something truly informative in a broader sense. ...
... This article has generally never been more than a way to show off Firefox Web compatibility, rather than something truly informative in a broader sense. Therefore, given that it's also badly out of date, it's been archived. ...
...And 36 more matches
max-height - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 36 more matches
position - CSS: Cascading Style Sheets
es of top, right, bottom, and left. This value creates a new stacking context when the value of z-index is not auto. The margins of absolutely positioned boxes do not collapse with other margins. fixed The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to the initial containing block established by the view
port, except when one of its ancestors has a transform, perspective, or filter property set to something other than none (see the CSS Transforms Spec), in which case that ancestor behaves as the containing block. (Note that there are browser inconsistencies with perspective and filter contributing to containing block formation.) Its final position is determined by the values of top, right, bottom, and...
...This can be used to create a "floating" element that stays in the same position regardless of scrolling. In the example below, box "One" is fixed at 80 pixels from the top of the page and...
...none (see CSS Transforms Spec), which then causes that ancestor to take the place of the elements containing block. This can be used to create a "floating" element that stays in the same position regardless of scrolling. In the example below, box "One" is fixed at 80 pixels from the top of the page and 10 pixels from the left. Even after scrolling, it remains in the same place relative to the view
port. HTML <div class="outer"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam congue tortor eget pulvinar lobortis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam ac dolor augue. Pellentesque mi mi, laoreet et dolor sit amet, ultrices varius risus. Nam vitae iaculis elit. Aliquam mollis interdum libero. Sed sodales plac...
...And 36 more matches
Working with Svelte stores - Learn web development
ation arrives the Alert component will be in charge of displaying it on screen. Creating a store Let's start by creating a writable store. Any component will be able to write to this store, and the Alert component will subscribe to it and display a message whenever the store is modified. Create a new file -- stores.js -- inside your src directory. Give it the following content: im
port { writable } from 'svelte/store' ex
port const alert = writable('Welcome to the To-Do list app!') Note: Stores can be defined and used outside of Svelte components, so you can organize them in any way you please. In the above code we im
port the writable() function from svelte/store and use it to create a new store called alert with an initial value of "Welcome to the To-Do list app!". We t...
...table } from 'svelte/store' ex
port const alert = writable('Welcome to the To-Do list app!') Note: Stores can be defined and used outside of Svelte components, so you can organize them in any way you please. In the above code we im
port the writable() function from svelte/store and use it to create a new store called alert with an initial value of "Welcome to the To-Do list app!". We then ex
port the store. Creating the actual component Let's now create our Alert component and see how we can read values from the store. Create another new file named src/components/Alert.svelte. ...
...table() function from svelte/store and use it to create a new store called alert with an initial value of "Welcome to the To-Do list app!". We then ex
port the store. Creating the actual component Let's now create our Alert component and see how we can read values from the store. Create another new file named src/components/Alert.svelte. ...
...And 35 more matches
IDBKeyRange - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 35 more matches
DMD
Originally, this was the only mode that DMD had, which explains DMD's name. This is the default mode. "Live" mode. In this mode, DMD tracks the current contents of the heap. ...
...Originally, this was the only mode that DMD had, which explains DMD's name. This is the default mode. "Live" mode. In this mode, DMD tracks the current contents of the heap. ...
...Originally, this was the only mode that DMD had, which explains DMD's name. This is the default mode. "Live" mode. In this mode, DMD tracks the current contents of the heap. ...
...And 34 more matches
IDBFactory - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 34 more matches
URLUtilsReadOnly - Web APIs
art of the affected interfaces. Properties This interface doesn't inherit any properties. URLUtilsReadOnly.href Read only Is a DOMString containing the whole URL. URLUtilsReadOnly.protocol Read only Is a DOMString containing the protocol scheme of the URL, including the final ':'. URLUtilsReadOnly.host Read only Is a DOMString containing the host, that is the hostname, a ':', and the
port of the URL. URLUtilsReadOnly.hostname Read only Is a DOMString containing the domain of the URL. URLUtilsReadOnly.origin Read only Returns a DOMString containing the canonical form of the origin of the specific location. URLUtilsReadOnly.
port Read only Is a DOMString containing the
port number of the URL. URLUtilsReadOnly.pathname Read only Is a DOMString containing an initial '/' fol...
... compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 34 more matches
Codecs used by WebRTC - Web media technologies
users communicate in real time, using audio and/or video as well as optional data and other information. To communicate, the two devices need to be able to agree upon a mutually-understood codec for each track so they can successfully communicate and present the shared media. ...
...r codecs that some or all browsers sup
port for WebRTC. Containerless media WebRTC uses bare MediaStreamTrack objects for each track being shared from one peer to another, without a container or even a MediaStream associated with the tracks. Which codecs can be within those tracks is not mandated by the WebRTC specification. However, RFC 7742 specifies that all WebRTC-compatible browsers must sup
port VP8 and H.264's Constrained Baseline profile for video, and RFC 7874 specifies that browsers must sup
port at least the Opus codec as well as G.711's PCMA and PCMU formats. These two RFCs also lay out options that must be sup
ported for each codec, as well as specific user comfort features such as echo cancelation. This guide reviews the codecs that browsers are required to implement as well as ot...
...ofile for video, and RFC 7874 specifies that browsers must sup
port at least the Opus codec as well as G.711's PCMA and PCMU formats. These two RFCs also lay out options that must be sup
ported for each codec, as well as specific user comfort features such as echo cancelation. This guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers sup
port for WebRTC. While compression is always a necessity when dealing with media on the web, it's of additional im
portance when videoconferencing in order to ensure that the participants are able to communicate without lag or interruptions. ...
...And 34 more matches
Introduction to SSL - Archive of obsolete content
Introduction This document introduces the Secure Sockets Layer (SSL) protocol. SSL has been universally accepted on the World Wide Web for authenticated and encrypted communication between clients and servers. The SSL Protocol Ciphers Used with SSL The SSL Handshake The new Internet Engineering Task Force (IETF) standard protocol called Trans
port Layer Security (TLS) is based on SSL. ...
...for authenticated and encrypted communication between clients and servers. The SSL Protocol Ciphers Used with SSL The SSL Handshake The new Internet Engineering Task Force (IETF) standard protocol called Trans
port Layer Security (TLS) is based on SSL. The details of the protocol are available in Request For Comments (RFC): 2246,The TLS Protocol Version 1.0. Some Red Hat products already sup
port TLS. Most other Red Hat products plan to sup
port the protocol in future versions. This document is primarily intended for administrators of Red Hat server products, but the information it contains may also be useful for developers of applications that sup
port SSL. The document assumes that you are familiar with the basic concepts of public-key cryptography, as summarized in "Introduction to Publ...
... for administrators of Red Hat server products, but the information it contains may also be useful for developers of applications that sup
port SSL. The document assumes that you are familiar with the basic concepts of public-key cryptography, as summarized in "Introduction to Public-Key Cryptography." The SSL Protocol The Transmission Control Protocol/Internet Protocol (TCP/IP) governs the trans
port and routing of data over the Internet. Other protocols, such as the HyperText Trans
port Protocol (HTTP), Lightweight Directory Access Protocol (LDAP), or Internet Messaging Access Protocol (IMAP), run "on top of" TCP/IP in the sense that they all use TCP/IP to sup
port typical application tasks such as displaying web pages or running email servers. The SSL protocol runs above TCP/IP and below h...
...And 33 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
events. Create a new file -- components/MoreActions.svelte. When the first button is clicked, we'll emit a checkAll event to signal that all the todos should be checked/unchecked. When the second button is clicked, we'll emit a removeCompleted event to signal that all of the completed todos should be removed. ...
...> <div class="btn-group"> <button type="button" class="btn btn__primary" on:click={checkAll}>{completed ? 'Check' : 'Uncheck'} all</button> <button type="button" class="btn btn__primary" on:click={removeCompleted}>Remove completed</button> </div> We've also included a completed variable to toggle between checking and unchecking all tasks. ...
...ton> <button type="button" class="btn btn__primary" on:click={removeCompleted}>Remove completed</button> </div> We've also included a completed variable to toggle between checking and unchecking all tasks. Back over in Todos.svelte, we are going to im
port our MoreActions component and create two functions to handle the events emitted by the MoreActions component. ...
...And 33 more matches
An Overview of XPCOM
ntly of one another. In order to allow interoperability between components within an application, XPCOM separates the implementation of a component from the interface, which we discuss in Interfaces. ...
...of these components, services that help the developer write modular cross-platform code, and versioning sup
port, so that components can be replaced or upgraded without breaking or having to recreate the application. Using XPCOM, developers create components that can be reused in different applications or that can be replaced to change the functionality of existing applications. ...
...age passing memory management We will discuss the above items in detail in the coming chapters, but for now, it can be useful to think of XPCOM as a platform for component development, in which features such as those listed above are provided. Gecko Although it is in some ways structurally similar to Microsoft COM, XPCOM is designed to be used principally at the application level. The most im
portant use of XPCOM is within Gecko, an open source, standards compliant, embeddable web browser and toolkit for creating web browsers and other applications. XPCOM is the means of accessing Gecko library functionality and embedding or extending Gecko. This book focuses on the latter - extending Gecko - but the fundamental ideas in the book will be im
portant to developers embedding Gecko as well. G...
...And 31 more matches
FileSystemEntry - Web APIs
le or a directory (directories are represented by the DirectoryEntry interface). It includes methods for working with files--including copying, moving, removing, and reading files--as well as information about a file it points to--including the file name and its path from the root to the entry. Because this is a non-standard API, whose specification is not currently on a standards track, it's im
portant to keep in mind that not all browsers implement it, and those that do may implement only small
portions of it. Check the Browser compatibility section for details. Basic concepts You don't create FileSystemEntry objects directly. Instead, you will receive an object based on this interface through other APIs. This interface serves as a base class for the FileSystemFileEntry and FileSystemDir...
... table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 30 more matches
font-variant - CSS: Cascading Style Sheets
aps, all-small-caps, petite-caps, all-petite-caps, unicase, titling-caps Specifies the keywords and functions related to the font-variant-caps longhand property. <numeric-figure-values>, <numeric-spacing-values>, <numeric-fraction-values>, ordinal, slashed-zero Specifies the keywords related to the font-variant-numeric longhand property. The possible values are: lining-nums, oldstyle-nums, pro
portional-nums, tabular-nums, diagonal-fractions, stacked-fractions, ordinal, and slashed-zero. <east-asian-variant-values>, <east-asian-width-values>, ruby Specifies the keywords related to the font-variant-east-asian longhand property. The possible values are: jis78, jis83, jis90, jis04, simplified, traditional, full-width, pro
portional-width, ruby. Formal definition Initial valuenormalApplies ...
...-lig-values> = [ common-ligatures | no-common-ligatures ]<discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]<historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]<contextual-alt-values> = [ contextual | no-contextual ]<feature-value-name> = <custom-ident><numeric-figure-values> = [ lining-nums | oldstyle-nums ]<numeric-spacing-values> = [ pro
portional-nums | tabular-nums ]<numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ]<east-asian-variant-values> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]<east-asian-width-values> = [ full-width | pro
portional-width ] Examples Setting the small-caps font variant HTML <p class="normal">Firefox rocks!</p> <p class="small">Firefox rocks!</p> CSS p.normal { fo...
...he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 30 more matches
CSS3 - Archive of obsolete content
already became a standard as a W3C Recommendation. These should be no more changes. CSS Color Module Level 3 Recommendation since June 7th, 2011 Adds the opacity property, and the hsl(), hsla(), rgba() and rgb() functions to create <color> values. It also defines the currentcolor keyword as a valid color. ...
...es the currentcolor keyword as a valid color. The transparent color is now a real color (thanks to the sup
port for the alpha channel) and is a now an alias for rgba(0,0,0,0.0). It deprecates the system-color keywords that shouldn't be used in a production environment anymore. CSS Namespaces Module Recommendation since September 29th, 2011 Adds the sup
port for the XML Namespaces by defining the notion of CSS qualified name, using the ' | ' syntax and adding the @namespace CSS at-rule. Selectors Level 3 Recommendation since September 29th, 2011 Adds: Substring matching attribute selectors, E[attribute^="value"], E[attribute$="value"], E[attribute*="value"] . New pseudo-classes: :target, :enabled a...
...ly screen and (color) . Media queries are not only used in CSS document but also in some attributes of HTML Elements, like the media attribute of the <link> element. The next iteration of this specification is in the work, allowing to tailor a Web site regarding the input methods available on the user agent, with new media features like hover or pointer. Detection of EcmaScript sup
port, using the script media features is also proposed. CSS Style Attributes Recommendation since November 7th, 2013 Formally defines the syntax of the content of the HTML style global attribute. CSS Fonts Module Level 3 Candidate Recommendation since September 20th, 2018 Amends the CSS2.1 Font matching algorithm to be closer to what is really i...
...And 29 more matches
Multiple-column layout - Learn web development
mn. column-count example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 Arial, Helvetica, sans-serif; } <div class="container"> <h1>Simple multicol example</h1> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. Duis felis orci, pulvinar id metus ut, rutrum luctus orci. Cras
porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. Sed auctor cursus massa at
porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula. Curabitur vehicula tellus neque, ac ornare ex malesuada et. In vitae convallis lacus. Aliquam erat volutpat. Suspendisse ac imperdiet turpis. Aenean finibus sollicitudin eros pharetra congue. Duis ornare egestas augue ut luctus...
...at width. column-width example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 Arial, Helvetica, sans-serif; } <div class="container"> <h1>Simple multicol example</h1> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. Duis felis orci, pulvinar id metus ut, rutrum luctus orci. Cras
porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. Sed auctor cursus massa at
porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula. Curabitur vehicula tellus neque, ac ornare ex malesuada et. In vitae convallis lacus. Aliquam erat volutpat. Suspendisse ac imperdiet turpis. Aenean finibus sollicitudin eros pharetra congue. Duis ornare egestas augue ut luctus...
...incidunt eget purus in interdum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </div> .container { column-width: 200px; } Styling the columns The columns created by multicol cannot be styled individually. There is no way to make one column bigger than other columns, or to change the background or text color of a single column. You have two op
portunities to change the way that columns display: Changing the size of the gap between columns using the column-gap. Adding a rule between columns with column-rule. Using your example above, change the size of the gap by adding a column-gap property: .container { column-width: 200px; column-gap: 20px; } You can play around with different values -- the property accepts any length unit. No...
...And 28 more matches
Index
ntime SpiderMonkey Standalone source code releases can be found on the Releases page. 2 Creating JavaScript tests Automated testing, Build documentation, Guide, QA, SpiderMonkey In which test suite does your new test belong? 3 Creating JavaScript jstest reftests ECMAScript, Guide, JavaScript, test In the js/src/tests directory, there are a few im
portant subdirectories. 4 FOSS Guide, SpiderMonkey Feel free to add your own SpiderMonkey-based open source projects (and if necessary add categories)! 5 Future directions Guide, Mozilla, SpiderMonkey This article documents future directions in functionality, design, and coding practices for SpiderMonkey. It can be read as something like an "ideal future state...
...ion fails when calling pod_{calloc,realloc}CanGC, the JS engine may call the large-allocation- failure callback, if set, to allow the embedding to flush caches, possibly perform shrinking GCs, etc. to make some room. The allocation will then be retried (and may still fail.) 68 JS::SetOutOfMemoryCallback JSAPI Reference, Reference, Reference(2), SpiderMonkey Unlike the error re
porter, which is only called if the exception for an OOM bubbles up and is not caught, the JS::OutOfMemoryCallback is called immediately at the OOM site to allow the embedding to capture the current state of heap allocation before anything is freed. If the large-allocation-failure callback is called at all (not all allocation sites call the large-allocation-failure callback on failure), it is called b...
...ould define any remaining lazy properties that should be enumerable but are not yet defined in obj. This hook does not implement iteration: once the properties are defined, the JavaScript engine can enumerate them. 97 JSErrorFormatString JSAPI Reference, Reference, Reference(2), SpiderMonkey JSErrorFormatString is a struct to represent error message and type, returned by JS_Re
portErrorNumber function. 98 JSErrorRe
port JSAPI Reference, SpiderMonkey JSErrorRe
port describes a single error that occurs in the execution of script. 99 JSExceptionState JSAPI Reference, SpiderMonkey A JSExceptionState object is returned by the JS_SaveExceptionState function, and is passed to functions JS_RestoreExceptionState and JS_DropExceptionState. ...
...And 28 more matches
PushEvent - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetPushEvent ExperimentalChrome Full sup
port 42Edge Full sup
port 16Disabled Full sup
port 16Disabled Disabled From version 16: this feature is behind the Enable service workers preference. ...
...And 28 more matches
MSGestureEvent - Web APIs
ity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 27 more matches
background-size - CSS: Cascading Style Sheets
se the first sets the width and the second sets the height. Each value can be a <length>, a <percentage>, or auto. To specify the size of multiple background images, separate the value for each one with a comma. Values contain Scales the image as large as possible without cropping or stretching the image. cover Scales the image as large as possible without stretching the image. If the pro
portions of the image differ from the element, it is cropped either vertically or horizontally so that no empty space remains. auto Scales the background image in the corresponding direction such that its intrinsic pro
portions are maintained. <length> Stretches the image in the corresponding dimension to the specified length. Negative values are not allowed. <percentage> Stretches the image in t...
...ied length. Negative values are not allowed. <percentage> Stretches the image in the corresponding dimension to the specified percentage of the background positioning area. The background positioning area is determined by the value of background-origin (by default, the padding box). However, if the background's background-attachment value is fixed, the positioning area is instead the entire view
port. Negative values are not allowed. Intrinsic dimensions and pro
portions The computation of values depends on the image's intrinsic dimensions (width and height) and intrinsic pro
portions (width-to-height ratio). These attributes are as follows: A bitmap image (such as JPG) always has intrinsic dimensions and pro
portions. A vector image (such as SVG) does not necessarily have intrinsic dimen...
... values depends on the image's intrinsic dimensions (width and height) and intrinsic pro
portions (width-to-height ratio). These attributes are as follows: A bitmap image (such as JPG) always has intrinsic dimensions and pro
portions. A vector image (such as SVG) does not necessarily have intrinsic dimensions. If it has both horizontal and vertical intrinsic dimensions, it also has intrinsic pro
portions. If it has no dimensions or only one dimension, it may or may not have pro
portions. CSS <gradient>s have no intrinsic dimensions or intrinsic pro
portions. Background images created with the element() function use the intrinsic dimensions and pro
portions of the generating element. Note: The behavior of <gradient>s changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5). Befor...
...And 27 more matches
break-before - CSS: Cascading Style Sheets
tetur adipiscing elit. Nulla vitae fringilla mauris. Quisque commodo eget nisi sed pretium. Mauris luctus nec lacus in ultricies. Mauris vitae hendrerit arcu, ac scelerisque lacus. Aliquam lobortis in lacus sit amet posuere. Fusce iaculis urna id neque dapibus, eu lacinia lectus dictum.</p> <h2>Subheading</h2> <p>Praesent condimentum dui dui, sit amet rutrum diam tincidunt eu. Cras suscipit
porta leo sit amet rutrum. Sed vehicula ornare tincidunt. Curabitur a ipsum ac diam mattis volutpat ac ut elit. Nullam luctus justo non vestibulum gravida. Morbi metus libero, pharetra non
porttitor a, molestie nec nisi.</p> <h2>Subheading</h2> <p>Vivamus eleifend metus vitae neque placerat, eget interdum elit mattis. Donec eu vulputate nibh. Ut turpis leo, malesuada quis nisl nec, volutpat eges...
...nisi.</p> <h2>Subheading</h2> <p>Vivamus eleifend metus vitae neque placerat, eget interdum elit mattis. Donec eu vulputate nibh. Ut turpis leo, malesuada quis nisl nec, volutpat egestas tellus. <h2>Subheading</h2> <p>In finibus viverra enim vel suscipit. Quisque consequat velit eu orci malesuada, ut interdum tortor molestie. Proin sed pellentesque augue. Nam risus justo, faucibus non
porta a, congue vel massa. Cras luctus lacus nisl, sed tincidunt velit pharetra ac. Duis suscipit faucibus dui sed ultricies.</p> </article> CSS html { font-family: helvetica, arial, sans-serif; } h1 { font-size: 3rem; letter-spacing: 2px; column-span: all; } h2 { font-size: 1.2rem; color: red; letter-spacing: 1px; break-before: column; } p { line-height: 1.5; } article { col...
... 'break-before' in that specification. Working Draft Initial definition. Extends the CSS 2.1 page-break-before property to handle both page and column breaks. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 27 more matches
FileSystemFlags - Web APIs
table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...o contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetFileSystemFlags ExperimentalChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port <=79Prefixed Full sup
port <=79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox Full sup
port 50IE No sup
port NoOpera No sup
port NoSafari No sup
port ...
...And 26 more matches
Index - Learn web development
learning area. This set of articles aims to provide complete beginners to web development with all that they need to start coding websites. 2 Accessibility ARIA, Accessibility, Articles, Beginner, CSS, CodingScripting, HTML, JavaScript, Landing, Learn, Module Learning some HTML, CSS, and JavaScript is useful if you want to become a web developer. Beyond mechanical use, it's im
portant to learn how to use these technologies responsibly so that all readers might use your creations on the web. To help you achieve this, this module will cover general best practices (which are demonstrated throughout the HTML, CSS, and JavaScript topics), cross browser testing, and some tips on enforcing accessibility from the start. We'll cover accessibility in special detail. 3 Acce...
...aim of this skill test is to assess whether you've understood our WAI-ARIA basics article. 12 What is accessibility? AT, Accessibility, Article, Beginner, CSS, CodingScripting, HTML, JavaScript, Learn, Tools, Users, assistive technology, keyboard, screan reader, screenreader This article should have given you a useful high-level overview of accessibility, shown you why it's im
portant, and looked at how you can fit it into your workflow. You should now also have a thirst to learn about the implementation details that can make sites accessible, and we'll start on that in the next section, looking at why HTML is a good basis for accessibility. 13 Aprender y obtener ayuda Beginner, Learn, Learning, Web Development, getting help It is great that you are put...
...argon. Don't worry, we won't overwhelm you with all of it (we have a glossary if you're curious). However, there are a few basic terms you need to understand at the outset, since you'll hear these expressions all the time as you read on. It's easy to confuse these terms sometimes since they refer to related but different functionalities. In fact, you'll sometimes see these terms misused in news re
ports and elsewhere, so getting them mixed up is understandable! 33 What software do I need to build a website? Beginner, NeedsActiveLearning, WebMechanics You can download most of the programs you need for web development for free. We'll provide a few links in this article. 34 What text editors are available? Beginner, Composing, Guide, Tools, text editor A w...
...And 25 more matches
WebAssembly.Table - JavaScript
instance with an initial size of 2 elements. We then print out the table length and contents of the two indexes (retrieved via Table.prototype.get() to show that the length is two and both elements are null. var tbl = new WebAssembly.Table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" We then create an im
port object that contains the table: var im
portObj = { js: { tbl:tbl } }; Finally, we load and instantiate a wasm module (table2.wasm) using the WebAssembly.instantiateStreaming() method. The table2.wasm module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the im
ported table (see text representation). So after instantiatio...
... } }; Finally, we load and instantiate a wasm module (table2.wasm) using the WebAssembly.instantiateStreaming() method. The table2.wasm module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the im
ported table (see text representation). So after instantiation, the table still has length 2, but the elements now contain callable Ex
ported WebAssembly Functions which we can call from JS. ...
...ethod. The table2.wasm module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the im
ported table (see text representation). So after instantiation, the table still has length 2, but the elements now contain callable Ex
ported WebAssembly Functions which we can call from JS. WebAssembly.instantiateStreaming(fetch('table2.wasm'), im
portObject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); }); Note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored inside it (e.g. get(0)() rather than get(0)) . This example shows that we're creating and accessing the table from ...
...And 25 more matches
nsIMsgFolder
The nsIMsgFolder interface is used to interact with folders in Thunderbird. This page is out of date. Check //github.com/RealityRipple/UXP/blob/master/mailnews/base/public/nsIMsgFolder.idl for the newer methods (esp. isSpecialFolder and such). ...
...such). ...
...MsgWindow msgWindow); void createSubfolder(in AString folderName, in nsIMsgWindow msgWindow); nsIMsgFolder addSubfolder(in AString folderName); void createStorageIfMissing(in nsIUrlListener urlListener); void compact(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow); void compactAll(in nsIUrlListener aListener, innsIMsgWindow aMsgWindow,in nsISup
portsArray aFolderArray, in boolean aCompactOfflineAlso,in nsISup
portsArray aOfflineFolderArray); void compactAllOfflineStores(in nsIMsgWindow aMsgWindow,in nsISup
portsArray aOfflineFolderArray); void emptyTrash(in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener); void rename(in AString name, in nsIMsgWindow msgWindow); void renameSubFolders( in nsIMsgWindow ms...
...And 24 more matches
GamepadEvent - Web APIs
Specifications Specification Status Comment GamepadThe definition of 'GamepadEvent' in that specification. ...
... GamepadThe definition of 'GamepadEvent' in that specification. ...
...pecification. ...
...And 24 more matches
Capabilities, constraints, and settings - Web APIs
t errors occur, and so forth. The result has been a lot of very fragile code, or a reliance on libraries which figure this stuff out for you, then implement polyfills to patch the holes in the implementation on your behalf. The twin concepts of constraints and capabilities let the browser and Web site or app exchange information about what constrainable properties the browser's implementation sup
ports and what values it sup
ports for each one. This article discusses capabilities and constraints, as well as media settings, and includes an example we call the Constraint Exerciser. The Constraint Exerciser lets you experiment with the results of different constraint sets being applied to the audio and video tracks coming from the computer's A/V input devices (such as its webcam and microphone). ...
...ttings, and includes an example we call the Constraint Exerciser. The Constraint Exerciser lets you experiment with the results of different constraint sets being applied to the audio and video tracks coming from the computer's A/V input devices (such as its webcam and microphone). Overview The process works like this (using MediaStreamTrack as an example): If needed, call MediaDevices.getSup
portedConstraints() to get the list of sup
ported constraints, which tells you what constrainable properties the browser knows about. This isn't always necessary, since any that aren't known will simply be ignored when you specify them--but if you have any that you can't get by without, you can start by checking to be sure they're on the list. Once the script knows whether the property or properties i...
...the list of sup
ported constraints, which tells you what constrainable properties the browser knows about. This isn't always necessary, since any that aren't known will simply be ignored when you specify them--but if you have any that you can't get by without, you can start by checking to be sure they're on the list. Once the script knows whether the property or properties it wishes to use are sup
ported, it can then check the capabilities of the API and its implementation by examining the object returned by the track's getCapabilities() method; this object lists each sup
ported constraint and the values or range of values which are sup
ported. Finally, the track's applyConstraints() method is called to configure the API as desired by specifying the values or ranges of values it wishes to use fo...
...And 24 more matches
requiredFeatures - SVG: Scalable Vector Graphics
This provides a way to design SVG that gracefully falls back when features aren't available. If the attribute is not present, then its implicit evaluated value is true. ...
...This provides a way to design SVG that gracefully falls back when features aren't available. If the attribute is not present, then its implicit evaluated value is true. ...
...t>, <g>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textPath>, <tref>, <tspan>, <use> html, body, svg { height: 100%; } text { fill: white; } <svg viewBox="0 0 250 45" xmlns="http://www.w3.org/2000/svg"> <g> <rect fill="forestgreen" x="10" y="10" height="25" width="230" /> <text x="20" y="27">requiredFeatures sup
ported</text> </g> <g requiredFeatures=""> <rect fill="crimson" x="10" y="10" height="25" width="230" /> <text x="20" y="27">requiredFeatures not sup
ported</text> </g> </svg> Usage notes Value <list-of-features> Default value true if not defined, false if null or empty string as value Animatable No <list-of-features> This is a list of fe...
...And 24 more matches
Handling common HTML and CSS problems - Learn web development
Previous Overview: Cross browser testing Next With the scene set, we'll now look specifically at the common cross-browser problems you will come across in HTML and CSS code, and what tools can be used to prevent problems from happening, or fix problems that occur. This includes linting code, handling CSS prefixes, using browser dev tools to track down problems, using polyfills to add sup
port into browsers, tackling responsive design problems, and more. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high level principles of cross browser testing. Objective: To be able to diagnose common HTML and CSS cross browser problems, and use appropriate tools and techniques to fix them. The trouble with HTML and CSS S...
...n developers don't take them seriously, in terms of making sure the code is well-crafted, efficient, and semantically describes the purpose of the features on the page. In the worst cases, JavaScript is used to generate the entire web page content and style, which makes your pages inaccessible, and less performant (generating DOM elements is expensive). In other cases, nascent features are not sup
ported consistently across browsers, which can make some features and styles not work for some users. Responsive design problems are also common -- a site that looks good in a desktop browser might provide a terrible experience on a mobile device, because the content is too small to read, or perhaps the site is slow because of expensive animations. Let's go forth and look at how we can reduce cross b...
...you are not missing any curly braces, and so on. The W3C has a CSS Validator available too, for this purpose. Linters Another good option to choose is a so-called Linter application, which not only points out errors, but can also flag up warnings about bad practices in your CSS, and other points besides. Linters can generally be customized to be stricter or more relaxed in their error/warning re
porting. There are many online linter applications, the best of which are probably Dirty Markup (HTML, CSS, JavaScript), and CSS Lint (CSS only). These allows you to paste your code into a window, and it will flag up any errors with crosses, which can then be hovered to get an error message informing you what the problem is. Dirty Markup also allows you to make fixes to your markup using the Clean bu...
...And 23 more matches
ByteLengthQueuingStrategy - Web APIs
this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetByteLengthQueuingStrategy ExperimentalChrome Full sup
port 59Edge Full sup
port 16Firefox Full sup
port 57Disabled Full sup
port 57Disabled Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true) and the javascript.options.streams preference (needs to be set to true). To change preferences in Firefox, visi...
... Full sup
port 57Disabled Full sup
port 57Disabled Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true) and the javascript.options.streams preference (needs to be set to true). ...
...And 23 more matches
CountQueuingStrategy - Web APIs
e on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...o contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetCountQueuingStrategy ExperimentalChrome Full sup
port 59Edge Full sup
port 16Firefox Full sup
port 57Disabled Full sup
port 57Disabled Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true) and the javascript.options.streams preference (needs to be set to true). To change preferences in Firefox, visi...
... Full sup
port 57Disabled Full sup
port 57Disabled Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true) and the javascript.options.streams preference (needs to be set to true). ...
...And 23 more matches
WebGL best practices - Web APIs
trum of expertise, and not only highlights dos and don'ts, but also details why. You can rely on this document to guide your choice of approach, and ensure you're on the right track no matter what browser or hardware your users run. General Topics Address and eliminate WebGL errors Your application should run without generating any WebGL errors (as returned by getError). Every WebGL error is re
ported in the Web Console as a JavaScript warning with a descriptive message. After too many errors (32 in Firefox), WebGL stops generating descriptive messages, which really hinders debugging. The only errors a well-formed page generates are OUT_OF_MEMORY and CONTEXT_LOST. Know your limits (and extensions) The availability of most WebGL extensions depends on the client system. When using WebGL ext...
...refox), WebGL stops generating descriptive messages, which really hinders debugging. The only errors a well-formed page generates are OUT_OF_MEMORY and CONTEXT_LOST. Know your limits (and extensions) The availability of most WebGL extensions depends on the client system. ...
...most WebGL extensions depends on the client system. When using WebGL extensions, if possible, try to make them optional by gracefully adapting to the case there they are not sup
ported. ...
...And 23 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
s looking at your site. But this is increasingly inefficient: browser sniffing is inherently error prone, and maintaining multiple copies of your code can turn out to be a nightmare. It is usually much better to create a single version of your code which doesn't care about what browser or platform is accessing the site, but instead uses feature tests to find out what code features the browser sup
ports or what the values of certain browser features are, and then adjusts the code appropriately. This tends to be termed responsive design or adaptive design, two related but different approaches. This is much more reliable, more maintainable, and more future proof. You don't get caught in the situation of having to bring out more new site versions as more new browsers and platforms come out, and a...
...ertain browser features are, and then adjusts the code appropriately. This tends to be termed responsive design or adaptive design, two related but different approaches. This is much more reliable, more maintainable, and more future proof. You don't get caught in the situation of having to bring out more new site versions as more new browsers and platforms come out, and adjust code as feature sup
port in existing browsers changes. There are disadvantages to this approach as well. If the content, layout, and functionality need to change greatly for different devices, it may not be such a good approach. Also, taking an existing site and adding responsiveness to it, to make it mobile/tablet friendly, can be a lot more effort than just creating a separate mobile site or app, especially if it is a...
...he basics of responsive design, if you need some more background information and basics. Fluid grids The best place to start is with fluid measurements for our application layout -- essentially, this means using a combination of percentages and ems/rems to size your containers and text, not fixed widths such as pixels. This has a lot of advantages in that the layout will adapt to different view
port dimensions. Let's look at an example. We've written a simple-but-fun prototype for an application called Snapshot, which takes a video stream from your webcam (using getUserMedia()) then allows you to capture stills from that video stream (using HTML5 <canvas>), and save them to a gallery. You can then view previously-captured images and delete them. Other articles will discuss the functionality...
...And 23 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
y.id1.stationery_folder", "imap://" + env_user + "@imap-int.int-evry.fr/Templates"); lockPref("mail.identity.id1.tmpl_folder_picker_mode", "0"); lockPref("mail.identity.id1.valid", true); //SMTP general lockPref("mail.smtp.defaultserver", "smtp1"); lockPref("mail.smtpserver.smtp1.auth_method", 0); lockPref("mail.smtpserver.smtp1.hostname", "smtp-int.int-evry.fr"); lockPref("mail.smtpserver.smtp1.
port", 25); lockPref("mail.smtpserver.smtp1.try_ssl", 0); lockPref("mail.smtpserver.smtp1.username", ""); lockPref("mail.smtpservers", "smtp1"); lockPref("mail.startup.enabledMailCheckOnce", true); lockPref("mailnews.quotingPrefs.version", 1); lockPref("mailnews.ui.threadpane.version", 5); /* 3) define here (because if set after "4)" below it doesn't work!) processLDAPValues which is eventually calle...
...ird-account-management-using-mcd/ // Identity defaultPref("mail.identity.id1.fullName", userInfo.cn ); defaultPref("mail.identity.id1.smtpServer", "smtp1" ); defaultPref("mail.identity.id1.useremail", userInfo.mail ); // IMAP server settings defaultPref("mail.server.server1.hostname", "myImap.server.com" ); defaultPref("mail.server.server1.name", userInfo.mail ); defaultPref("mail.server.server1.
port", 993 ); defaultPref("mail.server.server1.socketType", 3 ); defaultPref("mail.server.server1.type", "imap" ); defaultPref("mail.server.server1.userName", userInfo.mail ); // SMTP server settings defaultPref("mail.smtpserver.smtp1.authMethod", 3 ); defaultPref("mail.smtpserver.smtp1.description", "my Company Name" ); defaultPref("mail.smtpserver.smtp1.hostname", "mySmtp.server.com" ); defaultPref...
...ail.server.server1.socketType", 3 ); defaultPref("mail.server.server1.type", "imap" ); defaultPref("mail.server.server1.userName", userInfo.mail ); // SMTP server settings defaultPref("mail.smtpserver.smtp1.authMethod", 3 ); defaultPref("mail.smtpserver.smtp1.description", "my Company Name" ); defaultPref("mail.smtpserver.smtp1.hostname", "mySmtp.server.com" ); defaultPref("mail.smtpserver.smtp1.
port", 465 ); defaultPref("mail.smtpserver.smtp1.try_ssl", 3 ); defaultPref("mail.smtpserver.smtp1.username", userInfo.mail ); // Glue it all together defaultPref("mail.account.account1.identities", "id1" ); defaultPref("mail.account.account1.server", "server1" ); defaultPref("mail.accountmanager.accounts", "account1" ); defaultPref("mail.accountmanager.defaultaccount", "account1" ); defaultPref("mai...
...And 22 more matches
Componentizing our React app - Learn web development
ten, it's probably a component. That second bullet is especially valuable: making a component out of common UI elements allows you to change your code in one place and see those changes everywhere that component is used. You don't have to break everything out into components right away, either. Let's take the second bullet point as inspiration and make a component out of the most reused, most im
portant piece of the UI: a todo list item. Make a <Todo /> Before we can make a component, we should create a new file for it. In fact, we should make a directory just for our components. The following commands make a components directory and then, within that, a file called Todo.js. Make sure you're in the root of your app before you run these! mkdir src/components touch src/components/Todo.js Ou...
...ponent, we should create a new file for it. In fact, we should make a directory just for our components. The following commands make a components directory and then, within that, a file called Todo.js. ...
...alled Todo.js. Make sure you're in the root of your app before you run these! ...
...And 22 more matches
Creating the Component Code
ually need, however. Using XPCOM Utilities to Make Things Easier shows some simpler and more elegant ways to create an XPCOM component using generic macros, and this chapter is more about learning the basics. As in grade school when you learned long division, better tools like calculators come after you figure out what's actually happening. In this case, the long-hand implementation gives us an op
portunity to talk about various features of XPCOM. What We'll Be Working On The component we'll be working on in this book controls a special mode in your browser that prevents users from leaving the current domain or a set of safe domains. Once enabled, this "weblock" mode is password protected and persists until it is turned off by the password holder. It can be used to implement parental control...
...egistration Alternatives A Gecko embedding application may provide other ways to register XPCOM components. XPInstall, the cross-platform installation technology that Mozilla uses to install the browser and other components, is one such alternative. It is described further in Packaging WebLock. You should consult with the authors of the application you wish to extend to see if there are other sup
ported ways. Overview of the WebLock Module Source As we mentioned in the previous section, components have layers. There are three main parts to every XPCOM component. From the innermost and moving outward, the first object is the XPCOM object. This is the object that contains the business logic, that implements functionality such as starting a network download, implementing interfaces that listen ...
...reate an XPCOM component. Basic Structure of the WebLock Component Source weblock1.cpp that defines these classes and the code you need to create a basic component has the following structure: * required includes and constants * WebLock: public iWebLock * WebLockFactory: public nsIFactory * WebLockModule: public nsIModule In XPCOM, all of these classes also derive from the nsISup
ports base interface. Digging In: Required Includes and Constants Let's take a look at the first several lines of code in the component and discuss what they mean in XPCOM. The includes and definitions at the top of an XPCOM source file can give you an idea about some of the data types and techniques we'll be discussing more in the upcoming chapters. For example, MOZILLA_STRICT_API is a variable t...
...And 22 more matches
break-after - CSS: Cascading Style Sheets
tetur adipiscing elit. Nulla vitae fringilla mauris. Quisque commodo eget nisi sed pretium. Mauris luctus nec lacus in ultricies. Mauris vitae hendrerit arcu, ac scelerisque lacus. Aliquam lobortis in lacus sit amet posuere. Fusce iaculis urna id neque dapibus, eu lacinia lectus dictum.</p> <h2>Subheading</h2> <p>Praesent condimentum dui dui, sit amet rutrum diam tincidunt eu. Cras suscipit
porta leo sit amet rutrum. Sed vehicula ornare tincidunt. Curabitur a ipsum ac diam mattis volutpat ac ut elit. Nullam luctus justo non vestibulum gravida. Morbi metus libero, pharetra non
porttitor a, molestie nec nisi.</p> <h2>Subheading</h2> <p>Vivamus eleifend metus vitae neque placerat, eget interdum elit mattis. Donec eu vulputate nibh. Ut turpis leo, malesuada quis nisl nec, volutpat eges...
...nisi.</p> <h2>Subheading</h2> <p>Vivamus eleifend metus vitae neque placerat, eget interdum elit mattis. Donec eu vulputate nibh. Ut turpis leo, malesuada quis nisl nec, volutpat egestas tellus. <h2>Subheading</h2> <p>In finibus viverra enim vel suscipit. Quisque consequat velit eu orci malesuada, ut interdum tortor molestie. Proin sed pellentesque augue. Nam risus justo, faucibus non
porta a, congue vel massa. Cras luctus lacus nisl, sed tincidunt velit pharetra ac. Duis suscipit faucibus dui sed ultricies.</p> </article> CSS html { font-family: helvetica, arial, sans-serif; } h1 { font-size: 3rem; letter-spacing: 2px; column-span: all; } h2 { font-size: 1.2rem; color: red; letter-spacing: 1px; } p { line-height: 1.5; break-after: column; } article { colu...
...of 'break-after' in that specification. Working Draft Initial definition. Extends the CSS 2.1 page-break-after property to handle both page and column breaks. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 22 more matches
Audio and Video Delivery - Developer guides
streams. This article is intended as a starting point for exploring the various delivery mechanisms of web based media and compatibility with popular browsers. The Audio and Video Elements Whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. ...
... Identify how you want to play/instantiate the media (e.g. ...
...hough with the adoption of MP3 and MP4 formats in Firefox and Opera, this is changing fast. You can find compatibility information in the Guide to media types and formats on the web. To deliver video and audio, the general workflow is usually something like this: Check what format the browser sup
ports via feature detection (usually a choice of two, as stated above). If the browser doesn't sup
port playback of any of the provided formats natively, either present a still image or use a fallback technology to present the video. Identify how you want to play/instantiate the media (e.g. a <video> element, or document.createElement('video') perhaps?) Deliver the media file to the player. HTML Audio <audio controls preload="auto"> <source src="audiofile.mp3" type="audio/mpeg"> <!-- fall...
...And 22 more matches
WebAssembly.instantiate() - JavaScript
typed array or ArrayBuffer, and performs both compilation and instantiation in one step. The returned Promise resolves to both a compiled WebAssembly.Module and its first WebAssembly.Instance. The secondary overload takes an already-compiled WebAssembly.Module and returns a Promise that resolves to an Instance of that Module. This overload is useful if the Module has already been compiled. Im
portant: This method is not the most efficient way of fetching and instantiating wasm modules. If at all possible, you should use the newer WebAssembly.instantiateStreaming() method instead, which fetches, compiles, and instantiates a module all in one step, directly from the raw bytecode, so doesn't require conversion to an ArrayBuffer. Syntax Primary overload -- taking wasm binary code Promise<R...
...ching and instantiating wasm modules. If at all possible, you should use the newer WebAssembly.instantiateStreaming() method instead, which fetches, compiles, and instantiates a module all in one step, directly from the raw bytecode, so doesn't require conversion to an ArrayBuffer. ...
...ches, compiles, and instantiates a module all in one step, directly from the raw bytecode, so doesn't require conversion to an ArrayBuffer. Syntax Primary overload -- taking wasm binary code Promise<ResultObject> WebAssembly.instantiate(bufferSource, im
portObject); Parameters bufferSource A typed array or ArrayBuffer containing the binary code of the .wasm module you want to compile. im
portObject Optional An object containing the values to be im
ported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared im
port of the compiled module or else a WebAssembly.LinkError is thrown. Return value A Promise that resolves to a ResultObject which contains two fields: module: A WebAssembly.Module object rep...
...And 22 more matches
Implementing feature detection - Learn web development
Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high-level principles of cross-browser testing. ...
... Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high-level principles of cross-browser testing. Objective: To understand what the concept of feature detection is, and be able to implement suitable solutions in CSS and JavaScript. ...
... with the core HTML, CSS, and JavaScript languages; an idea of the high-level principles of cross-browser testing. Objective: To understand what the concept of feature detection is, and be able to implement suitable solutions in CSS and JavaScript. The concept of feature detection The idea behind feature detection is that you can run a test to determine whether a feature is sup
ported in the current browser, and then conditionally run code to provide an acceptable experience both in browsers that do sup
port the feature, and browsers that don't. If you don't do this, browsers that don't sup
port the features you are using in your code won't display your sites properly and will just fail, creating a bad user experience. Let's recap and look at the example we touched on in our ...
...And 21 more matches
Handling common JavaScript problems - Learn web development
had JScript and also offered VBScript as an option), and while at least JavaScript and JScript were compatible to some degree (both based on the ECMAScript specification), things were often implemented in conflicting, incompatible ways, causing developers many nightmares. Such incompatibility problems persisted well into the early 2000s, as old browsers were still being used and still needed sup
porting. This is one of the main reasons why libraries like jQuery came into existence -- to abstract away differences in browser implementations (e.g. see the code snippet in How to make an HTTP request) so developers only have to write one simple bit of code (see jQuery.ajax()). jQuery (or whatever library you are using) will then handle the differences in the background, so you don't have to. Thin...
...nce -- to abstract away differences in browser implementations (e.g. see the code snippet in How to make an HTTP request) so developers only have to write one simple bit of code (see jQuery.ajax()). jQuery (or whatever library you are using) will then handle the differences in the background, so you don't have to. Things have improved significantly since then; modern browsers do a good job of sup
porting "classic JavaScript features", and the requirement to use such code has diminished as the requirement to sup
port older browsers has lessened (although bear in mind that they have not gone away altogether). These days, most cross-browser JavaScript problems are seen: When poor-quality browser-sniffing code, feature-detection code, and vendor prefix usage block browsers from running code the...
...e sure you are applying functionality to the correct this scope. Incorrectly using functions inside loops -- for example, in bad-for-loop.html (see source code), we loop through 10 iterations, each time creating a paragraph and adding an onclick event handler to it. When clicked, each one should alert a message containing its number (the value of i at the time it was created), however each one re
ports i as 11, because for loops do all their iterating before nested functions are invoked. If you want this to work correctly, you need to define a function to add the handler separately, calling it on each iteration and passing it the current value of para and i each time (or something similar). See good-for-loop.html (see the source code also) for a version that works. Making sure asynchronous op...
...And 21 more matches
JSAPI User Guide
cety if the process is about to exit anyway. But as that is not always the case, calling JS_Shutdown is a good habit to get into.) The context: Use JS_NewContext and JS_DestroyContext. For maximum ECMAScript standard compliance, applications should also use JS_SetOptions to enable JSOPTION_VAROBJFIX. To get the latest JavaScript language features, applications may use JS_SetVersion. Error re
porting is also per-context and is enabled using JS_SetErrorRe
porter. The global object: To create this object, you first need a JSClass with the JSCLASS_GLOBAL_FLAGS option. The example below defines a very basic JSClass (named global_class) with no methods or properties of its own. Use JS_NewGlobalObject to create a global object. Use JS_InitStandardClasses to populate it with the standard Jav...
...th no methods or properties of its own. Use JS_NewGlobalObject to create a global object. Use JS_InitStandardClasses to populate it with the standard JavaScript globals. This may seem like a lot of pieces for a simple application. It amounts to about 80 lines of code, as shown below. But the JSAPI is designed to scale to applications that need many global objects. It is a fine-grained API, sup
porting many different combinations of the parts, and giving applications precise control over how SpiderMonkey behaves. Here is the boilerplate code necessary for a minimal JSAPI application. It contains everything described above. #include "jsapi.h" using namespace JS; // The class of the global object. static JSClass globalClass = { "global", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, ...
...bove. #include "jsapi.h" using namespace JS; // The class of the global object. static JSClass globalClass = { "global", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr, nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook }; // The error re
porter callback. void re
portError(JSContext *cx, const char *message, JSErrorRe
port *re
port) { fprintf(stderr, "%s:%u:%s\n", re
port->filename ? re
port->filename : "[no filename]", (unsigned int) re
port->lineno, message); } int run(JSContext *cx) { // Enter a request before running anything in the context. JSAutoRequest ar(cx); // Create the glo...
...And 21 more matches
FileReaderSync - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 21 more matches
SVGCircleElement - Web APIs
is clicked. It randomly increases or decreases the radius of the circle element. function clickCircle() { var circle = document.getElementById("circle"); // Randomly determine if the circle radius will increase or decrease var change = Math.random() > 0.5 ? 10 : -10; // Clamp the circle radius to a minimum of 10 and a maximum of 250, // so it won't disappear or get bigger than the view
port var newValue = Math.min(Math.max(circle.r.baseVal.value + change, 10), 250); circle.setAttribute("r", newValue); } Click on the circle. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGCircleElement' in that specification. Candidate Recommendation Replaced the inheritance from SVGElement, SVGTests, SVGLangSpa...
...ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 21 more matches
animation-direction - CSS: Cascading Style Sheets
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 21 more matches
WebAssembly.Module - JavaScript
that has already been compiled by the browser -- this can be efficiently shared with Workers, and instantiated multiple times. Constructor WebAssembly.Module() Creates a new Module object. Static properties WebAssembly.Module.customSections() Given a Module and string, returns a copy of the contents of all custom sections in the module with the given string name. WebAssembly.Module.ex
ports() Given a Module, returns an array containing descriptions of all the declared ex
ports. WebAssembly.Module.im
ports() Given a Module, returns an array containing descriptions of all the declared im
ports. Examples Sending a compiled module to a worker The following example (see our index-compile.html demo on GitHub, and view it live also) compiles the loaded simple.wasm byte code using the ...
...tml demo on GitHub, and view it live also) compiles the loaded simple.wasm byte code using the WebAssembly.compileStreaming() method and then sends the resulting Module instance to a worker using postMessage(). ...
...ew Worker("wasm_worker.js"); WebAssembly.compileStreaming(fetch('simple.wasm')) .then(mod => worker.postMessage(mod) ); In the worker (see wasm_worker.js) we define an im
port object for the module to use, then set up an event handler to receive the module from the main thread. When the module is received, we create an instance from it using the WebAssembly.instantiate() method and invoke an ex
ported function from inside it. ...
...And 21 more matches
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes An Overview The separation of content and presentation is a key design feature of XML. The structure of an XML document is designed to reflect and clarify im
portant relationships among the individual aspects of the content itself, unhindered by a need to provide any indication about how this data should eventually be presented. This intelligent structuring is particularly im
portant as more and more data transfers are automated and take place between highly heterogeneous machines linked by a network. Yet eventually much of the content stored in XML documents will need to be presented to human readers. Because a browser provides a familiar and highly flexible interface, it is an ideal mechanism for...
...presentation versions of XML content. Built from the ground up utilizing a wide variety of XML technologies, Firefox incorporates within itself all of the mechanisms needed to process both original XML documents and the specialized stylesheets used to style and lay them out for HTML display, reducing server load with client-side processing. At present, Gecko (the layout engine behind Firefox) sup
ports two forms of XML stylesheets. For basic control of appearance -- fonts, colors, position, and so forth -- Gecko uses CSS. CSS1 and CSS2 are well sup
ported and sup
port for the emerging CSS3 standard is under development. For further information about CSS, see Eric Meyer's CSS pages. Our focus here is on the second type of stylesheet that Gecko sup
ports: the XSLT stylesheet. XSLT stands for eXten...
...s a stylesheet author to transform a primary XML document in two significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format (and in the case of Firefox, the focus is on converting it on the fly into HTML which can then be displayed by the browser). ...
...And 21 more matches
Windows Media in Netscape - Archive of obsolete content
dows Media Player(TM) as an ActiveX control, and thus developers can now build multimedia experiences that script the Windows Media Player in Netscape 7.1, just as they do in Internet Explorer. Netscape 7.1 will work with both the Windows Media Player 6.4 ActiveX control as well as versions 7 through 9. This article explains how to embed the Windows Media Player ActiveX control in web pages to sup
port Netscape 7.1, how to control the Windows Media Player ActiveX control using JavaScript and provides working examples. This article deals uniquely with Netscape 7.1 running on the Windows operating system. Detecting the Right Browser Like Internet Explorer, Netscape 7.1 and later versions can play Windows Media files using the popular Windows Media Player ActiveX control. This control is widely us...
...the Windows Media Player ActiveX control using JavaScript and provides working examples. This article deals uniquely with Netscape 7.1 running on the Windows operating system. Detecting the Right Browser Like Internet Explorer, Netscape 7.1 and later versions can play Windows Media files using the popular Windows Media Player ActiveX control. ...
...rnet Explorer, Netscape 7.1 and later versions can play Windows Media files using the popular Windows Media Player ActiveX control. This control is widely used to provide inline media sup
port for web pages that provide sound, video and other media. Controls such as Windows Media Player also interact closely with the scripts in a web page. Netscape 7.1 is the first Netscape Gecko(TM) browser to sup
port the Windows Media Player as an ActiveX control -- previous Netscape browsers did not sup
port any ActiveX controls, and thus detecting which versions of Netscape sup
port the Windows Media ActiveX control is an im
portant first step towards building multimedia experiences using HTML, JavaScript, and the Windows Media ActiveX control. The Windows Media 9 Series SDK documentation for Netscape browsers...
...And 20 more matches
Video and audio content - Learn web development
with HTML fundamentals (as covered in Getting started with HTML) and Images in HTML. Objective: To learn how to embed video and audio content into a webpage, and add captions/subtitles to video. Video and audio on the web Web developers have wanted to use video and audio on the Web for a long time, ever since the early 2000s when we started to have bandwidth fast enough to sup
port any kind of video (video files are much larger than text or even images.) In the early days, native web technologies such as HTML didn't have the ability to embed video and audio on the Web, so proprietary (or plugin-based) technologies like Flash (and later, Silverlight) became popular for handling such content. This kind of technology worked ok, but it had a number of problems, including not wo...
...for embedding video/audio in your webpages; if you use that route, you can avoid some of the difficulties we discuss in this article. We'll be discussing this kind of service a bit more in the next article. The <video> element The <video> element allows you to embed a video very easily. A really simple example looks like this: <video src="rabbit320.webm" controls> <p>Your browser doesn't sup
port HTML5 video. Here is a <a href="rabbit320.webm">link to the video</a> instead.</p> </video> The features of note are: src In the same way as for the <img> element, the src (source) attribute contains a path to the video you want to embed. It works in exactly the same way. controls Users must be able to control video and audio playback (it's especially critical for people who have epilepsy.
...) You must either use the controls attribute to include the browser's own control interface, or build your interface using the appropriate JavaScript API. At a minimum, the interface must include a way to start and stop the media, and to adjust the volume. The paragraph inside the <video> tags This is called fallback content -- this will be displayed if the browser accessing the page doesn't sup
port the <video> element, allowing us to provide a fallback for older browsers. This can be anything you like; in this case, we've provided a direct link to the video file, so the user can at least access it some way regardless of what browser they are using. The embedded video will look something like this: You can try the example live here (see also the source code.) Using multiple source form...
...And 20 more matches
Examples
How to throw reject If you have a function that is a promise, and want to end it and throw a reject, you can throw an Error. Components.utils.im
port("resource://gre/modules/osfile.jsm") let path = OS.Path.join(OS.Constants.Path.tmpDir, "file.txt"); let promise = OS.File.exists(path); let newPromise = promise.then(function onFulfill(aExists) { if (aExists) { console.log("You have file.txt in your temporary directory."); } else { throw new Error("You don't have file.txt in your temporary directory."); } }); // Unexpected errors should always be re
ported at the end of a promise chain. let lastPromise = newPromise.then(function onFulfill(){ }) .catch(function onReject(aRejectReason) { console.warn('newPromise failed with reason: ', aRejectReason); }); Using a pro...
...}); // Unexpected errors should always be re
ported at the end of a promise chain. let lastPromise = newPromise.then(function onFulfill(){ }) .catch(function onReject(aRejectReason) { console.warn('newPromise failed with reason: ', aRejectReason); }); Using a promise returned by a function (verbose) This example uses a verbose syntax, showing all the involved promises. ...
...When the callback finishes execution, newPromise will be fulfilled with an undefined fulfillment value, because the callback does not return any value. When newPromise is fulfilled, nothing happens, because...
...And 20 more matches
MathML Accessibility in Mozilla
This table below provides a list of MathML constructions and how they are read in Mozilla applications for various platforms: Windows: MathML sup
port is provided by NVDA, which actually delegates math reading to the proprietary MathPlayer plugin. We started exposing generic accessible objects for MathML in bug 920547 and so these can be retrieved by NVDA starting with Gecko 27.0 (Firefox 27.0 / Thunderbird 27.0 / SeaMonkey 2.24). Mozilla and NVDA developers essentially do not have control on how mathematical formulas are read, please contact Design Science for any inquiries. Mac: MathML sup
port is provided by VoiceOver. ...
... with Gecko 27.0 (Firefox 27.0 / Thunderbird 27.0 / SeaMonkey 2.24). Mozilla and NVDA developers essentially do not have control on how mathematical formulas are read, please contact Design Science for any inquiries. Mac: MathML sup
port is provided by VoiceOver. In bug 1175269 and bug 1001641, we relied on the WebKit's NSAccessibility MathML tree to expose the main constructions. Hence basic sup
port is available in Gecko 41.0 (Firefox 41.0 / Thunderbird 41.0 / SeaMonkey 2.38) and we are still trying to keep in sync with WebKit/VoiceOver. Note that VoiceOver is proprietary so we do not have control on Improvements to MathML accessibility in VoiceOver. Linux: MathML sup
port is provided by the development version of Orca. We try to keep in sync with WebKit/ATK/Orca developments. At the moment,...
...The table gives the output in mode "utterance" and description spoken last. Note that this is still very experimental. ...
...And 20 more matches
sample2
distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. ...
...---END SIGNATURE-----" #define NS_CERT_HEADER "-----BEGIN CERTIFICATE-----" #define NS_CERT_TRAILER "-----END CERTIFICATE-----" /* Missing publically from nss versions earlier than 3.13 */ #ifndef SEC_ERROR_BASE #define SEC_ERROR_BASE (-0x2000) typedef enum { SEC_ERROR_IO = SEC_ERROR_BASE + 0, SEC_ERROR_TOKEN_NOT_LOGGED_IN = (SEC_ERROR_BASE + 155), SEC_ERROR_END_OF_LIST } SECErrorCodes; #endif /*
PORT_ErrorToString introduced in nss 3.13. On earlier versions of nss that * don't sup
port error tables, PR_ErrorToString will return "Unknown code". */ #ifndef
PORT_ErrorToString #define
PORT_ErrorToString(err) PR_ErrorToString((err), PR_LANGUAGE_I_DEFAULT) #endif /* sample 6 commands */ typedef enum { GENERATE_CSR, ADD_CERT_TO_DB, SAVE_CERT_TO_HEADER, ENCRYPT, DECRYPT, SIGN, VERIFY, UNKNOWN } Comman...
... trailer = NS_SIG_TRAILER; break; default: rv = SECFailure; goto cleanup; } rv = FileToItem(&filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* check for headers and trailers and remove them */ if ((body = strstr(nonbody, header)) != NULL) { char *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* maybe this is a MAC file */ if (body) trail = strstr(++body, trailer); if (trail != NULL) { *trail = '\0'; } else { PR_fprintf(PR_STDERR, "input has header but no trailer\n");
PORT_Free(filedata.data); rv = SECFailure; goto cleanup; } } else { /* headers didn't exist */ char *trail = NULL; body = nonbody; if (body) { trail = str...
...And 20 more matches
NSS functions
This page lists all ex
ported functions in NSS 3.11.7 It was
ported from here. This is a composite page. Section headings are links to the individual pages where you can edit them. Keywords: Deprecated - function should no longer be used. Updated - function has new arguments such as new flag or addition to structure. SSL functions The public functions listed here are used to configure sockets for communication via the SSL and TLS protocols. In addition to the functions listed here, applications that sup
port SSL use some of the Certificate functions, Crypto functions, and Utility functions described below on this page. Other sources of information: The NSS_reference documents the functions most commonly used by applications to sup
port SSL. The NSS home page links to additio...
...s to additional SSL documentation. If documentation is available for a function listed below, the function name is linked to either its MDC wiki page or its entry in the old SSL Reference. The Mozilla Cross Reference (MXR) link for each function provides access to the function definition, prototype definition, and source code references. ...
... (MXR) link for each function provides access to the function definition, prototype definition, and source code references. The NSS version column indicates which versions of NSS sup
port the function. ...
...And 20 more matches
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
Id; Value A DOMString which can be compared to the value of an RTCInboundRtpStreamStats object's remoteId property to see if the two represent statistics for each of the two sides of the same set of data received by the local peer. Usage notes You can think of the local and remote views of the same RTP stream as pairs, each of which has a reference back to the other one. Thus, if an RTCStatsRe
port includes an remote-outbound-rtp statistics object (of type RTCRemoteOutboundRtpStreamstats), it should also have a corresponding inbound-rtp object. Both of these provide information about the same batch of packets being transmitted from the remote peer to the local device. The difference is that remote-outbound-rtp describes statistics about the transmission(s) from the perspective of the remot...
...ference is that remote-outbound-rtp describes statistics about the transmission(s) from the perspective of the remote peer, while inbound-rtp offers statistics about the incoming data from the local peer's perspective. You can examine, try out, and experiment with this example on Glitch. ...
...t the transmission(s) from the perspective of the remote peer, while inbound-rtp offers statistics about the incoming data from the local peer's perspective. You can examine, try out, and experiment with this example on Glitch. ...
...And 20 more matches
aspect-ratio - CSS: Cascading Style Sheets
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...k out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 20 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
utton A push button with no default behavior displaying the value of the value attribute, empty by default. <input type="button" name="button" /> checkbox A check box allowing single values to be selected/deselected. <input type="checkbox" name="checkbox"/> color A control for specifying a color; opening a color picker when active in sup
porting browsers. <input type="color" name="color"/> HTML5 date A control for entering a date (year, month, and day, with no time). Opens a date picker or numeric wheels for year, month, day when active in sup
porting browsers. <input type="date" name="date"/> HTML5 datetime-local A control for entering a date and time, with no time zone. Opens a ...
... date A control for entering a date (year, month, and day, with no time). Opens a date picker or numeric wheels for year, month, day when active in sup
porting browsers. <input type="date" name="date"/> HTML5 datetime-local A control for entering a date and time, with no time zone. Opens a date picker or numeric wheels for date- and time-components when active in sup
porting browsers. <input type="datetime-local" name="datetime-local"/> HTML5 email A field for editing an email address. Looks like a text input, but has validation parameters and relevant keyboard in sup
porting browsers and devices with dynamic keyboards. <input type="email" name="email"/> HTML5 file A control that lets the user select a file. Us...
...ined by the src attribute. The alt attribute displays if the image src is missing. <input type="image" name="image" src="" alt="image input"/> month A control for entering a month and year, with no time zone. <input type="month" name="month"/> HTML5 number A control for entering a number. Displays a spinner and adds default validation when sup
ported. Displays a numeric keypad in some devices with dynamic keypads. <input type="number" name="number"/> HTML5 password A single-line text field whose value is obscured. Will alert user if site is not secure. <input type="password" name="password"/> radio A radio button, allowing a single value to be selected out of multiple choices with the...
...And 20 more matches
HTTP Index - HTTP
n web browsers and web servers, but it can also be used for other purposes. HTTP follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. HTTP is a stateless protocol, meaning that the server does not keep any data (state) between two requests. Though often based on a TCP/IP layer, it can be used on any reliable trans
port layer, that is, a protocol that doesn't lose messages silently like UDP does. RUDP -- the reliable update of UDP -- is a suitable alternative. 2 A typical HTTP session HTTP In client-server protocols, like HTTP, sessions consist of three phases: 3 An overview of HTTP HTML, HTTP, Overview, WebMechanics, l10n:priority HTTP isthe foundation of any data excha...
... HTTP (HyperText Transfer Protocol) is the underlying protocol of the World Wide Web. HTTP has evolved from an early protocol to exchange files in a semi-trusted laboratory environment, to the modern maze of the Internet, now carrying images, videos in high resolution and 3D. 8 Identifying resources on the Web Domain, HTTP, Path, Scheme, Syntax, URI, URL, URL Syntax, Web, fragment,
port, query, resources The target of an HTTP request is called a "resource", whose nature isn't defined further; it can be a document, a photo, or anything else. Each resource is identified by a Uniform Resource Identifier (URI) used throughout HTTP for identifying resources. 9 MIME types (IANA media types) Content-Type, Guide, HTTP, MIME Types, Meta, Request header, Response Head...
... or services to different browsers is usually a bad idea. The Web is meant to be accessible to everyone, regardless of which browser or device they're using. There are ways to develop your website to progressively enhance itself based on the availability of features rather than by targeting specific browsers. 13 Compression in HTTP Guide, HTTP, compression Compression is an im
portant way to increase the performance of a Web site. For some documents, size reduction of up to 70% lowers the bandwidth capacity needs. Over the years, algorithms also got more efficient, and new ones are sup
ported by clients and servers. 14 Configuring servers for Ogg media Audio, HTTP, Media, Ogg, Video This guide covers a few server configuration changes that may be necessa...
...And 20 more matches
Using the WebAssembly JavaScript API - WebAssembly
new directory on your local machine. Next, let's create a simple HTML file called index.html in the same directory as your wasm file (can use our simple template if you haven't got one easily available). Now, to help us understand what is going on here, let's look at the text representation of our wasm module (which we also meet in Converting WebAssembly format to wasm): (module (func $i (im
port "im
ports" "im
ported_func") (param i32)) (func (ex
port "ex
ported_func") i32.const 42 call $i)) In the second line, you will see that the im
port has a two-level namespace -- the internal function $i is im
ported from im
ports.im
ported_func. We need to reflect this two-level namespace in JavaScript when writing the object to be im
ported into the wasm module. Create a <script></script> ele...
..._func") i32.const 42 call $i)) In the second line, you will see that the im
port has a two-level namespace -- the internal function $i is im
ported from im
ports.im
ported_func. We need to reflect this two-level namespace in JavaScript when writing the object to be im
ported into the wasm module. Create a <script></script> element in your HTML file, and add the following code to it: var im
portObject = { im
ports: { im
ported_func: arg => console.log(arg) } }; Streaming the WebAssembly module New in Firefox 58 is the ability to compile and instantiate WebAssembly modules directly from underlying sources. This is achieved using the WebAssembly.compileStreaming() and WebAssembly.instantiateStreaming() methods. These methods are easier than their non-streaming counterparts, because th...
...nstantiateStreaming() methods. These methods are easier than their non-streaming counterparts, because they can turn the byte code directly into Module/Instance instances, cutting out the need to separately put the Response into an ArrayBuffer. ...
...And 20 more matches
dev/panel - Archive of obsolete content
the JavaScript Debugger or the Web Console, occupy "panels" in the toolbox. With the dev/panel module, you can create your own panels in the Toolbox: The panel gets a tab in the Toolbox toolbar which enables the user to open it: You specify the panel's content and behavior using HTML, CSS, and JavaScript. When the panel's created, the framework passes it a debuggee: this is a Message
Port object that you can use to exchange JSON messages with the browser that the developer tools are currently debugging. The messages follow the remote debugging protocol. For a simple walkthrough of using the dev/panel API to add a new tool, see Adding a panel to the toolbox. Basic usage Defining the panel constructor To add a new tool you first need to define a constructor that inherits from th...
...s content from main.js, but you can exchange messages with scripts running in the panel. Mandatory tooltip String A string that will be used as a tooltip in the Toolbox toolbar. Optional setup Function A function that will be called when the panel is created. It's passed an options object containing a single property debuggee. debuggee is a Message
Port object that you can use to exchange messages with the debugger server. Optional dispose Function A function that will be called when the panel is about to be destroyed. You can use it to do any cleanup. Optional onReady Function An event handler that will be called when the document in the panel becomes interactive. It's equivalent to document.readyState ==...
...nel becomes interactive. It's equivalent to document.readyState === "interactive". At this point you can send the panel document messages. Optional onLoad Function An event handler that will be called after the document in the panel is fully loaded. It's equivalent to document.readyState === "complete". Optional Once you've defined the panel's constructor you have to ex
port it so it can be called by the framework. Creating a Tool Next, you need to create a new Tool using the dev/toolbox module, initializing it with the newly defined constructor. Example Here's a complete main.js: // main.js // require the SDK modules const { Panel } = require("dev/panel"); const { Tool } = require("dev/toolbox"); const { Class } = require("sdk/core/heritage"); // define the p...
...And 19 more matches
Tamarin build documentation - Archive of obsolete content
Windows 32 and 64 bit Mac OSX 10.4, 10.5 on PPC Mac OSX 10.5, 10.6 on Intel Linux 32 and 64 bit Solaris 10 on SPARC Android 2.2 on ARM Windows Mobile 6.5 MIPS (Linux) SH4 (Linux) Getting the Tamarin source The Tamarin source resides in Mercurial at Tamarin Central. ...
...arguments will list the available options. Note that additional command-line arguments are only available in the debug configuration. The Tamarin codebase contains a cross-platform build system for Mozilla developers. The cross-platform build system is used for daily automated build testing so it is the most reliable system. The Tamarin codebase has the ability to build additional code which sup
ports debugging hooks. In the XCode project, this is the Debug_Debugger and Release_Debugger configurations. The Flash Player builds Tamarin with the debugging hooks off for codesize reasons, but the Mozilla client will build Tamarin with the debugging hooks on. Cross-platform build (general instructions - non-android) Prerequisites: You need Python 2.5 or later and GNU make 3.81 or later. (GNU make...
...c ndk zip file from http://developer.android.com/sdk/ndk/index.html. Unzip to your sdk/ndk top folder. Rename this folder to 'android-ndk'. - Run the Android SDK/AVD Manager at /android-public/android-sdk-mac_86/tools/android and add Android SDK Platform-tools (to get adb), SDK Platform Android 2.3.3, and API 10 (samples and docs are optional). If you have trouble starting the app try this: $ ex
port ANDROID_SWT=$ANDROID_BUILD_TOP/android-sdk-mac_86/tools/lib/x86_64 where $ANDROID_BUILD_TOP is the full path to your sdk/ndk top folder - Get the openssl-0.9.8r.tar (openssl-1.0.0c.tar.gz won't work) openssl files from http://www.openssl.org (use the Source link on the left). Unzip the file and put the /openssl main folder under your sdk/ndk top folder. Make sure its name is just "openssl". Th...
...And 19 more matches
Gecko Compatibility Handbook - Archive of obsolete content
nt has been developed for Microsoft Internet Explorer 4 or Netscape Navigator 4. These browsers were developed before the relevant W3C recommendations for HTML, CSS, and the DOM existed. These earlier, non-standards based browsers differed in several ways from Gecko: These browsers use proprietary (non-standard) HTML, CSS, and JavaScript. ...
...se browsers were developed before the relevant W3C recommendations for HTML, CSS, and the DOM existed. These earlier, non-standards based browsers differed in several ways from Gecko: These browsers use proprietary (non-standard) HTML, CSS, and JavaScript. Internet Explorer 4 and Netscape Navigator 4 share sup
port for a large part of the HTML 3.2 standard and basic JavaScript. While they sup
port the CSS 1 standard to some degree, the implementations are not complete and have non-standard features added. Neither Internet Explorer 4 or Netscape Navigator 4 sup
port the W3 DOM. Instead, each browser sup
ports its own proprietary API for manipulating the content, style and position of HTML Elements in a web page. In addition, Internet Explorer 4 and Netscape Navigator 4 use completely differ...
...xplorer for Mac and IE for Windows, which are very different programs and so may behave quite differently from each other. Quick Compatibility Test If your site uses Netscape 4.x and Microsoft proprietary technologies, see Using Web Standards in Your Web Pages for a quick tutorial on standards. This compatibility test will be most beneficial to sites using simple code or that have updated to sup
port standards. Set Up Browsers For Testing The various Gecko-based browsers do not always contain Netscape in the user-agent string. Thus it's critical to verify that you are properly detecting browsers such as AOL for macOS. You can either download the various browsers. Or, if you are using user-agent detection, you can install an extension in Firefox or Mozilla which allows you to "spoof" the us...
...And 19 more matches
Beginner's guide to media queries - Learn web development
Previous Overview: CSS layout Next The CSS Media Query gives you a way to apply CSS only when the browser and device environment matches a rule that you specify, for example "view
port is wider than 480 pixels". Media queries are a key part of responsive web design, as they allow you to create different layouts depending on the size of the view
port, but they can also be used to detect other things about the environment your site is running on, for example whether the user is using a touchscreen rather than a mouse. In this lesson you will first learn about the syntax used in media queries, and then move on to use them in a worked example showing how a simple design might be made responsive. Prerequisites: HTML basics (study Introduction to HTML), and an idea of how...
...be avoided. Note: Media types are optional; if you do not indicate a media type in your media query then the media query will default to being for all media types. Media feature rules After specifying the type, you can then target a media feature with a rule. Width and height The feature we tend to detect most often in order to create responsive designs (and that has widespread browser sup
port) is view
port width, and we can apply CSS if the view
port is above or below a certain width -- or an exact width -- using the min-width, max-width, and width media features. These features are used to create layouts that respond to different screen sizes. For example, to change the body text color to red if the view
port is exactly 600 pixels, you would use the following media query. @media scree...
...ly 600 pixels, you would use the following media query. @media screen and (width: 600px) { body { color: red; } } Open this example in the browser, or view the source. The width (and height) media features can be used as ranges, and therefore be prefixed with min- or max- to indicate that the given value is a minimum, or a maximum. For example, to make the color blue if the view
port is narrower than 600 pixels, use max-width: @media screen and (max-width: 600px) { body { color: blue; } } Open this example in the browser, or view the source. In practice, using minimum or maximum values is much more useful for responsive design so you will rarely see width or height used alone. There are a number of other media features that you can test for, although some ...
...And 19 more matches
CSS property compatibility table for form controls - Learn web development
You may still face strange side effects in certain edge cases. Partial While the property works, you may frequently face strange side effects or inconsistencies. You should probably avoid these properties unless you master those side effects first. ...
...You may still face strange side effects in certain edge cases. Partial While the property works, you may frequently face strange side effects or inconsistencies. You should probably avoid these properties unless you master those side effects first. ...
...; appearance: none; /* for Internet Explorer */ background: none; } Compatibility tables Global behaviors Some behaviors are common to many browsers at a global level: border, background, border-radius, height Using one of these properties can partially or fully turn off the native look & feel of widgets on some browsers. Be careful when you use them. line-height This property is sup
ported inconsistently across browsers and you should avoid it. text-decoration This property is not sup
ported by Opera on form widgets. text-overflow Opera, Safari, and IE9 do not sup
port this property on form widgets. text-shadow Opera does not sup
port text-shadow on form widgets and IE9 does not sup
port it at all. Text fields See the text, search, and password input types. Propert...
...And 19 more matches
Accessible Toolkit Checklist
Expose your UI - a way for assistive technologies such as screen readers, screen magnifiers and voice dictation software to understand your software. Provide theme compatibility with the operating system, at least as an option. Some low vision users will be running your software with high contrast or large font themes. Go beyond section 508. ...
...s wrap the widgets implemented by the OS with a consistent API for each platform. Since the individual widgets predominately come from the operating system, they already implement standard keyboard commands and follow the operating system's visual theme. Also, assistive technologies already understand native widgets so it is only necessary to implement Microsoft Active Accessibility (MSAA) API sup
port for custom controls. However, be aware that the wrapping layer will introduce accessibility bugs, and thus you will need to test extensively and fill in the holes. You will also need to provide a way for custom and owner drawn controls to easily accessibility API sup
port, as wxWidgets does. There will be custom and owner drawn controls -- there always are. For example, lists of checkboxes are imp...
...wner drawn controls -- there always are. For example, lists of checkboxes are implemented in Windows with images of checked and unchecked checkboxes. Owner drawn toolkits , like XUL and Flash's Flex UI framework use few or no native widgets. These toolkits need to have accessibility implemented from the ground up, and get nothing for free in terms of keyboard, API or OS-theme sup
port. In this case, adding a complete or even a partial accessibility solution is major work, and will require more than one full time person as well as cooperation from Windows assistive technology vendors when parts of your MSAA solution isn't working. Often these kinds of toolkits don't use a separate window for each control; in that case remember to generate a unique 32 bit child ID for each contr...
...And 19 more matches
nsIXPConnect
js/src/xpconnect/idl/nsIXPConnect.idlNot scriptable Provides the XPConnect service. ...
... ...
...ectPtr aParent, in JSObjectPtr aWrappedObj); Native code only! ...
...And 19 more matches
MediaMetadata - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. ...
...And 19 more matches
WebAssembly.Instance - JavaScript
A WebAssembly.Instance object is a stateful, executable instance of a WebAssembly.Module. Instance objects contain all the Ex
ported WebAssembly functions that allow calling into WebAssembly code from JavaScript. Constructor WebAssembly.Instance() Creates a new Instance object. Instance properties Instance.prototype.ex
ports Returns an object containing as its members all the functions ex
ported from the WebAssembly module instance, to allow them to be accessed and used by JavaScript. Read-only. ...
...ototype.ex
ports Returns an object containing as its members all the functions ex
ported from the WebAssembly module instance, to allow them to be accessed and used by JavaScript. Read-only. ...
...turns an object containing as its members all the functions ex
ported from the WebAssembly module instance, to allow them to be accessed and used by JavaScript. Read-only. ...
...And 19 more matches
The "codecs" parameter in common media types - Web media technologies
For instance, just describing a video in an MPEG-4 file with the MIME type video/mp4 doesn't say anything about what format the actual media within takes. For that reason, the codecs parameter can be added to the MIME type describing media content. With it, container-specific information can be provided. ...
...le using the MPEG file type, such as an MP3. video/ogg A video file using the Ogg file type. video/mp4 A video file using the MPEG-4 file type. video/quicktime A video file in Apple's QuickTime format. As noted elsewhere, this format was once commonly used on the web but no longer is, since it required a plugin to use. However, each of these MIME types is vague. All of these file types sup
port a variety of codecs, and those codecs may have any number of profiles, levels, and other configuration factors. For this reason, you can add the codecs parameter to the media type. To do so, append a semicolon (;) followed by codecs= and then the string describing the format of the contents of the file. Some media types only let you specify the names of the codecs to use, while others allow you ...
... You can use the JavaScript encodeURI() function to encode the parameter list; similarly, you can use decodeURI() to decode a previously encoded parameter list. When the codecs parameter is used, the specified list of codecs must include every codec used for the contents of the file. The list may also contain codecs not present in the file.= Codec options by container The containers below sup
port extended codec options in their codecs parameters: 3GP AV1 ISO BMFF MPEG-4 QuickTime WebM Several of the links above go to the same section; that's because those media types are all based on ISO Base Media File Format (ISO BMFF), so they share the same syntax. AV1 The syntax of the codecs parameter for AV1 is defined the AV1 Codec ISO Media File Format Binding specification, section...
...And 19 more matches
Mozilla Application Framework in Detail - Archive of obsolete content
echnologies to design and implement anything from a simple text editor to a comprehensive IDE - complete with all of the interface widgets that you would find in virtually any major application framework. Another benefit of this standards-based approach to UI development is that your application is cross-platform "out of the box". Imagine not having to re-write your application 3 times, or not sup
porting a less popular platform simply because you do not have the resources for parallel development! Unlike many other application frameworks, you are not limited to the widget set we provide, nor limited to the "look and feel" of the native OS. You can create applications using our framework that either have a native look and feel for each OS, or one which is identical on Macs, PC's or Unix ...
...RSS, SOAP, or other XML-based languages and convert them into a form that you might display in your user interface. The Gecko Rendering Engine Gecko is the revolutionary rendering engine that offers advanced features for Internet browsing anywhere across applications, computing platforms and devices. This innovation in browser technology offers small size, speed and industry leading standards sup
port. Gecko is the premier cross-platform, full-featured, mature and well-tested layout engine available, providing robust and high quality sup
port for a massive array of standards. Its ability to render web content correctly is exceptional. Gecko consists roughly of an HTML parser and XML parser, a DOM implementation, a CSS parser and style system, and the code for CSS-based and HTML-based layout and...
... designed from the ground up to power a new generation of desktop browsers and browsing devices and to accelerate the growth and development of the next-generation Internet. Small, fast and standards compliant, Gecko is easily embeddable across platforms in browsers, desktop applications and browsing devices and delivers full-functionality browsing to them all. ...
...And 18 more matches
Responsive images - Learn web development
the width of the header, and the content image will fit somewhere inside the content column. ...
... simple example: This works well on a wide screen device, such as a laptop or desktop (you can see the example live and find the source code on Github.) We won't discuss the CSS much in this lesson, except to say that: The body content has been set to a maximum width of 1200 pixels -- in view
ports above that width, the body remains at 1200px and centers itself in the available space. In view
ports below that width, the body will stay at 100% of the width of the view
port. The header image has been set so that its center always stays in the center of the header, no matter what width the heading is set at. If the site is being viewed on a narrower screen, the im
portant detail in the center of the image (the people) can still be seen, and the excess is lost off either side. It is 200px high.
... the body, rather than overflowing it. However, issues arise when you start to view the site on a narrow screen device. The header below looks ok, but it's starting to take up a lot of the screen height for a mobile device. And at this size, it is difficult to see the people within the first content image. An improvement would be to display a cropped version of the image which displays the im
portant details of the image when the site is viewed on a narrow screen. A second cropped image could be displayed for a medium width screen device, like a tablet. This is commonly known as the art direction problem. In addition, there is no need to embed such large images on the page if it is being viewed on a mobile screen. And conversely, a small raster image starts to look grainy when displayed l...
...And 18 more matches
AudioBuffer() - Web APIs
fer(options); Parameters Inherits parameters from the AudioNodeOptions dictionary. options Options are as follows: length: The size of the audio buffer in sample-frames. To determine the length to use for a specific number of seconds of audio, use numSeconds * sampleRate. numberOfChannels: The number of channels for the buffer. The default is 1, and all user agents are required to sup
port at least 32 channels. sampleRate: The sample rate in Hz for the buffer. The default is the sample rate of the context used in constructing this object. User agents are required to sup
port sample rates from 8,000 Hz to 96,000 Hz (but are allowed to go farther outside this range). Deprecated parameters context A reference to an AudioContext. This parameter was removed from the spec. ...
... RangeError There isn't enough memory available to allocate the buffer. ...
... RangeError There isn't enough memory available to allocate the buffer. ...
...And 18 more matches
IDBTransaction.error - Web APIs
e (for example QuotaExceededError or UnknownError). This property is null if the transaction is not finished, is finished and successfully committed, or was aborted with the IDBTransaction.abort method. Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. Note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in re
porting what went wrong when the transaction was unsuccessful. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("t...
...on to add the data to the database addData(); }; function addData() { // Create a new object ready for being inserted into the IDB var newItem = [ { taskTitle: "Walk dog", hours: 19, minutes: 30, day: 24, month: "December", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["toDoList"], "readwrite"); // re
port on the success of opening the transaction transaction.oncomplete = function(event) { note.innerHTML += '<li>Transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerHTML += '<li>Transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectStore = tran...
... Recommendation Indexed Database AP...
...And 18 more matches
PasswordCredential - Web APIs
Note: This interface is restricted to top-level contexts and cannot be used from an <iframe>. Constructor PasswordCredential()Secure context Creates a new PasswordCredential object. Properties Inherits properties from its ancestor, Credential. PasswordCredential.additionalData Secure context One of a FormData instance, a URLSearchParams instance, or null. ...
...ble on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 18 more matches
Content Scripts - Archive of obsolete content
ent scripts. Content scripts can be one of the more confusing aspects of working with the SDK, but you're very likely to have to use them. There are five basic principles: the add-on's main code, including "main.js" and other modules in "lib", can use the SDK high-level and low-level APIs, but can't access web content directly content scripts can't use the SDK's APIs (no access to globals ex
ports, require) but can access web content SDK APIs that use content scripts, like page-mod and tabs, provide functions that enable the add-on's main code to load content scripts into web pages content scripts can be loaded in as strings, but are more often stored as separate files under the add-on's "data" directory. jpm doesn't make a "data" directory by default, so you must add it and put your co...
...e page: // main.js var tabs = require("sdk/tabs"); var contentScriptString = 'document.body.innerHTML = "<h1>this page has been eaten</h1>";' tabs.activeTab.attach({ contentScript: contentScriptString }); The following high-level SDK modules can use content scripts to modify web pages: page-mod: enables you to attach content scripts to web pages that match a specific URL pattern. tabs: ex
ports a Tab object for working with a browser tab. The Tab object includes an attach() function to attach a content script to the tab. page-worker: lets you retrieve a web page without displaying it. You can attach content scripts to the page, to access and manipulate the page's DOM. context-menu: use a content script to interact with the page in which the menu is invoked. Additionally, some SDK u...
...ts and page scripts is what you want. But sometimes you might want to interact with page scripts: you might want to share objects between content scripts and page scripts or to send messages between them. If you need to do this, read about interacting with page scripts. Event listeners You can listen for DOM events in a content script just as you can in a normal page script, but there are two im
portant differences: First, if you define an event listener by passing it as a string into setAttribute(), then the listener is evaluated in the page's context, so it will not have access to any variables defined in the content script. For example, this content script will fail with the error "theMessage is not defined": var theMessage = "Hello from content script!"; anElement.setAttribute("onclick...
...And 17 more matches
Developing for Firefox Mobile - Archive of obsolete content
ements its UI using native Android widgets instead of XUL. With the add-on SDK you can develop add-ons that run on this new version of Firefox Mobile as well as on the desktop version of Firefox. You can use the same code to target both desktop Firefox and Firefox Mobile, and use jpm-mobile instead of the normal jpm. Right now not all modules are fully functional, but we're working on adding sup
port for more modules. The tables at the end of this guide list the modules that are currently sup
ported on Firefox Mobile. This tutorial explains how to run SDK add-ons on an Android device connected via USB to your development machine. We'll use the Android Debug Bridge (adb) to communicate between the Add-on SDK and the device. It's possible to use the Android emulator to develop add-ons for An...
...ndroid SDK. Make sure the "platform-tools" directory is in your path. Then type: adb devices You should see some output like: List of devices attached 51800F220F01564 device (The long hex string will be different.) If you do, then adb has found your device and you can get started. Running Add-ons on Android You can develop your add-on as normal, as long as you restrict yourself to the sup
ported modules. When you need to run the add-on, first ensure that Firefox is not running on the device. Then execute jpm-mobile run with some extra options: jpm-mobile run --adb /path/to/adb In the command shell, you should see something like: Launching mobile application with intent name org.mozilla.fennec Pushing the addon to your device Starting: Intent { act=android.activity.MAIN cmp=org.moz...
...way is probably to copy the signed XPI somewhere on the device: adb push my-addon.xpi /mnt/sdcard/ Then open Firefox Mobile and type this into the address bar: file:///mnt/sdcard/my-addon.xpi The browser should open the XPI and ask if you want to install it. ...
...And 17 more matches
Gecko FAQ - Gecko Redirect 1
Gecko is used in multiple browsers, including Mozilla Firefox, SeaMonkey, and others. Gecko is continuously under development at mozilla.org. Gecko has been known previously by the code names "Raptor" and "NGLayout"; the new name was chosen following a trademark infringement dispute. For more information see the Wikipedia article on Gecko. ...
... the browser's content area, which is the blank area inside the browser window's chrome. Formally, a layout engine defines the placement policy for a document and places content on a page. Gecko's core is a very fast layout engine. Gecko also offers the ability to parse various document types (HTML, XML, SVG, etc), advanced rendering capabilities including compositing and transformations, and sup
port for embedded JavaScript and plugins. Gecko is so fast and so powerful that it's being used to create the user interface of some applications ("chrome") as well. In other words, Gecko will not only be displaying the document's content, but it will also be painting the scrollbars, toolbars, and menus on the screen as well. For more information see XUL. How is a layout engine like Gecko different ...
...ers greater presentation control to Web developers, using open and recommended Internet standards instead of proprietary APIs. You are encouraged to join this team by getting involved. How does Mozilla use Gecko? Gecko lies at the heart of Mozilla and Firefox browsers, as well as others, powering all of the individual components. Gecko technologies will also power the display of the mozilla.com
portal site, speedily delivering more exciting content and services. Gecko's architecture will serve Mozilla well into the future, enabling faster time to market, more innovation, less costly development, easier distribution and updating, and better cross platform sup
port. How can other companies and organizations use Gecko? Because Gecko is small, lightweight, and open source, other companies and o...
...And 17 more matches
WAI-ARIA basics - Learn web development
>Skip to navigation</a> But this is still not very precise, and can only be used when the screenreader is reading from the top of the page. As another example, apps started to feature complex controls like date pickers for choosing dates, sliders for choosing values, etc. HTML5 provides special input types to render such controls: <input type="date"> <input type="range"> These are not well-sup
ported across browsers, and it is also difficult to style them, making them not very useful for integrating with website designs. As a result, developers quite often rely on JavaScript libraries that generate such controls as a series of nested <div>s or table elements with classnames, which are then styled using CSS and controlled using JavaScript. The problem here is that visually they work, but sc...
... an example of this at Text alternatives. States -- Special properties that define the current conditions of elements, such as aria-disabled="true", which specifies to a screenreader that a form input is currently disabled. States differ from properties in that properties don't change throughout the lifecycle of an app, whereas states can change, generally programmatically via JavaScript. An im
portant point about WAI-ARIA attributes is that they don't affect anything about the web page, except for the information exposed by the browser's accessibility APIs (where screenreaders get their information from). WAI-ARIA doesn't affect webpage structure, the DOM, etc., although the attributes can be useful for selecting elements by CSS. Note: You can find a useful list of all the ARIA roles and ...
...ributes can be useful for selecting elements by CSS. Note: You can find a useful list of all the ARIA roles and their uses, with links to futher information, in the WAI-ARIA spec -- see Definition of Roles. The spec also contains a list of all the properties and states, with links to further information -- see Definitions of States and Properties (all aria-* attributes). Where is WAI-ARIA sup
ported? This is not an easy question to answer. It is difficult to find a conclusive resource that states what features of WAI-ARIA are sup
ported, and where, because: There are a lot of features in the WAI-ARIA spec. There are many combinations of operating system, browser, and screenreader to consider. This last point is key -- To use a screenreader in the first place, your operating system ne...
...And 17 more matches
Getting started with React - Learn web development
cussed in the same spaces as -- and utilized to solve the same problems as -- other true web development frameworks. When we refer to React as a "framework", we're working with that colloquial understanding. React's primary goal is to minimize the bugs that occur when developers are building UIs. It does this through the use of components -- self-contained, logical pieces of code that describe a
portion of the user interface. These components can be composed together to create a full UI, and React abstracts away much of the rendering work, leaving you to concentrate on the UI design. Use cases Unlike the other frameworks covered in this module, React does not enforce strict rules around code conventions or file organization. This allows teams to set conventions that work best for them, and ...
...act to a website without create-react-app by copying some <script> elements into an HTML file, but the create-react-app CLI is a common starting point for React applications. Using it will allow you spend more time building your app, and less time fussing with setup. Requirements In order to use create-react-app, you need to have Node.js installed. It's recommended that you use the long-term sup
port (LTS) version. Node includes npm (the node package manager), and npx (the node package runner). You may also use the Yarn package manager as an alternative, but we'll assume you are using npm in this set of tutorials. See Package management basics for more information on npm and yarn. If you're using Windows, you will need to install some software to give you parity with Unix/macOS terminal in ...
... index.html | +-- manifest.json +-- src +-- App.css +-- App.js +-- App.test.js +-- index.css +-- index.js +-- logo.svg +-- serviceWorker.js The src directory is where we'll spend most of our time, as it's where the source code for our application lives. ...
...And 17 more matches
JSS Provider Notes
en moved to http://www.dogtagpki.org/wiki/JSS_Provider. The Mozilla-JSS JCA Provider Newsgroup: mozilla.dev.tech.crypto Overview This document describes the JCA Provider shipped with JSS. The provider's name is "Mozilla-JSS". It implements cryptographic operations in native code using the NSS libraries. Contents Signed JAR file Installing the Provider Specifying the CryptoToken Sup
ported Classes What's Not Sup
ported Signed JAR file JSS 3.2 implements several JCE (Java Cryptography Extension) algorithms. These algorithms have at various times been ex
port-controlled by the US government. Sun therefore requires that JAR files implementing JCE algorithms be digitally signed by an approved organization. Netscape has this approval and signs the official builds of jss32.jar. ...
...A KeyPair. This will happen on TokenA because TokenA // was the per-thread default token when rsaKpg was created. rsaKpg.initialize(1024); KeyPair rsaPair = rsaKpg.generateKeyPair(); // Generate a DSA KeyPair. This will happen on TokenB because TokenB // was the per-thread default token when dsaKpg was created. ...
...appen on TokenB because TokenB // was the per-thread default token when dsaKpg was created. dsaKpg.initialize(1024); KeyPair dsaPair = dsaKpg.generateKeyPair(); Sup
ported Classes Cipher DSAPrivateKey DSAPublicKey KeyFactory KeyGenerator KeyPairGenerator Mac MessageDigest RSAPrivateKey RSAPublicKey SecretKeyFactory SecretKey SecureRandom Signature What's Not Sup
ported The following classes don't work very well: KeyStore: There are many serious problems mapping the JCA keystore interface onto NSS's model of PKCS #11 modules. The current implementation is almost useless. Since these problems lie deep in the NSS design and implementation, there is no clear timeframe for fixing them. Meanwhile, the org.mozilla.jss.crypto.CryptoStore class can ...
...And 17 more matches
Gecko events
<< AT APIs Sup
port Page This page offers a list of Accessibility-related events sup
ported by Gecko. Event constants are defined in nsIAccessibleEvent interface. EVENT_DOM_CREATE An object has been created. Is Sup
ported: yes EVENT_DOM_DESTROY An object has been destroyed. Is Sup
ported: yes EVENT_DOM_SIGNIFICANT_CHANGE An object's properties or content have changed significantly so that the type of object has really changed, and therefore the accessible should be destroyed or recreated. ...
...nt constants are defined in nsIAccessibleEvent interface. EVENT_DOM_CREATE An object has been created. Is Sup
ported: yes EVENT_DOM_DESTROY An object has been destroyed. Is Sup
ported: yes EVENT_DOM_SIGNIFICANT_CHANGE An object's properties or content have changed significantly so that the type of object has really changed, and therefore the accessible should be destroyed or recreated. ...
...: yes EVENT_DOM_DESTROY An object has been destroyed. Is Sup
ported: yes EVENT_DOM_SIGNIFICANT_CHANGE An object's properties or content have changed significantly so that the type of object has really changed, and therefore the accessible should be destroyed or recreated. ...
...And 17 more matches
nsIDOMWindowUtils
dom/interfaces/base/nsIDOMWindowUtils.idlScriptable This interface is a DOM utility interface that provides useful DOM methods and attributes. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 49.0 (Firefox 49.0 / Thunderbird 49.0 / SeaMonkey 2.46) Implemented by: Window. To get this interface, use: var domWindowUtils = window.windowUtils; Method overview void activateNativeMenuItemAt(in AString indexString); void clearMozAfterPaintEvents(); PRUint32 compareCanvases(in nsIDOMHTMLCanvasElement aCanvas1, in nsIDOMHTMLCanvasElement aCanvas2, out unsigned long aMaxDifference); double computeAnimationDistance(in nsIDOMElement element, in AString property, in AString value1, in AString valu...
...ount)] in PRUint32 aIdentifiers, [array, size_is(count)] in PRInt32 aXs, [array, size_is(count)] in PRInt32 aYs, [array, size_is(count)] in PRUint32 aRxs, [array, size_is(count)] in PRUint32 aRys, [array, size_is(count)] in float aRotationAngles, [array, size_is(count)] in float aForces, in PRUint32 count, in long aModifiers, [optional] in boolean aIgnoreRootScrollFrame); void setCSSView
port(in float aWidthPx, in float aHeightPx); void setDisplay
Port(in float aXPx, in float aYPx, in float aWidthPx, in float aHeightPx); void setResolution(in float aXResolution, in float aYResolution); void startPCCountProfiling(); void stopPCCountProfiling(); void suppressEventHandling(in boolean aSuppress); void suspendTimeouts(); ...
...EMOVE 4 TOUCH_CANCEL 8 IME_STATUS_DISABLED 0 Users cannot use IME at all. This state is not the same as ime-mode: disabled. IME_STATUS_ENABLED 1 Users can use all functions of IME. This state is same as ime-mode: normal. IME_STATUS_PASSWORD 2 Users cannot use most IME functions. On GTK2, users can use "Simple IME" which only sup
ports dead key inputting. This state is the same as ime-mode: password. IME_STATUS_PLUGIN 3 Plug-in has focus. At this time we should not attempt to set the IME state. COMPOSITION_ATTR_RAWINPUT 0x02 Synthesize a text event to the window. Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without Univ...
...And 17 more matches
Mozilla
h builds are largely unrelated to what would be found in a release browser. Browser chrome tests The browser chrome test suite is an automated testing framework designed to allow testing of application chrome windows using JavaScript. ...
...allow testing of application chrome windows using JavaScript. It currently allows you to run JavaScript code in the same scope as the main Firefox browser window and re
port results using the same functions as the Mochitest test framework. As all tests, they won't work in a build with tests disabled (--disable-tests). Browser security An im
portant aspect of developing code for any browser, including Firefox, as well as any Web-oriented project, is its security. These articles provide im
portant guides and references to ensuring the code you write is secure, including both design recommendations and testing guidelines. Bugzilla bugzilla.mozilla.org (often abbreviated b.m.o) is Moz...
...s and enhancement requests for Firefox, Thunderbird, SeaMonkey, Camino, and other mozilla.org projects. Building Mozilla In this article, we list documents that will guide you in building Firefox or other projects based upon Mozilla code. Building SpiderMonkey with UBSan 1. Compile a recent version of LLVM & Clang. C++
portability guide This document has migrated to Using C++ in Mozilla code. Choosing the right memory allocator There are a lot of different memory allocators in the Mozilla source tree. This article looks over some of them and tries to sort out which should be used under what circumstances. Chrome registration Chrome is the set of use...
...And 17 more matches
IDBCursorWithValue - Web APIs
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 17 more matches
animation-delay - CSS: Cascading Style Sheets
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 17 more matches
font-size-adjust - CSS: Cascading Style Sheets
ly at small sizes, is determined more by the size of lowercase letters than by the size of capital letters. Legibility can become an issue when the first-choice font-family is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font). To use this property in a way that is compatible with browsers that do not sup
port font-size-adjust, it is specified as a number that the font-size property is multiplied by. This means the value specified for the property should generally be the aspect ratio of the first choice font. For example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5 x 14px). This will st...
...nt-size property is multiplied by. This means the value specified for the property should generally be the aspect ratio of the first choice font. For example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5 x 14px). This will still produce reasonable results in browsers that do not sup
port font-size-adjust, where a 14px font will be used. Syntax Values none Choose the size of the font based only on the font-size property. <number> Choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. The number specified should generally be the aspect ratio (ratio of x-height to font size) of ...
...mber> Choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. This means that the first-choice font, when available, will appear the same size in browsers, whether or not they sup
port font-size-adjust. 0 yields text of zero height (hidden text). Formal definition Initial valuenoneApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typea number Formal syntax none | <number> Examples Adjusting lower-case letter sizes HTML <p class="times">This text uses the Times font (10px), which is hard to read...
...And 17 more matches
HTML documentation index - HTML: Hypertext Markup Language
y, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. Values include user and environment. 39 HTML attribute: crossorigin Advanced, Attribute, CORS, HTML, NeedsContent, Reference, Security The crossorigin attribute, valid on the <audio>, <img>, <link>, <script>, and <video> elements, provides sup
port for CORS, defining how the element handles crossorigin requests, thereby enabling the configuration of the CORS requests for the element's fetched data. Depending on the element, the attribute can be a CORS settings attribute. 40 HTML attribute: max Attribute, Attributes, Constraint validation, HTML, Reference The max attribute defines the maximum value that is acceptable and...
...dation, Forms, required The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control. 47 HTML attribute: rel Attribute, Attributes, Constraint validation, Link, form, rel The rel attribute defines the relationship between a linked resource and the current document. Valid on <link>, <a>, <area>, and <form>, the sup
ported values depend on the element on which the attribute is found. 48 HTML attribute: required Attribute, Attributes, Constraint validation, Forms, required The Boolean required attribute 49 HTML attribute: size Attribute, HTML, Input, Reference, Select The size attribute defines the width of the <input> and the height of the <select> element. For the input,...
...ML <article> element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication). 62 <aside>: The Aside element Element, HTML, HTML sections, HTML5, HTML:Flow content, HTML:Palpable Content, HTML:Sectioning content, Reference, Web The HTML <aside> element represents a
portion of a document whose content is only indirectly related to the document's main content. 63 <audio>: The Embed Audio element Audio, Element, HTML, HTML embedded content, HTML5, HTML:Embedded content, HTML:Flow content, HTML:Phrasing content, Media, Multimedia, Reference, Web, sound The HTML <audio> element is used to embed sound content in documents. It may contain one or mo...
...And 17 more matches
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
The following is an alphabetized and annotated list of the elements, axes, and functions from the W3C's 1.0 Recommendation for XSLT, as well as from the appropriate sections of the XPath Recommendation. Development of the XSLT processor is ongoing, and this document will be updated as functionality is expanded. ...
... The following is an alphabetized and annotated list of the elements, axes, and functions from the W3C's 1.0 Recommendation for XSLT, as well as from the appropriate sections of the XPath Recommendation. Development of the XSLT processor is ongoing, and this document will be updated as functionality is expanded. ...
... The following is an alphabetized and annotated list of the elements, axes, and functions from the W3C's 1.0 Recommendation for XSLT, as well as from the appropriate sections of the XPath Recommendation. Development of the XSLT processor is ongoing, and this document will be updated as functionality is expanded. ...
...And 17 more matches
NSS_3.12_release_notes.html
Note: Firefox 3 uses NSS 3.12, but not the new SQLite-based shareable certificate and key databases. We missed the deadline to enable that feature in Firefox 3. Distribution Information The CVS tag for the NSS 3.12 release is NSS_3_12_RTM. NSS 3.12 requires NSPR 4.7.1. See the Documentation...
...Ex (see secmod.h) SEC_GetRegisteredHttpClient (see ocsp.h) SEC_PKCS5IsAlgorithmPBEAlgTag (see secpkcs5.h) VFY_CreateContextDirect (see cryptohi.h) VFY_CreateContextWithAlgorithmID (see cryptohi.h) VFY_VerifyDataDirect (see cryptohi.h) VFY_VerifyDataWithAlgorithmID (see cryptohi.h) VFY_VerifyDigestDirect (see cryptohi.h) VFY_VerifyDigestWithAlgorithmID (see cryptohi.h) New macros for Camellia sup
port (see blapit.h): NSS_CAMELLIA NSS_CAMELLIA_CBC CAMELLIA_BLOCK_SIZE New macros for RSA (see blapit.h): RSA_MAX_MODULUS_BITS RSA_MAX_EXPONENT_BITS New macros in certt.h: X.509 v3 KU_ENCIPHER_ONLY CERT_MAX_SERIAL_NUMBER_BYTES CERT_MAX_DN_BYTES PKIX CERT_REV_M_DO_NOT_TEST_USING_THIS_METHOD CERT_REV_M_TEST_USING_THIS_METHOD CERT_REV_M_ALLOW_NETWORK_FETCHING CERT_REV_M_FORBID_NETWORK_FETCHING C...
...) SEC_OID_PKCS12_KEY_USAGE changed to SEC_OID_BOGUS_KEY_USAGE SEC_OID_ANSIX962_ECDSA_SIGNATURE_WITH_SHA1_DIGEST changed to SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE Note: SEC_OID_ANSIX962_ECDSA_SIGNATURE_WITH_SHA1_DIGEST is also kept for compatibility reasons. ...
...And 16 more matches
NSS Sample Code Sample1
This program shows the following: RSA key pair generation Naming RSA key pairs Looking up a previously generated key pair by name Creating AES and MAC keys (or encryption and MAC keys in general) Wrapping symmetric keys using your own RSA key pair so that they can be stored on disk or in a database. ...
...r that will be used // store keys locally. // 1b. The primary host wraps the newly generated key using the // RSA key and stores the wrapped key data in a local file. // 1c. The primary host unwraps the key using the RSA key each time // access to the key is required, such as at server startup. // 2. ...
...he wrapped key data in a local file. // 1c. The primary host unwraps the key using the RSA key each time // access to the key is required, such as at server startup. // 2. The secondary host generates an RSA keypair that will be used // to trans
port keys between the primary host and itself. This // key needs to exist long enough to be used to process the // response to a key trans
port request that is made to the primary // server. The example here shows how to create a permanent (token) // RSA key for this purpose. (This key will also be used for // storage of the keys, since NSS does not sup
port permanent symmetric // keys at the current time.) // 3. The secondary host sends its RSA public key to the primary host as // part of a request for a particular key, or...
...And 16 more matches
Handling Mozilla Security Bugs
For more information read the rest of this document. Introduction In order to improve the Mozilla project's approach to resolving Mozilla security vulnerabilities, mozilla.org is creating more formal arrangements for handling Mozilla security-related bugs. First, mozilla.org is appointing a security module owner charged with primary responsibility for coordinating the investigation and resolution of re
ported Mozilla security vulnerabilities. The security module owner will have one or more peers to assist in this task. ...
...e information read the rest of this document. Introduction In order to improve the Mozilla project's approach to resolving Mozilla security vulnerabilities, mozilla.org is creating more formal arrangements for handling Mozilla security-related bugs. First, mozilla.org is appointing a security module owner charged with primary responsibility for coordinating the investigation and resolution of re
ported Mozilla security vulnerabilities. The security module owner will have one or more peers to assist in this task. At the same time, mozilla.org is also creating a larger "Mozilla security bug group" by which Mozilla contributors and others can participate in addressing security vulnerabilities in Mozilla. This document describes how the new security organizational structure will work, and how sec...
...ilities. The security module owner will have one or more peers to assist in this task. At the same time, mozilla.org is also creating a larger "Mozilla security bug group" by which Mozilla contributors and others can participate in addressing security vulnerabilities in Mozilla. This document describes how the new security organizational structure will work, and how security-related Mozilla bug re
ports will be handled. Note that the focus of this new structure is restricted solely to addressing actual security vulnerabilities arising from problems in Mozilla code. This work is separate from the work of developers adding new security features (cryptographically-based or otherwise) to Mozilla, although obviously many of the same people will be involved in both sets of activities. Background S...
...And 16 more matches
Using XPCOM Utilities to Make Things Easier
flexibility as you have when you are writing your own implementation. But they have the advantage of allowing much more rapid development. To get an idea about how much can be handled with the macros described in this section, compare the code listing in weblock2.cpp at the end of the chapter with webLock1.cpp in the previous chapter. The module macros include one set of macros that define the ex
ported NSGetModule entry point, the required nsIModule implementation code and another that creates a generic factory for your implementation class. Used together, these macros can take care of a lot of the component implementation code and leave you working on the actual logic for your component. Note that all of the macros described in this section are similar but are used in slightly different si...
...keep track of things. The four required parts[other-parts] of the structure contain the following information: A human readable class name the class ID (CID) the contract ID (an optional but recommended argument) a constructor for the given object static const nsModuleComponentInfo components[] = { { "Pretty Class Name", CID, CONTRACT_ID, Constructor }, // ... }; The im
portant thing to note in the fictitious listing above is that it can sup
port multiple components in a module. Modules such as the networking libraries in Gecko ("necko") have over 50 components declared in a single nsModuleComponentInfo array like this. The first entry of the nsModuleComponentInfo above is the name of the component. Though it isn't used that much internally at the present time, this ...
...duleComponentInfo structure. #include "nsIGenericFactory.h" static const nsModuleComponentInfo components[] = { { "Pretty Class Name", SAMPLE_CID, "@company.com/sample", SampleConstructor } } NS_IMPL_NSGETMODULE(nsSampleModule, components) Most of the components in the Mozilla browser client use this approach. Common Implementation Macros Every XPCOM object implements nsISup
ports, but writing this implementation over and over is tedious. Unless you have very special requirements for managing reference counting or handling interface discovery, theimplementation macros that XPCOM provides can be used. Instead of implementing the nsISup
ports yourself, NS_IMPL_ISUP
PORTS1 can expand to the implementation of AddRef, Release, and QueryInterface for any object. NS_IMPL_ISUP
PORT...
...And 16 more matches
nsITransferable
widget/nsITransferable.idlScriptable A container for typed data that can be transferred from one place or owner to another, possibly involving format conversion. These objects are used during drag-and-drop operations. Inherits from: nsISup
ports Last changed in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10) Implemented by: @mozilla.org/widget/transferable;1. To create an instance, use: var transferable = Components.classes["@mozilla.org/widget/transferable;1"] .createInstance(Components.interfaces.nsITransferable); It's im
portant to note that a flavor, which specifies a type of data the transferable sup
ports, is represented by a null-terminated string indicating the MIME type of the format sup
ported by the flavor. Method overview v...
...illa.org/widget/transferable;1"] .createInstance(Components.interfaces.nsITransferable); It's im
portant to note that a flavor, which specifies a type of data the transferable sup
ports, is represented by a null-terminated string indicating the MIME type of the format sup
ported by the flavor. ...
... .createInstance(Components.interfaces.nsITransferable); It's im
portant to note that a flavor, which specifies a type of data the transferable sup
ports, is represented by a null-terminated string indicating the MIME type of the format sup
ported by the flavor. ...
...And 16 more matches
FileList - Web APIs
An object of this type is returned by the files property of the HTML <input> element; this lets you access the list of files selected with the <input type="file"> element. It's also used for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object for details on this usage. Note: Prior to Gecko 1.9.2, the input element only sup
ported a single file being selected at a time, meaning that the FileList would contain only one file. Starting with Gecko 1.9.2, if the input element's multiple attribute is true, the FileList may contain multiple files. Using the file list All <input> element nodes have a files attribute of type FileList on them which allows access to the items in this list. For example, if the HTML includes the following file input: ...
...y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 16 more matches
IDBObjectStore.name - Web APIs
Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transact...
...Transaction not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); console.log(objectStore.name); // Make a request to add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of our request note.innerHTML += '<li>Request successful.</li>'; }; }; Specification Specification Status Comment Indexed Database API 2.0The definition of 'name' in that specification. Recommendation Indexed Database API DraftThe definition of 'name' in that specification. Recommendation Browser compatibility The compa...
...lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 16 more matches
IDBRequest.error - Web APIs
result is not available, the InvalidStateError exception is thrown. Example The following example requests a given record title, onsuccess gets the associated record from the IDBObjectStore (made available as objectStoreTitleRequest.result), updates one property of the record, and then puts the updated record back into the object store. Also included at the bottom is an onerror function that re
ports what the error was if the request fails. For a full working example, see our To-do Notifications app (view example live.) var title = "Walk dog"; // Open up a transaction as usual var objectStore = db.transaction(['toDoList'], "readwrite").objectStore('toDoList'); // Get the do-do list with the specified title var objectStoreTitleRequest = objectStore.get(title); objectStoreTitleRequest.onsu...
...ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 16 more matches
NavigationPreloadManager - Web APIs
this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ntribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ser-compat-data and send us a pull request. ...
...And 16 more matches
WritableStream - Web APIs
}); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer example. Backpressure Because of how backpressure is sup
ported in the API, its implementation in code may be less than obvious. To see how backpressure is implemented look for three things. The highWaterMark property, which is set when creating the counting strategy (line 35), sets the maximum amount of data that the WritableStream instance will handle in a single write() operation. In this example, it's the maximum amount of data that can be sent to de...
...y table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 16 more matches
CSS Scrollbars - CSS: Cascading Style Sheets
able in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ike to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. scrollbar-width DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetscrollbar-widthChrome No sup
port NoEdge No sup
port NoFirefox Full sup
port 64 Full sup
port 64 Full sup
port 63Disabled Disabled From version 63: this feature is behind the layout.css.scrollbar-width.enabled preference (needs to be set to true). To change preferences in Firefox, visit abo...
...efox Full sup
port 64 Full sup
port 64 Full sup
port 63Disabled Disabled From version 63: this feature is behind the layout.css.scrollbar-width.enabled preference (needs to be set to true). ...
...And 16 more matches
nsIContentPolicy - Archive of obsolete content
or shouldProcess() (for example, by launching a dialog to prompt the user for something).") Note: In reality, much of this interface is defined in the nsIContentPolicyBase interface, but for now is documented here until someone has time to split things up. ...
...og to prompt the user for something).") Note: In reality, much of this interface is defined in the nsIContentPolicyBase interface, but for now is documented here until someone has time to split things up. ...
...meone has time to split things up. Method overview short shouldLoad(in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISup
ports aContext, in ACString aMimeTypeGuess, in nsISup
ports aExtra, in nsIPrincipal aRequestPrincipal); short shouldProcess(in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISup
ports aContext, in ACString aMimeType, in nsISup
ports aExtra, in nsIPrincipal aRequestPrincipal); Constants Content types Constant Value Description TYPE_OTHER 1 Indicates content whose type is unknown, or is not interesting outside a limited use case. In general, you should try not to use this type unless none of the others is a fit. TYPE_SCRIPT 2 ...
...And 15 more matches
Introduction to CSS layout - Learn web development
Objective: To give you an overview of CSS page layout techniques. Each technique can be learned in greater detail in subsequent tutorials. CSS page layout techniques allow us to take elements contained in a web page and control where they are positioned relative to their default position in normal layout flow, the other elements around them, their parent container, or the main view
port/window. The page layout techniques we'll be covering in more detail in this module are Normal flow The display property Flexbox Grid Floats Positioning Table layout Multiple-column layout Each technique has its uses, advantages, and disadvantages, and no technique is designed to be used in isolation. By understanding what each method is designed for you will be in a good place to und...
... Japanese. The corresponding Inline Direction is the direction in which inline contents (such as a sentence) would run. For many of the elements on your page the normal flow will create exactly the layout you need, however for more complex layouts you will need to alter this default behavior using some of the tools available to you in CSS. Starting with a well-structured HTML document is very im
portant, as you can then work with the way things are laid out by default rather than fighting against it. The methods that can change how elements are laid out in CSS are as follows: The display property -- Standard values such as block, inline or inline-block can change how elements behave in normal flow, for example making a block-level element behave like an inline element (see Types of CSS bo...
...rap alongside one side of an element, like the way images sometimes have text floating around them in magazine layouts. The position property -- Allows you to precisely control the placement of boxes inside other boxes. static positioning is the default in normal flow, but you can cause elements to be laid out differently using other values, for example always fixed to the top of the browser view
port. Table layout -- features designed for styling the parts of an HTML table can be used on non-table elements using display: table and associated properties. Multi-column layout -- The Multi-column layout properties can cause the content of a block to layout in columns, as you might see in a newspaper. The display property The main methods of achieving page layout in CSS are all values of the ...
...And 15 more matches
Using JavaScript code modules
be used for sharing code between different privileged scopes. Modules can also be used to create global JavaScript singletons that previously required using JavaScript XPCOM objects. A JavaScript code module is simply some JavaScript code located in a registered location. The module is loaded into a specific JavaScript scope, such as XUL script or JavaScript XPCOM script, using Components.utils.im
port() or Components.utils["im
port"](). Creating a JavaScript code module A very simple JavaScript module looks like this: var EX
PORTED_SYMBOLS = ["foo", "bar"]; function foo() { return "foo"; } var bar = { name : "bar", size : 3 }; var dummy = "dummy"; Notice that the module uses normal JavaScript to create functions, objects, constants, and any other JavaScript type. The module also de...
..."](). Creating a JavaScript code module A very simple JavaScript module looks like this: var EX
PORTED_SYMBOLS = ["foo", "bar"]; function foo() { return "foo"; } var bar = { name : "bar", size : 3 }; var dummy = "dummy"; Notice that the module uses normal JavaScript to create functions, objects, constants, and any other JavaScript type. The module also defines a special Array named EX
PORTED_SYMBOLS. Any JavaScript item named in EX
PORTED_SYMBOLS will be ex
ported from the module and injected into the im
porting scope. For example: Components.utils.im
port("resource://app/my_module.jsm"); alert(foo()); // displays "foo" alert(bar.size + 3); // displays "6" alert(dummy); // displays "dummy is not defined" because 'dummy' was not ex
ported from the module Note: When y...
...(The URL in the example is "resource://app/my_module.jsm".) Code modules can only be loaded using a chrome: (), resource:, or file: URL. ...
...And 15 more matches
An overview of NSS Internals
Software developed by the Mozilla.org projects traditionally used its own implementation of security protocols and cryptographic algorithms, originally called Netscape Security Services, nowadays called Network Security Services (NSS). NSS is a library written in the C programming language. It's free and open source software, and many other software projects have decided to use it. In order to sup
port multiple operating systems (OS), it is based on a cross platform
portability layer, called the Netscape
Portable Runtime (NSPR), which provides cross platform application programming interfaces (APIs) for OS specific APIs like file system access, memory management, network communication, and multithreaded programming. NSS offers lots of functionality; we'll walk through the list of modules, de...
...tems (OS), it is based on a cross platform
portability layer, called the Netscape
Portable Runtime (NSPR), which provides cross platform application programming interfaces (APIs) for OS specific APIs like file system access, memory management, network communication, and multithreaded programming. NSS offers lots of functionality; we'll walk through the list of modules, design principles, and im
portant relevant standards. In order to allow interoperability between software and devices that perform cryptographic operations, NSS conforms to a standard called PKCS#11. ...
...APIs like file system access, memory management, network communication, and multithreaded programming. NSS offers lots of functionality; we'll walk through the list of modules, design principles, and im
portant relevant standards. In order to allow interoperability between software and devices that perform cryptographic operations, NSS conforms to a standard called PKCS#11. (Note that it's im
portant to look at the number 11, as there are other PKCS standards with different numbers that define quite different topics.) A software or hardware module conforming to the PKCS#11 standard implements an interface of C calls, which allow querying the characteristics and offered services of the module. Multiple elements of NSS's own modules have been implemented with this interface, and NSS makes...
...And 15 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
= FileToItem(&filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* check for headers and trailers and remove them */ if ((body = strstr(nonbody, header)) != NULL) { char *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* maybe this is a MAC file */ if (body) trail = strstr(++body, trailer); if (trail != NULL) { *trail = '\0'; } else { PR_fprintf(PR_STDERR, "input has header but no trailer\n");
PORT_Free(filedata.data); rv = SECFailu...
...
PORT_Free(filedata.data); rv = SECFailure; goto cleanup; } } else { /* headers didn't exist */ char *trail = NULL; body = nonbody; if (body) { trail = strstr(++body, trailer); if (trail != NULL) { PR_fprintf(PR_STDERR, "input has no header but has trailer\n");
PORT_Free(filedata.data); rv = SECFailure; goto cleanup; } } } HexToBuf(body, item, isHexData); cleanup: if (file) { PR_Close(file); } return rv; } /* * Generate the private key */ SECKEYPrivateKey * GeneratePrivateKey(KeyType keytype, PK11SlotInfo *slot, int size, int publicExpone...
... mechanism; SECOidTag algtag; PK11RSAGenParams rsaparams; void *params; SECKEYPrivateKey *privKey = NULL; SECStatus rv; unsigned char randbuf[BLOCKSIZE + 1]; rv = GenerateRandom(randbuf, BLOCKSIZE); if (rv != SECSuccess) { fprintf(stderr, "Error while generating the random numbers : %s\n",
PORT_ErrorToString(rv)); goto cleanup; } PK11_RandomUpdate(randbuf, BLOCKSIZE); switch (keytype) { case rsaKey: rsaparams.keySizeInBits = size; rsaparams.pe = publicExponent; mechanism = CKM_RSA_PKCS_KEY_PAIR_GEN; algtag = SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION; pa...
...And 15 more matches
Drawing and Event Handling - Plugins
a plug-in instance appears in a web page, you (and the web page author) have many options. The content provider who writes the web page determines its display mode: whether the plug-in is embedded, or displayed in its own separate page. You determine whether a plug-in is windowed or windowless by the way you define the plug-in itself. A windowed plug-in is drawn into its own native window (or
portion of a native window) on a web page. A windowed plug-in is opaque, hiding the part of the page beneath its display window. This type of plug-in determines when it draws itself. A windowless plug-in does not require a native window. It is drawn in a target called a drawable, which corresponds to either the browser window or an off-screen bitmap. A drawable can be defined in several ways, dependi...
...r the browser window or an off-screen bitmap. A drawable can be defined in several ways, depending on the platform. Windowless plug-ins can be opaque or transparent. A windowless plug-in draws itself only in response to a paint message from the browser. For information about the way HTML determines plug-in display mode, see Using HTML to Display Plug-ins. NOTE: Windowless plug-ins were not sup
ported on the X Window System platform prior to Gecko 1.9 Alpha 7 (bug 137189). The NPWindow Structure When a plug-in is loaded, it is drawn into a target area. This target is either the windowed plug-in's native window, or the drawable of a windowless plug-in. The NPWindow structure represents either the native window or a drawable. This structure contains information about coordinate position, si...
...On Mac OS, window is a pointer to an NP_
Port. The x and y fields speci...
...And 15 more matches
Using channel messaging - Web APIs
In this article we'll explore the basics of using this technology. Note: This feature is available in Web Workers. ...
...ayer onto the game? Such things are not so easy using conventional web technology, because of the security models the web uses. You have to think about whether the origins trust one another, and how the messages are passed. Message channels on the other hand can provide a secure channel that allows you to pass data between different browsing contexts. Note: For more information and ideas, the
Ports as the basis of an object-capability model on the Web section of the spec is a useful read. Simple examples To get your started, we have published a couple of demos on Github. First up, check out our channel messaging basic demo (run it live too), which shows a really simple single message transfer between a page and an embedded <iframe>. Secondly, have a look at our multimessaging demo (run...
...be sent to an <iframe>. We also have a paragraph which we will use later on to display confirmation messages that we will receive back from the <iframe>. ...
...And 15 more matches
FileSystem - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...It's not available for use in file or folder picker panels (such as when you use an <input> element wit...
...And 15 more matches
Using the Resource Timing API - Web APIs
about the size of the fetched resource as well as the type of resource that initiated the fetch. This document shows the use of Resource Timing interfaces. For more details about the interfaces, including examples, see each interface's reference page and the references in the See also section. A live version of the examples is available on Github, as is the source code. Pull requests and bug re
ports are welcome. Resource loading phases An application can get timestamps for the various phases of resource loading such as redirection, DNS lookup, and TCP connection setup. Those phases and their property names are illustrated in Figure 1. Figure 1. Resource timing properties An application developer can use the property values to calculate the length of time a phase takes and that informat...
... responseEnd). This example also calculates the time from the start of the fetch and request start phases (fetchStart and requestStart, respectively), until the response has ended (responseEnd). This timing data provides a detailed profile of the resource loading phases and this data can be used to help identify performance bottlenecks. ...
...hases (fetchStart and requestStart, respectively), until the response has ended (responseEnd). This timing data provides a detailed profile of the resource loading phases and this data can be used to help identify performance bottlenecks. ...
...And 15 more matches
Slottable - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetSlottable ExperimentalChrome Full sup
port 53Edge Full sup
port 79Firefox Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Fir...
... Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config. No sup
port ? -- 59Disabled Disabled Until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true) and the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE No sup
port NoOpera Full sup
port ...
...And 15 more matches
Signaling and video calling - Web APIs
. This process is called signaling and involves both devices connecting to a third, mutually agreed-upon server. Through this third server, the two devices can locate one another, and exchange negotiation messages. In this article, we will further enhance the WebSocket chat first created as part of our WebSocket documentation (this article link is forthcoming; it isn't actually online yet) to sup
port opening a two-way video call between users. You can try out this example on Glitch, and you can remix the example to experiment with it as well. You can also look at the full project on GitHub. Note: If you try out the example on Glitch, please note that any changes made to the code will immediately reset any connections. In addition, there is a short timeout period; the Glitch instance is for ...
...ng server to resolve how to connect them over the internet. A signaling server's job is to serve as an intermediary to let two peers find and establish a connection while minimizing exposure of potentially private information as much as possible. How do we create this server and how does the signaling process actually work? First we need the signaling server itself. WebRTC doesn't specify a trans
port mechanism for the signaling information. You can use anything you like, from WebSocket to XMLHttpRequest to carrier pigeons to exchange the signaling information between the two peers. It's im
portant to note that the server doesn't need to understand or interpret the signaling data content. Although it's SDP, even this doesn't matter so much: the content of the message going through the signalin...
...eer, you do so, and the other peer knows how to receive this information and deliver it to its own ICE subsystem. All you have to do is channel the information back and forth. The contents don't matter at all to the signaling server. Readying the chat server for signaling Our chat server uses the WebSocket API to send information as JSON strings between each client and the server. The server sup
ports several message types to handle tasks, such as registering new users, setting usernames, and sending public chat messages. To allow the server to sup
port signaling and ICE negotiation, we need to update the code. We'll have to allow directing messages to one specific user instead of broadcasting to all connected users, and ensure unrecognized message types are passed through and delivered, with...
...And 15 more matches
Functions and classes available to Web Workers - Web APIs
Unknown no postMessage() yes, on DedicatedWorkerGlobalScope no no Unknown no APIs available in workers Function Funct...
...s, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope no close() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, but is a no-op. ...
..., on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope no close() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, but is a no-op. ...
...And 15 more matches
:visited - CSS: Cascading Style Sheets
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 15 more matches
<input type="time"> - HTML: Hypertext Markup Language
The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. ...
...on is provided to clear the control's value. 12-hour 24-hour Edge The Edge time control is somewhat more elaborate, opening up an hour and minute picker with sliding reels. It, like Chrome, uses a 12- or 24-hour format for inputting times, based on system locale: 12-hour 24-hour Value A DOMString representing a time, or empty. Events change and input Sup
ported common attributes autocomplete, list, readonly, and step IDL attributes value, valueAsDate, valueAsNumber, and list. Methods select(), stepDown(), and stepUp(). Value A DOMString containing the value of the time entered into the input. You can set a default value for the input by including a valid time in the value attribute when creating the <input> element,...
...And 15 more matches
WebAssembly.Instance() constructor - JavaScript
The WebAssembly.Instance() constructor creates a new Instance object which is a stateful, executable instance of a WebAssembly.Module. Syntax Im
portant: Since instantiation for large modules can be expensive, developers should only use the Instance() constructor when synchronous instantiation is absolutely required; the asynchronous WebAssembly.instantiateStreaming() method should be used at all other times. new WebAssembly.Instance(module, im
portObject); Parameters module The WebAssembly.Module object to be instantiated. ...
...x Im
portant: Since instantiation for large modules can be expensive, developers should only use the Instance() constructor when synchronous instantiation is absolutely required; the asynchronous WebAssembly.instantiateStreaming() method should be used at all other times. new WebAssembly.Instance(module, im
portObject); Parameters module The WebAssembly.Module object to be instantiated. im
portObject Optional An object containing the values to be im
ported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared im
port of module or else a WebAssembly.LinkError is thrown. Examples Synchronously instantiating a WebAssembly module The WebAssembly.Instance() constructor function can be called to synchronously...
...he newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared im
port of module or else a WebAssembly.LinkError is thrown. ...
...And 15 more matches
WebAssembly.Memory - JavaScript
embly.Memory object. The first way is to construct it from JavaScript. The following example creates a new WebAssembly Memory instance with an initial size of 10 pages (640KiB), and a maximum size of 100 pages (6.4MiB). Its buffer property will return an ArrayBuffer. var memory = new WebAssembly.Memory({initial:10, maximum:100}); The second way to get a WebAssembly.Memory object is to have it ex
ported by a WebAssembly module. The following example (see memory.html on GitHub, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the WebAssembly.instantiateStreaming() method, while im
porting the memory created in the line above. It then stores some values in that memory, then ex
ports a function and uses it to sum some values. WebAssembly.instantiateStreaming(...
...You can create a shared memory by passing shared: true in the constructor's initialization object: let memory = new WebAssembly.Memory({initial:10, maximum:100, shared: true}); This memory's buffer property will return a SharedArrayBuffer. ...
...atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 15 more matches
WebAssembly.Module() constructor - JavaScript
ing stateless WebAssembly code that has already been compiled by the browser and can be efficiently shared with Workers, and instantiated multiple times. The WebAssembly.Module() constructor function can be called to synchronously compile given WebAssembly binary code. However, the primary way to get a Module is through an asynchronous compilation function like WebAssembly.compile(). Syntax Im
portant: Since compilation for large modules can be expensive, developers should only use the Module() constructor when synchronous compilation is absolutely required; the asynchronous WebAssembly.compileStreaming() method should be used at all other times. new WebAssembly.Module(bufferSource); Parameters bufferSource A typed array or ArrayBuffer containing the binary code of the .wasm module y...
...e the Module() constructor when synchronous compilation is absolutely required; the asynchronous WebAssembly.compileStreaming() method should be used at all other times. new WebAssembly.Module(bufferSource); Parameters bufferSource A typed array or ArrayBuffer containing the binary code of the .wasm module you want to compile. ...
...tructor when synchronous compilation is absolutely required; the asynchronous WebAssembly.compileStreaming() method should be used at all other times. new WebAssembly.Module(bufferSource); Parameters bufferSource A typed array or ArrayBuffer containing the binary code of the .wasm module you want to compile. ...
...And 15 more matches
XUL Migration Guide - Archive of obsolete content
This guide aims to help you migrate a XUL-based add-on to the SDK. First we'll outline how to decide whether your add-on is a good candidate for migration via a comparison of the benefits and limitations of the SDK versus XUL development. ...
... This guide aims to help you migrate a XUL-based add-on to the SDK. First we'll outline how to decide whether your add-on is a good candidate for migration via a comparison of the benefits and limitations of the SDK versus XUL development. ...
... If your add-on needs a lot of help from third party packages, low-level APIs, or XPCOM, then the cost of migrating is high, and may not be worth it at this point. ...
...And 14 more matches
widget - Archive of obsolete content
's APIs. So implementing a complete solution usually means you have to send messages between the content script and the main add-on code. You can specify one or more content scripts to load into the widget using the contentScript or contentScriptFile options to the Widget() constructor. You can communicate with the script using either the postMessage() API or (preferably, usually) the
port API. Unless your content script is extremely simple and consists only of a static string, don't use contentScript: if you do, you may have problems getting your add-on approved on AMO. Instead, keep the script in a separate file and load it using contentScriptFile. This makes your code easier to maintain, secure, debug and review. For example, suppose we want to implement a media player a...
...> </html> We just include three icons, and assign an ID to each one. This HTML file, and the icon files it references, are saved in the add-on's data directory. Next, we write a content script that listens for click events on each icon and sends the corresponding message to the main add-on code: var play_button = document.getElementById("play-button"); play_button.onclick = function() { self.
port.emit("play"); } var pause_button = document.getElementById("pause-button"); pause_button.onclick = function() { self.
port.emit("pause"); } var stop_button = document.getElementById("stop-button"); stop_button.onclick = function() { self.
port.emit("stop"); } We save this file in the add-on's data directory as "button-script.js". Finally. in the add-on's "main.js" file, we create the widget,...
... Scripting trusted widget content We've already seen that you can package HTML files in your add-on's data directory and ...
...And 14 more matches
remote/parent - Archive of obsolete content
b changes. Loading modules into the child process To load a module into the child process, use remoteRequire(): const { remoteRequire } = require("sdk/remote/parent"); remoteRequire("./my-module.js", module); Inter-process communication A module loaded into a different process cannot directly communicate or share state with the module that loaded it. ...
...ire(): const { remoteRequire } = require("sdk/remote/parent"); remoteRequire("./my-module.js", module); Inter-process communication A module loaded into a different process cannot directly communicate or share state with the module that loaded it. Instead, the two sides communicate using
port objects like those used for communication with content scripts. ...
...module); Inter-process communication A module loaded into a different process cannot directly communicate or share state with the module that loaded it. Instead, the two sides communicate using
port objects like those used for communication with content scripts. The sdk/remote/parent module provides
port objects for the parent's end of the conversation, and the sdk/remote/child module provides
port objects for the child's end. ...
...And 14 more matches
Code snippets - Archive of obsolete content
This page documents how to perform custom actions with Firefox Sync via JavaScript. All of the in this page must be executed in a chrome-privileged console. To access a chrome-privileged console, open an about page (like about:about) then open a Web Console via the Web Developer menu. Tabs from Other Computers This snippet shows how to load all tabs from other computers. Components.utils.im
port("resource://services-sync/main.js"); // Obtain a reference to the main Firefox window. let mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .rootTreeItem .QueryIn...
...ference to Sync's Tabs "engine." let tabsEngine = Weave.Service.engineManager.get("tabs"); // Iterate over each client having data. for each (let client in tabsEngine.getAllClients()) { for each (let tab in client.tabs) { let url = tab.urlHistory[0]; // Load the tab via the tabbed browser API. ...
...ce.engineManager.get("tabs"); // Iterate over each client having data. for each (let client in tabsEngine.getAllClients()) { for each (let tab in client.tabs) { let url = tab.urlHistory[0]; // Load the tab via the tabbed browser API. ...
...And 14 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
ne or Something Authentication Confirms an Identity How Certificates Are Used Contents of a Certificate How CA Certificates Are Used to Establish Trust A Certificate Identifies Someone or Something A certificate is an electronic document used to identify an individual, a server, a company, or some other entity and to associate that identity with a public key. Like a driver's license, a pass
port, or other commonly used personal IDs, a certificate provides generally recognized proof of a person's identity. Public-key cryptography uses certificates to address the problem of impersonation. To get a driver's license, you typically apply to a government agency, such as the Department of Motor Vehicles, which verifies your identity, your ability to drive, your address, and other information b...
...f fake public keys for impersonation. Only the public key certified by the certificate will work with the corresponding private key possessed by the entity identified by the certificate. In addition to a public key, a certificate always includes the name of the entity it identifies, an expiration date, the name of the CA that issued the certificate, a serial number, and other information. Most im
portantly, a certificate always includes the digital signature of the issuing CA. The CA's digital signature allows the certificate to function as a "letter of introduction" for users who know and trust the CA but don't know the entity identified by the certificate. For more information about the role of CAs, see "How CA Certificates Are Used to Establish Trust". Authentication Confirms an Identity ...
... For more information about the role of CAs, see "How CA Certificates Are Used to Establish Trust". Authentication Confirms an Identity Authentication is the process of confirming an identity. In the context of network interactions, authentication involves the confident identification of one party by another party. Authentication over networks can take many forms. Certificates are one way of sup
porting authentication. Network interactions typically take place between a client, such as browser software running on a personal computer, and a server, such as the software and hardware used to host a Web site. Client authentication refers to the confident identification of a client by a server (that is, identification of the person assumed to be using the client software). Server authentication r...
...And 14 more matches
Client-side form validation - Learn web development
Previous Overview: Forms Next Before submitting data to the server, it is im
portant to ensure all required form controls are filled out, in the correct format. This is called client-side form validation, and helps ensure data submitted matches the requirements set forth in the various form controls. This article leads you through basic concepts and examples of client-side form validation. Prerequisites: Computer literacy, a reasonable understanding of HTML, CSS, and JavaScript. Objective: To understand what client-side form validation is, why it's im
portant, and how to apply various techniques to implement it. ...
...his article leads you through basic concepts and examples of client-side form validation. Prerequisites: Computer literacy, a reasonable understanding of HTML, CSS, and JavaScript. Objective: To understand what client-side form validation is, why it's im
portant, and how to apply various techniques to implement it. Client-side validation is an initial check and an im
portant feature of good user experience; by catching invalid data on the client-side, the user can fix it straight away. If it gets to the server and is then rejected, a noticeable delay is caused by a round trip to the server and then back to the client-side to tell the user to fix their data. However, client-side validation should not be considered an exhaustive security measure! Your apps should a...
... out the new behavior in the example below: Note: You can find this example live on GitHub as fruit-validation.html (see also the source code.) Try submitting the form without a value. Note how the invalid input gets focus, a default error message ("Please fill out this field") appears, and the form is prevented from being sent. The presence of the required attribute on any element that sup
ports this attribute means the element matches the :required pseudoclass whether it has a value or not. If the <input> has no value, the input will match the :invalid pseudoclass. Note: For good user experience, indicate to the user when form fields are required. It isn't only good user experience, it is required by WCAG accessibility guidelines. Also, only require users to input data you actually n...
...And 14 more matches
Getting started with Svelte - Learn web development
rience of the modern tooling ecosystem. Svelte sticks closely to the classic web development model of HTML, CSS, and JS, just adding a few extensions to HTML and JavaScript. It arguably has fewer concepts and tools to learn than some of the other framework options. It's main current disadvantages are that it is a young framework -- its ecosystem is therefore more limited in terms of tooling, sup
port, plugins, clear usage patterns, etc. than more mature frameworks, and there are also less job op
portunities. But it's advantages should be enough to make you interested to explore it. Note: recently Svelte has added official TypeScript sup
port, one of its most requested features. We'll look at it later on in this tutorial series. We encourage you to go through the Svelte tutorial for a really...
... knowledge: Svelte has a shallow learning curve. Web developers with basic HTML, CSS, and JavaScript knowledge can easily grasp Svelte specifics in a short time and start building web applications. Moreover, with the help of Sapper (a framework based on Svelte), you can also develop applications with advanced features like server-side rendering, code splitting, file-based routing and offline sup
port. And then there's also Svelte Native, which lets you build native mobile applications. How does Svelte work? Being a compiler, Svelte can extend HTML, CSS, and JavaScript, generating optimal JavaScript code without any runtime overhead. To achieve this, Svelte extends vanilla web technologies in the following ways: It extends HTML by allowing JavaScript expressions in markup and providing di...
...only intervenes in very specific situations and only in the context of Svelte components. Extensions to the JavaScript language are minimal and carefully picked in order to not break JavaScript syntax nor alienate developers. In fact, you will be mostly working with vanilla JavaScript. First steps with Svelte Being a compiler, you can't just add a <script src="svelte.js"> tag to your page and im
port it into your app. You'll have to set up your development environment in order to let the compiler do its job. Requirements In order to work with Svelte you need to have Node.js installed. It's recommended that you use the long-term sup
port (LTS) version. Node includes npm (the node package manager), and npx (the node package runner). Note that you can also use the Yarn package manager in place ...
...And 14 more matches
NSS FAQ
General Questions What is Network Security Services (NSS) NSS is set of libraries, APIs, utilities, and documentation designed to sup
port cross-platform development of security-enabled client and server applications. It provides a complete open-source implementation of the crypto libraries used by Mozilla and other companies in the Firefox browser, AOL Instant Messenger (AIM), server products from Red Hat, and other products. For an overview of NSS, see Overview of NSS. For detailed information on the open-source NSS project, see NSS Project Page. What can I do with NSS? Is NSS appropriate for my application? If you want add sup
port for SSL, S/MIME, or other Internet security standards to your application, you can use Network Security Services (NSS) to do so. Because NSS provides ...
...at, and other products. For an overview of NSS, see Overview of NSS. For detailed information on the open-source NSS project, see NSS Project Page. What can I do with NSS? Is NSS appropriate for my application? If you want add sup
port for SSL, S/MIME, or other Internet security standards to your application, you can use Network Security Services (NSS) to do so. Because NSS provides complete sup
port for all versions of SSL and TLS, it is particularly well-suited for applications that need to communicate with the many clients and servers that already sup
port the SSL protocol. The PKCS #11 interface included in NSS means that your application can use hardware accelerators on the server and smart cards for two-factor authentication. How does NSS compare to OpenSSL? OpenSSL is an open sourc...
...with the many clients and servers that already sup
port the SSL protocol. The PKCS #11 interface included in NSS means that your application can use hardware accelerators on the server and smart cards for two-factor authentication. How does NSS compare to OpenSSL? OpenSSL is an open source project that implements server-side SSL, TLS, and a general-purpose cryptography library. It does not sup
port PKCS #11. It is based on the SSLeay library developed by Eric A. Young and Tim J. Hudson. OpenSSL is widely used in Apache servers and is licensed under an Apache-style licence. NSS sup
ports both server and client applications as well as PKCS #11 and S/MIME. To permit its use in as many contexts as possible, NSS is licensed under the Mozilla Public License, version 2. How does NSS compare to S...
...And 14 more matches
Mozilla-JSS JCA Provider notes
The Mozilla-JSS JCA Provider Newsgroup: mozilla.dev.tech.crypto Overview This document describes the JCA Provider shipped with JSS. The provider's name is "Mozilla-JSS". It implements cryptographic operations in native code using the NSS libraries. Contents Signed JAR file Installing the Provider Specifying the CryptoToken Sup
ported Classes What's Not Sup
ported Signed JAR file JSS implements several JCE (Java Cryptography Extension) algorithms. These algorithms have at various times been ex
port-controlled by the US government. JRE therefore requires that JAR files implementing JCE algorithms be digitally signed by an approved organization. The maintainers of JSS, Sun, Red Hat, and Mozilla, have this approval and signs the official builds of jss4.jar. At runtime, the JRE automa...
...enerate an RSA KeyPair. This will happen on TokenA because TokenA // was the per-thread default token when rsaKpg was created. rsaKpg.initialize(1024); KeyPair rsaPair = rsaKpg.generateKeyPair(); // Generate a DSA KeyPair. This will happen on TokenB because TokenB // was the per-thread default token when dsaKpg was created. ...
...DSA KeyPair. This will happen on TokenB because TokenB // was the per-thread default token when dsaKpg was created. ...
...And 14 more matches
NSS API Guidelines
nent of the API should live in its own layer. The functions in these APIs should never call API layers above them. In addition, some low-level APIs may be completely opaque to higher level layers. That is, access to these functions should only be provided by the API directly above them. The NSS APIs are layered, as shown in this diagram: The boxes in the gray section, towards the center, are ex
ported only through PKCS #11. PKCS #11 is only ex
ported through the Wrappers. The areas which need the most work (both here and throughout the code) is: The relationship of the Certificate library with just about every other component (most noticeably PKCS #12, PKCS #7, and PKCS #11) Splitting Low Key and High Key components more clearly The Crypto wrappers (PKCS #11 Wrappers) and High Key PKC...
...cates and CRLs). It also provides general certificate-handling routines (create a certificate, verify, add/check certificate extensions). Low Cert lib/certdb cdbhdl.h, certdb.h, cert.h, certt.h certhi Provides high-level certificate-related functions, that do not access the certificate database, nor individual certificate data directly. Currently, OCSP checking settings are ex
ported through certhi. High Cert lib/certhigh ocsp.h, ocspt.h crmf Provides functions, and data types, to handle Certificate Management Message Format (CMMF) and Certificate Request Message Format (CRMF, see RFC 2511) data. CMMF no longer exists as a proposed standard; CMMF functions have been incorporated into the proposal for Certificate Management Protocols (CMP). Same Lev...
...le Certificate Management Message Format (CMMF) and Certificate Request Message Format (CRMF, see RFC 2511) data. CMMF no longer exists as a proposed standard; CMMF functions have been incorporated into the proposal for Certificate Management Protocols (CMP). Same Level as SSL lib/crmf cmmf.h, crmf.h, crmft.h, cmmft.h, crmffut.h cryptohi Provides high-level cryptographic sup
port operations: such as signing, verifying signatures, key generation, key manipulation, hashing; and data types. This code is above the PKCS #11 layer. Sign/Verify lib/cryptohi cryptohi.h, cryptoht.h, hasht.h, keyhi.h, keythi.h, key.h, keyt.h, sechash.h fort Provides a PKCS #11 interface, to Fortezza crypto services. Fortezza is a set of security algorithms, used by the U.S. gov...
...And 14 more matches
IDBObjectStore.add() - Web APIs
orithm. ConstraintError An insert operation failed because the primary key constraint was violated (due to an already existing record with the same primary key value). Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database initialised.</li>'; // store the result of opening the database in the ...
...Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transact...
...vent) { note.innerHTML += '<li>Transaction not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); // Make a request to add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of our request note.innerHTML += '<li>Request successful.</li>'; }; }; Specification Specification Status Comment Indexed Database API 2.0The definition of 'add()' in that specification. Recommendation Indexed Database API DraftThe definition of 'add()' in that specification. Recommendation Browser compatibility The ...
...And 14 more matches
IDBTransaction.db - Web APIs
rface returns the database connection with which this transaction is associated. Note: This feature is available in Web Workers. Syntax var myDatabase = transaction.db; Value An IDBDatabase object. Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. At the end, we return the associated database connection using db. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database initial...
...Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = tr...
...ror = function(event) { note.innerHTML += '<li>Transaction not opened due to error. ...
...And 14 more matches
Intersection Observer API - Web APIs
Historically, detecting visibility of an element, or the relative visibility of two elements in relation to each other, has been a difficult task for which solutions have been unreliable and prone to causing the browser and the sites the user is accessing to become sluggish. As the web has matured, the need for this kind of information has grown. ...
... accessing to become sluggish. As the web has matured, the need for this kind of information has grown. Intersection information is needed for many reasons, such as: Lazy-loading of images or other content as a page is scrolled. Implementing "infinite scrolling" web sites, where more and more content is loaded and rendered as you scroll, so that the user doesn't have to flip through pages. Re
porting of visibility of advertisements in order to calculate ad revenues. Deciding whether or not to perform tasks or animation processes based on whether or not the user will see the result. Implementing intersection detection in the past involved event handlers and loops calling methods like Element.getBoundingClientRect() to build up the needed information for every element affected. Since all ...
... user scrolls the page, these intersection detection routines are firing constantly during the scroll handling code, resulting in an experience that leaves the user frustrated with the browser, the web site, and their computer. The Intersection Observer API lets code register a callback function that is executed whenever an element they wish to monitor enters or exits another element (or the view
port), or when the amount by which the two intersect changes by a requested amount. This way, sites no longer need to do anything on the main thread to watch for this kind of element intersection, and the browser is free to optimize the management of intersections as it sees fit. One thing the Intersection Observer API can't tell you: the exact number of pixels that overlap or specifically which ones...
...And 14 more matches
Key Values - Web APIs
F7F) Qt::Key_NumLock (0x01000025) KEYCODE_NUM_LOCK (143) "ScrollLock" [2] The Scroll Lock key. Toggles between scrolling and cursor movement modes. VK_SCROLL (0x91) GDK_KEY_Scroll_Lock (0xFF14) Qt::Key_ScrollLock (0x01000026) KEYCODE_SCROLL_LOCK (116) "Shift" The Shift key. Modifies keystrokes to allow typing upper (or other) case letters, and to sup
port typing punctuation and other special characters. VK_SHIFT (0x10) VK_LSHIFT (0xA0) VK_RSHIFT (0xA1) kVK_Shift (0x38) kVK_RightShift (0x3C) GDK_KEY_Shift_L (0xFFE1) GDK_KEY_Shift_R (0xFFE2) Qt::Key_Shift (0x01000020) KEYCODE_SHIFT_LEFT (59) KEYCODE_SHIFT_RIGHT (60) "Super" [4] The Super key. GDK_KEY_Super_L (0xFFEB) GDK_KEY_Super_R (0xF...
... GDK_KEY_Super_R (0xFFEC) Qt::Key_Super_L (0x01000053) Qt::Key_Super_R (0x01000054) "Symbol" The Symbol modifier key (found on certain virtual keyboards). KEYCODE_SYM (63) [3] "SymbolLock" The Symbol Lock key. ...
... [4] Firefox generates the key value "OS" for the Super and Hyper keys, instead of "Super" and "Hyper". [5] Chrome 67 and Firefox 63 now correctly interpret the right Alt key for keyboard layouts which map that key to AltGr. ...
...And 14 more matches
Using the Payment Request API - Web APIs
referred payment systems and platforms to merchants that they want to pay for goods and services. This article is a guide to making use of the Payment Request API, with examples and suggested best practices. The basics of making a payment This section details the basics of using the Payment Request API to make a payment. Note: The code snippets from this section are from our Feature detect sup
port demo. Creating a new payment request object A payment request always starts with the creation of a new PaymentRequest object -- using the PaymentRequest() constructor. This takes two mandatory parameters and one option parameter: methodData -- an object containing information concerning the payment provider, such as what payment methods are sup
ported, etc. details -- an object containing i...
...t provider, such as what payment methods are sup
ported, etc. details -- an object containing information concerning the specific payment, such as the total payment amount, tax, shipping cost, etc. options (optional) -- an object containing addtional options related to the payment. ...
...options (optional) -- an object containing addtional options related to the payment. ...
...And 14 more matches
PushManager.hasPermission() - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...dn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternethasPermission ExperimentalChrome Full sup
port 42Edge Full sup
port 16Disabled Full sup
port 16Disabled Disabled From version 16: this feature is behind the Enable service workers preference. ...
...And 14 more matches
RTCPeerConnection - Web APIs
iptions in WebRTC connectivity.remoteDescription Read only The read-only property RTCPeerConnection.remoteDescription returns a RTCSessionDescription describing the session (which includes configuration and media information) for the remote end of the connection. If this hasn't been set yet, this is null.sctp The read-only sctp property on the RTCPeerConnection interface returns an RTCSctpTrans
port describing the SCTP trans
port over which SCTP data is being sent and received. If SCTP hasn't been negotiated, this value is null.signalingState Read only The read-only signalingState property on the RTCPeerConnection interface returns one of the string values specified by the RTCSignalingState enum; these values describe the state of the signaling process on the local end of the connection while...
...o the other peer.close() The RTCPeerConnection.close() method closes the current peer connection.createAnswer() The createAnswer() method on the RTCPeerConnection interface creates an SDP answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection. The answer contains information about any media already attached to the session, codecs and options sup
ported by the browser, and any ICE candidates already gathered. The answer is delivered to the returned Promise, and should then be sent to the source of the offer to continue the negotiation process.createDataChannel() The createDataChannel() method on the RTCPeerConnection interface creates a new channel linked with the remote peer, over which any kind of data may be transmitted.createOffer()The cr...
...or the remote peer to be able to use it. ...
...And 14 more matches
ScreenOrientation - Web APIs
ScreenOrientation.angleRead only Returns the document's current orientation angle. Event handlers ScreenOrientation.onchange The EventHandler called whenever the screen changes orientation. ...
... ScreenOrientation.angleRead only Returns the document's current orientation angle. Event handlers ScreenOrientation.onchange The EventHandler called whenever the screen changes orientation. ...
...mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 14 more matches
window.location - Web APIs
ada condimentum magna. Quisque in ante tellus, in placerat est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec a mi magna, quis mattis dolor. Etiam sit amet ligula quis urna auctor imperdiet nec faucibus ante. Mauris vel consectetur dolor. Nunc eget elit eget velit pulvinar fringilla consectetur aliquam purus. Curabitur convallis, justo posuere
porta egestas, velit erat ornare tortor, non viverra justo diam eget arcu. Phasellus adipiscing fermentum nibh ac commodo. Nam turpis nunc, suscipit a hendrerit vitae, volutpat non ipsum.</p> <p>Duis lobortis sapien quis nisl luctus
porttitor. In tempor semper libero, eu tincidunt dolor eleifend sit amet. Ut nec velit in dolor tincidunt rhoncus non non diam. Morbi auctor ornare orci, non euismod felis...
...tas.</p> <p>Aenean viverra varius mauris, sed elementum lacus interdum non. Phasellus sit amet lectus vitae eros egestas pellentesque fermentum eget magna. Quisque mauris nisl, gravida vitae placerat et, condimentum id metus. Nulla eu est dictum dolor pulvinar volutpat. Pellentesque vitae sollicitudin nunc. Donec neque magna, lobortis id egestas nec, sodales quis lectus. Fusce cursus sollicitudin
porta. Suspendisse ut tortor in mauris tincidunt rhoncus. Maecenas tincidunt fermentum facilisis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p> <p>Suspendisse turpis nisl, consectetur in lacinia ut, ornare vel mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non lectus eu turpis vulputate cursus. Mauris interdum tincidunt erat id ph...
...nt fermentum facilisis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p> <p>Suspendisse turpis nisl, consectetur in lacinia ut, ornare vel mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non lectus eu turpis vulputate cursus. Mauris interdum tincidunt erat id pharetra. Nullam in libero elit, sed consequat lectus. Morbi odio nisi,
porta vitae molestie ut, gravida ut nunc. Ut non est dui, id ullamcorper orci. Praesent vel elementum felis. Maecenas ornare, dui quis auctor hendrerit, turpis sem ullamcorper odio, in auctor magna metus quis leo. Morbi at odio ante.</p> <p>Curabitur est ipsum,
porta ac viverra faucibus, eleifend sed eros. In sit amet vehicula tortor. Vestibulum viverra pellentesque erat a elementum. Integer commodo u...
...And 14 more matches
:scope - CSS: Cascading Style Sheets
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet:scopeChrome Full sup
port 27Edge Full sup
port 79Firefox Full sup
port 32Notes Full sup
port 32Notes Notes Firefox 55 removes sup
port for <style scoped> but not for the :scope pseudo-class, which is still sup
ported. <style scoped> made it possible to explicitly s...
... Full sup
port 32Notes Notes Firefox 55 removes sup
port for <style scoped> but not for the :scope pseudo-class, which is still sup
ported. <style scoped> made it possible to explicitly set up element scopes, but ongoing discussions about the design of this feature as well as lack of other implementations resulted in the decision to remove it. No sup
port 20 -- 32Disabled Disabled From version 20 until version 32 (exclusive): this feature is behind the layout.css.scope-pseudo.enabled preference (needs to be set to true). ...
...ns about the design of this feature as well as lack of other implementations resulted in the decision to remove it. No sup
port 20 -- 32Disabled Disabled From version 20 until version 32 (exclusive): this feature is behind the layout.css.scope-pseudo.enabled preference (needs to be set to true). ...
...And 14 more matches
Using feature queries - CSS: Cascading Style Sheets
Feature queries are created using the CSS at-rule @sup
ports, and are useful as they give web developers a way to test to see if a browser has sup
port for a certain feature, and then provide CSS that will only run based on the result of that test. In this guide you will learn how to implement progressive enhancement using feature queries. Syntax CSS feature queries are part of the CSS Conditional Rules module, which also contains the media query @media rule; when you use feature queries, you will find they behave in a similar way to media queries. ...
...ies. Syntax CSS feature queries are part of the CSS Conditional Rules module, which also contains the media query @media rule; when you use feature queries, you will find they behave in a similar way to media queries. ...
...ional Rules module, which also contains the media query @media rule; when you use feature queries, you will find they behave in a similar way to media queries. The difference is that with a media query you are testing something about the environment in which the web page is running, whereas with feature queries you are testing browser sup
port for CSS features. A feature query consists of the @sup
ports rule, followed by the property name and value you would like to test for. You may not test for a bare property name such as display; the rule requires a property name and a value: @sup
ports (property: value) { CSS rules to apply } If you want to check if a browser sup
ports the row-gap property, for example, you would write the following feature query. It doesn't matter which value you use in...
...And 14 more matches
box-direction - CSS: Cascading Style Sheets
n this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ibute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetbox-direction DeprecatedNon-standardChrome Full sup
port 1Prefixed Full sup
port 1Prefixed Prefixed Implemented with the vendor prefix: -webkit-Edge Full sup
port 12Prefixed Full sup
port 12Prefixed Prefixed Implemented with the vendor prefix: -webkit-Firefox Full sup
port 1Prefixed Full sup
port 1Prefixed Prefixed Implemented with the vendor prefix: -moz- Full sup
port ...
...And 14 more matches
break-inside - CSS: Cascading Style Sheets
t arcu, ac scelerisque lacus. Aliquam lobortis in lacus sit amet posuere. Fusce iaculis urna id neque dapibus, eu lacinia lectus dictum.</p> <figure> <img src="https://udn.realityripple.com/samples/fe/4508d88f78.png"> <figcaption>The Firefox logo -- fox wrapped around the world</figcaption> </figure> <p>Praesent condimentum dui dui, sit amet rutrum diam tincidunt eu. Cras suscipit
porta leo sit amet rutrum. Sed vehicula ornare tincidunt. Curabitur a ipsum ac diam mattis volutpat ac ut elit. Nullam luctus justo non vestibulum gravida. Morbi metus libero, pharetra non
porttitor a, molestie nec nisi.</p> <p>In finibus viverra enim vel suscipit. Quisque consequat velit eu orci malesuada, ut interdum tortor molestie. Proin sed pellentesque augue. Nam risus justo, faucibus non por...
...inition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...le on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 14 more matches
<shape> - CSS: Cascading Style Sheets
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 14 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
date and a time, including the year, month, and day as well as the time in hours and minutes. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The control's UI varies in general from browser to browser; at the moment sup
port is patchy, with only Chrome/Opera and Edge on desktop and most modern versions of mobile browsers having usable implementations. In other browsers, these degrade gracefully to simple <input type="text"> controls. The control is intended to simply represent a local date and time, not necessarily the user's local date and time. In other words, an implementation should allow any valid combination o...
...r's local date and time. In other words, an implementation should allow any valid combination of year, month, day, hour, and minute - even if such a combination is invalid in the user's local time zone (such as times within a daylight saving time spring-forward transition gap). Some mobile browsers (particularly on iOS) do not currently implement this correctly. Because of the limited browser sup
port for datetime-local, and the variations in how the inputs work, it may currently still be best to use a framework or library to present these, or to use a custom input of your own. Another option is to use separate date and time inputs, each of which is more widely sup
ported than datetime-local. Some browsers may resort to a text-only input element that validates that the results are legitimate d...
...Clicking the down arrow on the right hand side brings up a date picker to allow you to choose a date; you have to enter the time manually. ...
...And 14 more matches
Content Security Policy (CSP) - HTTP
tain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft to site defacement to distribution of malware. CSP is designed to be fully backward compatible (except CSP version 2 where there are some explicitly-mentioned inconsistencies in backward compatibility; more details here section 1.1). Browsers that don't sup
port it still work with servers that implement it, and vice-versa: browsers that don't sup
port CSP simply ignore it, functioning as usual, defaulting to the standard same-origin policy for web content. If the site doesn't offer the CSP header, browsers likewise use the standard same-origin policy. To enable CSP, you need to configure your web server to return the Content-Security-Policy HTTP header. ...
...XSS attacks exploit the browser's trust of the content received from the server. Malicious scripts are executed by the victim's browser because the browser trusts the source of the content, even when it's not coming from where it seems to be coming from. CSP makes it possible for server administrators to reduce or eliminate the vectors by which XSS can occur by specifying the domain...
... be used; for example (and ideally, from a security standpoint), a server can specify that all content must be loaded using HTTPS. A complete data transmission security strategy includes not only enforcing HTTPS for data transfer, but also marking all cookies with the secure attribute and providing automatic redirects from HTTP pages to their HTTPS counterparts. Sites may also use the Strict-Trans
port-Security HTTP header to ensure that browsers connect to them only over an encrypted channel. Using CSP Configuring Content Security Policy involves adding the Content-Security-Policy HTTP header to a web page and giving it values to control what resources the user agent is allowed to load for that page. For example, a page that uploads and displays images could allow images from anywhere, but r...
...And 14 more matches
WebAssembly.Global - JavaScript
This allows dynamic linking of multiple modules. Constructor WebAssembly.Global() Creates a new Global object. Global instances All Global instances inherit from the Global() constructor's prototype object -- this can be modified to affect all Global instances. Instance properties Global.prototype.constructor Returns the function that created this object's instance. By default this is the WebAssembly.Global() constructor. ...
...ns the value contained inside the global variable. Examples Creating a new Global instance The following example shows a new global instance being created using the WebAssembly.Global() constructor. It is being defined as a mutable i32 type, with a value of 0. The value of the global is then changed, first to 42 using the Global.value property, and then to 43 using the incGlobal() function ex
ported out of the global.wasm module (this adds 1 to whatever value is given to it and then returns the new value). const output = document.getElementById('output'); function assertEq(msg, got, expected) { output.innerHTML += `Testing ${msg}: `; if (got !== expected) output.innerHTML += `FAIL!<br>Got: ${got}<br>Expected: ${expected}<br>`; else output.innerHTML += `SUCCESS...
... Specifications Specification WebAssembly JavaScript Inter...
...And 14 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
ter idea if given the option, but some users take forever to upgrade. There will be no usage of the Add-on SDK or any other external libraries here. Everything will use APIs available in Firefox 17+ or code provided here. Step 1: Use Services.jsm If you load one of Mozilla's internal JSM files, for example Services.jsm, you'll do so via privileged JavaScript code like this: Components.utils.im
port("resource://gre/modules/Services.jsm"); From here on out, it is assumed you've im
ported Services.jsm somewhere at the top of whatever file you're in and will be using it in all code examples. The examples will also assume that you know how to properly add instructions to your add-on's chrome.manifest to add and remove resource, chrome, locale, & etc. mappings, so that you can access your files w...
... and in examples. Resource mappings for files in the mozilla distribution, such as Services.jsm (above), will continue to work. In overlay extensions, you can place a resource mapping in the chrome.manifest for your add-on and load your own JSM from resource:// URIs. It's a great way to modularize your code that's been available since Firefox 3. You can use chrome:// URIs with "Components.utils.im
port()" just fine; in fact you've been able to since Firefox 4. However, because it was implemented first for only file:// and resource:// but not chrome://, everyone who learned of this new feature learned that you had to load JSM from resource:// URIs and just stuck with that forever. It does still work if you don't have restartlessness to worry about, though the protocol (or scheme, or whatever ter...
...eme, or whatever term you prefer) really should be avoided at this point. The resource:// protocol actually bleeds into content which allows webpages to detect installed add-ons using the protocol, which is not particularly fantastic (just the static file contents, not any loaded script/data). Step 2a: Load your JSM from chrome:// Now with that preface out of the way, this part is easy: drop sup
port for Firefox 3.x if you haven't already, move your JSM files to wherever you've got your chrome mapping to for your XUL overlay and/or windows, im
port your files from that new chrome mapped path instead of the old resource one, and remove your "resource" line from your chrome.manifest file. It's probably a good idea to do this even if you aren't going fully restartless / extractionless due to the ...
...And 13 more matches
XML in Mozilla - Archive of obsolete content
DTDs and Other External Entities Mozilla does not load external entities from the web. ...
...DTDs and Other External Entities Mozilla does not load external entities from the web. ...
...DTDs and Other External Entities Mozilla does not load external entities from the web. ...
...And 13 more matches
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
nternal procedural standards so they are able to operate efficiently. They may also incorporate external procedural and/or technical standards. Technical standards have traditionally been pioneered through consortiums or standards bodies. The technical standards can be either public, standards-based or a proprietary de facto standard. The purpose of this document is to discuss and emphasize the im
portance of conforming to open technology standards that are external to the organization. Let's begin the discussion, however, by looking inward to internal procedures, processes and standards. Why should organizations have standard procedures at every level? Following standards is certainly not a new organizational phenomenon; organizations require their employees to follow common rules, or a commo...
...esource allocations, and make adjustments when needed. Adherence to standards and processes can actually provide a level of flexibility because development does become predictable. In addition to predictability, standard processes improve understanding and streamline costs. Common Development Process As an organization matures, managers and engineers develop a fundamental understanding of the im
portance of requiring adherence to these processes. When projects are proposed, they are evaluated to ensure compatibility with the overall business strategy. Product marketing must then analyze the marketability of the application/product, and then conduct in-depth technical evaluations and market research studies. If the project is accepted, the compiled information, analysis and research is merged ...
...sy to get caught up in the process and forget why organizations have these processes in place. Bottom line, organizations have them because they save money, time, and resources. Sure, there are other reasons -- accountability, checkpoints, and scheduling, for example. The end result, however, is having a process in place that maximizes the organization's investment. Other Standards It is also im
portant to follow other types of standards across an organization. There are numerous standards organizations that affect how and why we do what we do. For example, in the accounting arena there is FASB (Financial Accounting Standards Board) and IASB (International Accounting Standards Board). All businesses are expected and required to follow the guidelines set forth by the FASB. When auditors evalua...
...And 13 more matches
What is CSS? - Learn web development
features coming available. However, a key thing about CSS is that everyone works very hard to never change things in a way that would break old websites. ...
...t you will find the CSS specs overwhelming -- they are intended for engineers to use to implement sup
port for the features in user agents, not for web developers to read to understand CSS. Many experienced developers would much rather refer to MDN documentation or other tutorials. It is however worth knowing that they exist, understanding the relationship between the CSS you are using, browser sup
port (see below), and the specs. Browser sup
port Once CSS has been specified then it is only useful for us in developing web pages if one or more browsers have implemented it. This means that the code has been written to turn the instruction in our CSS file into something that can be output to the screen. We'll look at this process more in the lesson How CSS works. It is unusual for all browsers to ...
...n MDN you can see the status of the property you are interested in, so you can tell if you will be able to use it on a website. What follows is the compat data chart for the CSS font-family property. ...
...And 13 more matches
Server-side web frameworks - Learn web development
ow; we'll be working you through the code in our framework-specific modules. Overview Server-side web frameworks (a.k.a. "web application frameworks") are software frameworks that make it easier to write, maintain and scale web applications. They provide tools and libraries that simplify common web development tasks, including routing URLs to appropriate handlers, interacting with databases, sup
porting sessions and user authorization, formatting output (e.g. HTML, JSON, XML), and improving security against web attacks. The next section provides a bit more detail about how web frameworks can ease web application development. We then explain some of the criteria you can use for choosing a web framework, and then list some of your options. What can a web framework do for you? Web frameworks ...
... easier, higher-level code rather than lower level networking primitives. The example below shows how this works in the Django (Python) web framework. Every "view" function (a request handler) receives an HttpRequest object containing request information, and is required to return an HttpResponse object with the formatted output (in this case a string). # Django view function from django.http im
port HttpResponse def index(request): # Get an HttpRequest (request) # perform operations using information from the request. # Return HttpResponse return HttpResponse('Output string to return') Route requests to the appropriate handler Most sites will provide a number of different resources, accessible through distinct URLs. Handling these all in one function would be hard to main...
... The first code snippet below shows a very simple Django model for a Team object. This stores the team name and team level as character fields and specifies a maximum number of characters to be stored for each record. The team_level is a choice field, so we also provide a mapping between choices to be displayed and data to be stored, along with a default value. #best/models.py from django.db im
port models class Team(models.Model): team_name = models.CharField(max_length=40) TEAM_LEVELS = ( ('U09', 'Under 09s'), ('U10', 'Under 10s'), ('U11', 'Under 11s'), ... #list our other teams ) team_level = models.CharField(max_length=3,choices=TEAM_LEVELS,default='U11') The Django model provides a simple query API for searching the database. This can...
...And 13 more matches
Creating our first Vue component - Learn web development
Note: If you need to check your code against our version, you can find a finished version of the sample Vue app code in our todo-vue repository. ...
...l display a single todo item. We'll use this to build our list of todos. In your moz-todo-vue/src/components directory, create a new file named ToDoItem.vue. Open the file in your code editor. Create the component's template section by adding <template></template> to the top of the file. Create a <script></script> section below your template section. Inside the <script> tags, add a default ex
ported object ex
port default {}, which is your component object. Your file should now look like this: <template> </template> <script> ex
port default {}; </script> We can now begin to add actual content to our ToDoItem. Vue templates are currently only allowed a single root element -- one element needs to wrap everything inside the template section (this will change when Vue 3 comes out). We'll u...
...nput type="checkbox" id="todo-item" checked="false" /> <label for="todo-item">My Todo Item</label> </div> </template> Using TodoItem inside our app This is all fine, but we haven't added the component to our app yet, so there's no way to test it and see if everything is working. Let's add it now. Open up App.vue again. ...
...And 13 more matches
Strategies for carrying out testing - Learn web development
browser testing. Gotta test 'em all? When doing cross-browser testing, you need to work out a list of browsers you will need to test on to start with. There is no way you can test on every combination of browser and device your users might use to view your site -- there are just too many, and new ones appear all the time. Instead, you should try to make sure your site works on the most im
portant target browsers and devices, and then code defensively to give your site the widest sup
port reach it can be expected to have. By coding defensively, we mean trying to build in intelligent fallbacks so that if a feature or style doesn't work in a browser, the site will be able to downgrade to something less exciting that still provides an acceptable user experience -- the core information is s...
...ll be able to downgrade to something less exciting that still provides an acceptable user experience -- the core information is still accessible, for example, even if it doesn't look quite as nice. The aim is to build up a chart of browsers/devices you can refer to as you test. You can make this as simple or as complex as you like -- for example a common approach is to have multiple grades of sup
port level, something like: A grade: Common/modern browsers -- Known to be capable. Test thoroughly and provide full sup
port. B grade: Older/less capable browsers -- known not to be capable. Test, and provide a more basic experience that gives full access to core information and services. C grade: Rare/unknown browsers -- don't test, but assume they are capable. Serve the full site, which should ...
... B grade: Older/less capable browsers -- known not to be capable. Test, and provide a more basic experience that gives full access to core information and services. C grade: Rare/unknown browsers -- don't test, but assume they are capable. Serve the full site, which should work, at least with the fallbacks provided by our defensive coding. Throughout the following sections, we'll build up a sup
port chart in this format. Note: Yahoo first made this approach popular, with their Graded browser Sup
port approach. Educated guesses You could call these "assumptions", or "gut feelings". This is not an accurate, scientific approach, but as someone who has experience with the web industry you'll have a pretty good idea of at least some of the browsers you should test. This can form a good basis ...
...And 13 more matches
Experimental features in Firefox
ntal features, you need to download Firefox Nightly or Firefox Developer Edition. Which you need is described alongside each feature's description below. Editor's note: When adding features to these tables, please try to include a link to the relevant bug or bugs using the bug macro: {{bug(bug-number)}}. HTML Element: <dialog> The HTML <dialog> element and its associated DOM APIs provide sup
port for HTML-based modal dialog boxes. The current implementation is a little inelegant but is basically functional. See bug 840640 for more details. Release channel Version added Enabled by default? Nightly 53 Yes Developer Edition 53 No Beta 53 No Release 53 No Preference name dom.dialog_element.enabled ...
... are focused using a mouse or other pointing device. See bug 1617600 for more details. Release channel Version added Enabled by default? Nightly 75 No Developer Edition 75 No Beta 75 No Release 75 No Preference name layout.css.focus-visible.enabled Single numbers as aspect ratio in media queries Sup
port for using a single <number> as a <ratio> when specifying the aspect ratio for a media query. See bug 1565562 for more details. Release channel Version added Enabled by default? Nightly 70 No Developer Edition 70 No Beta 70 No Release 70 No Preference name layout.css.aspect-ratio-number.enabled Prope...
...op-filter property applies filter effects to the area behind an element. See bug 1178765 for more details. Release channel Version added Enabled by default? Nightly 70 No Developer Edition 70 No Beta 70 No Release 70 No Preference name layout.css.backdrop-filter.enabled Grid: Masonry layout Adds sup
port for a masonry style layout based on grid layout where one axis has a masonry layout while having normal grid layout on the other. This allows to create gallery style layouts like on Pinterest. See bug 1607954 for more details. Release channel Version added Enabled by default? Nightly 77 No Developer Edition 77 No Beta 77 No ...
...And 13 more matches
WebRequest.jsm
More generally, you can also use this API instead of HTTP request observers. You can use WebRequest.jsm in either the chrome or content processes. The WebRequest API is modeled on Chrome's webRequest extension API, which makes it easier to write cross-browser add-on code. There are some differences between this API and Chrome's, though: see Chrome incompatibilities for the details. ...
...P request observers. You can use WebRequest.jsm in either the chrome or content processes. The WebRequest API is modeled on Chrome's webRequest extension API, which makes it easier to write cross-browser add-on code. There are some differences between this API and Chrome's, though: see Chrome incompatibilities for the details. ...
...er is an object that may contain up to two properties: urls and types. Name Type Description urls MatchPattern Only invoke the listener for URLs that match one of the patterns. types Array of Strings. An array of resource types. Only invoke the listener for resource types that match one of the types given. ...
...And 13 more matches
Enc Dec MAC Output Public Key as CSR
---" #define NS_CERTREQ_HEADER "-----BEGIN NEW CERTIFICATE REQUEST-----" #define NS_CERTREQ_TRAILER "-----END NEW CERTIFICATE REQUEST-----" typedef enum { GEN_CSR, ENCRYPT, DECRYPT, UNKNOWN } CommandType; typedef enum { SYMKEY = 0, MACKEY = 1, IV = 2, MAC = 3, PAD = 4, PUBKEY = 5, LAB = 6 } HeaderType; /* This is conditionalized because
PORT_ErrorToString was introduced with nss 3.13. * Though PR_ErrorToString was available, sup
port for it in nss wasn't. * FIXME: samples should determine the version of nss that's available and refuse * to run if not 3.13 or higher. */ #ifndef
PORT_ErrorToString #ifndef SEC_ERROR_BASE #define SEC_ERROR_BASE (-0x2000) #define
PORT_ErrorToString(err) PR_ErrorToString((err), ...
...enumerated commad type */ static CommandType option2Command(const char* c) { switch (*c) { case 'G': return GEN_CSR; case 'E': return ENCRYPT; case 'D': return DECRYPT; default: return UNKNOWN; } } /* * Wrap the symkey using public key */ SECStatus WrapKey(PK11SymKey* key, SECKEYPublicKey *pubKey, SECItem **wrappedKey) { SECStatus rv; SECItem *data = (SECItem *)
PORT_ZAlloc(sizeof(SECItem)); if (!data) { PR_fprintf(PR_STDERR, "Error while allocating memory\n"); rv = SECFailure; goto cleanup; } data->len = SECKEY_PublicKeyStrength(pubKey); data->data = (unsigned char*)
PORT_ZAlloc((data->len)*sizeof(unsigned int)); if (!data->data) { PR_fprintf(PR_STDERR, "Error while allocating memory\n"); rv = SEC...
...filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* check for headers and trailers and remove them */ char *trail = NULL; if ((body = strstr(nonbody, header)) != NULL) { char *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* maybe this is a MAC file */ if (body) trail = strstr(++body, trailer); if (trail != NULL) { *trail = '\0'; } else { PR_fprintf(PR_STDERR, "input has header but no trailer\n");
PORT_Free(filedata.data); return SECFailure; ...
...And 13 more matches
NSS tools : pk12util
NSS tools : pk12util Name pk12util -- Ex
port and im
port keys and certificate to or from a PKCS #12 file and the NSS database Synopsis pk12util [-i p12File|-l p12File|-o p12File] [-d [sql:]directory] [-h tokenname] [-P dbprefix] [-r] [-v] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword] Description The PKCS #12 utility, pk12util, enables sharing certificates among any server that sup
ports PKCS#12. The tool can im
port certificates and keys from PKCS#12 files into security databases, ex
port certificates, and list certificates and keys. Options and Arguments Options -i p12file Im
port keys and certificates from a PKCS#12 file into a security database. ...
...sharing certificates among any server that sup
ports PKCS#12. The tool can im
port certificates and keys from PKCS#12 files into security databases, ex
port certificates, and list certificates and keys. Options and Arguments Options -i p12file Im
port keys and certificates from a PKCS#12 file into a security database. -l p12file List the keys and certificates in PKCS#12 file. -o p12file Ex
port keys and certificates from the security database to a PKCS#12 file. Arguments -c keyCipher Specify the key encryption algorithm. -C certCipher Specify the key cert (overall package) encryption algorithm. -d [sql:]directory Specify the database directory into which to im
port to or ex
port from certificates and keys. ...
... keys and certificates in PKCS#12 file. -o p12file Ex
port keys and certificates from the security database to a PKCS#12 file. Arguments -c keyCipher Specify the key encryption algorithm. -C certCipher Specify the key cert (overall package) encryption algorithm. -d [sql:]directory Specify the database directory into which to im
port to or ex
port from certificates and keys. pk12util sup
ports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new SQLite databases (cert9.db, key4.db, and pkcs11.txt). If the prefix sql: is not used, then the tool assumes that the given databases are in the old format. -h tokenname Specify the name of the token to im
port into or ex
port from. -k slotPasswordFile Specify the text file containing the slot's...
...And 13 more matches
Using the clipboard
ersion. The transferring object will hold the clipboard contents until the application has decided what it needs. This allows the clipboard to be used by another application right away. Let's break down the steps needed to copy data to the clipboard. First, we need to create an XPCOM object to wrap what we want to copy. We'll assume that we want to copy some text. ...
...ght away. Let's break down the steps needed to copy data to the clipboard. First, we need to create an XPCOM object to wrap what we want to copy. We'll assume that we want to copy some text. We will use the interface nsISup
portsString which can be used to represent strings (specifically, Unicode strings). The following boilerplate utility functions will be used in all later code examples. // Im
port the Services module for future use, if we're not in // a browser window where it's already loaded. ...
...p what we want to copy. We'll assume that we want to copy some text. We will use the interface nsISup
portsString which can be used to represent strings (specifically, Unicode strings). The following boilerplate utility functions will be used in all later code examples. // Im
port the Services module for future use, if we're not in // a browser window where it's already loaded. Components.utils.im
port('resource://gre/modules/Services.jsm'); // Create a constructor for the built-in sup
ports-string class. ...
...And 13 more matches
FileSystemDirectoryEntry - Web APIs
this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...o the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...net ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetFileSystemDirectoryEntry ExperimentalChrome Full sup
port 8Alternate Name Full sup
port 8Alternate Name Alternate Name Uses the non-standard name: DirectoryEntryEdge Full sup
port 79Prefixed Full sup
port 79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox Full sup
port 50IE No sup
port NoOpera Full sup
port YesPrefixed Full sup
port ...
...And 13 more matches
FileSystemDirectoryReader - Web APIs
The FileSystemDirectoryReader interface of the File and Directory Entries API lets you access the FileEntry-based objects (generally FileSystemFileEntry or FileSystemDirectoryEntry) representing each entry in a directory. Because this is a non-standard API, whose specification is not currently on a standards track, it's im
portant to keep in mind that not all browsers implement it, and those that do may implement only small
portions of it. Check the Browser compatibility section for details. Methods readEntries() Returns an array containing some number of the directory's entries. Each item in the array is an object based on FileSystemEntry--typically either FileSystemFileEntry or FileSystemDirectoryEntry. Specifications Specification Status Comment File...
...is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
IDBObjectStore.autoIncrement - Web APIs
Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transa...
...on not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); console.log(objectStore.autoIncrement); // Make a request to add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of our request note.innerHTML += '<li>Request successful.</li>'; }; }; Specification Specification Status Comment Indexed Database API 2.0The definition of 'autoIncrement' in that specification. Recommendation Indexed Database API DraftThe definition of 'autoIncrement' in that specification. Recommendation Browser compati...
...e compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
IDBObjectStore.clear() - Web APIs
innerHTML += '<li>Database initialised.</li>'; // store the result of opening the database in the db variable. ...
... Recommendation Indexed Database API DraftThe definition of 'clear()' in that specification. Recommendation Browser compatibility The...
...ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
IDBObjectStore.delete() - Web APIs
ase initialised.</li>'; // store the result of opening the database in the db variable. ...
... Recommendation Indexed Database API DraftThe definition of 'delete()' in that specification. Recommendation Browser compatibility T...
...ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
IDBObjectStore.get() - Web APIs
Database initialised.</li>'; // store the result of opening the database in the db variable. ...
... Recommendation Indexed Database API DraftThe definition of 'get()' in that specification. Recommend...
...ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
IDBObjectStore.indexNames - Web APIs
Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transac...
...ction not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); console.log(objectStore.indexNames); // Make a request to add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of our request note.innerHTML += '<li>Request successful.</li>'; }; }; Specification Specification Status Comment Indexed Database API 2.0The definition of 'indexNames' in that specification. Recommendation Indexed Database API DraftThe definition of 'indexNames' in that specification. Recommendation Browser compatibility...
... The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
IDBObjectStore.keyPath - Web APIs
Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transact...
...nsaction not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); console.log(objectStore.keyPath); // Make a request to add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of our request note.innerHTML += '<li>Request successful.</li>'; }; }; Specification Specification Status Comment Indexed Database API 2.0The definition of 'keyPath' in that specification. Recommendation Indexed Database API DraftThe definition of 'keyPath' in that specification. Recommendation Browser compatibility The...
...y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
IDBObjectStore.transaction - Web APIs
Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transa...
...tion not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); console.log(objectStore.transaction); // Make a request to add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of our request note.innerHTML += '<li>Request successful.</li>'; }; }; Specification Specification Status Comment Indexed Database API 2.0The definition of 'transaction' in that specification. Recommendation Indexed Database API DraftThe definition of 'transaction' in that specification. Recommendation Browser compatibili...
...The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
PaymentRequest.canMakePayment() - Web APIs
You can call this before calling show() to provide a streamlined user experience when the user's browser can't handle any of the payment methods you accept. ...
...ld fall back to another payment method, or offer a list of methods that aren't handled by Payment Request API (or even provide instructions for paying by mail or by phone). Syntax paymentRequest.canMakePayment() .then( canPay => { ... }) .catch( error => { ... }) canPay = await paymentRequest.canMakePayment(); Returns A Promise to a Boolean that resolves to true if the user agent sup
ports any of the payment methods supplied when instantiating the request using the PaymentRequest constructor. If the payment can't be processed, the promise receives a value of false. Note: If you call this too often, the browser may reject the returned promise with a DOMException. Parameters None Examples In the following example, is excerpted from a demo that asynchronously builds a PaymentR...
...ly builds a PaymentRequest object for both Apple Pay and credit cards. It wraps the call to canMakePayment() in feature detection, and calls an appropriate callback depending on the resolution of the Promise. ...
...And 13 more matches
SharedWorkerGlobalScope.onconnect - Web APIs
The event object is a MessageEvent. ...
...The event object is a MessageEvent. ...
...hen the connect event is raised -- that is, when a Message
Port connection is opened between the associated SharedWorker and the main thread. Syntax onconnect = function() { ... }; Examples This example shows a shared worker file -- when a connection to the worker occurs from a main thread via a Message
Port, the onconnect event handler fires. The event object is a MessageEvent. ...
...And 13 more matches
WebRTC API - Web APIs
er third-party software. WebRTC consists of several interrelated APIs and protocols which work together to achieve this. The documentation you'll find here will help you understand the fundamentals of WebRTC, how to set up and use both data and media connections, and more. Interoperability Because implementations of WebRTC are still evolving, and because each browser has different levels of sup
port for codecs and WebRTC features, you should strongly consider making use of the Adapter.js library provided by Google before you begin to write your code. Adapter.js uses shims and polyfills to smooth over the differences among the WebRTC implementations across the environments sup
porting it. Adapter.js also handles prefixes and other naming differences to make the entire WebRTC development proce...
...the entire WebRTC development process easier, with more broadly compatible results. The library is also available as an NPM package. To learn more about Adapter.js, see Improving compatibility using WebRTC adapter.js. WebRTC concepts and usage WebRTC serves multiple purposes; together with the Media Capture and Streams API, they provide powerful multimedia capabilities to the Web, including sup
port for audio and video conferencing, file exchange, screen sharing, identity management, and interfacing with legacy telephone systems including sup
port for sending DTMF (touch-tone dialing) signals. Connections between peers can be made without requiring any special drivers or plug-ins, and can often be made without any intermediary servers. Connections between two peers are represented by the RTC...
...lEvent Represents events that occur while attaching a RTCDataChannel to a RTCPeerConnection. The only event sent with this interface is datachannel. RTCSessionDescription Represents the parameters of a session. Each RTCSessionDescription consists of a description type indicating which part of the offer/answer negotiation process it describes and of the SDP descriptor of the session. ...
...And 13 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
ode, it's helpful to keep in mind that the display for a 3D headset is a single screen, divided in half. The left half of the screen is seen only by the left eye, while the right half is only seen by the right eye. Rendering the scene for immersive presentation requires multiple renders of the scene--once from the perspective of each eye. When rendering the left eye, the XRWebGLLayer has its view
port configured to restrict drawing to the left half of the drawing surface. Contrarily, when rendering the right eye, the view
port is set to restrict drawing to the right half of the surface. This example demonstrates this by showing the canvas on the screen, even when presenting a scene as an immersive display using an XR device. Dependencies While we will not rely upon any 3D graphics frameworks...
...ght half of the surface. This example demonstrates this by showing the canvas on the screen, even when presenting a scene as an immersive display using an XR device. Dependencies While we will not rely upon any 3D graphics frameworks such as three.js or the like for this example, we do use the glMatrix library for matrix math, which we've used in other examples in the past. ...
...play using an XR device. Dependencies While we will not rely upon any 3D graphics frameworks such as three.js or the like for this example, we do use the glMatrix library for matrix math, which we've used in other examples in the past. This example also im
ports the WebXR polyfill maintained by the Immersive Web Working Group, which is the team responsible for the WebXR API's specification. By im
porting this polyfill, we allow the example to work on many browsers that don't yet have WebXR implementations in place, and we smooth out any transient deviations from the specification that occur during these still somewhat experimental days of the WebXR specification. Options This example has a number of options you can configure by adjusting the values of constants before you load it in the brow...
...And 13 more matches
image-set() - CSS: Cascading Style Sheets
"cat-2x.png" 2x, "cat-print.png" 600dpi); This example shows how to use image-set() to provide two alternative background-image options, chosen depending on the resolution needed: a normal version and a high-resolution version. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is im
portant primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 Spe...
...The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 13 more matches
Browser detection using the user agent - HTTP
tart by trying to identify why you want to do it. Are you trying to work around a specific bug in some version of a browser? Look, or ask, in specialized forums: you're unlikely to be the first to hit this problem. Also, experts, or simply people with another point of view, can give you ideas for working around the bug. ...
..., or ask, in specialized forums: you're unlikely to be the first to hit this problem. Also, experts, or simply people with another point of view, can give you ideas for working around the bug. If the problem seems uncommon, it's worth checking if this bug has been re
ported to the browser vendor via their bug tracking system (Mozilla; WebKit; Blink; Opera). Browser makers do pay attention to bug re
ports, and the analysis may hint about other workarounds for the bug. Are you trying to check for the existence of a specific feature? Your site needs to use a specific Web feature that some browsers don't yet sup
port, and you want to send those users to an older Web site with fewer features but that you know will work. This is the worst reason to use user agent detection because odds are eventually...
...he specific feature you need is available. If it's not, you use a fallback. In those rare cases where behavior differs between browsers, instead of checking the user agent string, you should instead implement a test to detect how the browser implements the API and determine how to use it from that. An example of feature detection is as follows. ...
...And 13 more matches
SVG documentation index - SVG: Scalable Vector Graphics
3 Compatibility sources SVG The following sources are used for the compatibility tables on SVG elements and attributes: 4 Content type NeedsTechnicalReview, SVG, Types, data types SVG makes use of a number of data types. This article lists these types along with their syntax and descr...
...This article lists these types along with their syntax and descriptions of what they're used for. 5 Linking Guide, SVG The target attribute on the SVG <a> element doesn't work in Mozilla Firefox 1.5. When SVG documents are embedded within a parent HTML document using the tag: 6 Namespaces crash course SVG, XML As an XML dialect, SVG is namespaced. It is im
portant to understand the concept of namespaces and how they are used if you plan to author SVG content. Versions of SVG viewers prior to the release of Firefox 1.5 unfortunately paid scant attention to namespaces, but they are essential to multi-XML dialect sup
porting user agents such as Gecko-based browsers which must be very strict. Take some time to understand namespaces now and it will save you a...
... tries to move away from the average mote position. Combined, we get this very natural-looking behavior. 8 Other Resources Reference, SVG Here is a list of additional resources on SVG: 9 Project SVG No summary! 10 Replaced Element SVG This page was auto-generated because a user created a sub-page to this page. 11 SVG 1.1 Sup
port in Firefox Firefox, SVG You can find some basic examples of SVG syntax and usage in the W3C SVG test suite. 12 SVG 2 sup
port in Mozilla Firefox, SVG SVG 2 is the next major version of the SVG standard, which is a complete rework of the SVG 1.2 draft. 13 SVG Attribute reference Drawing, Landing, NeedsHelp, Overview, Responsive Design, SVG, SVG Attribut...
...And 13 more matches
Features restricted to secure contexts - Web security
This reference lists the web platform features available only in secure contexts -- see Secure Contexts for a definition and more details. Current features available only in secure contexts This section lists all the APIs available only in secure contexts, along with browser versions the limitation was introduced in, as appropriate. ...
...xts -- see Secure Contexts for a definition and more details. Current features available only in secure contexts This section lists all the APIs available only in secure contexts, along with browser versions the limitation was introduced in, as appropriate. Note: Only the browsers that actually sup
port secure contexts are listed in this document. See here for information on secure contexts sup
port. ...
...This section lists all the APIs available only in secure contexts, along with browser versions the limitation was introduced in, as appropriate. Note: Only the browsers that actually sup
port secure contexts are listed in this document. See here for information on secure contexts sup
port. ...
...And 13 more matches
platform/xpcom - Archive of obsolete content
Implement XPCOM object interfaces Implement and register XPCOM factories Implement and register XPCOM services If all you need to do is use XPCOM objects that someone else has implemented, then you don't need to use this module. You can just use require("chrome") to get direct access to the Components object, and access XPCOM objects from there. Implementing XPCOM Interfaces This module ex
ports a class called Unknown which implements the fundamental XPCOM interface nsISup
ports. By subclassing Unknown, either using standard JavaScript inheritance or using the SDK's heritage module, you can provide your own implementations of XPCOM interfaces. "Unknown" is named after the "IUnknown" interface in COM. For example, the add-on below implements the nsIObserver interface to listen for and l...
...You can use this class to register factories for XPCOM components you have defined. For example, this add-on defines a subclass of Unknown called HelloWorld that implements a function called hello. By creating a Factory and passing it the contract ID for the HelloWorld component and the HelloWorld constructor, we enable XPCOM cli...
...If you don't specify a class ID, then the factory will generate one. Either way, it will be accessible as the value of the factory's id property. XPCOM users can look up the factory using the class ID inst...
...And 12 more matches
Introducing a complete toolchain - Learn web development
rough a complete toolchain case study. There really are unlimited combinations of tools and ways to use them, what you see in this article and the next is only one way that the featured tools can be used for a project. Note: It's also worth repeating that not all of these tools need to be run on the command line. Many of today's code editors (such as VS Code and Atom) have integration sup
port for a lot of tools via plugins. Introducing our case study The toolchain that we are creating in this article will be used to build and deploy a mini site that lists data (taken from one of NASA's open APIs) concerning potentially hazardous space objects that threaten our existence on Earth! It looks like this: You can see a live version of the site at near-misses.netlify.com. Tools used i...
...lowing tools and features: JSX, a React-related set of syntax extensions that allow you to do things like defining component structures inside JavaScript. You won't need to know React to follow this tutorial, but we've included this to give you an idea of how a non-native web language could be integrated into a toolchain. The latest built-in JavaScript features (at time of writing), such as im
port. Useful development tools such as Prettier for formatting and eslint for linting. PostCSS to provide CSS nesting capabilities. Parcel to build and minify our code, and to write a bunch of configuration file content automatically for us. GitHub to manage our source code control. Netlify to automate our deployment process. You may not be familiar with all the above features and tools or what...
...ted software requirements will likely benefit from the usage of tools to help simplify the development process. In addition, you should include tests before you deploy to your production server to ensure your software works as intended -- this already sounds like a necessary toolchain. For our sample project, we'll be using a toolchain specifically designed to aid our software development and sup
port the technical choices made during the software design phase. We will however be avoiding any superfluous tooling, with the aim of keeping complexity to a minimum. For example, we could have included a tool to minimize our SVG file sizes during build. However, this project has only 4 SVG images, which were manually minified using SVGO before adding them to the project. A couple of prerequisites...
...And 12 more matches
NSS 3.12.4 release notes
tarball: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_4_RTM/src/. Major changes in NSS 3.12.4 NSS 3.12.4 is the version that we submitted to NIST for FIPS 140-2 validation. Currently NSS 3.12.4 is in the "Review Pending" state in the FIPS 140-2 pre-validation list at http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140InProcess.pdf Added CRL Distribution Point sup
port (see cert.h). CERT_DecodeCRLIssuingDistributionPoint CERT_FindCRLIssuingDistPointExten The old documentation of the expression matching syntax rules was incorrect, and the new corrected documentation is as follows for public nssutil functions (see
portreq.h):
PORT_RegExpValid
PORT_RegExpSearch
PORT_RegExpCaseSearch These functions will match a string with a shell expression. The express...
...nion, to be matched and not treated as a special character, these characters must be escaped: \ ( | ) [ ~ except when they occur inside a bracketed expression, where only \ and ] require escaping. New functions in the nss shared library: PK11_IsInternalKeySlot (see pk11pub.h) SECMOD_OpenNewSlot (see pk11pub.h) New error codes (see secerr.h): SEC_ERROR_BAD_INFO_ACCESS_METHOD SEC_ERROR_CRL_IM
PORT_FAILED New OIDs (see secoidt.h) SEC_OID_X509_ANY_POLICY The nssckbi PKCS #11 module's version changed to 1.75. Obsolete code for Win16 has been removed. Sup
port for OpenVMS has been removed. Bugs Fixed The following bugs have been fixed in NSS 3.12.4. Bug 321755: implement crlDistributionPoint extension in libPKIX Bug 391434: avoid multiple encoding/decoding of PKIX_PL_OID to and from...
...OpenVMS has been removed. Bugs Fixed The following bugs have been fixed in NSS 3.12.4. ...
...And 12 more matches
Standard OS Libraries
using a MouseMove listener, as this is a high overhead event listener. So I went to the MSDN WinAPI Index page and then went to the "Cursors" category and came across GetCursorPos. I then searched it on MSDN and saw that it needed the user32.dll. (MSDN - GetCursorPos) This example was created on Windows XP SP2. It is a full working example; just copy & paste it to try it out. ...
...winapi - WinAPI js-ctypes snippets that can be copied and pasted to scratchpad COM See Using COM from js-ctypes. UNIX Unix based operating systems are Linux, *BSD, Solaris, etc. There is a star/asterik ("*") before "BSD" because this means the BSD family such as FreeB...
...winapi - WinAPI js-ctypes snippets that can be copied and pasted to scratchpad COM See Using COM from js-ctypes. UNIX Unix based operating systems are Linux, *BSD, Solaris, etc. There is a star/asterik ("*") before "BSD" because this means the BSD family such as FreeBSD, OpenBSD (who by the way made ss...
...And 12 more matches
Plug-in Basics - Plugins
ug-ins. Type "about:plugins" in the Location bar. The Installed Plug-ins page lists each installed plug-in along with its MIME type or types, description, file extensions, and the current state (enabled or disabled) of the plug-in for each MIME type assigned to it. Notice in view-source that this information is simply gathered from the JavaScript. Because plug-ins are platform-specific, you must
port them to every operating system and processor platform upon which you want to deploy your plug-in. Plug-ins and helper applications Before plug-ins, there were helper applications. A helper application is a separate, free-standing application that can be started from the browser. Like a plug-in, the browser starts a helper application when the browser encounters a MIME type that is mapped to it.
...hen the plug-in code is first loaded. By convention, all of the plug-in specific functions have the prefix "NPP", and all of the browser-specific functions have the prefix "NPN". Note: NP_Initialize and NP_Shutdown are not technically a part of the function table that the plug-in hands to the browser. The browser calls them when the plug-in software is loaded and unloaded. These functions are ex
ported from the plug-in DLL and accessed with a system table lookup, which means that they are not related to any particular plug-in instance. Again, see Initialization and Destruction for more information about initializing and destructing. The browser calls the plug-in API function NPP_New when the instance is created. Multiple instances of the same plug-in can exist (a) if there are multiple em...
...where * can be replaced by any name. Mac OS X ~/Library/Internet Plug-Ins. /Library/Internet Plug-Ins. /System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources. Plug-ins within toolkit bundles. Profile directory/plugins, where Profile directory is a user profile directory. Linux Directory pointed to by MOZ_PLUGIN_PATH environment variable. For example: #!/bin/bash ex
port MOZ_PLUGIN_PATH=/usr/lib64/mozilla/plugins exec /usr/lib64/firefox/firefox Profile directory/plugins, where Profile directory is the directory of the current user profile. ~/.mozilla/plugins. /usr/lib/mozilla/plugins (the 64-bit Firefox checks /usr/lib64/mozilla/plugins as well). /usr/lib64/firefox/plugins (for 64-bit Firefox) Note: Firefox Nightly checks a subset of these locations. Also...
...And 12 more matches
BiquadFilterNode() - Web APIs
able on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...s a pull request. ...
...And 12 more matches
HTMLImageElement.x - Web APIs
tibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 12 more matches
HTMLImageElement.y - Web APIs
tibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 12 more matches
IDBIndex.name - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
..., please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 12 more matches
NotificationEvent - Web APIs
able on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...rowser-compat-data and send us a pull request. ...
...And 12 more matches
PushRegistrationManager - Web APIs
age is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...st. ...
...And 12 more matches
Screen Orientation API - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 12 more matches
:host() - CSS: Cascading Style Sheets
Specification Status Comment CSS Scoping Module Level 1The definition of ':host()' in that specification. Working Draft Initial definition. ...
...oping Module Level 1The definition of ':host()' in that specification. Working Draft Initial definition. Browser compatibility DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet:host()Chrome Full sup
port 54Edge Full sup
port 79Firefox Full sup
port 63 Full sup
port 63 No sup
port 61 -- 63Disabled Disabled From version 61 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Fir...
... Full sup
port 63 Full sup
port 63 No sup
port 61 -- 63Disabled Disabled From version 61 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). ...
...And 12 more matches
WebAssembly.Table.prototype.set() - JavaScript
The set() prototype method of the WebAssembly.Table object mutates a reference stored at a given index to a different value. Syntax table.set(index, value); Parameters index The index of the function reference you want to mutate. value The value you want to mutate the reference to. This must be an ex
ported WebAssembly function, a JavaScript wrapper for an underlying wasm function. Return value Void. Exceptions If index is greater than or equal to Table.prototype.length, a RangeError is thrown. If value is not an ex
ported WebAssembly function or null, a TypeError is thrown. Examples Using Table.set The following example (see table2.html source code and live version) creates a new WebAssembly Table instance with an initial size of 2 references. We then print out the table ...
...2 references. We then print out the table length and contents of the two indexes (retrieved via Table.prototype.get()) to show that the length is two, and the indexes currently contain no function references (they currently return null). ...
...ts of the two indexes (retrieved via Table.prototype.get()) to show that the length is two, and the indexes currently contain no function references (they currently return null). ...
...And 12 more matches
Authoring MathML - MathML
t contains advanced structures like lists or tables but fortunately there are many generators from simple notations, WYSIWYG editors and other Content Management Systems to help writing Web pages. Mathematical notations are even more complex with structures like fractions, square roots or matrices that are likely to require their own tags. As a consequence, good MathML authoring tools are more im
portant and we describe some tools below. In particular, the Mozilla MathML team has been developing TeXZilla, a Javascript Unicode LaTeX-to-MathML converter that is intended to be used in many scenarios described here. Of course, the list is by no means exhaustive and you are invited to check out the W3C MathML software list where you can find various other tools. Note that by design, MathML is well...
...r demos and MathML references for more details. Using MathML MathML in HTML pages You can use Presentation MathML inside HTML5 documents: <!DOCTYPE html> <html> <head> <title>MathML in HTML5</title> </head> <body> <h1>MathML in HTML5</h1> <p> Square root of two: <math> <msqrt> <mn>2</mn> </msqrt> </math> </p> </body> </html> Content MathML is not sup
ported by browsers. It's recommended to convert your Content MathML markup into Presentation MathML before publishing it, for example with the help of the ctop.xsl stylesheet. Tools mentioned on this page generates Presentation MathML. Fallback for Browsers without MathML sup
port Unfortunately, some browsers are not able to render MathML equations or only have a limited sup
port. Hence you will need...
...d consider using the heavier MathJax library as a MathML polyfill: <script src="https://fred-wang.github.io/mathjax.js/mpadded-min.js"></script> Note that these two scripts perform feature detection of the mspace or mpadded elements (see the browser compatibility table on these pages). There is also a similar script to display a warning at the top of the page for browsers without good MathML sup
port and let the users choose between one of the fallback above: <script src="https://fred-wang.github.io/mathml-warning.js/mpadded-min.js"></script> If you don't want to use this link to GitHub but instead to integrate these polyfills or others in your own project, you might need the detection scripts to verify the level of MathML sup
port. For example the following function verifies the MathML supp...
...And 12 more matches
panel - Archive of obsolete content
A panel is a dialog. Its content is specified as HTML and you can execute scripts in it, so the appearance and behavior of the panel is limited only by what you can do using HTML, CSS, and JavaScript. ...
...: var myPanel = require("sdk/panel").Panel({ width: 180, height: 180, contentURL: "https://en.wikipedia.org/w/index.php?title=Jetpack&useformat=mobile" }); myPanel.show(); You can also load HTML that's been packaged with your add-on, and this is most probably how you will create dialogs. To do this, save the HTML in your add-on's data directory and load it using the data.url() method ex
ported by the self module, like this: var myPanel = require("sdk/panel").Panel({ contentURL: require("sdk/self").data.url("myFile.html") }); myPanel.show(); From Firefox 34, you can use "./myFile.html" as an alias for self.data.url("myFile.html"). So you can rewrite the above code like this: var myPanel = require("sdk/panel").Panel({ contentURL: "./myFile.html" }); myPanel.show(); Panel p...
... SDK's APIs. So implementing a complete solution usually means you have to send messages between the content script and the main add-on code. You can specify one or more content scripts to load into a panel using the contentScript or contentScriptFile options to the Panel() constructor. You can communicate with the script using either the postMessage() API or (preferably, usually) the
port API. For example, here's an add-on whose content script intercepts mouse clicks on links inside the panel, and sends the target URL to the main add-on code. The content script sends messages using self.
port.emit() and the add-on script receives them using panel.
port.on(). var myScript = "window.addEventListener('click', function(event) {" + " var t = event.target;" + ...
...And 11 more matches
Index of archived content - Archive of obsolete content
Navigator Navigator.mozNotification Add-ons Add-on SDK Builder Guides Content Scripts Communicating With Other Scripts Communicating using "
port" Communicating using "postMessage" Cross-domain Content Scripts Interacting with page scripts Loading Content Scripts Reddit Example
port self Contributor's Guide Classes and Inheritance ...
... self Contributor's Guide Classes and Inheritance Content Processes Getting Started Modules Private Properties Firefox Compatibility Module structure of the SDK
Porting the Library Detector Program ID SDK API Lifecycle SDK and XUL Comparison Testing the Add-on SDK Two Types of Scripts Working with Events XUL Migration Guide High-Level APIs addon-page base64 ...
... Rosetta Running applications SVG Animation SVG General Scrollbar Sidebar StringView Tabbox Toolbar Tree URI parsing View Source for XUL Applications Windows XML-related code snippets xml:base sup
port in old browsers XPath getAttributeNS Common Pitfalls Communication between HTML and your extension Creating custom Firefox extensions with the Mozilla build system Custom about: URLs Default Preferences Deploying a Plugin as an Extension Developing add-on...
...And 11 more matches
Ember interactivity: Events, classes and state - Learn web development
ting a component class to go along with your component. This is a vanilla JavaScript class and has no special meaning to Ember, other than extending from the Component super-class. ...
...component. This is a vanilla JavaScript class and has no special meaning to Ember, other than extending from the Component super-class. ...
...ass to go with your header component, type this in to your terminal: ember generate component-class header This will create the following empty class file -- todomvc/app/components/header.js: im
port Component from '@glimmer/component'; ex
port default class HeaderComponent extends Component { } Inside this file we will implement the event handler code. ...
...And 11 more matches
Deployment and next steps - Learn web development
In this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your Svelte learning journey. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. ...
...ended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: Learn how to prepare our Svelte app for production, and what learning resources you should visit next. Note that our application is fully functional and
porting it to TypeScript is completely optional. There are different opinions about it, and in this chapter we will talk briefly about the pros and cons of using TypeScript. Even if you are not planning to adopt it, this article will be useful for allowing you to learn what it has to offer and help you make your own decision. If you are not interested at all in TypeScript, you can skip to the next cha...
... file package.json you can see that the dev and start scripts are just calling rollup: "scripts": { "build": "rollup -c", "dev": "rollup -c -w", "start": "sirv public" }, In the dev script we are passing the -w argument, which tells rollup to watch files and rebuild on changes. ...
...And 11 more matches
Accessibility Features in Firefox
In recent articles from both AFB's Access World and NFB's Voice of the Nation's Blind, reviewers found no significant roadblocks in moving to Firefox from Internet Explorer for screen reader users. In fact, the same keyboard commands are still available, so users can become comfortable and productive right away. ...
...In recent articles from both AFB's Access World and NFB's Voice of the Nation's Blind, reviewers found no significant roadblocks in moving to Firefox from Internet Explorer for screen reader users. In fact, the same keyboard commands are still available, so users can become comfortable and productive right away. ...
...orer for screen reader users. In fact, the same keyboard commands are still available, so users can become comfortable and productive right away. Screen magnifier users can also benefit from Firefox's powerful features today, as caret and focus tracking are fully enabled. Mozilla Corporation is currently reaching out to work with AI Squared, the makers of ZoomText, in order to enable complete sup
port of advanced ZoomText features such as the Doc Reader and App Reader. We are also optimistic that the the makers of MAGic and Lunar/Supernova will add Firefox sup
port in the coming year. Mozilla has sup
port for Dragon Naturally Speaking. Some users of the professional version are happily playing with Dragon and Firefox. We are optimistic that Nuance will work to improve access to the user interfa...
...And 11 more matches
Mozilla accessibility architecture
This page is maintained by Aaron Leventhal and by the Mozilla Accessibility Community. Feedback and constructive suggestions are encouraged. 1. Intro This document is for people who wish to understand the architecture of Mozilla's accessibility API module, which provides sup
port for platform accessibility APIs. Accessibility APIs are used by 3rd party software like screen readers, screen magnifiers, and voice dictation software, which need information about document content and UI controls, as well as im
portant events like changes of focus. Mozilla sup
ports two accessibility APIs: Microsoft Active Accessibility (MSAA) on Windows and Accessibility Tool Kit (ATK) on Linux and Unix. We do not currently sup
port the Carbon accessibility model for Apple's OS X. Please note, the documentation...
...ility (MSAA) on Windows and Accessibility Tool Kit (ATK) on Linux and Unix. We do not currently sup
port the Carbon accessibility model for Apple's OS X. Please note, the documentation for implementing an MSAA server has moved. You may also wish to read Gecko Info for Windows Accessibility Vendors, a primer for vendors of 3rd party accessibility software, on how MSAA clients can utilize Gecko's sup
port. If you're interested in Linux or UNIX accessibility, check out Mozilla's ATK project page. Readers of this document should be familiar with interfaces, the W3C DOM, XUL and the concept of a layout object tree. 2. Accessible Nodes and Interfaces Every node in the DOM tree could be im
portant to 3rd party assistive technology. Accessibility APIs on each operating system have built-in assumptions ab...
...in Linux or UNIX accessibility, check out Mozilla's ATK project page. Readers of this document should be familiar with interfaces, the W3C DOM, XUL and the concept of a layout object tree. 2. Accessible Nodes and Interfaces Every node in the DOM tree could be im
portant to 3rd party assistive technology. Accessibility APIs on each operating system have built-in assumptions about what is the most im
portant information, and how an accessibility server like Mozilla should use the API's programmatic interfaces to expose this information to an accessibility client (the assistive technology). Each platform's accessibility API has made different assumptions, although there are a number of common characteristics. For example, they all expose an accessible name, or text representation, of each object, a...
...And 11 more matches
The Firefox codebase: CSS Guidelines
The Overriding CSS section contains more information about this. Avoid magic numbers; prefer automatic sizing or alignment methods. ...
...lass when the new element you are styling reuses some styles from another element, this allows the maintenance cost and the amount of code duplication to be reduced. Formatting Spacing & Indentation 2 spaces indentation is preferred Add a space after each comma, except within color functions: linear-gradient(to bottom, black 1px, rgba(255,255,255,0.2) 1px) Always add a space before !im
portant. Omit units on 0 values Do this: margin: 0; Not this: margin: 0px; Use expanded syntax It is often harder to understand what the shorthand is doing and the shorthand can also hide some unwanted default values. It is good to privilege expanded syntax to make your intentions explicit. Do this: border-color: red; Not this: border: red; Put multiple selectors on differe...
...imply dropping the override should work. It is also good practice to look at whether the rule you are overriding is still needed: maybe the UX spec for the component has changed and that rule can actually be updated or removed. When this is the case, don't be afraid to remove or update that rule. Once the two things above have been checked, check if the other rule you are overriding contains !im
portant, if that is case, try putting it in question, because it might have become obsolete. Afterwards, check the specificity of the other selector; if it is causing your rule to be overriden, you can try reducing its specificity, either by simplifying the selector or by changing where the rule is placed in the stylesheet. If this isn't possible, you can also try introducing a :not() to prevent the ...
...And 11 more matches
NSS 3.14 release notes
The NSS license has changed to MPL 2.0. Previous releases were released under a MPL 1.1/GPL 2.0/LGPL 2.1 tri-license. ...
... The NSS license has changed to MPL 2.0. Previous releases were released under a MPL 1.1/GPL 2.0/LGPL 2.1 tri-license. ...
... The NSS license has changed to MPL 2.0. Previous releases were released under a MPL 1.1/GPL 2.0/LGPL 2.1 tri-license. ...
...And 11 more matches
Component Internals
ix). The illustration below shows the basic relationship between the shared library containing the component implementation code you write and the XPCOM framework itself. In this diagram, the outer boundary is that of the module, the shared library in which a component is defined. A Component in the XPCOM Framework When you build a component or module and compile it into a library, it must ex
port a single method named NSGetModule. This NSGetModule function is the entry point for accessing the library. It gets called during registration and unregistration of the component, and when XPCOM wants to discover what interfaces or classes the module/library implements. In this chapter we will outline this entire process. As A Component in the XPCOM Framework illustrates, in addition to the NSGet...
.... As A Component in the XPCOM Framework illustrates, in addition to the NSGetModule entry point, there are nsIModule and nsIFactory interfaces that control the actual creation of the component, and also the string and XPCOM glue parts, which we'll discuss in some detail in the next section (see XPCOM Glue). These latter supply ease-of-development utilities like smart pointers, generic modules sup
port, and simple string implementations. The largest and possibly most complex part of a component is the code specific to the component itself. But Where Are the Components? Components reside in modules, and those modules are defined in shared library files that typically sit in the components directory of an XPCOM application. A set of default libraries stored in this components directory makes ...
...ationship of components to the files and interfaces that define them is shown in Onion Peel View of XPCOM Component Creation in the next chapter. The component is an abstraction sitting between the actual module in which it is implemented and the objects that its factory code creates for use by clients. XPCOM Initialization To understand why and when your component library gets called, it is im
portant to understand the XPCOM initalization process. When an application starts up, that application may initialize XPCOM. The sequence of events that kicks off this XPCOM initialization may be triggered by user action or by the application startup itself. A web browser that embeds Gecko, for example, may initialize XPCOM at startup through the embedding APIs. Another application may delay this star...
...And 11 more matches
nsISocketProvider
netwerk/socket/nsISocketProvider.idlScriptable This interface represents a socket provider. It is implemented by several types of socket classes like: UDP, SOCKS, TLS, SSL, and so on. Inherits from: nsISup
ports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Implemented by: @mozilla.org/network/socket;2?type=foo. ...
...changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Implemented by: @mozilla.org/network/socket;2?type=foo. ...
...derbird 3.0 / SeaMonkey 2.0) Implemented by: @mozilla.org/network/socket;2?type=foo. ...
...And 11 more matches
XPCOM primitive
le below. Primitives are rarely useful. The main use case is to store primitive values in a data structure that can only store XPCOM objects, such as nsIArray. Also, certain APIs, such as nsITransferable.setTransferData(), require primitives. ...
... rarely useful. The main use case is to store primitive values in a data structure that can only store XPCOM objects, such as nsIArray. Also, certain APIs, such as nsITransferable.setTransferData(), require primitives. ...
...hat can only store XPCOM objects, such as nsIArray. Also, certain APIs, such as nsITransferable.setTransferData(), require primitives. ...
...And 11 more matches
GestureEvent - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBCursor.key - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBFactory.cmp() - Web APIs
ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBFactory.deleteDatabase() - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...heck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBFactory.open() - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
..., please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.count() - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.get() - Web APIs
ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.getKey() - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.keyPath - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...lease check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.multiEntry - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.objectStore - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.openCursor() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.openKeyCursor() - Web APIs
e compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ed data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBIndex.unique - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBObjectStore.count() - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBObjectStore.createIndex() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBObjectStore.deleteIndex() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBObjectStore.index() - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBObjectStore.openCursor() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBObjectStore.put() - Web APIs
ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBOpenDBRequest.onblocked - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ase check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBOpenDBRequest.onupgradeneeded - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBTransaction.oncomplete - Web APIs
Previously in a readwrite transaction IDBTransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. ...
...abase.transaction.) This is currently experimental, and can only be used if the dom.indexedDB.experimental pref is set to true in about:config. Syntax transaction.oncomplete = function(event) { ... }; Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. Note the transaction.oncomplete = function(event) { }; block, which re
ports back when the transaction was successful. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.onsuccess = function...
...on to add the data to the database addData(); }; function addData() { // Create a new object ready for being inserted into the IDB var newItem = [ { taskTitle: "Walk dog", hours: 19, minutes: 30, day: 24, month: "December", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["toDoList"], "readwrite"); // re
port on the success of opening the transaction transaction.oncomplete = function(event) { note.innerHTML += '<li>Transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerHTML += '<li>Transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectStore = trans...
...And 11 more matches
IDBVersionChangeEvent.newVersion - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
IDBVersionChangeEvent.oldVersion - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
SubtleCrypto.wrapKey() - Web APIs
The wrapKey() method of the SubtleCrypto interface "wraps" a key. This means that it ex
ports the key in an external,
portable format, then encrypts the ex
ported key. Wrapping a key helps protect it in untrusted environments, such as inside an otherwise unprotected data store or in transmission over an unprotected network. As with SubtleCrypto.ex
portKey(), you specify an ex
port format for the key. To ex
port a key, it must have CryptoKey.extractable set to true. But because wrapKey() also encrypts the key to be im
ported, you also need to pass in the key that must be used to encrypt it. This is sometimes called the "wrapping key". The inverse of wrapKey() is SubtleCrypto.unwrapKey(): while wrapKey is composed of ex
port + encrypt, unwrapKey is composed of im
port + decrypt. Syntax const res...
...used to encrypt it. This is sometimes called the "wrapping key". The inverse of wrapKey() is SubtleCrypto.unwrapKey(): while wrapKey is composed of ex
port + encrypt, unwrapKey is composed of im
port + decrypt. Syntax const result = crypto.subtle.wrapKey( format, key, wrappingKey, wrapAlgo ); Parameters format is a string describing the data format in which the key will be ex
ported before it is encrypted. It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format. spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. key is the CryptoKey to wrap. ...
... key, wrappingKey, wrapAlgo ); Parameters format is a string describing the data format in which the key will be ex
ported before it is encrypted. It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format. spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. key is the CryptoKey to wrap. wrappingkey is the CryptoKey used to encrypt the ex
ported key. The key must have the wrapKey usage set. wrapAlgo is an object specifying the algorithm to be used to encrypt the ex
ported key, and any required extra parameters: To use RSA-OAEP, pass an RsaOaepParams object. To use AES-CTR, pass an AesCtrParams object. To use AES-CBC, pass an AesCbcParams object. To use AES-GCM, pass an AesGcmParams object. To use AES-KW, pass the stri...
...And 11 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
There's no magic object provided by either the WebGL or the WebXR API that represents the viewer that you can simply rotate and move around to automatically change what's seen on the screen. In this guide we show how use WebGL to simulate camera movements without having a camera to move. These techniques can be used in any WebGL (or WebXR) project. Animating 3D graphics is an area of software development that brings together multiple disciplines in computer science, mathematics, art, graphic design, kinematics, anatomy, physiology, physics, and cinematography. ...
...c arcade game such as Pac-Man takes place on a fixed game map, so the camera remains fixed a set distance above the map, always pointed straight down at the game world. In a side-scrolling or top-scrolling game such as Super Mario Bros., the camera moves along left and right (or up and down, or both) to ensure that the action remains visible even though the game level is much larger than the view
port. Positioning the camera Since there are no standard camera objects in WebGL or WebXR, we need to simulate the camera ourselves. Before we can do so, and before we can then simulate the movement of the camera, let's actually take a look at the virtual camera and how it can move, at the most fundamental level. As in all things, the position of an object in space--even if that space if virtual--c...
...spatial relationship of an object to the origin in space left to be considered: perspective. Perspective, properly applied to the objects in a scene, can take a scene that would otherwise look as flat as a typical 2D screen and make it pop as if it were truly 3D. There are several kinds of perspective; those are defined and their mathematics explained in the article WebGL model view projection. Im
portantly, the effect of perspective on a vector can be represented by adding a fourth component to the vector: the perspective component, called w. The value of w is applied by dividing each of the other three components by it to get the final position or vector; that is, for a coordinate given as (x, y, z, w), the point in the 3D space is actually (x/w, y/w, z/w, 1) or simply (x/w, y/w, z/w). If yo...
...And 11 more matches
Geometry and reference spaces in WebXR - Web APIs
erything you draw must have its coordinates mapped to fit into this space, either explicitly within your code, or by using a transform to adjust the coordinates of all vertices. The most efficient way, of course, is to design your objects and code to use the same coordinate system as WebGL does. The WebGL coordinates and lengths are transformed automatically at render time to the size of the view
port in which the scene is being rendered. Angles Angles are specified using radians. To convert degrees to radians, simply multiply the value in degrees by ?/180. The following code snippet shows two simple functions, degreesToRadians() and radiansToDegrees(), which convert back and forth between the two units for measuring angles. const RADIANS_PER_DEGREE = Math.PI / 180.0; let degreesToRadians ...
...ors are described using a coordinate value to define the direction and magnitude of the vector. On the origins of spaces A complete XR-enhanced scene--whether virtual or augmented--is a composite of anywhere from one to potentially dozens of frames of reference. Each object within the scene that needs to directly exchange position and orientation data with the WebXR system needs to be able to re
port that information in a way that can be understood and adapted as needed to be comprehensible by other objects within the scene. In augmented reality (AR), this is because of the need to insert virtual objects into the real world, not only placing them correctly but also ensuring that they don't seem to wander around on their own as the user's perspective shifts. In virtual reality (VR), it's all ...
...ositive to your right and negative to your left. Z is negative as you go up and positive as you go upward. This indicates the position of the headset in space at the start of your use of the XR system, with the origin (0, 0, 0) being positioned basically at the bridge of your nose. This space is the world space. Next, consider the XR controller you have in your left hand. It has the ability to re
port movement and its orientation, but it doesn't know anything about the position of the headset or, more crucially, its coordinate system. But the controller still needs a way to re
port its position to your app. Thus, it has its own coordinate system. This is a reference space which is provided to your app when input events occur. This reference space internally knows how to map the coordinates of t...
...And 11 more matches
Window.showModalDialog() - Web APIs
in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 11 more matches
Web applications and ARIA FAQ - Accessibility
vides additional structural information, helping authors identify landmarks, regions, and grids on their pages. ARIA enables dynamic, JavaScript-driven applications and widgets to interoperate with a variety of desktop-based assistive technologies. For more information about how to create accessible widgets with ARIA, see the Overview of accessible web applications and widgets. Where is ARIA Sup
ported? ARIA is a relatively new specification, but sup
port for it is growing. A wide variety of commonly-used browsers, assistive technologies, JavaScript toolkits, and applications now sup
port ARIA. However, many users may still be using older versions of these technologies. You may want to consider implementing ARIA using progressive enhancement techniques--such as adding ARIA using JavaScript, no...
...or it is growing. A wide variety of commonly-used browsers, assistive technologies, JavaScript toolkits, and applications now sup
port ARIA. However, many users may still be using older versions of these technologies. You may want to consider implementing ARIA using progressive enhancement techniques--such as adding ARIA using JavaScript, not directly to your markup--in order to more gracefully sup
port older browsers and assistive technologies. ...
...technologies, JavaScript toolkits, and applications now sup
port ARIA. However, many users may still be using older versions of these technologies. You may want to consider implementing ARIA using progressive enhancement techniques--such as adding ARIA using JavaScript, not directly to your markup--in order to more gracefully sup
port older browsers and assistive technologies. Browsers ARIA is sup
ported in the following browsers: Browser Minimum Version Notes Firefox 3.0+ Works with NVDA, JAWS 10+, and Orca Chrome Latest Screen reader sup
port still experimental as of Chrome 15 Safari 4+ Safari 5 sup
port is much improved. ...
...And 11 more matches
Live streaming web audio and video - Developer guides
Often shortened to just streaming, live streaming is the process of transmitting media 'live' to computers and devices. This is a fairly complex and nascent subject with a lot of variables, so in this article, we'll introduce you to the subject and let you know how you can get started. The key consideration when streaming media to a browser is the fact that rather than playing a finite file we are relaying a file that is being created on the fly and has no pre-determined start or end. ...
...ia will start playing more quickly Adaptive streaming makes for better experiences on a variety of devices Media is downloaded just in time which makes bandwidth usage more efficient Streaming Protocols While static media is usually served over HTTP, there are several protocols for serving adaptive streams; let's take a look at the options. HTTP For now, HTTP is by far the most commonly sup
ported protocol used to transfer media on demand or live. RTMP Real Time Messaging Protocol (RTMP) is a proprietary protocol developed by Macromedia (now Adobe) and sup
ported by the Adobe Flash plugin. RTMP comes in various flavours including RTMPE (Encrypted), RTMPS (Secure over SSL/TLS) and RTMPT (encapsulated within HTTP requests). RTSP Real Time Streaming Protocol (RTSP) controls media sessio...
...me Messaging Protocol (RTMP) is a proprietary protocol developed by Macromedia (now Adobe) and sup
ported by the Adobe Flash plugin. RTMP comes in various flavours including RTMPE (Encrypted), RTMPS (Secure over SSL/TLS) and RTMPT (encapsulated within HTTP requests). RTSP Real Time Streaming Protocol (RTSP) controls media sessions between endpoints and is often used together with Real-time Trans
port Protocol (RTP) and with Real-time Control Protocol (RTCP) for media stream delivery. Using RTP with RTCP allows for adaptive streaming. This is not yet sup
ported natively in most browsers, but be aware that Firefox OS 1.3 sup
ports RTSP. Note: some vendors implement propriety trans
port protocols, such as RealNetworks and their Real Data Trans
port (RDT). RTSP 2.0 RTSP 2.0 is currently in develo...
...And 11 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
ther attributes to achieve various purposes: Referrer/CORS control for security and privacy: see crossorigin and referrerpolicy. Use both width and height to set the intrinsic size of the image, allowing it to take up space before it loads, to mitigate content layout shifts. Responsive image hints with sizes and srcset (see also the <picture> element and our Responsive images tutorial). Sup
ported image formats The HTML standard doesn't list what image formats to sup
port, so each user agent sup
ports different formats. A complete guide to image formats sup
ported by web browsers is available. Below is a list of the image formats that are most commonly used on the web, as well as some older formats that should no longer be used, despite existing content possibly still using them. ...
...formats. A complete guide to image formats sup
ported by web browsers is available. Below is a list of the image formats that are most commonly used on the web, as well as some older formats that should no longer be used, despite existing content possibly still using them. ...
... Interchange Format image/gif .gif Chrome, Edge, Firefox, Internet Explorer, Opera, Safari ICO Microsoft Icon image/x-icon .ico, .cur Chrome, Edge, Firefox, Internet Explorer, Opera, Safari JPEG Joint Photographic Expert Group image image/jpeg .jpg, .jpeg, .jfif, .pjpeg, .pjp Chrome, Edge, Firefox, Internet Explorer, Opera, Safari PNG
Portable Network Graphics image/png .png Chrome, Edge, Firefox, Internet Explorer, Opera, Safari SVG Scalable Vector Graphics image/svg+xml .svg Chrome, Edge, Firefox, Internet Explorer, Opera, Safari TIFF Tagged Image File Format image/tiff .tif, .tiff None built-in; add-ons required WebP Web Picture format image/webp .webp Chrom...
...And 11 more matches
<input type="month"> - HTML: Hypertext Markup Language
alue is in the format "YYYY-MM", where YYYY is the four-digit year and MM is the month number. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...pository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The control's UI varies in general from browser to browser; at the moment sup
port is patchy, with only Chrome/Opera and Edge on desktop -- and most modern mobile browser versions -- having usable implementations. In browsers that don't sup
port month inputs, the control degrades gracefully to a simple <input type="text">, although there may be automatic validation of the entered text to ensure it's formatted as expected. For those of you using a browser that doesn't sup
port month, the screenshot below shows what it looks like in Chrome and Opera. Clicking the down arrow on the right hand side brings up a date picker that lets you selec...
... IDL attributes value Methods select(), stepDown(), stepUp(). Value A DOMString representing the value of the month and year entered into the input, in the form YYYY-MM (four or more digit year, then a hyphen ("-"), followed by the two-digit month). ...
...And 11 more matches
HTTP headers - HTTP
ion TE Trailer Transfer-Encoding Upgrade (see also Protocol upgrade mechanism). End-to-end headers These headers must be transmitted to the final recipient of the message: the server for a request, or the client for a response. Intermediate proxies must retransmit these headers unmodified and caches must store them. Hop-by-hop headers These headers are meaningful only for a single trans
port-level connection, and must not be retransmitted by proxies or cached. Note that only hop-by-hop headers may be set using the Connection general header. Authentication WWW-Authenticate Defines the authentication method that should be used to access a resource. Authorization Contains the credentials to authenticate a user-agent with a server. Proxy-Authenticate Defines the authentication ...
...rious effects anywhere along the request-response chain. Used for backwards compatibility with HTTP/1.0 caches where the Cache-Control header is not yet present. Warning General warning information about possible problems. Client hints HTTP Client hints are a work in progress. Actual documentation can be found on the website of the HTTP working group. Accept-CH Servers can advertise sup
port for Client Hints using the Accept-CH header field or an equivalent HTML <meta> element with http-equiv attribute ([HTML5]). Accept-CH-Lifetime Servers can ask the client to remember the set of Client Hints that the server sup
ports for a specified period of time, to enable delivery of Client Hints on subsequent requests to the server's origin ([RFC6454]). Early-Data Indicates that the requ...
...ver's origin ([RFC6454]). Early-Data Indicates that the request has been conveyed in early data. Content-DPR A number that indicates the ratio between physical pixels over CSS pixels of the selected image response. DPR A number that indicates the client's current Device Pixel Ratio (DPR), which is the ratio of physical pixels over CSS pixels (Section 5.2 of [CSSVAL]) of the layout view
port (Section 9.1.1 of [CSS2]) on the device. Device-Memory Technically a part of Device Memory API, this header represents an approximate amount of RAM client has. Save-Data A boolean that indicates the user agent's preference for reduced data usage. View
port-Width A number that indicates the layout view
port width in CSS pixels. The provided pixel value is a number rounded to the smal...
...And 11 more matches
WebAssembly.Table() constructor - JavaScript
instance with an initial size of 2 elements. We then print out the table length and contents of the two indexes (retrieved via Table.prototype.get() to show that the length is two and both elements are null. var tbl = new WebAssembly.Table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" We then create an im
port object that contains the table: var im
portObj = { js: { tbl:tbl } }; Finally, we load and instantiate a wasm module (table2.wasm) using the WebAssembly.instantiateStreaming() method. The table2.wasm module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the im
ported table (see text representation). So after instantiatio...
... } }; Finally, we load and instantiate a wasm module (table2.wasm) using the WebAssembly.instantiateStreaming() method. The table2.wasm module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the im
ported table (see text representation). So after instantiation, the table still has length 2, but the elements now contain callable Ex
ported WebAssembly Functions which we can call from JS. ...
...ethod. The table2.wasm module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the im
ported table (see text representation). So after instantiation, the table still has length 2, but the elements now contain callable Ex
ported WebAssembly Functions which we can call from JS. WebAssembly.instantiateStreaming(fetch('table2.wasm'), im
portObject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); }); Note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored inside it (e.g. get(0)() rather than get(0)) . This example shows that we're creating and accessing the table from ...
...And 11 more matches
Modifying Web Pages Based on URL - Archive of obsolete content
.org/") as they are loaded, use page-mod module. To create a page-mod, you need to specify two things: One or more content scripts to run whose job is to interact with web content. One or more patterns to match URLs for the pages you want to modify. A simple code snippet where content script is supplied as contentScript option and URL pattern is given as include option is as follows: // Im
port the page-mod API var pageMod = require("sdk/page-mod"); // Create a page-mod // It will run a script whenever a ".org" URL is loaded // The script replaces the page contents with a message pageMod.PageMod({ include: "*.org", contentScript: 'document.body.innerHTML = ' + ' "<h1>Page matches ruleset</h1>";' }); Do as follows: Create a new directory and navigate to it. Ru...
... review. To do this, you need to: Save the script in add-on's data directory. Use contentScriptFile option instead of contentScript and pass it script URL which can be obtained using self.data.url("my-script.js"). From Firefox 34 onwards, you can just use "./my-script.js" instead. ...
...ata directory. Use contentScriptFile option instead of contentScript and pass it script URL which can be obtained using self.data.url("my-script.js"). From Firefox 34 onwards, you can just use "./my-script.js" instead. ...
...And 10 more matches
JavaScript crypto - Archive of obsolete content
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. DeprecatedThis feature has been removed from the Web standards. Though some browsers may still sup
port it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. Warning: The features mentioned in this article are deleted proprietary Mozilla extensions, and are not sup
ported in any other browser. They won't work i...
... a special JavaScript object to allow web pages access to certain cryptographic-related services. These services are a balance between the functionality web pages need and the requirement to protect users from malicious web sites. Most of these services are available via the DOM window object as window.crypto. Services are provided to enable: smart card events, generating certificate requests, im
porting user certs, generating random numbers, logging out of your tokens, and signing text. Handling smart card events Web sites can make themselves more SmartCard friendly by listening for SmartCard insertion and removal events. To enable your document to receive these events, you must first tell the crypto system you are interested by setting window.crypto.enableSmartCardEvents to true. You can t...
...t.body.onunload = deregister; </script> With the above example, your web site will automatically reload anytime a SmartCard is inserted or removed. This allows the page to automatically login and logout based on the presence of the SmartCard. Generating keys and issuing user certificates There are several crypto object methods used in generating keys for certificates: generateCRMFRequest(), im
portUserCertificates(). The generateCRMFRequest() function generates a key and creates a CRMF Request object. This object can be passed to a CA using a webform. The im
portUserCertificates() function loads certificates into the NSS database or SmartCard if the corresponding key is found there. The popChallengeResponse() function is not implemented. Overview of the new cert issuing process User f...
...And 10 more matches
Mozilla release FAQ - Archive of obsolete content
The Mozilla newsgroups are intended to be used by people who will be working with Mozilla, eit...
...Invalid option 'foo' cc: No such file or directory 'foo' These are almost always caused by your platform-specific Makefile being incorrect for your system, either because you're not using the compiler that you're expected to (i.e. GCC instead of the Sun Workshop compiler), or because you're not using a recognized version of your OS. Go dig through the makefiles in config and remove the offending
portions, and see if that fixes things. If not, post to netscape.public.mozilla.builds Problems of this sort are currently most likely to happen in NSPR, as it still uses the classic build system. It's doubtful that this will happen in the main tree. /usr/include/stdlib.h:196: previous declaration of `seed48' See section 3.7 Nothing looks much like an error, except something returned error status You...
... dist/bin there's a script called mozilla. Use that to launch Mozilla for you -- it sets LD_LIBRARY_PATH automatically. To launch other binaries from dist/bin with the correct environment, use run-mozilla.sh ./your_binary Features, Patches What platforms is Mozilla available for? Mozilla is currently targeted for Win32, MacOS, and Unix/X systems. ...
...And 10 more matches
Responsive design - Learn web development
he column becomes wider than the image. The third key component was the media query. Media Queries enable the type of layout switch that Cameron Adams had previously explored using JavaScript, using only CSS. Rather than having one layout for all screen sizes, the layout could be changed. Sidebars could be repositioned for the smaller screen, or alternate navigation could be displayed. It is im
portant to understand that responsive web design isn't a separate technology -- it is a term used to describe an approach to web design or a set of best practices, used to create a layout that can respond to the device being used to view the content. In Marcotte's original exploration this meant flexible grids (using floats) and media queries, however in the almost 10 years since that article was writ...
...mentation in browsers. Media Queries allow us to run a series of tests (e.g. whether the user's screen is greater than a certain width, or a certain resolution) and apply CSS selectively to style the page appropriately for the user's needs. For example, the following media query tests to see if the current web page is being displayed as screen media (therefore not a printed document) and the view
port is at least 800 pixels wide. The CSS for the .container selector will only be applied if these two things are true. @media screen and (min-width: 800px) { .container { margin: 1em 2em; } } You can add multiple media queries within a stylesheet, tweaking your whole layout or parts of it to best suit the various screen sizes. The points at which a media query is introduced, and the layo...
...version. On mobile the heading is smaller: On desktop, however, we see the larger heading size: Note: See this example in action: example, source code. As this approach to typography shows, you do not need to restrict media queries to only changing the layout of the page. They can be used to tweak any element to make it more usable or attractive at alternate screen sizes. Using view
port units for responsive typography An interesting approach is to use the view
port unit vw to enable responsive typography. 1vw is equal to one percent of the view
port width, meaning that if you set your font size using vw, it will always relate to the size of the view
port. h1 { font-size: 6vw; } The problem with doing the above is that the user loses the ability to zoom any text set using the v...
...And 10 more matches
HTML forms in legacy browsers - Learn web development
nes. In the mobile world, when neither the browser nor the OS can be updated such as on older Android phones or iPhones, the stock browsers that don't update are also legacy browsers. Dealing with this wilderness is part of the job. Fortunately, there are a few tricks to know that can help you to solve most of the problems caused by legacy browsers. And HTML5 <input> types don't fail when not sup
ported: they fall back to type=text. Learn about the issues To understand common patterns, it helps to read browser documentation. If you are reading this on MDN, you are at the right place to start. Just check the sup
port of the elements (or DOM interface) you want to use. MDN has compatibility tables available for most elements, properties and APIs that can be used in a web page. There are other r...
... As well as the Apple web site. ...
... As well as the Apple web site. Make things simple Because HTML forms involves complex interaction, there is one rule of thumb: keep it simple, also known as the "KISS principal". ...
...And 10 more matches
How to build custom form controls - Learn web development
building the control, not on how to make the code generic and reusable; that would involve some non-trival JavaScript code and DOM manipulation in an unknown context, and that is out of the scope of this article. Design, structure, and semantics Before building a custom control, you should start by figuring out exactly what you want. This will save you some precious time. In particular, it's im
portant to clearly define all the states of your control. To do this, it's good to start with an existing control whose states and behavior are well known, so that you can simply mimic those as much as possible. In our example, we will rebuild the <select> element. Here is the result we want to achieve: This screenshot shows the three main states of our control: the normal state (on the left); the...
...e Tab key). The control is in its active state when: the user clicks on it or touches it on a touch screen. the user hits the tab key and it gains focus. the control was in its open state and the user clicks on it. The control is in its open state when: the control is in any other state than open and the user clicks on it. Once we know how to change states, it is im
portant to define how to change the control's value: The value changes when: the user clicks on an option when the control is in the open state. the user hits the up or down arrow keys when the control is in its active state. The value does not change when: the user hits the up arrow key when the first option is selected. the user hits the down arrow key when the last option is...
... how to handle the real value that will be sent with the form data --> <li class="option">Cherry</li> <li class="option">Lemon</li> <li class="option">Banana</li> <li class="option">Strawberry</li> <li class="option">Apple</li> </ul> </div> Note the use of class names; these identify each relevant part regardless of the actual underlying HTML elements used. This is im
portant to make sure that we don't bind our CSS and JavaScript to a strong HTML structure, so that we can make implementation changes later without breaking code that uses the control. For example, what if you wish to implement the equivalent of the <optgroup> element later on? Class names, however, provide no semantic value. In this current state, the screen reader user only "sees" an unordered list...
...And 10 more matches
Introduction to client-side frameworks - Learn web development
e are many frameworks out there, but currently the "big four" are considered to be the following. Ember Ember was initially released in December 2011 as a continuation of work that started in the SproutCore project. It is an older framework that has less users than more modern alternatives such as React and Vue, but it still enjoys a fair amount of popularity due to its stability, community sup
port, and some clever coding principles. Start learning Ember Angular Angular is an open-source web application framework led by the Angular Team at Google and by a community of individuals and corporations. It is a complete rewrite from the same team that built AngularJS. Angular was officially released on the 14th of September 2016. Angular is a component-based framework which uses declarative H...
...ern web applications typically do not fetch and render new HTML files -- they load a single HTML shell, and continually update the DOM inside it (referred to as single page apps, or SPAs) without navigating users to new addresses on the web. Each new pseudo-webpage is usually called a view, and by default, no routing is done. When an SPA is complex enough, and renders enough unique views, it's im
portant to bring routing functionality into your application. People are used to being able to link to specific pages in an application, travel forward and backward in their navigation history, etc., and their experience suffers when these standard web features are broken. When routing is handled by a client application in this fashion, it is aptly called client-side routing. It's possible to make a ...
...ity with the tool Just like vanilla JavaScript, frameworks take time to learn and have their quirks. Before you decide to use a framework for a project, be sure you have time to learn enough of its features for it to be useful to you rather than it working against you, and be sure that your teammates are comfortable with it as well. ...
...And 10 more matches
Software accessibility: Where are we today?
One great place to go and learn about this industry is the CSUN conference in Los Angeles, which takes place every year in mid-late March. Alternat...
...peech (TTS) Makes the computer talk to the user: Those who can't read print at all usually use talking programs (text-to-speech). Talking programs are also useful for print disabilities other than visual impairments, such as dyslexia. Additionally, text-to-speech is used by those who cannot speak, in place of their own voice. ...
...Screen magnifiers also have some built-in text-to-speech and the ability to filter text and images through various color palettes, such as black on yellow for high contrast, or green on blue for low contrast. ...
...And 10 more matches
Assert.jsm
The Assert.jsm JavaScript code module implements the CommonJS Unit Testing specification version 1.1, which provides a basic, standardized interface for performing in-code logical assertions with optional, customizable error re
porting. To use it, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://testing-common/Assert.jsm"); The Assert class offers methods for performing common logical assertions. Method overview undefined ok(value, message); undefined equal(actual, expected, message); undefined notEqual(actual, expected, message); undefined deepEqual(actual, expected, message); undefined notDeepEqual(actual, expected, message); undefined strictEqual(actual, expected, message); ...
... ok, equal, notEqual, deepEqual, notDeepEqual, strictEqual, notStr...
... ok, equal, notEqual, deepEqual, notDeepEqual, strictEqual, notStrictEqual,...
...And 10 more matches
Utilities for nss samples
*/ extern char * GetPassword(FILE *input, FILE *output, char *prompt, PRBool (*ok)(char *)); /* * FilePasswd extracts the password from a text file * * Storing passwords is often used with server environments * where prompting the user for a password or requiring it * to be entered in the commnd line is not a feasible option. * * This function sup
ports password extraction from files with * multipe passwords, one for each token. In the single password * case a line would just have the passord whereas in the multi- * password variant they could be of the form * * token_1_name:its_password * token_2_name:its_password * */ extern char * FilePasswd(PK11SlotInfo * slot, PRBool retry, void *arg); /* * GetModulePassword */ extern...
... tools and * other NSS test applications. ...
...f (c <= 'f' && c >= 'a') { return c - 'a' + 0xa; } if (c <= 'F' && c >= 'A') { return c - 'A' + 0xa; } return -1; } /* * HexToBuf */ int HexToBuf(unsigned char *inString, SECItem *outbuf, PRBool isHexData) { int len = strlen((const char *)inString); int outLen = len+1/2; int trueLen = 0; int digit1, digit2; outbuf->data = isHexData ? ...
...And 10 more matches
nss tech note5
IV is relevant only when using CBC mode of encryption. If not using CBC mode, just pass a NULL I...
...Can use CKM_GENERIC_SECRET_KEY_GEN as the key gen mechanism. <big>Prepare the parameter for crypto context. The param must be provided, but can...
...Can use CKM_GENERIC_SECRET_KEY_GEN as the key gen mechanism. <big>Prepare the parameter for crypto context. The param must be provided, but can be...
...And 10 more matches
PKCS11 FAQ
PKCS11 FAQ QUESTIONS AND ANSWERS GENERAL QUESTIONS After plugging in an external PKCS #11 module, how do you use the certificate available on the token? Does the certificate need to be im
ported into NSS's internal certificate database? If so, is there a way to get the certificate from an external token into NSS's internal certificate database? NSS searches all the installed PKCS #11 modules when looking for certificates. Once you've installed the module, the module's certificates simply appear in the list of certificates displayed in the Certificate window. What version of PKCS #11 does NSS sup
port? NSS requires at least PKCS #11 version 2.0, but can sup
port some features of later versions of NSS, including NSS 2.20. NSS does not use all the features of later versions of PKCS #11. What...
...PKCS #11 functions that make sense for your token. NSS continues to evolve, and periodically enhances it's functionality by using a more complete list of PKCS #11 functions. You should have implementations for all the functions specified in the version of the PKCS #11 spec your token implements. If you do not actually do the operation specified by that function, you can return CKR_FUNCTION_NOT_SUP
PORTED. Will NSS get the user's CA certificate via PKCS #11 and push it into the CA certificate database or is the CA certificate database expected to obtain the CA certificate by some other means? PKCS #11 certificates that have private keys associated with them are are loaded into the temporary database (in memory) and marked as user certificates. All other certificates in the module are loaded in...
...ate keys doesn't also do symmetric operations, for example, it's likely that the internal token will end up doing the symmetric operations. Is the PKCS #11 module supplied with NSS accessible through a shared library? Yes, the token is call softokn3 (softokn3.dll on windows, libsoftokn3.so on most unix platforms). The NSS softokn3 is not a complete PKCS #11 module, it was implemented only to sup
port NSS, though other products have managed to get it to work in their environment. There are a number of bugs against softoken's non-compliance, but these bugs have lower priority than fixing NSS's non-complient uses of PKCS #11 or adding new features to NSS. If multiple PKCS #11 modules are loaded, how does NSS determine which ones to use for the mechanisms required by SSL? NSS uses the first slo...
...And 10 more matches
NSS Tools pk12util
Availability See the release notes for the platforms this tool is available on. ...
... Availability See the release notes for the platforms this tool is available on. ...
... Availability See the release notes for the platforms this tool is available on. ...
...And 10 more matches
Mozilla internal string guide
at are not required to have a null-terminator (nsA[C]String). nsA[C]String is the base of the string classes (since it imposes fewer requirements) and ns[C]String is a class derived from it. Functions taking strings as parameters should generally take one of these four types. ...
...ring). nsA[C]String is the base of the string classes (since it imposes fewer requirements) and ns[C]String is a class derived from it. Functions taking strings as parameters should generally take one of these four types. In order to avoid unnecessary copying of string data (which can have significant performance cost), the string classes sup
port different ownership models. ...
...onversions from these encodings to UTF-8 and UTF-16 are provided by mozilla::Encoding. Additonally, on Windows the are some rare cases (e.g. drag&drop) where it's necessary to call a system API with data encoded in the Windows locale-dependent legacy encoding instead of UTF-16. In those rare cases, use MultiByteToWideChar/WideCharToMultiByte from kernel32.dll. Do not use iconv on *nix. We only sup
port UTF-8-encoded file paths on *nix, non-path Gtk strings are always UTF-8 and Cocoa and Java strings are always UTF-16. When working with existing code, it is im
portant to examine the current usage of the strings that you are manipulating, to determine the correct conversion mechanism. When writing new code, it can be confusing to know which storage class and encoding is the most appropriate. The...
...And 10 more matches
nsIWebNavigationInfo
docshell/base/nsIWebNavigationInfo.idlScriptable Exposes a way to get information on the capabilities of Gecko web navigation objects. ...
...ntroduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Implemented by: @mozilla.org/webnavigation-info;1 as a service: var webNavigationInfo = Components.classes["@mozilla.org/webnavigation-info;1"] .getService(Components.interfaces.nsIWebNavigationInfo); Method overview unsigned long isTypeSup
ported(in ACString aType, in nsIWebNavigation aWebNav); Constants Sup
port type constants Constant Value Description UNSUP
PORTED 0 Returned by isTypeSup
ported() to indicate lack of sup
port for a type. Note: This is guaranteed not to change, so that boolean tests can be done on the return value if isTypeSup
ported to detect whether a type is sup
ported at all. ...
...ebNav); Constants Sup
port type constants Constant Value Description UNSUP
PORTED 0 Returned by isTypeSup
ported() to indicate lack of sup
port for a type. Note: This is guaranteed not to change, so that boolean tests can be done on the return value if isTypeSup
ported to detect whether a type is sup
ported at all. IMAGE 1 Returned by isTypeSup
ported() to indicate that a type is sup
ported as an image. PLUGIN 2 Returned by isTypeSup
ported() to indicate that a type is sup
ported via an NPAPI ("Netscape 4 API") plug-in. This is not the value returned for "XPCOM plug-ins". OTHER 1 << 15 Note: Other return types may be added here in the future as they become relevant. ...
...And 10 more matches
nsIZipWriter
modules/libjar/zipwriter/public/nsIZipWriter.idlScriptable This interface provides an easy way for scripts to archive data in the Zip file format. Operations on the archive can be performed one by one, or queued for later execution. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Once all the operations you wish to perform are added to the queue, a call to processQueue() will perform the operations in the order they were added to the queue. Operations performed on the queue throw any errors that occur out to the observer. Attempting to perform a synchronous operation on the interface while the background queue is in progress will throw an NS_ERROR_IN_PROGRESS exception. File and directory names should use slashes...
... Exceptions thrown NS_ERROR_NOT_INITIALIZED If no zip file has been opened. file nsIFile The Zip file being w...
...OMPRESSION_DEFAULT 6 Use the default compression method when adding the file to the archive. COMPRESSION_BEST 9 Use the best compression method when adding the file to the archive. Methods addEntryChannel() Adds data from a channel to the Zip file. If the operation is performed on the queue then the channel will be opened asynchronously, otherwise the channel must sup
port being opened synchronously. void addEntryChannel( in AUTF8String aZipEntry, in PRTime aModTime, in PRInt32 aCompression, in nsIChannel aChannel, in boolean aQueue ); Parameters aZipEntry The path of the file entry to add to the Zip file. This is the path it will be located at within the Zip file. Note: You must use forward slashes ('/') in the path. aModTime The modification...
...And 10 more matches
readValue() - Web APIs
Otherwise it throws an error. Syntax BluetoothRemoteGATTDescriptor.readValue().then(function(value[]) { ... }) Returns A Promise that resolves to an ArrayBuffer. Specifications Specification Status Comment Web BluetoothThe definition of 'readValue()' in that specification. Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
...bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetreadValue ExperimentalChrome Full sup
port 57Notes Full sup
port 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change pre...
...t 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. ...
...And 10 more matches
FederatedCredential - Web APIs
The FederatedCredential interface of the the Credential Management API provides information about credentials from a federated identity provider. A federated identity provider is an entity that a website trusts to correctly authenticate a user, and that provides an API for that purpose. OpenID Connect is an example of a federated identity provider framework. In browsers that sup
port it, an instance of this interface may be passed in the credential member of the init object for global fetch. Constructor FederatedCredential() Creates a new FederatedCredential object. Properties Inherits properties from its ancestor, Credential. FederatedCredential.provider Read only Returns a USVString containing a credential's federated identity provider. FederatedCredential.protocol R...
...le in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
HTMLImageElement.src - Web APIs
The HTMLImageElement property src, which reflects the HTML src attribute, specifies the image to display in the <img> element. Syntax htmlImageElement.src = newSource; let src = htmlImageElement.src; Value When providing only a single image, rather than a set of images from which the browser selects the best match for the view
port size and display pixel density, the src attribute is a USVString specifying the URL of the desired image. This can be set either within the HTML itself using the src content attribute, or programmatically by setting the element's src property. If you use the srcset content attribute to provide multiple image options for different display pixel densities, the URL specified by the src attribute is used in one of two ways: as a fallback for browsers that don't ...
...ifying the URL of the desired image. This can be set either within the HTML itself using the src content attribute, or programmatically by setting the element's src property. ...
...a fallback for browsers that don't sup
port srcset. as an equivalent for specifying an image in srcset with the size multiplier 1x; that is, the image specified by src is used on low-density screens (such as typical 72 DPI or 96 DPI displays). Additionally, if you use src along with both sizes (or the corresponding sizes content attribute) and srcset in order to choose an image based on the view
port size, the src attribute is only used as a fallback for browsers that don't sup
port sizes and srcset; otherwise, it's not used at all. Examples Specifying a single image HTML <img src="https://udn.realityripple.com/samples/d6/7ab36d79bb.jpg" width="160" alt="Slices of grapefruit, looking yummy."> Result Using src with an image set When using a set of images with the srcset prop...
...And 10 more matches
IDBDatabase.transaction() - Web APIs
ansaction unless you actually need to write into the database. If you need to open the object store in readwrite mode to change data, you would use the following: var transaction = db.transaction('my-store-name', "readwrite"); As of Firefox 40, IndexedDB transactions have relaxed durability guarantees to increase performance (see bug 1112702), which is the same behaviour as other IndexedDB-sup
porting browsers. Previously in a readwrite transaction IDBTransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. In Firefox 40+ the complete event is fired after the OS has been told to write the data but potentially before that data has actually been flushed to disk. The complete event may thus be delivered quicker than before, however, there exists a small ...
...t be recomputed later) you can force a transaction to flush to disk before delivering the complete event by creating a transaction using the experimental (non-standard) readwriteflush mode (see IDBDatabase.transaction.) This is currently experimental, and can only be used if the dom.indexedDB.experimental pref is set to true in about:config. details Optional Dictionary of other settings, sup
ported only by Chrome: Return value An IDBTransaction object. Exceptions This method may raise a DOMException of one of the following types: Exception Description InvalidStateError The close() method has previously been called on this IDBDatabase instance. NotFoundError An object store specified in in the storeNames parameter has been deleted or r...
...li>'; // store the result of opening the database in the db variable. // This is used a lot below db = DBOpenRequest.result; // Run the displayData() function to populate the task list with // all the to-do list data already in the IDB displayData(); }; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["toDoList"], "readwrite"); // re
port on the success of opening the transaction transaction.oncomplete = function(event) { note.innerHTML += '<li>Transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerHTML += '<li>Transaction not opened due to error. Duplicate items not allowed.</li>'; }; // you would then go on to do something to this database // via an object store v...
...And 10 more matches
IDBTransaction.abort() - Web APIs
Exceptions This method may raise a DOMException of the following type: Exception Description InvalidStateError The transaction has already been committed or aborted. Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. At the end, we simply abort any activity done under the current transaction using abort(). For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.onsuccess = function(event) { note.innerHTML ...
...Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = t...
...ror = function(event) { note.innerHTML += '<li>Transaction not opened due to error. ...
...And 10 more matches
IDBTransaction.mode - Web APIs
nsactions that were started using IDBDatabase.setVersion(). Transactions of this mode cannot run concurrently with other transactions. Transactions in this mode are known as "upgrade transactions." Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. At the end, we simply log the mode of the current transaction using mode. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database ...
...Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = tr...
...ror = function(event) { note.innerHTML += '<li>Transaction not opened due to error. ...
...And 10 more matches
IDBTransaction.objectStore() - Web APIs
equested object store is not in this transaction's scope. InvalidStateError The request was made on a source object that has been deleted or removed, or if the transaction has finished. Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database initialised.</li>'; // store the result of opening the database in the ...
...Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = tr...
...ror = function(event) { note.innerHTML += '<li>Transaction not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); // add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of the request (this does not mean the item // has been stored successfully in the DB - for that you need transaction.onsuccess) note.innerHTML += '<li>Request successful.</li>'; }; Specification Specification Status Comment Indexed Database API 2.0The definition of 'objectStore()' in that specification. Recommendation Indexed D...
...And 10 more matches
IDBTransaction.onabort - Web APIs
abort event, fired, when the current transaction is aborted via the IDBTransaction.abort method. Note: This feature is available in Web Workers. Syntax transaction.onabort = function(event) { ... }; Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. Note the transaction.onabort = function(event) { }; block, re
porting when the transaction has been aborted. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.onsuccess = function(event) { ...
...on to add the data to the database addData(); }; function addData() { // Create a new object ready for being inserted into the IDB var newItem = [ { taskTitle: "Walk dog", hours: 19, minutes: 30, day: 24, month: "December", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["toDoList"], "readwrite"); // re
port on the success of opening the transaction transaction.oncomplete = function(event) { note.innerHTML += '<li>Transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerHTML += '<li>Transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectStore = trans...
...nerror = function(event) { note.innerHTML += '<li>Transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectStore = transaction.objectStore("toDoList"); // add our newItem object to the object store var objectStoreRequest = objectStore.add(newItem[0]); objectStoreRequest.onsuccess = function(event) { // re
port the success of the request (this does not mean the item // has been stored successfully in the DB - for that you need transaction.onsuccess) note.innerHTML += '<li>Request successful.</li>'; }; transaction.onabort = function() { // Re
port when the transaction was successfully aborted console.log("Transaction aborted!"); }; // Abort the transaction we just did transacti...
...And 10 more matches
IDBTransaction.onerror - Web APIs
der using IDBTransaction.onabort instead to handle non- successful completion of the transaction. Note: This feature is available in Web Workers. Syntax transaction.onerror = function(event) { ... }; Example In the following code snippet, we open a read/write transaction on our database and add some data to an object store. Note also the functions attached to transaction event handlers to re
port on the outcome of the transaction opening in the event of success or failure. Note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in re
porting what went wrong when the transaction was unsuccessful. For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("t...
...on to add the data to the database addData(); }; function addData() { // Create a new object ready for being inserted into the IDB var newItem = [ { taskTitle: "Walk dog", hours: 19, minutes: 30, day: 24, month: "December", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["toDoList"], "readwrite"); // re
port on the success of opening the transaction transaction.oncomplete = function(event) { note.innerHTML += '<li>Transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerHTML += '<li>Transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectStore = tran...
... Recommendation Indexed Database ...
...And 10 more matches
IDBVersionChangeRequest - Web APIs
page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...et ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetIDBVersionChangeRequest DeprecatedNon-standardChrome No sup
port 12 -- 23Prefixed No sup
port 12 -- 23Prefixed Prefixed Implemented with the vendor prefix: webkitEdge ? ...
...And 10 more matches
PaymentRequest.onshippingoptionchange - Web APIs
by the user agent changes at any time during a payment process, the event is triggered. To make sure an updated option is included when sending payment information to the server, you should add event listeners for a PaymentRequest object after instantiation, but before the call to show(). // Initialization of PaymentRequest arguments are excerpted for clarity. ...
...are excerpted for clarity. ...
...shippingOption = { id: '', label: '', amount: { currency: 'USD', value: '0.00' }, selected: true }; // Shipping to US is sup
ported if (addr.country === 'US') { shippingOption.id = 'us'; shippingOption.label = 'Standard shipping in US'; shippingOption.amount.value = '0.00'; details.total.amount.value = '55.00'; // Shipping to JP is sup
ported } else if (addr.country === 'JP') { shippingOption.id = 'jp'; shippingOption.label = 'International shipping'; shippingOption.amount.value = '10.00'; details.total.amount.value = '65.00'; // Shipping to elsewhere is unsup
ported } else { // Empty array indicates rejection of the address details.shippingOptions = []; return Promise.resolve(det...
...And 10 more matches
PhotoCapabilities - Web APIs
abilities object is retrieved by calling ImageCapture.getPhotoCapabilities(). Properties PhotoCapabilities.redEyeReduction Read only Returns one of "never", "always", or "controllable". The "controllable" value means the device's read-eye reduction is controllable by the user. PhotoCapabilities.imageHeight Read only Returns a MediaSettingsRange object indicating the image height range sup
ported by the user agent. PhotoCapabilities.imageWidth Read only Returns a MediaSettingsRange object indicating the image width range sup
ported by the user agent. PhotoCapabilities.fillLightMode Read only Returns an array of available fill light options. Options may include auto, off, or flash. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, use...
...able on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
PushEvent.PushEvent() - Web APIs
n this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ontribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetPushEvent() constructor ExperimentalChrome Full sup
port 42Edge Full sup
port 16Disabled Full sup
port 16Disabled Disabled From version 16: this feature is behind the Enable service workers preference. ...
...And 10 more matches
PushEvent.data - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetdata ExperimentalChrome Full sup
port 57Edge Full sup
port 16Disabled Full sup
port 16Disabled Disabled From version 16: this feature is behind the Enable service workers preference. ...
...And 10 more matches
SubtleCrypto.unwrapKey() - Web APIs
The unwrapKey() method of the SubtleCrypto interface "unwraps" a key. This means that it takes as its input a key that has been ex
ported and then encrypted (also called "wrapped"). It decrypts the key and then im
ports it, returning a CryptoKey object that can be used in the Web Crypto API. As with SubtleCrypto.im
portKey(), you specify the key's im
port format and other attributes of the key to im
port details such as whether it is extractable, and which operations it can be used for. But because unwrapKey() also decrypts the key to be im
ported, you also need to pass in the key that must be used to decrypt it. This is sometimes called the "unwrapping key". ...
... Syntax const result = crypto.subtle.unwrapKey( format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages ); Parameters format is a string describing the data format of the key to unwrap. It can be one of the following: raw: Raw format. ...
... Syntax const result = crypto.subtle.unwrapKey( format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages ); Parameters format is a string describing the data format of the key to unwrap. ...
...And 10 more matches
Writing a WebSocket server in Java - Web APIs
a WebSocket server, this example uses Oracle Java to simplify the example code. This server conforms to RFC 6455, so it only handles connections from Chrome version 16, Firefox 11, IE 10 and higher. First steps WebSockets communicate over a TCP (Transmission Control Protocol) connection. Java's ServerSocket class is located in the java.net package. ...
...le code. This server conforms to RFC 6455, so it only handles connections from Chrome version 16, Firefox 11, IE 10 and higher. First steps WebSockets communicate over a TCP (Transmission Control Protocol) connection. Java's ServerSocket class is located in the java.net package. ServerSocket Constructor: ServerSocket(int
port) When you instantiate the ServerSocket class, it is bound to the
port number you specified by the
port argument. ...
...16, Firefox 11, IE 10 and higher. First steps WebSockets communicate over a TCP (Transmission Control Protocol) connection. Java's ServerSocket class is located in the java.net package. ServerSocket Constructor: ServerSocket(int
port) When you instantiate the ServerSocket class, it is bound to the
port number you specified by the
port argument. ...
...And 10 more matches
Fundamentals of WebXR - Web APIs
dware such as VR headsets and glasses with integrated augmented reality features. This includes both managing the process of rendering the views needed to simulate the 3D experience and the ability to sense the movement of the headset or other motion sensing apparatus to provide the needed data to let you update the imagery shown to the user based on that movement. ...
...ng apparatus to provide the needed data to let you update the imagery shown to the user based on that movement. WebXR additionally provides sup
port for accepting inputs from control devices such as handheld VR controllers or specialized mixed reality gamepads. WebXR is not a rendering technology, and provides no features for actually managing 3D data or rendering it to the display. This is an im
portant fact to keep in mind; while WebXR manages the timing, scheduling, and the various points of view relevant when drawing the scene, it does not actually know how to load and manage models, render and texture them, and so forth. That part is entirely up to you. Fortunately, WebGL and the various WebGL-based frameworks and libraries are available to make it much easier to deal with all of that. H...
...entirely up to you. Fortunately, WebGL and the various WebGL-based frameworks and libraries are available to make it much easier to deal with all of that. How is WebXR different from WebVR? WebVR was generally considered to be an experimental API designed to help specification writers determine the best approaches to creating an API for virtual reality on the Web. ...
...And 10 more matches
Starting up and shutting down a WebXR session - Web APIs
e the Navigator property xr, which returns the XRSystem object if suitable XR hardware is available for your use given the hardware available and your document's environment. Thus the simplest code that fetches the XRSystem object is: const xr = navigator.xr; The value of xr will be null or undefined if WebXR isn't available. ...
...t API, WebXR sup
port is limited to specific devices and browsers; and even on those, it may not be enabled by default. There may be options available to allow you to experiment with WebXR even if you don't have a compatible system, however. WebXR polyfill The team designing the WebXR specification has published a WebXR polyfill which you can use to simulate WebXR on browsers which don't have sup
port for the WebXR APIs. If the browser sup
ports the older WebVR API, that is used. Otherwise, the polyfill falls back to an implementation which uses Google's Cardboard VR API. The polyfill is maintained alongside the specification, and is kept up to date with the specification. ...
... Be sure to read the readme carefully; the polyfill comes in several versions depending on what degree of compatibility with newer JavaScript features your target browsers include. ...
...And 10 more matches
Window.event - Web APIs
The read-only Window property event returns the Event which is currently being handled by the site's code. Outside the context of an event handler, the value is always undefined. You should avoid using this property in new code, and should instead use the Event passed into the event handler function. This property is not universally sup
ported and even when sup
ported introduces potential fragility to your code. Note: This property can be fragile, in that there may be situations in which the returned Event is not the expected value. In addition, Window.event is not accurate for events dispatched within shadow trees. Specifications Specification Status Comment DOMThe definition of 'Window.event' in that specification. Living Standard Initial definition. ...
...lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
Web APIs
A ANGLE_instanced_arrays AbortController AbortSignal AbsoluteOrientationSensor AbstractRange AbstractWorker Accelerometer AddressError...
...Section CSS CSSConditionRule CSSCounterStyleRule CSSGroupingRule CSSImageValue CSSKeyframeRule CSSKeyframesRule CSSKeywordValue CSSMathProduct CSSMathSum CSSMathValue CSSMediaRule CSSNamespaceRule CSSNumericValue CSSOMString CSSPageRule CSSPositionValue CSSPrimitiveValue CSSPseudoElement CSSRule CSSRuleList CSSStyleDeclaration CSSStyleRule CSSStyleSheet CSSStyleValue CSSSup
portsRule CSSUnitValue CSSUnparsedValue CSSValue CSSValueList CSSVariableReferenceValue Cache CacheStorage CanvasCaptureMediaStreamTrack CanvasGradient CanvasImageSource CanvasPattern CanvasRenderingContext2D CaretPosition ChannelMergerNode ChannelSplitterNode CharacterData ChildNode Client Clients Clipboard ClipboardEvent ClipboardItem CloseEvent Comment CompositionEvent Con...
...dient CanvasImageSource CanvasPattern CanvasRenderingContext2D CaretPosition ChannelMergerNode ChannelSplitterNode CharacterData ChildNode Client Clients Clipboard ClipboardEvent ClipboardItem CloseEvent Comment CompositionEvent ConstantSourceNode ConstrainBoolean ConstrainDOMString ConstrainDouble ConstrainULong ContentIndex ContentIndexEvent ConvolverNode CountQueuingStrategy CrashRe
portBody Credential CredentialsContainer Crypto CryptoKey CryptoKeyPair CustomElementRegistry CustomEvent D DOMConfiguration DOMError DOMException DOMHighResTimeStamp DOMImplementation DOMImplementationList DOMLocator DOMMatrix DOMMatrixReadOnly DOMObject DOMParser DOMPoint DOMPointInit DOMPointReadOnly DOMQuad DOMRect DOMRectReadOnly DOMString DOMStringList DOMStringMap DOMTime...
...And 10 more matches
quotes - CSS: Cascading Style Sheets
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...t https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
ruby-position - CSS: Cascading Style Sheets
lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ttps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
<input type="date"> - HTML: Hypertext Markup Language
<input> elements of type="date" create input fields that let the user enter a date, either with a textbox that validates the input or a special date picker interface. The resulting value includes the year, month, and day, but not the time. The time and datetime-local input types sup
port time and date+time input. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The input UI generally varies from browser to browser; see Browser compatibility for further details. In unsup
ported browsers, the control degrades gracefully to <input type="text">. Among browsers with custom interfaces for selecting dates are Chrome and Ope...
... browsers, the control degrades gracefully to <input type="text">. Among browsers with custom interfaces for selecting dates are Chrome and Opera, whose data control looks like so: The Edge date control looks like: And the Firefox date control looks like this: Value A DOMString representing a date in YYYY-MM-DD format, or empty Events change and input Sup
ported common attributes autocomplete, list, readonly, and step IDL attributes list, value, valueAsDate, valueAsNumber. Methods select(), stepDown(), stepUp() Value A DOMString representing the date entered in the input. The date is formatted according to ISO8601, described in Format of a valid date string in Date and time formats used in HTML. You can set a default...
... of step is 1, indicating 1 day. Specifying any as the value for step has the same effect as 1 for date inputs. Using date inputs Date inputs sound convenient -- they provide an easy interface for choosing dates, and they normalize the data format sent to the server regardless of the user's locale. However, there are currently issues with <input type="date"> because of its limited browser sup
port. In this section, we'll look at basic and then more complex uses of <input type="date">, and offer advice on mitigating the browser sup
port issue later (see Handling browser sup
port). Hopefully, over time browser sup
port will become ubiquitous, and this problem will fade away. Basic uses of date The simplest use of <input type="date"> involves one <input> combined with its <label>, as seen ...
...And 10 more matches
MIME types (IANA media types) - HTTP
type (also known as a Multipurpose Internet Mail Extensions or MIME type) is a standard that indicates the nature and format of a document, file, or assortment of bytes. It is defined and standardized in IETF's RFC 6838. The Internet Assigned Numbers Authority (IANA) is responsible for all official MIME types, and you can find the most up-to-date and complete list at their Media Types page. Im
portant: Browsers use the MIME type, not the file extension, to determine how to process a URL, so it's im
portant that web servers send the correct MIME type in the response's Content-Type header. If this is not correctly configured, browsers are likely to misinterpret the contents of files and sites will not work correctly, and downloaded files may be mishandled. Structure of a MIME type The simpl...
...at IANA Data that is comprised of multiple components which may individually have different MIME types. Examples include multipart/form-data (for data produced using the FormData API) and multipart/byteranges (defined in RFC 7233: 5.4.1 and used with HTTP's 206 "Partial Content" response returned when the fetched data is only part of the content, such as is delivered using the Range header). Im
portant MIME types for Web developers application/octet-stream This is the default for binary files. As it means unknown binary file, browsers usually don't execute it, or even ask if it should be executed. They treat it as if the Content-Disposition header was set to attachment, and propose a "Save As" dialog. text/plain This is the default for textual files. Even if it really means "unknown text...
...It's the only MIME type guaranteed to work now and into the future. Some content you find may have a charset parameter at the end of the text/javascript media type, to specify the character set used to represent the code's content. This is not valid, and in most cases will result in a script not being loaded. Image types Files whose MI...
...And 10 more matches
WebAssembly.CompileError - JavaScript
ity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
WebAssembly.LinkError - JavaScript
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
....com/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
WebAssembly.Memory.prototype.buffer - JavaScript
The buffer prototype property of the WebAssembly.Memory object returns the buffer contained in the memory. Examples Using buffer The following example (see memory.html on GitHub, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the WebAssembly.instantiateStreaming() method, while im
porting the memory created in the line above. It then stores some values in that memory, then ex
ports a function and uses it to sum some values. ...
... Browser compatibility The compatibility table on this page is generated from structured data. ...
...atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
WebAssembly.RuntimeError - JavaScript
ity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
WebAssembly.Table.prototype.get() - JavaScript
The get() prototype method of the WebAssembly.Table() object retrieves a function reference stored at a given index. Syntax table.get(index); Parameters index The index of the function reference you want to retrieve. Return value A function reference -- this is an ex
ported WebAssembly function, a JavaScript wrapper for an underlying wasm function. Exceptions If index is greater than or equal to Table.prototype.length, a RangeError is thrown. Examples Using get The following example (see table.html on GitHub, and view it live also) compiles and instantiates the loaded table.wasm byte code using the WebAssembly.instantiateStreaming() method. It then retrieves the references stored in the ex
ported table. WebAssembly.instantiateStreaming(fetch('table.wasm')) .then(function(obj) {...
...th, a RangeError is thrown. Examples Using get The following example (see table.html on GitHub, and view it live also) compiles and instantiates the loaded table.wasm byte code using the WebAssembly.instantiateStreaming() method. It then retrieves the references stored in the ex
ported table. WebAssembly.instantiateStreaming(fetch('table.wasm')) .then(function(obj) { var tbl = obj.instance.ex
ports.tbl; console.log(tbl.get(0)()); // 13 console.log(tbl.get(1)()); // 42 }); Note how you've got to include a second function invocation operator at the end of the accessor to actually retrieve the value stored inside the reference (e.g. get(0)() rather than get(0)) -- it is a function rather than a simple value. Specifications Specification WebAssembly JavaScript In...
...ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 10 more matches
preserveAspectRatio - SVG: Scalable Vector Graphics
Because the aspect ratio of an SVG image is defined by the viewBox attribute, if this attribute isn't set, the preserveAspectRatio attribute has no effect (with one exception, the <image> element, as described below). ...
...d; } Syntax preserveAspectRatio="<align> [<meetOrSlice>]" Its value is made of one or two keywords: A required alignment value and an optional "meet or slice" reference as described below: Alignment value The alignment value indicates whether to force uniform scaling and, if so, the alignment method to use in case the aspect ratio of the viewBox doesn't match the aspect ratio of the view
port. The alignment value must be one of the following keywords: none Do not force uniform scaling. Scale the graphic content of the given element non-uniformly if necessary such that the element's bounding box exactly matches the view
port rectangle. Note that if <align> is none, then the optional <meetOrSlice> value is ignored. xMinYMin - Force uniform scaling. Align the <min-x> of the el...
...ywords: none Do not force uniform scaling. Scale the graphic content of the given element non-uniformly if necessary such that the element's bounding box exactly matches the view
port rectangle. Note that if <align> is none, then the optional <meetOrSlice> value is ignored. xMinYMin - Force uniform scaling. Align the <min-x> of the element's viewBox with the smallest X value of the view
port. Align the <min-y> of the element's viewBox with the smallest Y value of the view
port. xMidYMin - Force uniform scaling. Align the midpoint X value of the element's viewBox with the midpoint X value of the view
port. Align the <min-y> of the element's viewBox with the smallest Y value of the view
port. xMaxYMin - Force uniform scaling. Align the <min-x>+<width> of the element's view...
...And 10 more matches
Modules - Archive of obsolete content
A module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface. The use of modules greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them. Unfortunately, JavaScript does not yet have native sup
port for modules: it has to rely on the host application to provide it with functionality such as loading subscripts, and ex
porting/ im
porting names. We will show how to do each of these things using the built-in Components object provided by Xulrunner application such as Firefox and Thunderbird. To improve encapsulation, each module should be defined in the scope of its own global object. This is made possible by the use of sandboxes. Each sandbox lives in its own compar...
...loader;1"]; var loader = instance.getService(Ci.mozIJSSubScriptLoader); function loadScript(url) { loader.loadSubScript(url); } When a script is loaded, it is evaluated in the scope of the global object of the script that loaded it. Any property defined on the global object will be accessible from both scripts: // index.js: loadScript("www.foo.com/a.js"); foo; // => 3 // a.js: foo = 3; Ex
porting Names The script loader we obtained from the Components object allows us load scripts from other locations, but its API is rather limited. For instance, it does not know how to handle relative URLs, which is cumbersome if you want to organize your project hierarchically. A more serious problem with the loadScript function, however, is that it evaluates all scripts in the scope of the same glo...
...scripts are loaded: there is no way to access the property foo defined by "a.js", since it is overwritten by "b.js". To prevent scripts from interfering with each other, loadScript should evaluate each script to be loaded in the scope of their own global object, and then return the global object as its result. In effect, any properties defined by the script being loaded on its global object are ex
ported to the loading script. The script loader we obtained from Components allows us to do just that: function loadScript(url) { let global = {}; loader.loadSubScript(url, global); return global; } If present, the loadSubScript function evaluates the script to be loaded in the scope of the second argument. Using this new version of loadScript, we can now rewrite our earlier example as f...
...And 9 more matches
Module structure of the SDK - Archive of obsolete content
CommonJS is the underlying infrastructure for both the SDK and the add-ons you build using the SDK. A CommonJS module is a piece of reusable JavaScript: it ex
ports certain objects which are thus made available to dependent code. CommonJS defines: an object called ex
ports which contains all the objects which a CommonJS module wants to make available to other modules a function called require which a module can use to im
port the ex
ports object of another module. Except for scripts that interact directly with web content, all the JavaScript code you'll write or use when developing add-ons using the SDK is part of a CommonJS module, including: SDK modules: the JavaScript modules which the SDK provides, such as panel and page-mod. Local modules: each of the JavaScript files under your ...
...odules, you can do this by checking out the version of the SDK that you need and passing the -o or --overload option to jpm run or jpm xpi. Local Modules At a minimum, an SDK-based add-on consists of a single module named main.js, but you can factor your add-on's code into a collection of separate CommonJS modules. Each module is a separate file stored under your add-on's "lib" directory, and ex
ports the objects you want to make available to other modules in your add-on. See the tutorial on creating reusable modules for more details. To im
port a local module, specify a path relative to the im
porting module. For example, the following add-on contains an additional module directly under "lib", and other modules under subdirectories of "lib": my-addon lib main.js pas...
...m
port a local module, specify a path relative to the im
porting module. ...
...And 9 more matches
Game promotion - Game development
You have to let the world know that you have something interesting available that people will enjoy playing. There are many ways to promote your game -- most of them being free, so even if you're struggling to make a living as an indie dev with zero budget you can still do a lot to let people know about your great new game. Promoting the game helps a lot when monetizing it later on too, so it's im
portant to do it correctly. Competitions Taking part in competitions will not only level up your gamedev skills and let you meet new devs to befriend and learn from -- and it will also get you involved in the community. If you make a good game for a competition and win some prizes in the process your game will automatically be promoted by the organizers and other attendees. You'll be rich and famous...
...llow a mandatory theme, so you can get creative around a theme if you are stuck for ideas. Website and blog You should definitely create your own website containing all the information about your games, so people can see what you've worked on. The more information you can include the better -- you should include screenshots, description, trailer, press kit, requirements, available platforms, sup
port details and more. You'll get bonus points for allowing your users to directly play your games online -- at least in demo form. Also, you should do some work on SEO to allow people to find your games more easily. You should also blog about everything related to your gamedev activities. Write about your development process, nasty bugs you encounter, funny stories, lessons learned, and the ups and ...
...ould also blog about everything related to your gamedev activities. Write about your development process, nasty bugs you encounter, funny stories, lessons learned, and the ups and downs of being a game developer. Continually publishing information about your games will help educate others, increase your reputation in the community, and further improve SEO. A further option is to publish monthly re
ports that summarize all your progress -- it helps you see what you've accomplished throughout the month and what's still left to do, and it keeps reminding people that your game is coming out soon -- building buzz is always good. While you can create your website from scratch, there are also tools that can help make the process easier. ManaKeep is a website builder made for indie game developers an...
...And 9 more matches
HTML: A good basis for accessibility - Learn web development
g of HTML (see Introduction to HTML), and an understanding of what accessibility is. Objective: To gain familiarity with the features of HTML that have accessibility benefits and how to use them appropriately in your web documents. HTML and accessibility As you learn more about HTML -- read more resources, look at more examples, etc. -- you'll keep seeing a common theme: the im
portance of using semantic HTML (sometimes called POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their intended purpose as much as possible. You might wonder why this is so im
portant. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. For example, a control button to play a video on your si...
...e start of your project. Even better, semantic markup has other benefits beyond accessibility: Easier to develop with -- as mentioned above, you get some functionality for free, plus it is arguably easier to understand. Better on mobile -- semantic HTML is arguably lighter in file size than non-semantic spaghetti code, and easier to make responsive. Good for SEO -- search engines give more im
portance to keywords inside headings, links, etc. than keywords included in non-semantic <div>s, etc., so your documents will be more findable by customers. Let's get on and look at accessible HTML in more detail. Note: It is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below. See our Screen readers guide for more details. ...
...keywords included in non-semantic <div>s, etc., so your documents will be more findable by customers. Let's get on and look at accessible HTML in more detail. Note: It is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below. See our Screen readers guide for more details. Good semantics We've already talked about the im
portance of proper semantics, and why we should use the right HTML element for the job. This cannot be ignored, as it is one of the main places that accessibility is badly broken if not handled properly. Out there on the web, the truth is that people do some very strange things with HTML markup. Some abuses of HTML are due to legacy practices that have not been completely forgotten, and some are just...
...And 9 more matches
HTML: A good basis for accessibility - Learn web development
g of HTML (see Introduction to HTML), and an understanding of what accessibility is. Objective: To gain familiarity with the features of HTML that have accessibility benefits and how to use them appropriately in your web documents. HTML and accessibility As you learn more about HTML -- read more resources, look at more examples, etc. -- you'll keep seeing a common theme: the im
portance of using semantic HTML (sometimes called POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their intended purpose as much as possible. You might wonder why this is so im
portant. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. For example, a control button to play a video on your si...
...e start of your project. Even better, semantic markup has other benefits beyond accessibility: Easier to develop with -- as mentioned above, you get some functionality for free, plus it is arguably easier to understand. Better on mobile -- semantic HTML is arguably lighter in file size than non-semantic spaghetti code, and easier to make responsive. Good for SEO -- search engines give more im
portance to keywords inside headings, links, etc. than keywords included in non-semantic <div>s, etc., so your documents will be more findable by customers. Let's get on and look at accessible HTML in more detail. Note: It is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below. See our Screen readers guide for more details. ...
...keywords included in non-semantic <div>s, etc., so your documents will be more findable by customers. Let's get on and look at accessible HTML in more detail. Note: It is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below. See our Screen readers guide for more details. Good semantics We've already talked about the im
portance of proper semantics, and why we should use the right HTML element for the job. This cannot be ignored, as it is one of the main places that accessibility is badly broken if not handled properly. Out there on the web, the truth is that people do some very strange things with HTML markup. Some abuses of HTML are due to legacy practices that have not been completely forgotten, and some are just...
...And 9 more matches
Web fonts - Learn web development
natives, followed by the default system font, but this adds overhead in terms of testing to make sure that your designs look ok with each font, etc. Web fonts But there is an alternative, which works very well, right back to IE version 6. Web fonts are a CSS feature that allows you to specify font files to be downloaded along with your website as it is accessed, meaning that any browser that sup
ports web fonts can have exactly the fonts you specify available to it. Amazing! The syntax required looks something like this: First of all, you have a @font-face block at the start of the CSS, which specifies the font file(s) to download: @font-face { font-family: "myFont"; src: url("myFont.woff"); } Below this you can then use the font family name specified inside @font-face to apply your cu...
...e font file(s) to download: @font-face { font-family: "myFont"; src: url("myFont.woff"); } Below this you can then use the font family name specified inside @font-face to apply your custom font to anything you like, as normal: html { font-family: "myFont", "Bitstream Vera Serif", serif; } The syntax does get a bit more complex than this; we'll go into more detail below. ...
...t"; src: url("myFont.woff"); } Below this you can then use the font family name specified inside @font-face to apply your custom font to anything you like, as normal: html { font-family: "myFont", "Bitstream Vera Serif", serif; } The syntax does get a bit more complex than this; we'll go into more detail below. ...
...And 9 more matches
The HTML5 input types - Learn web development
me new input types, which were added in HTML5 to allow collection of specific types of data. Prerequisites: Basic computer literacy, and a basic understanding of HTML. Objective: To understand the newer input type values available to create native form controls, and how to implement them using HTML. Note: Most of the features discussed in this article have wide sup
port across browsers. We'll note any exceptions. If you want more detail on browser sup
port, you should consult our HTML forms element reference, and in particular our extensive <input> types reference. Because HTML form control appearance may be quite different from a designer's specifications, web developers sometimes build their own custom form controls. We cover this in an advanced tutorial: How...
...s it may include letters, etc.). As we mentioned earlier, The pattern attribute can be used to enforce constraints, which you'll learn about in Client-side form validation. URL field A special type of field for entering URLs can be created using the value url for the type attribute: <input type="url" id="url" name="url"> It adds special validation constraints to the field. The browser will re
port an error if no protocol (such as http:) is entered, or if the URL is otherwise malformed. On devices with dynamic keyboards, the default keyboard will often display some or all of the colon, period, and forward slash as default keys. See below for an example (taken on Firefox for Android): Note: Just because the URL is well-formed doesn't necessarily mean that it refers to a location that act...
...="0.01"> The number input type makes sense when the range of valid values is limited, for example a person's age or height. If the range is too large for incremental increases to make sense (such as USA ZIP codes, which range from 00001 to 99999), the tel type might be a better option; it provides the numeric keypad while forgoing the number's spinner UI feature. Note: number inputs are not sup
ported in versions of Internet Explorer below 10. Slider controls Another way to pick a number is to use a slider. You see these quite often on sites like housebuying sites where you want to set a maximum property price to filter by. Let's look at a live example to illustrate this: Usage-wise, sliders are less accurate than text fields. Therefore, they are used to pick a number whose precise val...
...And 9 more matches
Routing in Ember - Learn web development
: "Index", "Active" and "Completed". To do this you'll need to enter the following commands into your terminal, inside the root directory of your app: ember generate route index ember generate route completed ember generate route active The second and third commands should have not only generated new files, but also updated an existing file, app/router.js. It contains the following contents: im
port EmberRouter from '@ember/routing/router'; im
port config from './config/environment'; ex
port default class Router extends EmberRouter { location = config.locationType; rootURL = config.rootURL; } Router.map(function() { this.route('completed'); this.route('active'); }); The highlighted lines were added when the 2nd and 3rd commands above were run. router.js behaves as a "sitemap" for d...
...g is one to return just the completed todos. Add the following below the existing getters: get completed() { return this.todos.filter(todo => todo.isCompleted); } Models Now we need to add models to our route JavaScript files to allow us to easily return specific data sets to display in those models. model is a data loading lifecycle hook. ...
... data sets to display in those models. model is a data loading lifecycle hook. For TodoMVC, the capabilities of model aren't that im
portant to us; you can find more information in the Ember model guide if you want to dig deeper. We also provide access to the service, like we did for the components. ...
...And 9 more matches
Framework main features - Learn web development
ction will use React as an example, and are written with JSX. Properties Properties, or props, are external data that a component needs in order to render. Suppose you're building a website for an online magazine, and you need to be sure that each contributing writer gets credit for their work. You might create an AuthorCredit component to go with each article. This component needs to display a
portrait of the author and a short byline about them. In order to know what image to render, and what byline to print, AuthorCredit needs accept some props. A React representation of this AuthorCredit component might look something like this: function AuthorCredit(props) { return ( <figure> <img src={props.src} alt={props.alt} /> <figcaption>{props.byline}</figcaption> </figure...
...rops.src} alt={props.alt} /> <figcaption>{props.byline}</figcaption> </figure> ); } {props.src}, {props.alt}, and {props.byline} represent where our props will be inserted into the component. ...
... </figcaption> </figure> State We talked about the concept of state in the previous chapter -- a robust state-handling mechanism is key to an effective framework, and each component may have data to control the state of. ...
...And 9 more matches
Testopia
Though it is designed with software testing in mind, it can be used to track testing on virtually anything in the engineering process. Testopia 3.0 (not yet released) If you upgraded to Bugzilla 5.0, you probably noticed that Testopia 2.5 is not compatible with this version. ...
... that the current code in the git repository already works with Bugzilla 5.0, and so if you upgraded to 5.0 already, and if you don't mind having a work-in-progress extension on your machine, you can decide to pull the code from the git repository. This would also let us get some early feedback in case you find regressions. If you find bugs in the code available from the git repository, please re
port it to us so that we can fix most critical ones on time for Testopia 3.0. Do not ask when we plan to release 3.0, because we really don't know. "As soon as possible" is our best answer. Testopia 2.5 This versions sup
ports Bugzilla 4.2 and 4.4, and the best news is that it no longer requires a patch for Bugzilla. If you are upgrading, please reverse the existing version's patch before installing.
... Bugzilla 4.2 and 4.4, and the best news is that it no longer requires a patch for Bugzilla. If you are upgrading, please reverse the existing version's patch before installing. A fresh install only requires that you untar the tarball in your Bugzilla root directory and run checksetup. Thanks go to LpSolit from the Bugzilla team for his work in making this possible. Testopia 2.4 This version sup
ports Bugzilla 3.6. IM
PORTANT NOTICE: If you are upgrading on a case sensitive filesystem you must remove the existing testopia folder in the extensions directory. If you have made modifications to the testopia source code, you will need to merge them into the new Testopia folder (capital T). If you are on Windows or another case insensitive file system you should first rename the folder (testopia-ol...
...And 9 more matches
about:memory
about:memory is a special page within Firefox that lets you view, save, load, and diff detailed measurements of Firefox's memory usage. It also lets you do other memory-related operations like trigger GC and CC, dump GC & CC logs, and dump DMD re
ports. It is present in all builds and does not require any preparation to be used. How to generate memory re
ports Let's assume that you want to measure Firefox's memory usage. Perhaps you want to investigate it yourself, or perhaps someone has asked you to use about:memory to generate "memory re
ports" so they can investigate a problem you are having. Follow these steps. At the moment of interest (e.g. once Firefox's memory usage has gotten high) open a new tab and type "about:memory" into the address bar and hit "Enter". If you are using...
... problem you are having. Follow these steps. At the moment of interest (e.g. once Firefox's memory usage has gotten high) open a new tab and type "about:memory" into the address bar and hit "Enter". If you are using a communication channel where files can be sent, such as Bugzilla or email, click on the "Measure and save..." button. This will open a file dialog that lets you save the memory re
ports to a file of your choosing. (The filename will have a .json.gz suffix.) You can then attach or upload the file appropriately. The recipients will be able to view the contents of this file within about:memory in their own Firefox instance. If you are using a communication channel where only text can be sent, such as a comment thread on a website, click on the "Measure..." button. This will cause...
...cation channel where only text can be sent, such as a comment thread on a website, click on the "Measure..." button. This will cause a tree-like structure to be generated text within about:memory. This structure is just text, so you can copy and paste some or all of this text into any kind of text buffer. (You don't need to take a screenshot.) This text contains fewer measurements than a memory re
ports file, but is often good enough to diagnose problems. Don't click "Measure..." repeatedly, because that will cause the memory usage of about:memory itself to rise, due to it discarding and regenerating large numbers of DOM nodes. Note that in both cases the generated data contains privacy-sensitive details such as the full list of the web pages you have open in other tabs. If you do not wish to...
...And 9 more matches
NSS Certificate Download Specification
cates are X509 version 1, 2, or 3. Binary Formats NSS's certificate loader will recognize several binary formats. They are: DER encoded certificate: This is a single binary DER encoded certificate. PKCS#7 certificate chain: This is a single PKCS#7 SignedData object. The only significant field in the SignedData object is the certificates field, which may contain multiple certificates to be im
ported together. The contents of the version, digestAlgorithms, contentInfo, crls, and signerInfos fields are ignored. Netscape Certificate Sequence: This is another PKCS#7 object format, and like the SignedData format, it allows multiple certificates to be im
ported together. This format is simpler than the PKCS#7 SignedData object format. It consists of a PKCS#7 ContentInfo structure, wrapping a seq...
..., wrapping a sequence of certificates. The contentType field OID must be netscape-cert-sequence (see Object Identifiers). The content field is the following ASN.1 structure: CertificateSequence ::= SEQUENCE OF Certificate See the section below on Certificate Chains for more information about how multiple certificates are handled. Text Formats Any of the above binary formats can also be im
ported in text form. The text form begins with the following line: -----BEGIN CERTIFICATE----- Following this line should be the certificate data, which can be in any of the binary formats described above. This data must be base64 encoded as described by RFC 1113. Following the data should be the following line: -----END CERTIFICATE----- In a text format download, NSS ignores any text befo...
...of the binary formats described above. This data must be base64 encoded as described by RFC 1113. Following the data should be the following line: -----END CERTIFICATE----- In a text format download, NSS ignores any text before the first BEGIN CERTIFICATE line, and ignores any text after the first END CERTIFICATE line. ...
...And 9 more matches
NSS 3.22 release notes
vices (NSS) 3.22, which is a minor release. Distribution Information The HG tag is NSS_3_22_RTM. NSS 3.22 requires NSPR 4.11 or newer. ...
...nload: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_22_RTM/src/ New in NSS 3.22 New Functionality RSA-PSS signatures are now sup
ported (bug 1215295) New functions PK11_SignWithMechanism() and PK11_SignWithMechanism() are provided to allow RSA keys to be used with PSS. Pseudorandom functions based on hashes other than SHA-1 are now sup
ported with PBKDF (bug 554827). PK11_CreatePBEV2AlgorithmID() now sup
ports SEC_OID_PKCS5_PBKDF2 with cipherAlgTag and prfAlgTag set to SEC_OID_HMAC_SHA256, SEC_OID_HMAC_SHA224, SEC_OID_HMAC_SHA384, or SEC_OID_HMAC_SHA512. Enforce an External Policy on NSS from a config file (bug 1009429) you can now add a config= line to pkcs11.txt (assuming you are using sql databases), which will f...
... New Functions in pk11pub.h PK11_SignWithMechanism - This function is an extended version PK11_Sign(). PK11_VerifyWithMechanism - This function is an extended version of PK11_Verify(). These functions take an explicit mechanism and parameters as arguments rather than inferring it from the key type using PK11_MapSignKeyType(). The mechanism type CKM_RSA_PKCS_PSS is now sup
ported for RSA in addition to CKM_RSA_PKCS. The CK_RSA_PKCS_PSS mechanism takes a parameter of type CK_RSA_PKCS_PSS_PARAMS. in ssl.h SSL_PeerSignedCertTimestamps - Get signed_certificate_timestamp TLS extension data SSL_SetSignedCertTimestamps - Set signed_certificate_timestamp TLS extension data New Types in secoidt.h The following are added to SECOidTag: ...
...And 9 more matches
NSS 3.28 release notes
NSS 3.28 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_28_RTM/src/ New in NSS 3.28 New Functionality NSS includes sup
port for TLS 1.3 draft -18. ...
..., which is a minor release. Distribution information The hg tag is NSS_3_28_RTM. NSS 3.28 requires Netscape
Portable Runtime (NSPR) 4.13.1 or newer. ...
...source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_28_RTM/src/ New in NSS 3.28 New Functionality NSS includes sup
port for TLS 1.3 draft -18. This includes a number of improvements to TLS 1.3: The signed certificate timestamp, used in certificate transparency, is sup
ported in TLS 1.3 (bug 1252745). Key ex
porters for TLS 1.3 are sup
ported (bug 1310610). This includes the early key ex
porter, which can be used if 0-RTT is enabled. Note that there is a difference between TLS 1.3 and key ex
porters in older versions of TLS. TLS 1.3 does not distinguish between an empty context and no context. The TLS 1.3 (draft) protocol can be enabled, by defining NSS_ENABLE_T...
...And 9 more matches
NSS 3.35 release notes
work Security Services (NSS) 3.35, which is a minor release. Distribution Information The HG tag is NSS_3_35_RTM. NSS 3.35 requires NSPR 4.18, or newer. NSS 3.35 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_35_RTM/src/ New in NSS 3.35 New Functionality TLS 1.3 sup
port has been updated to draft -23. This includes a large number of changes since 3.34, which sup
ported only draft -18. See below for details. New Types in sslt.h SSLHandshakeType - The type of a TLS handshake message. For the SSLSignatureScheme enum, the enumerated values ssl_sig_rsa_pss_sha* are deprecated in response to a change in TLS 1.3. Please use the equivalent ssl_sig_rsa_pss_...
... below for details. New Types in sslt.h SSLHandshakeType - The type of a TLS handshake message. For the SSLSignatureScheme enum, the enumerated values ssl_sig_rsa_pss_sha* are deprecated in response to a change in TLS 1.3. Please use the equivalent ssl_sig_rsa_pss_rsae_sha* for rsaEncryption keys, or ssl_sig_rsa_pss_pss_sha* for PSS keys. Note that this release does not include sup
port for the latter. Notable Changes in NSS 3.35 Previously, NSS used the DBM file format by default. Starting with version 3.35, NSS uses the SQL file format by default. Below, are explanations that could be helpful for environments that need to adopt to the new default. If NSS is initialized, in read-write mode with a database directory provided, it uses database files to store certi...
... Previously, NSS used the DBM file format by default. Starting with version 3.35, NSS uses the SQL file format by default. Below, are explanations that could be helpful for environments that need to adopt to the new default. If NSS is initialized, in read-write mode with a database directory provided, it uses database files to store certificates, key, trust, and other information. NSS sup
ports two different database file formats: DBM: The legacy file format, based on Berkeley DB, using filenames cert8.db, key3.db and secmod.db. Parallel database access, by multiple applications, is forbidden as it will likely result in data corruption. SQL: The newer file format, based on SQLite, using filenames cert9.db, key4.and and pkcs11.txt. Parallel database access, by multiple ap...
...And 9 more matches
PKCS11 Implement
plements the information in PKCS #11: Cryptographic Token Interface Standard, version 2.0 with guidelines for implementors of cryptographic modules who want their products to work with Mozilla client software: How NSS Calls PKCS #11 Functions. Function-specific information organized in the same categories as the PKCS #11 specification. Functions for Different Kinds of Tokens. Summarizes the sup
port NSS expects from different kinds of tokens. Installation. Installing modules and informing the user of changes in the Cryptographic Modules settings. Semantics Unique to NSS. Miscellaneous NSS semantics that affect module implementation. Future versions of Netscape server products will also sup
port of PKCS #11 version 2.0. How NSS Calls PKCS #11 Functions This section is organized according to...
...the single C_Initialize parameter pReserved. C_Finalize The NSS calls C_Finalize on shutdown and whenever it unloads a module. C_GetFunctionList The NSS calls C_GetFunctionList on startup or when it loads a new module. The function list returned should include all the PKCS 2.0 function calls. If you don't implement a function, you should still provide a stub that returns CKR_FUNCTION_NOT_SUP
PORTED. C_GetInfo The NSS calls C_GetInfo on startup or when it loads a new module. The version numbers, manufacturer IDs, and so on are displayed when the user views the information. The supplied library names are used as the default library names; currently, these names should not include any double quotation marks. (This is more restrictive than PKCS 2.0 and may change in future versions of NSS.
...ken when the key database password is NULL. These are not standard PKCS #11 semantics; they are intended for NSS's internal use only. TRUE TRUE The device has been initialized and requires authentication. The NSS checks whether the user is logged on, and if not prompts the user for a PIN. C_GetMechanismList The NSS calls C_GetMechanismList fairly frequently to identify the mechanisms sup
ported by a token. C_GetMechanismInfo The NSS currently doesn't call C_GetMechanismInfo. This function may be called in the future, so you should implement it anyway. C_InitToken The NSS never calls C_InitToken. C_InitPIN The NSS calls C_InitPIN only in the key generation case, as noted in this document under C_GetTokenInfo, when CFK_LOGIN_REQUIRED = TRUE and CFK_USER_PIN_INITIALIZED = FALSE.
...And 9 more matches
NSS_3.12.3_release_notes.html
rom the file named in the environment variable NSRANDFILE (see below). Makes NSRANDFILE usable with /dev/urandom. NSS_ALLOW_WEAK_SIGNATURE_ALG Boolean (any non-empty value to enable) Enables the use of MD2 and MD4 hash algorithms inside signatures. This was allowed by default before NSS 3.12.3. NSS_HASH_ALG_SUP
PORT String Specifies algorithms allowed to be used in certain applications, such as in signatures on certificates and CRLs. See documentation at this link. NSS_STRICT_NOFORK String ("1", "DISABLED", or any other non-empty value) It is an error to try to use a PKCS#11 crypto module in a process befo...
...use a PKCS#11 crypto module in a process before it has been initialized in that process, even if the module was initialized in the parent process. Beginning in NSS 3.12.3, Softoken will detect this error. This environment variable controls Softoken's response to that error. If set to to "1" or unset, Softoken will trigger an assertion failure in debug builds, and will re
port an error in non-DEBUG builds. If set to "DISABLED", Softoken will ignore forks, and behave as it did in older versions. If set to any other non-empty value, Softoken will re
port an error in both DEBUG and non-DEBUG builds. NSS_USE_DECODED_CKA_EC_POINT Boolean (any non-empty value to enable) ...
... NSS_USE_SHEXP_IN_CERT_NAME Boolean (any non-empty value to enable) Tells NSS to allow shell-style wildcard patterns in certificates to match SSL server host names. This behavior was the default before NSS 3.12.3. The new behavior conforms to RFC 2818. ...
...And 9 more matches
NSS tools : pk12util
Name pk12util -- Ex
port and im
port keys and certificate to or from a PKCS #12 file and the NSS database Synopsis pk12util [-i p12File [-h tokenname] [-v] [common-options] ] [ -l p12File [-h tokenname] [-r] [common-options] ] [ -o p12File -n certname [-c keyCipher] [-C certCipher] [-m|--key_len keyLen] [-n|--cert_key_len certKeyLen] [common-options] ] [ common-options are: [-d [sql:]directory] [-P dbprefix] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword] ] Description The PKCS #12 utility, pk12util, enables sharing certificates among any server that sup
ports PKCS#12. The tool can im
port certificates and keys from PKCS#12 files into security databases, ex
port certificates, and list certificates and keys. Options ...
...ile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword] ] Description The PKCS #12 utility, pk12util, enables sharing certificates among any server that sup
ports PKCS#12. The tool can im
port certificates and keys from PKCS#12 files into security databases, ex
port certificates, and list certificates and keys. Options and Arguments Options -i p12file Im
port keys and certificates from a PKCS#12 file into a security database. -l p12file List the keys and certificates in PKCS#12 file. -o p12file Ex
port keys and certificates from the security database to a PKCS#12 file. Arguments -n certname Specify the nickname of the cert and private key to ex
port. -d [sql:]directory ...
...curity database. -l p12file List the keys and certificates in PKCS#12 file. -o p12file Ex
port keys and certificates from the security database to a PKCS#12 file. Arguments -n certname Specify the nickname of the cert and private key to ex
port. -d [sql:]directory Specify the database directory into which to im
port to or ex
port from certificates and keys. pk12util sup
ports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new SQLite databases (cert9.db, key4.db, and pkcs11.txt). If the prefix sql: is not used, then the tool assumes that the given databases are in the old format. -P prefix ...
...And 9 more matches
Scripting Java
hat is equivalent to Packages.java. So the previous example could be even shorter: js> java [JavaPackage java] We can access Java classes simply by stepping down the package hierarchy: js> java.io.File [JavaClass java.io.File] If your scripts access a lot of different Java classes, it can get awkward to use the full package name of the class every time. Rhino provides a top-level function im
portPackage that serves the same purpose as Java's im
port declaration. For example, we could im
port all of the classes in the java.io package and access class java.io.File using just the name File: js> im
portPackage(java.io) js> File [JavaClass java.io.File] Here im
portPackage(java.io) makes all the classes in the java.io package (such as File) available at the top level. It's equivalent in effect ...
...me purpose as Java's im
port declaration. For example, we could im
port all of the classes in the java.io package and access class java.io.File using just the name File: js> im
portPackage(java.io) js> File [JavaClass java.io.File] Here im
portPackage(java.io) makes all the classes in the java.io package (such as File) available at the top level. It's equivalent in effect to the Java declaration im
port java.io.*;. It's im
portant to note that Java im
ports java.lang.* implicitly, while Rhino does not. The reason is that JavaScript has its own top-level objects Boolean, Math, Number, Object, and String that are different from the classes by those names defined in the java.lang package. Because of this conflict, it's a good idea not to use im
portPackage on the java.lang package. One thing to be c...
...ames defined in the java.lang package. Because of this conflict, it's a good idea not to use im
portPackage on the java.lang package. One thing to be careful of is Rhino's handling of errors in specifying Java package or class names. If java.MyClass is accessed, Rhino attempts to load a class named java.MyClass. If that load fails, it assumes that java.MyClass is a package name, and no error is re
ported: js> java.MyClass [JavaPackage java.MyClass] Only if you attempt to use this object as a class will an error be re
ported. External Packages and Classes External packages and classes can also be used as in Rhino. Make sure your .jar or .class file is on you classpath then you may im
port them into your JavaScript application. These packages are likely not in the java package, so you'll need ...
...And 9 more matches
Finishing the Component
terface; the first entry in the v-table is in fact IsPrime(). When this method call is made, the code execution treats the IsPrime method as TestA. Needless to say, this is a bad thing. Furthermore, there is no way easy way to realize this error at runtime. Gecko developers could change the interface's IID, and some do. This can prevent many errors like this. But unfrozen interfaces are not sup
ported in any formal way, and relying upon a different IID for any change in the interface is not a good idea either. When using frozen interfaces, you are guaranteed compatibility with future versions of Gecko. The only trouble occurs when the compiler itself changes its v-table layout, which can happen when the compiler changes its ABI. For example, in 2002 the GNU Compiler Collection (GCC), versio...
...iled with an earlier version and vice versa. Similar problems occurred with GCC 4.0, which underwent similar ABI changes. Before attempting to use unfrozen interfaces, you should contact the developers who are responsible for the code you're trying to use (i.e., module owners) and ask them how best to do what you are trying to do. Be as precise you possibly can. They may be able to suggest a sup
ported alternative, or they may be able to notify you about pending changes. The interface that we need for this project is something called nsIContentPolicy. At the time this book was written, this interface was under review. An interface reaches this state when a group of module owners and peers are actively engaged in discussion about how best to expose it. Usually there are only minor changes to ...
... into this new directory. (For WebLock, all you need are the headers for nsIContentPolicy and the nsIContentPolicy.idl.) Then, using the same steps you used to create the Weblock.h, create a header from this IDL file using the xpidl compiler. Once you have these interface and header files, you can modify the WebLock class to implement the nsIContentPolicy interface. ...
...And 9 more matches
Introduction to XPCOM for the DOM
bout 80% of what you need to know to read the DOM code, and even write some. For more advanced topics, please see the XPCOM page. The tracking bug for this document is bug 99592. Target audience: People who would like a quick introduction to the use of C++ and XPCOM in the DOM code. The understanding of the content of this document is a requirement to read the rest of the DOM Hacking Guide. Im
portant note: This document assumes some knowledge of C++, specially the object-oriented part of it. I learned C++ by reading "C++ Primer" from Stanley Lippman and Josee Lajoie, then experimenting on the DOM code. I recommend that book to all the beginners out there. Introduction to the introduction The DOM makes extensive use of XPCOM. In fact, to do anything with the DOM implementation you need X...
...e hairy details, if you just intend to read the code or to work with the existing framework. The numerous macros and facilities brought by the DOM, as well as nsCOMPtr's, make our life much easier. In this chapter I will attempt to cover the most widespread use of XPCOM in the DOM, avoiding the details as much as possible. I will introduce nsCOMPtr's, interfaces, reference counting, and the nsISup
ports interface. A tutorial about how to add a new interface is also provided, and eventually, a more detailed discussion of class inheritance in C++. Interfaces Object-oriented programming is based on the used of inheritance between classes. Furthermore, a class can be de declared to be "abstract" if it declares some methods but does not implement them entirely. Pushing this concept to its maximum,...
... nsIFoo implemented by nsFoo can be declared as follows nsIFoo *fooptr = new nsFoo; A pointer such as fooptr is then called a "pointer to an interface nsIFoo implemented by an instance of the nsFoo class", or "pointer to nsIFoo" in short. From now on, when I speak of a "pointer to an interface", I really mean a "pointer to an interface implemented by an instance of a concrete C++ class". The im
portant thing to note is that a pointer to nsIFoo can only call the methods defined on the nsIFoo interface, and on its parents. For instance, if nsFoo implements two different interfaces, nsIFoo and nsIBar, a pointer to nsIFoo cannot call the methods defined on nsIBar and vice-versa. Note: the previous paragraph is extremely im
portant. If you haven't grasped it completely, there is no need to read f...
...And 9 more matches
nsIURL
netwerk/base/public/nsIURL.idlScriptable This interface provides convenience methods that further break down the path
portion of nsIURI. Inherits from: nsIURI Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6) http://host/directory/fileBaseName.fileExtension?query http://host/directory/fileBaseName.fileExtension#ref http://host/directory/fileBaseName.fileExtension;param \ \ / \ ----------------------- \ | / \ fileName / ---------------------------- | filePath You can get a nsIURL from an nsIURI, using the QueryInterface() method: var myURI = Compone...
...If the trailing slash is omitted, then the Directory is /foo/ and the file is bar (that is this is a syntactic, not a semantic breakdown of the Path). And hence don't rely on this for som...
... AUTF8String getCommonBaseSpec(in nsIURI aURIToCompare); AUTF8String getRelativeSpec(in nsIURI aURIToCompare); Attributes Attribute Type Description directory AUTF8String Directory
portion of a URL. If the URL denotes a path to a directory and not a file, for example http://host/foo/bar/, then the Directory attribute accesses the complete /foo/bar/
portion, and the FileName is the empty string. If the trailing slash is omitted, then the Directory is /foo/ and the file is bar (that is this is a syntactic, not a semantic breakdown of the Path). And hence don't rely on this for something to be a definitely be a file. But you can get just the leading directory
portion for sure. Some characters may be escaped. fileBaseName AUTF8String ...
...And 9 more matches
nsIWebBrowserPersist
browser/nsWebBrowser;1 and @mozilla.org/embedding/browser/nsWebBrowserPersist;1. ...
... To create an instance, use: var webBrowserPersist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"] .createInstance(Components.interfaces.nsIWebBrowserPersist); Method overview void cancelSave(); void saveChannel(in nsIChannel aChannel, in nsISup
ports aFile); void saveDocument(in nsIDOMDocument aDocument, in nsISup
ports aFile, in nsISup
ports aDataPath, in string aOutputContentType, in unsigned long aEncodingFlags, in unsigned long aWrapColumn); void saveURI(in nsIURI aURI, in nsISup
ports aCacheKey, in nsIURI aReferrer, in long aReferrerPolicy, in nsIInputStream aPostData, in string aExtraHeaders, in nsISup
ports aFile, in nsILoadContext aPrivacyContext); void savePrivacyAwareURI(in nsIURI aURI,...
...Read only. ...
...And 9 more matches
AudioParam.cancelAndHoldAtTime() - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 9 more matches
characteristic - Web APIs
y table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetcharacteristic ExperimentalChrome Full sup
port 57Notes Full sup
port 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change pre...
...t 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. ...
...e-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. Full sup
port <=79Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version <=79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). ...
...And 9 more matches
uuid - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetuuid ExperimentalChrome Full sup
port 57Notes Full sup
port 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change pre...
...t 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. ...
...e-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. Full sup
port <=79Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version <=79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). ...
...And 9 more matches
value - Web APIs
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetvalue ExperimentalChrome Full sup
port 57Notes Full sup
port 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change pre...
...t 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. ...
...e-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. Full sup
port <=79Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version <=79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). ...
...And 9 more matches
writeValue() - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetwriteValue ExperimentalChrome Full sup
port 57Notes Full sup
port 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change pre...
...t 57Notes Notes macOS only. Full sup
port 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. ...
...e-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags. Full sup
port 70Notes Notes Windows 10.Edge Full sup
port <=79Notes Full sup
port <=79Notes Notes macOS only. Full sup
port <=79Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version <=79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). ...
...And 9 more matches
Channel Messaging API - Web APIs
The Channel Messaging API allows two separate scripts running in different browsing contexts attached to the same document (e.g., two IFrames, or the main document and an IFrame, two documents via a SharedWorker, or two workers) to communicate directly, passing messages between one another through two-way channels (or pipes) with a
port at each end. Note: This feature is available in Web Workers. ...
...wo IFrames, or the main document and an IFrame, two documents via a SharedWorker, or two workers) to communicate directly, passing messages between one another through two-way channels (or pipes) with a
port at each end. Note: This feature is available in Web Workers. Channel messaging concepts and usage A message channel is created using the MessageChannel() constructor. ...
...a a SharedWorker, or two workers) to communicate directly, passing messages between one another through two-way channels (or pipes) with a
port at each end. Note: This feature is available in Web Workers. Channel messaging concepts and usage A message channel is created using the MessageChannel() constructor. ...
...And 9 more matches
Event.initEvent() - Web APIs
tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...b.com/mdn/browser-compat-data and send us a pull request. ...
...And 9 more matches
EventTarget.addEventListener() - Web APIs
addEventListener() works by adding a function or an object that implements EventListener to the list of event listeners for the specified event type on the EventTarget on which it's called. ...
...nt that has occurred, and it returns nothing. For example, an event handler callback that can be used to handle both fullscreenchange and fullscreenerror might look like this: function eventHandler(event) { if (event.type == 'fullscreenchange') { /* handle a full screen toggle */ } else /* fullscreenerror */ { /* handle a full screen toggle error */ } } Safely detecting option sup
port In older versions of the DOM specification, the third parameter of addEventListener() was a Boolean value indicating whether or not to use capture. Over time, it became clear that more options were needed. Rather than adding more parameters to the function (complicating things enormously when dealing with optional values), the third parameter was changed to an object that can contain various pro...
...ns to configure the process of removing the event listener. Because older browsers (as well as some not-too-old browsers) still assume the third parameter is a Boolean, you need to build your code to handle this scenario intelligently. You can do this by using feature detection for each of the options you're interested in. ...
...And 9 more matches
FileSystemFileEntry - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ke to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetFileSystemFileEntryChrome Full sup
port 8Alternate Name Full sup
port 8Alternate Name Alternate Name Uses the non-standard name: FileEntryEdge Full sup
port 79Prefixed Full sup
port 79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox Full sup
port 50IE No sup
port NoOpera No sup
port NoSafari Full sup
port ...
...And 9 more matches
FileSystemFlags.create - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...esktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetcreate ExperimentalChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port <=79Prefixed Full sup
port <=79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox Partial sup
port 50Notes Partial sup
port 50Notes Notes For security reasons, Firefox does not sup
port creating files. This option has no effect.IE No sup
port ...
...And 9 more matches
FileSystemFlags.exclusive - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...topMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetexclusive ExperimentalChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port <=79Prefixed Full sup
port <=79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox Partial sup
port 50Notes Partial sup
port 50Notes Notes For security reasons, Firefox does not sup
port creating files. This option has no effect.IE No sup
port ...
...And 9 more matches
HTMLImageElement.alt - Web APIs
The HTMLImageElement property alt provides fallback (alternate) text to display when the image specified by the <img> element is not loaded. This may be the case because of an error, because the user has disabled the loading of images, or because the image simply hasn't finished loading yet. Perhaps the most im
portant reason to use the alt tag is to sup
port accessibility, as the alt text may be used by screen readers and other assistive technologies to help differently-abled users make full use of your content. It will be read aloud or sent to the touch device, for example, to sup
port visually impaired users. Think of it like this: When choosing alt strings for your images, imagine what you would say when reading the page to someone over the phone without mentioning that there's an image o...
...ax htmlImageElement.alt = altText; let altText = htmlImageElement.alt; Value A DOMString which contains the alternate text to display when the image is not loaded or for use by assistive devices. The alt attribute is officially mandatory; it's meant to always be specified. If the image doesn't require a fallback (such as for an image which is simply decorative or an advisory icon of minimal im
portance), you may specify an empty string (""). For compatibility reasons, browsers generally will accept an image without an alt attribute, but you should try to get into the habit of using it. Usage notes The fundamental guideline for the alt attribute is that every image's alternate text should be able to replace the image without altering the meaning of the page. You should never use alt for te...
...ince it's simply a decorational detail. <div class="container"> <div class="left-margin"> <img src="/files/16861/margin-flourish.svg" alt=""> </div> <div class="contents"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque quis orci ligula. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac neque libero. Vivamus consectetur rhoncus elit eget
porta. Etiam pulvinar ex id sapien laoreet, quis aliquet odio lobortis. Nam ac mauris at risus laoreet cursus vitae et sapien. Etiam molestie auctor eros, ac
porta risus scelerisque sit amet. Ut nunc neque,
porta eu auctor at, tempor et arcu.</p> </div> </div> CSS The CSS for this example simply sets up the styles for the layout as shown in the result below. They're not crucial...
...And 9 more matches
HTMLImageElement.decoding - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 9 more matches
IDBDatabase.createObjectStore() - Web APIs
You can use the property to uniquely identify individual objects in the store. As the property is an identifier, it should be unique to every object, and every object should have that property. This method can be called only within a versionchange transaction. Note: This feature is available in Web Workers. ...
...yPath is either an empty string or an array containing an empty string. Example // Let us open our database var request = window.indexedDB.open("toDoList", 4); // This handler is called when a new version of the database // is created, either when one has not been created before // or when a new version number is submitted by calling // window.indexedDB.open(). // This handler is only sup
ported in recent browsers. request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) { note.innerHTML += "<li>Error loading database.</li>"; }; // Create an objectStore for this database var objectStore = db.createObjectStore("toDoList", { keyPath: "taskTitle" }); // define what data items the objectStore will contain objectStore.crea...
...mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 9 more matches
ImageCapture.takePhoto() - Web APIs
omise = imageCaptureObj.takePhoto([photoSettings]) Parameters photoSettings Optional An object that sets options for the photo to be taken. The available options are: fillLightMode: The flash setting of the capture device, one of "auto", "off", or "flash". imageHeight: The desired image height as an integer. The user agent selects the closest height value to this setting if it only sup
ports discrete heights. imageWidth: The desired image width as an integer. The user agent selects the closest width value to this setting if it only sup
ports discrete widths. redEyeReduction: A boolean indicating whether the red-eye reduction should be used if it is available. Return value A Promise that resolves with a Blob. Example This example is extracted from this Simple Image Captur...
...bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 9 more matches
PaymentAddress.toJSON() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...r AndroidOpera for AndroidSafari on iOSSamsung InternettoJSON()Chrome Full sup
port 61Disabled Full sup
port 61Disabled Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.Edge Full sup
port 15Firefox Full sup
port 62Notes Disabled Full sup
port 62Notes Disabled Notes Available only in nightly builds. ...
...And 9 more matches
RTCPeerConnection.getStats() - Web APIs
roviding statistics about either the overall connection or about the specified MediaStreamTrack. Syntax promise = rtcPeerConnection.getStats(selector) Parameters selector Optional A MediaStreamTrack for which to gather statistics. If this is null (the default value), statistics will be gathered for the entire RTCPeerConnection. Return value A Promise which resolves with an RTCStatsRe
port object providing connection statistics. The contents of the re
port depend on the selector as well as other details of the connection. Exceptions This method does not throw exceptions; instead, it rejects the returned promise with one of the following errors: InvalidAccessError There is no RTCRtpSender or RTCRtpReceiver whose track matches the specified selector, or selector matches more tha...
...details of the connection. Exceptions This method does not throw exceptions; instead, it rejects the returned promise with one of the following errors: InvalidAccessError There is no RTCRtpSender or RTCRtpReceiver whose track matches the specified selector, or selector matches more than one sender or receiver. Obsolete syntax Previously, getStats() used success and failure callbacks to re
port the results to you, instead of using a promise. This version of getStats() is obsolete; in addition, the data it returns is entirely different from the current specification, and the form of that data was never documented. This form of getStats() has been or will soon be removed from most browsers; you should not use it, and should update existing code to use the new promise-based version. Chec...
...PeerConnection.getStats(selector, successCallback, failureCallback) Parameters selector Optional A MediaStreamTrack for which to gather statistics. If this is null (the default value), statistics will be gathered for the entire RTCPeerConnection. successCallback A callback function to call when the stats have been retrieved. The function receives as input a single parameter: an RTCStatsRe
port with the collected statistics. No output is expected from the function. failureCallback A function to call when an error occurs while attempting to collect statistics. The callback receives as input the exception (a DOMException object describing the error which occurred. No return value is expected from the callback. Example This example creates a periodic function using setInterval() that ...
...And 9 more matches
SVGTransformList - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 9 more matches
StorageManager.persist() - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...lease check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 9 more matches
Using WebRTC data channels - Web APIs
ction. But there's a lot more you can do with WebRTC. In this guide, we'll examine how to add a data channel to a peer connection, which can then be used to securely exchange arbitrary data; that is, any kind of data we wish, in any format we choose. Since all WebRTC components are required to use encryption, any data transmitted on an RTCDataChannel is automatically secured using Datagram Trans
port Layer Security (DTLS). See Security below for more information. Creating a data channel The underlying data trans
port used by the RTCDataChannel can be created in one of two ways: Let WebRTC create the trans
port and announce it to the remote peer for you (by causing it to receive a datachannel event). This is the easy way, and works for a wide variety of use cases, but may not be flexible e...
... Let's look at each of these cases, starting with the first, which is the most common. Automatic negotiation Often, you can allow the peer connection to handle negotiating the RTCDataChannel connection for you. ...
...ippet, the channel is created with negotiated set to true, then a function called requestRemoteChannel() is used to trigger negotiation, to create a remote channel with the same ID as the local channel. Doing this lets you create data channels with each peer using different properties, and to create channels declaratively by simply using the same value for id. Buffering WebRTC data channels sup
port buffering of outbound data. This is handled automatically. While there's no way to control the size of the buffer, you can learn how much data is currently buffered, and you can choose to be notified by an event when the buffer starts to run low on queued data. This makes it easy to write efficient routines that make sure there's always data ready to send without over-using memory or swamping the...
...And 9 more matches
Using the Web Speech API - Web APIs
nition processing, so it won't work offline. Demo To show simple usage of Web speech recognition, we've written a demo called Speech color changer. When the screen is tapped/clicked, you can say an HTML color keyword, and the app's background color will change to that color. To run the demo, you can clone (or directly download) the Github repo it is part of, open the HTML index file in a sup
porting desktop browser, or navigate to the live demo URL in a sup
porting mobile browser like Chrome. Browser sup
port Sup
port for Web Speech API speech recognition is curently limited to Chrome for Desktop and Android -- Chrome has sup
ported it since around version 33 but with prefixed interfaces, so you need to include prefixed versions of them, e.g. webkitSpeechRecognition. HTML and CSS The HTML...
...ragraph, and a div into which we output diagnostic messages. <h1>Speech color changer</h1> <p>Tap/click then say a color to change the background color of the app.</p> <div> <p class="output"><em>...diagnostic messages</em></p> </div> The CSS provides a very simple responsive styling so that it looks ok across devices. JavaScript Let's look at the JavaScript in a bit more detail. ...
...ic messages. <h1>Speech color changer</h1> <p>Tap/click then say a color to change the background color of the app.</p> <div> <p class="output"><em>...diagnostic messages</em></p> </div> The CSS provides a very simple responsive styling so that it looks ok across devices. JavaScript Let's look at the JavaScript in a bit more detail. ...
...And 9 more matches
Window.open() - Web APIs
the specified name. If the name doesn't exist, then a new browsing context is opened in a new tab or a new window, and the specified resource is loaded into it. Syntax var window = window.open(url, windowName, [windowFeatures]); Parameters url A DOMString indicating the URL of the resource to be loaded. This can be a path or URL to an HTML page, image file, or any other resource that is sup
ported by the browser. If the empty string ("") is specified as url, a blank page is opened into the targeted browsing context. windowName Optional A DOMString specifying the name of the browsing context (window, <iframe> or tab) into which to load the specified resource; if the name doesn't indicate an existing context, a new window is created and is given the name specified by windowName. This ...
... Otherwise the call to window.open() will just create a new window. To open a new window on every call of window.open(), use the special value _blank for windowName. Note on the use of window.open() to reopen an existing window with name windowName : This functionality is not valid for all browsers and more with variable conditions. Firefox (50.0.1) functions as described: from the same domain+
port reopen with same name will access the previously created window. Google Chrome (55.0.2883.87 m ) on the other hand will do it only from the same parent (as if the window was created dependent, which is the "opener"). This is a wide limitation and generates unbelievable complexity of development. Firefox (51.) gets the handle but cannot run any Element.focus() while Chrome can run focus() from ope...
...f. resizable If this feature is on, the new secondary window will be resizable. If windowFeatures is non-empty, resizable detaults to on. Tip: For accessibility reasons, it is strongly recommended to set this feature always on scrollbars If this feature is on, the new secondary window will show horizontal and/or vertical scrollbar(s) if the document doesn't fit into the window's view
port. If windowFeatures is non-empty, scrollbars detaults to off. See note on scrollbars. Tip: For accessibility reasons, it is strongly encouraged to set this feature always on Window functionality features noopener If this feature is set, the newly-opened window will open as normal, except that it will not have access back to the originating window (via Window.opener -- it returns...
...And 9 more matches
XRSystem: requestSession() - Web APIs
olves to an XRSession object through which you can manage the requested type of WebXR session. While only one immersive VR session can be active at a time, multiple inline sessions can be in progress at once. Syntax var sessionPromise = xr.requestSession(sessionMode, sessionInit) Parameters sessionMode A DOMString whose value is one of those included in the XRSessionMode enum. ...
...rs sessionMode A DOMString whose value is one of those included in the XRSessionMode enum. The sup
ported modes are: immersive-ar The session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend the content together. Im
portant: The immersive-ar mode is defined by the WebXR Augmented Reality Module, which is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected...
...f the hardware requires it. inline The output is presented inline within the context of an element in a standard HTML document, rather than occupying the full visual space. Inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. Inline sessions don't require special hardware and should be avalable on any user agent offering WebXR API sup
port. sessionInit Optional A XRSessionInit object providing options to configure the new XRSession. See Specifying session options for details on how to configure a WebXR session. Return value A Promise that resolves with an XRSession object if the device and user agent sup
port the requested mode and features. Exceptions This method doesn't throw true exceptions; instead, it rejects the return...
...And 9 more matches
Specificity - CSS: Cascading Style Sheets
t()) have no effect on specificity. (The selectors declared inside :not() do, however.) For more information, visit: "Specificity" in "Cascade and inheritance", you can also visit: https://specifishity.com Inline styles added to an element (e.g., style="font-weight: bold;") always overwrite any styles in external stylesheets, and thus can be thought of as having the highest specificity. The !im
portant exception When an im
portant rule is used on a style declaration, this declaration overrides any other declarations. Although technically !im
portant has nothing to do with specificity, it interacts directly with it. Using !im
portant, however, is bad practice and should be avoided because it makes debugging more difficult by breaking the natural cascading in your stylesheets. When two conflicti...
...tant rule is used on a style declaration, this declaration overrides any other declarations. Although technically !im
portant has nothing to do with specificity, it interacts directly with it. Using !im
portant, however, is bad practice and should be avoided because it makes debugging more difficult by breaking the natural cascading in your stylesheets. When two conflicting declarations with the !im
portant rule are applied to the same element, the declaration with a greater specificity will be applied. Some rules of thumb: Always look for a way to use specificity before even considering !im
portant Only use !im
portant on page-specific CSS that overrides foreign CSS (from external libraries, like Bootstrap or normalize.css). Never use !im
portant when you're writing a plugin/mashup. Never us...
...ule are applied to the same element, the declaration with a greater specificity will be applied. Some rules of thumb: Always look for a way to use specificity before even considering !im
portant Only use !im
portant on page-specific CSS that overrides foreign CSS (from external libraries, like Bootstrap or normalize.css). Never use !im
portant when you're writing a plugin/mashup. Never use !im
portant on site-wide CSS. Instead of using !im
portant, consider: Make better use of the CSS cascade Use more specific rules. By indicating one or more elements before the element you're selecting, the rule becomes more specific and gets higher priority: <div id="test"> <span>Text</span> </div> div#test span { color: green; } div span { color: blue; } span { color: red; } No matter...
...And 9 more matches
Creating a cross-browser video player - Developer guides
that the specified image is to be displayed until the user chooses to play the video. IE9 will only use the specified poster image in this way if preload="none" is set; otherwise, it will take the first still of the video and display that instead. Three different video sources are provided for the player: MP4, WebM, and Ogg. Using these different source formats gives the best chance of being sup
ported across all browsers that sup
port HTML5 video. For further information on video formats and browser compatibility, see sup
ported media formats. For browsers that do not sup
port HTML5 video, a Flash player is provided that will allow playback of the MP4 video source, provided the end user has Flash installed. In addition a download link is displayed to allow users to download the MP4 video file,...
...uld allow playback of the video in most browsers, using the browser's default control set. The next step is to define a custom control set, also in HTML, which will be used to control the video. The control set Most browser's default video controls have the following functionality: Play/pause Mute Volume control Progress bar Skip ahead Go fullscreen The custom control set will also sup
port this functionality, with the addition of a stop button. Once again the HTML is quite straightforward, using an unordered list with list-style-type:none set to enclose the controls, each of which is a list item with float:left. For the progress bar, the progress element is taken advantage of, with a fallback provided for browsers that don't sup
port it (e.g. IE8 and IE9). This list is inserted aft...
...n the HTML is quite straightforward, using an unordered list with list-style-type:none set to enclose the controls, each of which is a list item with float:left. For the progress bar, the progress element is taken advantage of, with a fallback provided for browsers that don't sup
port it (e.g. IE8 and IE9). This list is inserted after the <video> element, but inside the <figure> element (this is im
portant for the fullscreen functionality, which is explained later on). <ul id="video-controls" class="controls"> <li><button id="playpause" type="button">Play/Pause</button></li> <li><button id="stop" type="button">Stop</button></li> <li class="progress"> <progress id="progress" value="0" min="0"> <span id="progress-bar"></span> </progress> </li> <li><button id="m...
...And 9 more matches
HTML elements reference - HTML: Hypertext Markup Language
element indicates that the enclosed HTML provides contact information for a person or people, or for an organization. <article> The HTML <article> element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication). <aside> The HTML <aside> element represents a
portion of a document whose content is only indirectly related to the document's main content. <footer> The HTML <footer> element represents a footer for its nearest sectioning content or sectioning root element. A footer typically contains information about the author of the section, copyright data or links to related documents. <header> The HTML <header> element represent...
...ctions are menus, tables of contents, and indexes. <section> The HTML <section> element represents a standalone section -- which doesn't have a more specific semantic element to represent it -- contained within an HTML document. Text content Use HTML text content elements to organize blocks or sections of content placed between the opening <body> and closing </body> tags. Im
portant for accessibility and SEO, these elements identify the purpose or structure of that content. Element Description <blockquote> The HTML <blockquote> Element (or HTML Block Quotation Element) indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation (see Notes for how to change it). A URL for the source of th...
...page, or anything else a URL can address. <abbr> The HTML Abbreviation element (<abbr>) represents an abbreviation or acronym; the optional title attribute can provide an expansion or description for the abbreviation. <b> The HTML Bring Attention To element (<b>) is used to draw the reader's attention to the element's contents, which are not otherwise granted special im
portance. <bdi> The HTML Bidirectional Isolate element (<bdi>) tells the browser's bidirectional algorithm to treat the text it contains in isolation from its surrounding text. <bdo> The HTML Bidirectional Text Override element (<bdo>) overrides the current directionality of text, so that the text within is rendered in a different direction. <br> The HTML <br...
...And 9 more matches
Index - HTTP
esponse header. Browsers set adequate values for this header according to their user interface language and even if a user can change it, this happens rarely (and is frowned upon as it leads to fingerprinting). 6 Accept-Ranges HTTP, HTTP Header, Range Requests, Reference, Response Header The Accept-Ranges response HTTP header is a marker used by the server to advertise its sup
port of partial requests. The value of this field indicates the unit that can be used to define a range. 7 Access-Control-Allow-Credentials CORS, HTTP, Reference, header The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to frontend JavaScript code when the request's credentials mode (Request.credentials) is "include". 8 A...
...ade. This header is necessary as the preflight request is always an OPTIONS and doesn't use the same method as the actual request. 15 Age Caching, HTTP, Response, header The Age header contains the time in seconds the object has been in a proxy cache. 16 Allow Entity header, HTTP, HTTP Header, Reference, header The Allow header lists the set of methods sup
port by a resource. 17 Alt-Svc Draft, HTTP, HTTP Header, NeedsCompatTable, NeedsContent, NeedsExample, Reference The Alt-Svc header is used to list alternate ways to reach this website. 18 Authorization HTTP, HTTP Header, Reference, Request header, header The HTTP Authorization request header contains the credentials to authenticate a user agent with a server,...
...y limiting the types of resources which can be loaded. 43 CSP: referrer CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy (CSP) referrer directive used to specify information in the Referer header (with a single r as this was a typo in the original spec) for links away from a page. This API is deprecated and removed from browsers. 44 CSP: re
port-uri CSP, Directive, HTTP, Reference, Security The deprecated HTTP Content-Security-Policy (CSP) re
port-uri directive instructs the user agent to re
port attempts to violate the Content Security Policy. These violation re
ports consist of JSON documents sent via an HTTP POST request to the specified URI. 45 CSP: require-sri-for CSP, Directive, HTTP, Reference, Security ...
...And 9 more matches
No Proxy For configuration - Archive of obsolete content
ers) entries. New profiles contain the values "localhost, 127.0.0.1", by default. Entry points: Preferences | Advanced | Proxies control-click menu for off line-online icon (network plug) Configuration The no proxy list is composed of either domain elements or IPv4 address elements. The elements are separated by either a space (" ") or a comma (","). Note for former-IE users: "*" is sup
ported only at the beginning of domain filters (*.mozilla.org). To block ... put this into "No Proxy for" ...for example use... Limitations a domain, including sub-domains domain suffix "mozilla.org" Does not block domains that end in the same string (amozilla.org) sub-domains domain suffix, starting with a dot ".mozilla.org" Does not block the m...
... all non-FQDN hosts, such as intranet hosts The string "<local>" (without quotes) "<local>" Bypasses the proxy for all hostnames which have no periods in them. For example: ...
... all non-FQDN hosts, such as intranet hosts The string "<local>" (without quotes) "<local>" Bypasses the proxy for all hostnames which have no periods in them. For example: "https://myCompanyIntranet/" ...
...And 8 more matches
Frequently Asked Questions - Archive of obsolete content
svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> Make sure all your SVG files have these bindings. For more information see this link. Why am I asked to choose a program to open SVG files? When you try to load SVG files from some websites you may get a dialogue asking you "What should Firefox do with this file?". This is either because your browser doesn't sup
port SVG (you must have Mozilla Firefox 1.5 or newer), or because the webpage/server isn't correctly telling Mozilla that the file contains SVG. For example, webpages that embed SVG using the <object> or <embed> tags must have a 'type' attribute assigned with the correct SVG MIME type of "image/svg+xml". If the MIME type specified is wrong (for example image/svg-xml) Mozilla won't recognise it. If tha...
...uring servers for SVG see this link. Why am I asked to install a plug-in to view SVG files? This is probably because there is an <embed> or <object> tag in the HTML page and its 'type' attribute is set to the wrong MIME type. The SVG MIME type is image/svg+xml (not image/svg-xml or anything else for that matter). Correct this mistake or ask the document maintainer to correct it. ...
... that matter). Correct this mistake or ask the document maintainer to correct it. How should I re
port bugs in Mozilla SVG? ...
...And 8 more matches
Archived Mozilla and build documentation - Archive of obsolete content
If you are a plug-in author, you may find this project saves you a lot of work! ant script to assemble an extension This ant script helps to package an extension Archived SpiderMonkey docs This section contains old SpiderMonkey documentation. ...
...can be dragged around and dropped onto other objects. DTrace DTrace is Sun Microsystem's dynamic tracing framework that allows developers to instrument a program with probes that have little to no effect on performance when not in use and very little when active. Probe data can be collected with scripts written in D (no, not that one). Mozilla DTrace sup
port has been added by the Sun DTrace team and can be used on Solaris 10 and Mac OS X 10.5. Embedding FAQ Embedding Mozilla in a Java Application using JavaXPCOM XULRunner ships with the JavaXPCOM component, which allows Java code to interact with XPCOM objects. As you will see in this article, working with XPCOM objects in Java is ...
...ing JavaXPCOM XULRunner ships with the JavaXPCOM component, which allows Java code to interact with XPCOM objects. As you will see in this article, working with XPCOM objects in Java is not that much different than doing so in C++. Error Console The Error Console is a tool available in most Mozilla-based applications that is used for re
porting errors in the application chrome and in web pages user opens. It re
ports JavaScript-related errors and warnings, CSS errors and arbitrary messages from chrome code. In Firefox, the Error Console can be opened from the tools menu or by Ctrl-Shift-J. Exception logging in JavaScript Technical review completed. Existing Content This is a ...
...And 8 more matches
Using the W3C DOM - Archive of obsolete content
tions of elements, such as document.images and document.forms. Some browsers have non-standard properties, such as Internet Explorer's document.all[], that are not part of the W3C Document Object Model (DOM) standards and may cause JavaScript errors in standards-compliant browsers. The W3C Document Object Model provides interfaces DOM elements to scriptable objects. ...
...ers have non-standard properties, such as Internet Explorer's document.all[], that are not part of the W3C Document Object Model (DOM) standards and may cause JavaScript errors in standards-compliant browsers. The W3C Document Object Model provides interfaces DOM elements to scriptable objects. W3C DOM standards are well sup
ported by modern browsers, however the standards are moving target so sup
port for newer features should be tested before use. ...
...JavaScript errors in standards-compliant browsers. The W3C Document Object Model provides interfaces DOM elements to scriptable objects. W3C DOM standards are well sup
ported by modern browsers, however the standards are moving target so sup
port for newer features should be tested before use. Using W3C standards means that code will run in compliant browsers with minimal need for cross-browser sup
port, whereas code based on proprietary standards requires much more effort to be compatible with multiple user agents. ...
...And 8 more matches
Using the Right Markup to Invoke Plugins - Archive of obsolete content
L referenced by the codebase attribute and retrieve the ActiveX control. Additional param elements (which are "children" of the above object element) specify configuration parameters for the Flash plugin. For instance, the param name="movie" tells the Flash plugin the location of the SWF file to start playing. ...
...nts (which are "children" of the above object element) specify configuration parameters for the Flash plugin. For instance, the param name="movie" tells the Flash plugin the location of the SWF file to start playing. With the release of Netscape 7.1, this kind of ActiveX use of the object element is sup
ported for use with the Microsoft(R) Windows Media Player. Only the Windows Media Player is sup
ported as an ActiveX control in Netscape 7.1. The details are covered in another article. ...
...th the release of Netscape 7.1, this kind of ActiveX use of the object element is sup
ported for use with the Microsoft(R) Windows Media Player. Only the Windows Media Player is sup
ported as an ActiveX control in Netscape 7.1. The details are covered in another article. Browsers such as Netscape 7 will not render the Flash plugin if the above kind of markup is used, because Netscape 7 does not sup
port ActiveX or ActiveX-based component invocations, with the exception of Windows Media Player in Netscape 7.1. Mozilla-based browsers sup
port the Netscape Plugin architecture, which is not COM based like ActiveX (and thus, not invoked via a Unique Identifier) but rather, MIME type based. Mozilla-based browsers sup
port the use of the object element along with a MIME type. Here is an example of this u...
...And 8 more matches
Audio for Web games - Game development
Unfortunately these are also the platforms that people often use to play games. ...
... often need to decide which audio parts are essential to our games' experience and which are nice to have but not essential, and devise a strategy accordingly. This article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible. Mobile audio caveats By far the most difficult platforms to provide web audio sup
port for are mobile platforms. Unfortunately these are also the platforms that people often use to play games. There are a couple of differences between desktop and mobile browsers that may have caused browser vendors to make choices that can make web audio difficult for game developers to work with. Let's look at these now. Autoplay Browser autoplay policy now affects desktop and mobile browsers. T...
...required before playing can commence. Concurrent audio playback A requirement of many games is the need to play more than one piece of audio at the same time; for example, there might be background music playing along with sound effects for various things happening in the game. ...
...And 8 more matches
Cascade and inheritance - Learn web development
Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn about the cascade and specificity, and how inheritance works in CSS. Conflicting rules CSS stands for Cascading Style Sheets, and that first word cascading is incredibly im
portant to understand -- the way that the cascade behaves is key to understanding CSS. At some point, you will be working on a project and you will find that the CSS you thought should be applied to an element is not working. Usually the problem is that you have created two rules which could potentially apply to the same element. The cascade, and the closely-related concept of specificity, are mechan...
...its parent element. Effectively, this "turns on inheritance". initial Sets the property value applied to a selected element to the initial value of that property. unset Resets the property to its natural value, which means that if the property is naturally inherited it acts like inherit, otherwise it acts like initial. Note: There is also a newer value, revert, which has limited browser sup
port. Note: See Origin of CSS declarations in Introducing the CSS Cascade for more information on each of these and how they work. We can look at a list of links and explore how the universal values work. The live example below allows you to play with the CSS and see what happens when you make changes. Playing with code really is the best way to get to grips with HTML and CSS. For example: Th...
...nd from the introductory lessons we have an understanding of how to change the CSS applied to something at any point in the document -- whether by assigning CSS to an element or creating a class. We will now take a proper look at how the cascade defines which CSS rules apply when more than one thing could style an element. There are three factors to consider, listed here in increasing order of im
portance. Later ones overrule earlier ones: Source order Specificity Im
portance We will look at these to see how browsers figure out exactly what CSS should be applied. Source order We have already seen how source order matters to the cascade. If you have more than one rule, which has exactly the same weight, then the one that comes last in the CSS will win. You can think of this as rules whi...
...And 8 more matches
CSS values and units - Learn web development
und using the rgb() function: h1 { color: black; background-color: rgb(197,93,161); } A value in CSS is a way to define a collection of allowable sub-values. This means that if you see <color> as valid you don't need to wonder which of the different types of color value can be used -- keywords, hex values, rgb() functions, etc. You can use any available <color> values assuming they are sup
ported by your browser. The page on MDN for each value will give you information about browser sup
port. For example, if you look at the page for <color> you will see that the browser compatibility section lists different types of color value and sup
port for them. Let's have a look at some of the types of value and unit you may frequently encounter, with examples so that you can try out different poss...
...ercentage> represents a fraction of some other value, for example 50%. Percentage values are always relative to another quantity, for example an element's length is relative to its parent element's length. Lengths The numeric type you will come across most frequently is <length>, for example 10px (pixels) or 30em. There are two types of lengths used in CSS -- relative and absolute. It's im
portant to know the difference in order to understand how big things will become. Absolute length units The following are all absolute length units -- they are not relative to anything else and are generally considered to always be the same size. Unit Name Equivalent to cm Centimeters 1cm = 96px/2.54 mm Millimeters 1mm = 1/10th of 1cm Q Q...
... px Pixels 1px = 1/96th of 1in Most of these values are more useful when used for print, rather than screen output. For example we don't typically use cm (centimeters) on screen. The only value that you will commonly use is px (pixels). Relative length units Relative length units are relative to something else, perhaps the size of the parent element's font, or the size of the view
port. The benefit of using relative units is that with some careful planning you can make it so the size of text or other elements scale relative to everything else on the page. Some of the most useful units for web development are listed in the table below. Unit Relative to em Font size of the parent, in the case of typographical properties like font-size, and font size o...
...And 8 more matches
Flexbox - Learn web development
the opposite corner of the browser window and flows in reverse. flex-flow shorthand At this point it is worth noting that a shorthand exists for flex-direction and flex-wrap -- flex-flow. ...
...; Flexible sizing of flex items Let's now return to our first example, and look at how we can control what pro
portion of space flex items take up compared to the other flex items. Fire up your local copy of flexbox0.html, or take a copy of flexbox1.html as a new starting point (see it live). First, add the following rule to the bottom of your CSS: article { flex: 1; } This is a unitless pro
portion value that dictates how much of the available space along the main axis each flex item will take up compared to other flex items. In this case, we are giving each <article> element the same value (a value of 1), which means they will all take up an equal amount of the spare space left after things like padding and margin have been set. It is relative to other flex items, meaning that giving ea...
...ke padding and margin have been set. It is relative to other flex items, meaning that giving each flex item a value of 400000 would have exactly the same effect. Now add the following rule below the previous one: article:nth-of-type(3) { flex: 2; } Now when you refresh, you'll see that the third <article> takes up twice as much of the available width as the other two -- there are now four pro
portion units available in total (since 1 + 1 + 2 = 4). The first two flex items have one unit each so they take 1/4 of the available space each. The third one has two units, so it takes up 2/4 of the available space (or one-half). You can also specify a minimum size value inside the flex value. Try updating your existing article rules like so: article { flex: 1 200px; } article:nth-of-type(3) { ...
...And 8 more matches
Floats - Learn web development
uld look like. First, we'll start off with some simple HTML -- add the following to your HTML body, removing anything that was inside there before: <h1>Simple float example</h1> <div class="box">Float</div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. Duis felis orci, pulvinar id metus ut, rutrum luctus orci. Cras
porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. </p> <p>Sed auctor cursus massa at
porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula. Curabitur vehicula tellus neque, ac ornare ex malesuada et. In vitae convallis lacus. Aliquam erat volutpat. Suspendisse ac imperdiet turpis. Aenean finibus sollicitudin eros pharetra congue. Duis ornare egestas augue ut l...
...kground-color: rgb(207,232,220); padding: 1em; } Now if you save and refresh you'll see something like the following: Float Example 1 <h1>Simple float example</h1> <div class="box">Float</div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. </p> <p>Duis felis orci, pulvinar id metus ut, rutrum luctus orci. Cras
porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. Sed auctor cursus massa at
porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula. Curabitur vehicula tellus neque, ac ornare ex malesuada et. In vitae convallis lacus. Aliquam erat volutpat. Suspendisse ac imperdiet turpis. Aenean finibus sollicitudin eros pharetra congue. Duis ornare egestas augue ut luctus. Pr...
...o see the background on the paragraph running right underneath the floated box, as in the example below. Float Example 2 <h1>Simple float example</h1> <div class="box">Float</div> <p class="special">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. </p> <p>Duis felis orci, pulvinar id metus ut, rutrum luctus orci. Cras
porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. Sed auctor cursus massa at
porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula. Curabitur vehicula tellus neque, ac ornare ex malesuada et. In vitae convallis lacus. Aliquam erat volutpat. Suspendisse ac imperdiet turpis. Aenean finibus sollicitudin eros pharetra congue. Duis ornare egestas augue ut luctus. Pr...
...And 8 more matches
Making asynchronous programming easier with async and await - Learn web development
These features basically act as syntactic sugar on top of promises, making asynchronous code easier to write and to read afterwards. They make async code look more like old-school synchronous code, so they're well worth learning. This article gives you what you need to know. ...
...omise, we could use a .then() block: hello().then((value) => console.log(value)) or even just shorthand such as hello().then(console.log) Like we saw in the last article. So the async keyword is added to functions to tell them to return a promise rather than directly returning the value. In addition, this lets synchronous functions avoid any potential overhead that comes with running with sup
port for using await. By only adding the necessary handling when the function is declared async, the JavaScript engine can optimize your program for you. Sweet! The await keyword The real advantage of async functions becomes apparent when you combine it with the await keyword -- in fact, await only works inside async functions. This can be put in front of any async promise-based function to pause yo...
...ulk of the code out of the .then() block provides a nice, useful simplification, leaving us with a much more readable program. For error handling, we've included a .catch() block on our displayContent() call; this will handle errors ocurring in both functions. Note: It is also possible to use a sync finally block within an async function, in place of a .finally() async block, to show a final re
port on how the operation went -- you can see this in action in our live example (see also the source code). The downsides of async/await Async/await is really useful to know about, but there are a couple of downsides to consider. Async/await makes your code look synchronous, and in a way it makes it behave more synchronously. The await keyword blocks execution of all the code that follows until t...
...And 8 more matches
Componentizing our Svelte app - Learn web development
s to communicate between components, and the pros and cons of each. Extracting our filter component We'll begin by creating our FilterButton.svelte. First of all, create a new file -- components/FilterButton.svelte. Inside this file we will declare a filter prop, and then copy the relevant markup over to it from Todos.svelte. ...
...ss="btn toggle-btn" class:btn__primary={filter === 'completed'} aria-pressed={filter === 'completed'} on:click={()=> filter = 'completed'} > <span class="visually-hidden">Show</span> <span>Completed</span> <span class="visually-hidden">tasks</span> </button> </div> Back in our Todos.svelte component, we want to make use of our FilterButton component. ...
... 'completed'} on:click={()=> filter = 'completed'} > <span class="visually-hidden">Show</span> <span>Completed</span> <span class="visually-hidden">tasks</span> </button> </div> Back in our Todos.svelte component, we want to make use of our FilterButton component. ...
...And 8 more matches
Introduction to automated testing - Learn web development
nd a callback function containing the actual code to run to complete the task. You can run your gulp task with the following commands -- try this now: gulp Adding some real tasks to Gulp To add some real tasks to Gulp, we need to think about what we want to do. A reasonable set of basic functionalities to run on our project is as follows: html-tidy, css-lint, and js-hint to lint and re
port/fix common HTML/CSS/JS errors (see gulp-htmltidy, gulp-csslint, gulp-jshint). Autoprefixer to scan our CSS and add vendor prefixes only where needed (see gulp-autoprefixer). babel to transpile any new JavaScript syntax features to traditional syntax that works in older browsers (see gulp-babel). See the links above for full instructions on the different gulp packages we are using. To use eac...
...Our original code included a f...
...d the following test to the bottom of gulpfile.js: function js(cb) { return gulp.src('src/main.js') .pipe(jshint()) .pipe(jshint.re
porter('default')) .pipe(babel({ presets: ['@babel/env'] })) .pipe(gulp.dest('build')); cb(); } Here we grab our main.js file, run jshint on it and output the results to the terminal using jshint.re
porter; we then pass the file to babel, which converts it to old style syntax and outputs the result into the build directory. Our original code included a fat arrow function, which babel has modified into an old style function. ...
...And 8 more matches
Package management basics - Learn web development
e(s) in your application (this tends to be done using JavaScript modules, another subject that is worth reading up on and understanding). Doing the same thing for all of the packages' sub-dependencies, of which there could be tens, or hundreds. Removing all the files again if you want to remove the packages. ...
... For example, if your project relied on Webpack with a certain configuration, you'd want to ensure that if you installed that project on another machine or returned to it much later on, the configuration would still work. If a different version of Webpack was installed, it may not be compatible. ...
...mon in front-end development). In the case of npm (and JavaScript- and Node-based package managers) you have two options for where you install your dependencies. As we touched on in the previous article, dependencies can be installed globally or locally to your project. Although there tend to be more pros for installing globally, the pros for installing locally are more im
portant -- such as code
portability and version locking. For example, if your project relied on Webpack with a certain configuration, you'd want to ensure that if you installed that project on another machine or returned to it much later on, the configuration would still work. If a different version of Webpack was installed, it may not be compatible. To mitigate this dependencies are installed locally to a project. To see ...
...And 8 more matches
Chrome Worker Modules
The preferred way to define and load modules for Chrome Workers is to use the Chrome Worker Module Loader. This module loader should not surprise developers familiar with CommonJS, as it implements a minimal CommonJS require(). Loading modules Loading a module is simple. Start by im
porting the module loader. ...
... The preferred way to define and load modules for Chrome Workers is to use the Chrome Worker Module Loader. This module loader should not surprise developers familiar with CommonJS, as it implements a minimal CommonJS require(). Loading modules Loading a module is simple. Start by im
porting the module loader. ...
...Core.declareFFI(...) Note that, for the moment, require() only accepts absolute URIs. If the your module URI ends with ".js", you can omit the extension. ...
...And 8 more matches
CSUN Firefox Materials
owser which is rapidly gaining recognition for its fresh, streamlined approach to browsing the web. In addition to winning major awards such as PC World Product of the Year, Firefox has attracted a huge following among savvy users who simply care enough about their web browsing experience to download a new piece of software. Websites such as online magazines with sophisticated audiences are now re
porting upwards of 25% Firefox usage. Why do the most discerning users switch to Firefox? Because Firefox rethinks the web, and does away with many of the common annoyances that cause browsing to be difficult for ordinary people. Firefox's "WWW for everyone" philosophy is also a great accessibility story. Every user, regardless of what accomodations they need, can enjoy a less cluttered web, free of i...
...lt for ordinary people. Firefox's "WWW for everyone" philosophy is also a great accessibility story. Every user, regardless of what accomodations they need, can enjoy a less cluttered web, free of intrusions such as popup ads and spyware. The simple, uncluttered user interface is simply more pleasant. As a result, nearly everyone who tries Firefox finds themselves hooked.. Assistive Technology Sup
port on Windows "I am a full Firefox convert with the release of 1.5. At my next op
portunity, I intend to convert my family over to it too. " -- Darren Paskell, from Window-Eyes beta testing list Firefox works with popular screen readers, with the best sup
port currently coming from GW Micro's Window-Eyes 5.5. JAWS sup
port is quickly catching up as well. In recent articles from both AFB's Access Wo...
...lorer for screen reader users. In fact, the same keyboard commands are still available, so users can become comfortable and productive right away. Screen magnifier users can also benefit from Firefox's powerful features today, as caret and focus tracking are fully enabled. Mozilla Corporation is currently reaching out to work with AI Squared, the makers of ZoomText, in order to enable complete sup
port of advanced ZoomText features such as the Doc Reader and App Reader. Firefox on Linux currently boasts the best onscreen keyboard sup
port in the industry via GOK, the Gnome Onscreen Keyboard. Basic screen reader accessibility is available via Gnopernicus or the Fire Vox extension. Keyboard Sup
port "Mozilla Firefox is a web-browser with superior keyboard sup
port. " - Alan Cantor, Cantor Access ...
...And 8 more matches
How Mozilla's build system works
le: the build system does this for you. The primary job of configure is to determine characteristics of the system and compiler, apply options passed into it, and validate everything looks OK to build. The primary output of the configure script is an executable file in the object directory called config.status. configure also produces some additional files (like autoconf.mk). However, the most im
portant file in terms of architecture is config.status. The existence of a config.status file may be familiar to those who have worked with Autoconf before. However, Mozilla's config.status is different from many other config.status files, as it's written in Python! Instead of our configure script producing a shell script, it generates a Python script. Python 2 is prevalent in a Mozilla build system...
... there are makefiles in each directory. make starts processing the makefile in the root directory and then recursively descends into child directories until it's done. But there's more to the process than that. The recursive make backend divides the source tree into tiers. A tier is a grouping of related directories containing makefiles of their own. For example, there is a tier for the Netscape
Portable Runtime (nspr), one for the JavaScript engine, one for the core Gecko platform, one for the XUL app being built, and so on. The main moz.build file defines the tiers and directories in the tiers. In reality, the main moz.build files include other moz.build files, such as /toolkit/toolkit.mozbuild, which define the tiers. They do this via the add_tier_dir() function. At build time, the tiers...
...directories in the tiers. In reality, the main moz.build files include other moz.build files, such as /toolkit/toolkit.mozbuild, which define the tiers. They do this via the add_tier_dir() function. At build time, the tiers are traversed in the order they are defined. Typically, the traversal order looks something like base, nspr, nss, js, platform, app. Each tier consists of three sub-tiers: ex
port, libs, and tools. These sub-tiers roughly correspond to the actions of pre-build, main-build, and post-build. This naming, however, can be misleading because all three sub-tiers are part of the build: ex
port is used to do things like copy headers into place. libs is reserved for most of the work, like compiling C++ source files. tools is used to install tests and other sup
port tools. When ...
...And 8 more matches
Implementing QueryInterface
on::QueryInterface( REFNSIID aIID, void** aInstancePtr ) { NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!"); // It's a logic error, not a runtime error, to call me without any place to put my answer! // ...but that won't matter when someone calls me wrongly in a non-debug build. ...
.... if ( !aInstancePtr ) return NS_ERROR_NULL_POINTER; nsISup
ports* foundInterface; if ( aIID.Equals(nsCOMTypeInfo<nsIX>::GetIID()) ) foundInterface = NS_STATIC_CAST(nsIX*, this); else if ( aIID.Equals(nsCOMTypeInfo<nsIY>::GetIID()) ) foundInterface = NS_STATIC_CAST(nsIY*, this); // ...as many cases as needed... ...
... nsISup
ports* foundInterface; if ( aIID.Equals(nsCOMTypeInfo<nsIX>::GetIID()) ) foundInterface = NS_STATIC_CAST(nsIX*, this); else if ( aIID.Equals(nsCOMTypeInfo<nsIY>::GetIID()) ) foundInterface = NS_STATIC_CAST(nsIY*, this); // ...as many cases as needed... ...
...And 8 more matches
XPCOMUtils.jsm
Declare the class (or multiple classes) implementing the component(s). Create an array of component constructors. ...
... Declare the class (or multiple classes) implementing the component(s). Create an array of component constructors. ...
... Declare the class (or multiple classes) implementing the component(s). Create an array of component constructors. Define the NSGetFactory() or NSGetModule() entry point. ...
...And 8 more matches
Profiling with the Firefox Profiler
he Firefox Profiler web app. It is available from the menu at Tools > Web Developer > Performance. Understanding Profiles The Firefox Profiler has more current documentation available at profiler.firefox.com/docs/. However the following could have some potentially useful information for Gecko-specific problems. You can check out some frequently asked questions about the Firefox Profilers. Re
porting a Performance Problem has a step-by-step guide for obtaining a profile when requested by Firefox developers. Interface 1. Timeline The timeline has several rows of tracing markers (colored segments) which indicate interesting events. Hover over them to see more information. Below the tracing markers are rows corresponding with activity on a variety of threads. Tip: Threads that are anno...
...all clock time. There are lighter grey names to the right of tree elements that indicate where the code comes from. Be aware that elements can be from JavaScript, Gecko, or system libraries. Note that if some functions are not yet named properly, symbolication may not yet be finished. Tip: You can right-click on a function name to get an option to copy its name to the clipboard. A significant
portion of time can be spent in idle, blocking calls like waiting for events. This is ideal for a responsive application to be ready to service incoming events. There are OS-specific waiting functions like NtWaitForMultipleObjects seen in the example above taken on Windows or mach_msg_trap on macOS. Tip: You can quickly go deeper into the call tree by holding down your right arrow key. Alternatively...
...ing the main thread for a long time. If you notice these things happening in a loop, that's a bug to be fixed, since we're likely "layout thrashing". Some more tips and answers to common questions are available in a mid-2017 FAQ document. ...
...And 8 more matches
Introduction to NSPR
This chapter introduces key NSPR programming concepts and illustrates them with sample code. The current implementation of NSPR allows developers to compile a single source code base on Macintosh (PPC), Win32 (NT 3.51, NT 4.0, WIN'95), and over twenty versions of Unix. NSPR does not provide a platform for
porting existing code. It must be used from the beginning of a software project. ...
... atomic operations, and several other low-level services in a platform-independent manner. This chapter introduces key NSPR programming concepts and illustrates them with sample code. The current implementation of NSPR allows developers to compile a single source code base on Macintosh (PPC), Win32 (NT 3.51, NT 4.0, WIN'95), and over twenty versions of Unix. ...
...implementation of NSPR allows developers to compile a single source code base on Macintosh (PPC), Win32 (NT 3.51, NT 4.0, WIN'95), and over twenty versions of Unix. NSPR does not provide a platform for
porting existing code. It must be used from the beginning of a software project. ...
...And 8 more matches
NSS 3.24 release notes
NSS 3.24 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_24_RTM/src/ New in NSS 3.24 NSS 3.24 includes two NSS softoken updates, a new function to configure SSL/TLS server sockets, and two functions to improve the use of temporary arenas. ...
...y to select a "slot" into which the certificate is configured (which incorrectly identifies a key agreement type rather than a certificate). Separate functions for configuring Online Certificate Status Protocol (OCSP) responses or Signed Certificate Timestamps are not needed, since these can be added to the optional SSLExtraServerCertData struct provided to SSL_ConfigServerCert. Also, partial sup
port for RSA Probabilistic Signature Scheme (RSA-PSS) certificates has been added. Although these certificates can be configured, they will not be used by NSS in this version. For functions that use temporary arenas, allocating a
PORTCheapArena on the stack is more performant than allocating a PLArenaPool on the heap. Rather than declaring a PLArenaPool pointer and calling
PORT_NewArena/
PORT_FreeAren...
...Items allocated from the arena are still created on the heap, only the arena itself is stack-allocated. ...
...And 8 more matches
NSS Sample Code Utilities_1
tools and * other NSS test applications. ...
...'; } if (c <= 'f' && c >= 'a') { return c - 'a' + 0xa; } if (c <= 'F' && c >= 'A') { return c - 'A' + 0xa; } return -1; } /* * HexToBuf */ int HexToBuf(unsigned char *inString, SECItem *outbuf, PRBool isHexData) { int len = strlen(inString); int outLen = len+1/2; int trueLen = 0; int digit1, digit2; outbuf->data = isHexData ? ...
...c >= 'a') { return c - 'a' + 0xa; } if (c <= 'F' && c >= 'A') { return c - 'A' + 0xa; } return -1; } /* * HexToBuf */ int HexToBuf(unsigned char *inString, SECItem *outbuf, PRBool isHexData) { int len = strlen(inString); int outLen = len+1/2; int trueLen = 0; int digit1, digit2; outbuf->data = isHexData ? ...
...And 8 more matches
nsIContentSecurityPolicy
content/base/public/nsIContentSecurityPolicy.idlScriptable Describes an XPCOM component used to model and enforce Content Security Policies. ...
...ed to model and enforce Content Security Policies. ...
...rbird 3.3 / SeaMonkey 2.1) Method overview boolean permitsAncestry(in nsIDocShell docShell); void refinePolicy(in AString policyString, in nsIURI selfURI); void scanRequestData(in nsIHttpChannel aChannel); void sendRe
ports(in AString blockedURI, in AString violatedDirective); short shouldLoad(in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISup
ports aContext, in ACString aMimeTypeGuess, in nsISup
ports aExtra); short shouldProcess(in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISup
ports aContext, in ACString aMimeType, in nsISup
ports aExtra); Attributes Attribute Type Description allowsEval boolean Whether this policy allows eval and eval-like functions such as setTimeout("code string", t...
...And 8 more matches
nsINavBookmarksService
toolkit/components/places/nsINavBookmarksService.idlScriptable The BookmarksService interface provides methods for managing bookmarked history items. Bookmarks consist of a set of user-customizable folders. A URI in history can be contained in one or more such folders. 1.0 67 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) Implemented by: @mozilla.org/browser/nav-bookmarks-service;1. To use this service, use: var navBookmarksService = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getService(Components.interfaces.nsINavBookmarksService); Method overview void addObserver(in nsINavBookmarkObserver observer, in boolean o...
...Obsolete since Gecko 1.9 void getBookmarkIdsForURI(in nsIURI aURI, [optional] out unsigned long count, [array, retval, size_is(count)] out long long bookmarks); Note: Renamed from ge...
...d); unsigned short getItemType(in long long aItemId); AString getKeywordForBookmark(in long long aItemId); Obsolete since Gecko 40.0 AString getKeywordForURI(in nsIURI aURI); Obsolete since Gecko 40.0 nsITransaction getRemoveFolderTransaction(in long long aItemId); nsIURI getURIForKeyword(in AString keyword); Obsolete since Gecko 40.0 void im
portBookmarksHTML(in nsIURI url); Obsolete since Gecko 1.9 void im
portBookmarksHTMLToFolder(in nsIURI url, in PRInt64 folder); Obsolete since Gecko 1.9 PRInt32 indexOfFolder(in PRInt64 parent, in PRInt64 folder); Obsolete since Gecko 1.9 PRInt32 indexOfItem(in PRInt64 folder, in nsIURI uri); Obsolete since Gecko 1.9 long long insertBookmark(in long long aParentId, i...
...And 8 more matches
nsIURLParser
netwerk/base/public/nsIURLParser.idlScriptable Specifies the interface to an URL parser that attempts to follow the definitions of RFC 2396. ...
...ecifies the interface to an URL parser that attempts to follow the definitions of RFC 2396. ...
...Pos, out long extensionLen); void parsePath(in string path, in long pathLen, out unsigned long filepathPos, out long filepathLen, out unsigned long paramPos, out long paramLen, out unsigned long queryPos, out long queryLen, out unsigned long refPos, out long refLen); void parseServerInfo(in string serverinfo, in long serverinfoLen, out unsigned long hostnamePos, out long hostnameLen, out long
port); void parseURL(in string spec, in long specLen, out unsigned long schemePos, out long schemeLen, out unsigned long authorityPos, out long authorityLen, out unsigned long pathPos, out long pathLen); void parseUserInfo(in string userinfo, in long userinfoLen, out unsigned long usernamePos, out long usernameLen, out unsigned long passwordPos, out long passwordLen); Methods The string to pars...
...And 8 more matches
Add to iPhoto
extension uses Carbon routines, which can no longer be used in Firefox add-ons now that Firefox is a 64-bit application. You can download an installable version of this extension on AMO. Once installed, when you right-click on an image, you'll see among the options in the contextual menu an option to "Add Image to iPhoto". Choose it, and iPhoto will start up (if it's not already running) and im
port the image. Declaring the APIs The first thing we have to do is declare the Mac OS X APIs we'll be using. This extension uses a number of methods and data types, as well as constants, from three system frameworks. Since a lot of this stuff is repetitive, we'll only look at selected parts of the code to get an idea how things work. You can download the extension and poke through the code inside ...
...hese are routines for managing CFString, CFURL, and CFArray objects, among others. These are core system data formats that are used by other frameworks, and we'll be making use of them. The Core Foundation API is implemented by the CoreFoundation object, which consists of two methods to initialize and shut down the library, a reference to the library, and all the types and methods declared to sup
port Core Foundation. Initializing Core Foundation The init() method, which sets everything up, looks like this: init: function() { this.lib = ctypes.open("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"); // declaring all the APIs goes here } Shutting down Core Foundation While the Core Foundation system framework itself doesn't need to be shut down, we do need to close...
...n characters. CFURL The CFURL type is used to describe a URL. It differs from a string in that it offers URL-specific methods for managing the content, and includes methods for converting between URLs and file system routine data formats such as FSRef and Unix pathnames. We use a few of these routines because the Launch Services routine we'll be using to launch iPhoto and pass it the image to im
port uses CFURL for the file references. Let's take a look at two of the routines declared here: this.CFURLCreateFromFileSystemRepresentation = this.lib.declare("CFURLCreateFromFileSystemRepresentation", ctypes.default_abi, this.CFURLRef, // returns ctypes.voidptr_t, // input: alloc...
...And 8 more matches
AddressErrors - Web APIs
Any members which is present indicates that a validation error occurred for the member of the same name in an address described using PaymentAddress. AddressErrors is the type of the object returned by shippingAddressErrors in the PaymentDetailsUpdate passed into PaymentRequestUpdateEvent.updateWith() by the shippingaddresschange event handler if a change to the address resulted in a validation error occurring. See the examples below to see how this works. ...
...the example above (except of course that it's not connected to an actual payment handler, so no payments are actually processed). In the example, we're handling a donation to an organization that will be sending a "thank you" gift to the donor, so it requests shipping information along with allowing the donation payment itself. ...
...e example, we're handling a donation to an organization that will be sending a "thank you" gift to the donor, so it requests shipping information along with allowing the donation payment itself. JavaScript Payment Request data First, we declare the variables sup
portedHandlers, which is compatible with PaymentMethodData, and defaultPaymentDetails, which is a PaymentDetailsUpdate object. ...
...And 8 more matches
BudgetService - Web APIs
is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...orerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetBudgetService ExperimentalDeprecatedNon-standardChrome Full sup
port 55Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 42Safari ? WebView Android Full sup
port 55Chrome Android Full sup
port 55Firefox Android ? Opera Android Full sup
port 42Safari iOS ? Samsung Inter...
...And 8 more matches
BudgetState - Web APIs
e is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetBudgetState ExperimentalDeprecatedNon-standardChrome Full sup
port 60Edge Full sup
port <=79Firefox ? IE ? Opera No sup
port NoSafari ? WebView Android No sup
port NoChrome Android Full sup
port 60Firefox Android ? Opera Android No sup
port NoSafari iOS ? Samsung Internet ...
...And 8 more matches
ConvolverNode() - Web APIs
ining the (possibly multichannel) impulse response used by the ConvolverNode to create the reverb effect. disableNormalization: A Boolean controlling whether the impulse response from the buffer will be scaled by an equal-power normalization, or not. The default is 'false'. Return value A new ConvolverNode object instance. Exceptions Exception Explanation NotSup
portedError The referenced AudioBuffer does not have the correct number of channels, or it has a different sample rate to the associated AudioContext. Specifications Specification Status Comment Web Audio APIThe definition of 'ConvolverNode()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this...
...y table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
FileSystemDirectoryReader.readEntries() - Web APIs
on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ll request. ...
...And 8 more matches
FileSystemSync - Web APIs
y table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...bileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetFileSystemSync Non-standardChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port <=79Prefixed Full sup
port <=79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox No sup
port NoIE No sup
port NoOpera Full sup
port 15Prefixed Full sup
port ...
...And 8 more matches
HTMLIFrameElement.allowPaymentRequest - Web APIs
le on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ntribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...idSafari on iOSSamsung InternetallowPaymentRequest ExperimentalChrome Full sup
port 60Disabled Full sup
port 60Disabled Disabled From version 60: this feature is behind the #web-payments preference (needs to be set to Enabled). ...
...And 8 more matches
IDBEnvironment - Web APIs
The IDBEnvironment helper of the IndexedDB API contains the indexedDB property, which provides access to IndexedDB functionality. It is the top level IndexedDB interface implemented by the window and Worker objects. Note: This feature is available in Web Workers. Properties IDBEnvironment.indexedDB Read only Provides a mechanism for applications to asynchronously access capabilities of indexed databases; contains an IDBFactory object. ...
... this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...o contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
IDBRequest.onerror - Web APIs
in Web Workers. Syntax request.onerror = function(event) { ... }; Example The following example requests a given record title, onsuccess gets the associated record from the IDBObjectStore (made available as objectStoreTitleRequest.result), updates one property of the record, and then puts the updated record back into the object store. Also included at the bottom is an onerror function that re
ports what the error was if the request fails. For a full working example, see our To-do Notifications app (view example live.) var title = "Walk dog"; // Open up a transaction as usual var objectStore = db.transaction(['toDoList'], "readwrite").objectStore('toDoList'); // Get the to-do list object that has this title as it's title var objectStoreTitleRequest = objectStore.get(title); objectStoreT...
...y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
IDBVersionChangeEvent.version - Web APIs
Syntax readonly attribute unsigned long long? version; Value A 64-bit integer. ...
...able on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
PaymentRequest.abort() - Web APIs
The PaymentRequest.abort() method of the PaymentRequest interface causes the user agent to end the payment request and to remove any user interface that might be shown. Syntax PaymentRequest.abort(); Returns Void. Parameters None Examples The following example sets up a timeout to clear the payment request that might have been abandoned or neglected. ...
...y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetabort()Chrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 55Notes Disabled Full sup
port 55Notes Disabled Notes Available only in nightly builds.Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
...And 8 more matches
PaymentRequest.onshippingaddresschange - Web APIs
y the user agent changes at any time during a payment process, the event is triggered. To make sure an updated address is included when sending payment information to the server, you should add event listeners for a PaymentRequest object after instantiation, but before the call to show(). // Initialization of PaymentRequest arguments are excerpted for clarity. var payment = new PaymentRequest(sup
portedInstruments, details, options); request.addEventListener('shippingaddresschange', function(evt) { evt.updateWith(new Promise(function(resolve) { updateDetails(details, request.shippingAddress, resolve); })); }); payment.show().then(function(paymentResponse) { // Processing of paymentResponse exerpted for the same of clarity. }).catch(function(err) { console.error("Uh oh, something ...
...ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetonshippingaddresschangeChrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 55Notes Disabled Full sup
port 55Notes Disabled Notes Available only in nightly builds.Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
...And 8 more matches
PaymentResponse.complete() - Web APIs
nding. You can't treat a payment as complete after requesting that the payment be tried again. Examples The following example sends payment information to a secure server using the Fetch API. It calls complete() with an answer appropriate to the status in the response. // Initialization of PaymentRequest arguments are excerpted for the // sake of brevity. ...
... The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetcomplete()Chrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
...And 8 more matches
PaymentResponse.shippingAddress - Web APIs
lling the PaymentRequest constructor. In the example below, the cost of shipping varies by geography. When the PaymentRequest.onshippingaddresschange is called, updateDetails() is called to update the details of the PaymentRequest, using shippingAddress to set the correct shipping cost. // Initialization of PaymentRequest arguments are excerpted for brevity. var payment = new PaymentRequest(sup
portedInstruments, details, options); request.addEventListener('shippingaddresschange', function(evt) { evt.updateWith(new Promise(function(resolve) { updateDetails(details, request.shippingAddress, resolve); })); }); payment.show().then(function(paymentResponse) { // Processing of paymentResponse exerpted for the same of brevity. }).catch(function(err) { console.error("Uh oh, something ...
...compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetshippingAddressChrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
...And 8 more matches
PaymentResponse.shippingOption - Web APIs
bject passed to the PaymentRequest constructor. Syntax var shippingOption = PaymentRequest.shippingOption; Example In the example below, the PaymentRequest.onshippingaoptionchange event is called. It calls updateDetails() to toggle the shipping method between "standard" and "express". // Initialization of PaymentRequest arguments are excerpted for brevity. var payment = new PaymentRequest(sup
portedInstruments, details, options); request.addEventListener('shippingoptionchange', function(evt) { evt.updateWith(new Promise(function(resolve, reject) { updateDetails(details, request.shippingOption, resolve, reject); })); }); payment.show().then(function(paymentResponse) { // Processing of paymentResponse exerpted for the same of brevity. }).catch(function(err) { console.error("Uh ...
... compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetshippingOptionChrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
...And 8 more matches
SharedWorker - Web APIs
ic kind of worker that can be accessed from several browsing contexts, such as several windows, iframes or even workers. They implement an interface different than dedicated workers and have a different global scope, SharedWorkerGlobalScope. ...
... Methods Inherits methods from its parent, EventTarget, and implements methods from AbstractWorker. Example In our Basic shared worker example (run shared worker), we have two HTML pages, each of which uses some JavaScript to perform a simple calculation. ...
...rt). Constructors SharedWorker() Creates a shared web worker that executes the script at the specified URL. Properties Inherits properties from its parent, EventTarget, and implements properties from AbstractWorker. AbstractWorker.onerror Is an EventListener that is called whenever an ErrorEvent of type error bubbles through the worker. SharedWorker.
port Read only Returns a Message
Port object used to communicate with and control the shared worker. Methods Inherits methods from its parent, EventTarget, and implements methods from AbstractWorker. Example In our Basic shared worker example (run shared worker), we have two HTML pages, each of which uses some JavaScript to perform a simple calculation. The different scripts are using the same worker file to perform the calcu...
...And 8 more matches
SharedWorkerGlobalScope.applicationCache - Web APIs
Don't use it to make offline websites -- consider using service workers instead. The applicationCache read-only property of the SharedWorkerGlobalScope interface returns the ApplicationCache object for the worker (see Using the application cache). Syntax var nameObj = self.applicationCache; Value An ApplicationCache. Example If a shared worker has an AppCache associated with it, you can return a reference to the cache using self.applicationCache from inside the shared worker. Browser compatibility The compatibility table in this page is generated from structured data. ...
...ompatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
Using DTMF with WebRTC - Web APIs
In order to more fully sup
port audio/video conferencing, WebRTC sup
ports sending DTMF to the remote peer on an RTCPeerConnection. This article offers a brief high-level overview of how DTMF works over WebRTC, then provides a guide for everyday developers about how to send DTMF over an RTCPeerConnection. The DTMF system is often referred to as "touch tone," after an old trade name for the system. WebRTC doesn't send DTMF codes as audio data. Instead, they're sent out-of-band, as RTP payloads. Note, however, that although it's possible to send DTMF using WebRTC, there is currently no way to detect or receive incoming DTMF. ...
... The DTMF system is often referred to as "touch tone," after an old trade name for the system. WebRTC doesn't send DTMF codes as audio data. Instead, they're sent out-of-band, as RTP payloads. Note, however, that although it's possible to send DTMF using WebRTC, there is currently no way to detect or receive incoming DTMF. ...
...or sending DTMF. From there, you can simply call RTCDTMFSender.insertDTMF() to enqueue DTMF signals to be sent on the track to the other peer. The RTCRtpSender will then send the tones to the other peer as packets alongside the track's audio data. ...
...And 8 more matches
Rendering and the WebXR frame animation callback - Web APIs
es per second, and your goal is to do what you can to ensure that it doesn't get called less often than that. You achieve this by doing as much as is practicable off the main thread and by keeping your frame rendering callback as efficient as possible. The division of time into 60 Hz blocks with each block being used at least in part to render the scene is shown in the diagram below. This is im
portant because as the computer becomes increasingly busy, it may not be able to accurately call your callback every frame and may have to skip frames. This is called dropping frames. This happens when the amount of time it takes to render a frame exceeds the time available between frames, whether because rendering was delayed or because rendering itself took more time than was available. In the di...
...ion. You need to make sure that the main thread doesn't need to run for more time per frame than the duration of the frame itself. A basic renderer In this version of the WebXR renderering callback, we use a very straightforward approach that works great for relatively simple projects. This pseudocode outlines that process: for each view in the pose's views list: get the WebXR GL layer's view
port set the WebGL view
port to match for each object in the scene bindProgram() bindVertices() bindMatrices() bindUniforms() bindBuffers() bindTextures() drawMyObject() Put simply, this form of renderer is using view-first order. Each of the two views making up the XR device's display are rendered back to back, where every object is drawn on one view before rendering ...
...rm of renderer is using view-first order. Each of the two views making up the XR device's display are rendered back to back, where every object is drawn on one view before rendering the same set of objects on the other view. As a result, there's a good bit of replicated effort, since much of the data needed to draw an object winds up getting sent to the GPU twice per frame. However, it simplifies
porting existing WebGL code and is frequently good enough to do the job, so we'll look at this method first. See Optimizing by rendering in object-first order for an alternative approach that renders each object twice back-to-back, once for each eye, before moving on to the next object that makes up the scene for that frame; that is, rendering in object-first order. Sample renderer callback Let's t...
...And 8 more matches
Using Web Workers - Web APIs
of the script file on which the error occurred. Spawning subworkers Workers may spawn more workers if they wish. So-called sub-workers must be hosted within the same origin as the parent page. Also, the URIs for subworkers are resolved relative to the parent worker's location rather than that of the owning page. This makes it easier for workers to keep track of where their dependencies are. ...
... spawn more workers if they wish. So-called sub-workers must be hosted within the same origin as the parent page. Also, the URIs for subworkers are resolved relative to the parent worker's location rather than that of the owning page. This makes it easier for workers to keep track of where their dependencies are. Im
porting scripts and libraries Worker threads have access to a global function, im
portScripts(), which lets them im
port scripts. ...
...page. Also, the URIs for subworkers are resolved relative to the parent worker's location rather than that of the owning page. This makes it easier for workers to keep track of where their dependencies are. Im
porting scripts and libraries Worker threads have access to a global function, im
portScripts(), which lets them im
port scripts. It accepts zero or more URIs as parameters to resources to im
port; all of the following examples are valid: im
portScripts(); /* im
ports nothing */ im
portScripts('foo.js'); /* im
ports just "foo.js" */ im
portScripts('foo.js', 'bar.js'); /* im
ports two scripts */ im
portScripts('//example.com/hello.js'); /* You can im
port scripts from other origins */ The browser loads each listed script and executes it. Any global ob...
...And 8 more matches
Window.prompt() - Web APIs
ity The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...It does not display a prompt to the user, and always returns undef...
...And 8 more matches
Window.releaseEvents() - Web APIs
n this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ntribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...r-compat-data and send us a pull request. ...
...And 8 more matches
Window.scrollBy() - Web APIs
y The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
ARIA Test Cases - Accessibility
Introduction The information on this page is out of date: It was last updated November 2010. However, the information might still be useful for some readers. For more up-to-date examples, see the OpenAjaxAlliance ARIA examples page. Or copy-paste: http://oaa-accessibility.org/examples/ For each example we test the "Expected" results with assistive technologies, for each browser that AT sup
ports WAI-ARIA in. Where a failure occurs we will test the browser for API incorrectness, using tools such as MSAA Inspect. This must be done in order to determine where to file a bug (browser or AT). There are several purposes for providing this information: Help browser vendors provide correct implementations Help AT vendors provide correct implementations Inform authors as to what actually wo...
...2. reference to link example Note Regarding Dojo/Dijit Test Files The main purpose of Dojo's Dijit test files are for Dojo developers to exercise and debug the code. As such, they are used to test a variety of features, such as styling, behavior, mouse, and ...
...testers should test both tabbing forward and back, to make sure that the groupbox description and button description are both read when the button is the first item focused in the groupbox. (AL) Alternatively, description are not read automatically but may be accessible from a hotkey. However, if the screen reader does not at least indicate that the description exists, users are likely to miss im
portant information. Markup used: role="description" and aria-describedby Notes: Results: AT Firefox IE Opera Safari JAWS 9 - - n/a n/a JAWS 10 - - - - VoiceOver (Leopard) n/a n/a - fail Window-Eyes - - - - NVDA - n/a - - Zoom (Leopard) pass n/a pass ...
...And 8 more matches
:where() - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...afari on iOSSamsung Internet:where()Chrome Full sup
port 72Disabled Full sup
port 72Disabled Disabled From version 72: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to Enabled). ...
...And 8 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
In Spring of 2017, we saw for the first time a major specification like Grid being shipped into browsers almost simultaneously, and we now have CSS Grid Layout sup
port in the public versions of Firefox, Chrome, Opera, Safari and Edge. However, while evergreen browsers mean that many of us are going to see the majority of users having Grid Layout sup
port very quickly, there are also old or non-sup
porting browsers to contend with. In this guide we will walk through a variety of strategies for sup
port. The sup
porting browsers Other than in Internet Explorer, CSS Grid Layout is unprefixed in Safari, Chrome, Opera, Firefox and Edge. Sup
port for all the properties and values detailed in these guides is interoperable across browsers. This means that if you write some Grid Layout code in Fi...
...olumn-align The IE version has additional properties not required in the new specification of -ms-grid-column-span and -ms-grid-row-span. This version does not include auto-placement capability, or grid template areas. Some simple grid layouts could be implemented for IE10, through to Edge 15, using the -ms properties. As these properties are vendor prefixed, they will not effect any browser sup
porting the up to date and unprefixed specification. Autoprefixer grid layout sup
port The popular tool Autoprefixer has been updated to sup
port the -ms- grid version. By default, grid prefixes are disabled, but you can enable it with grid: true option. autoprefixer({ grid: 'autoplace' }) Grid prefixes are disabled by default because some properties can't be prefixed. Is it safe to use CSS grids f...
...othing way. You could start by simply enhancing elements in your design with grid, that could otherwise display using an older method. Overwriting of legacy methods with grid layout works surprisingly well, due to the way grid interacts with these other methods. Floats We have typically used floats to create multiple column layouts. If you have floated an item, which is also a grid item in a sup
porting browser, the float will no longer apply to the item. The fact is that a grid item takes precedence. In the example below, I have a simple media object. In a non-sup
porting browser, I use float, however I have also defined the container as a grid container, in order to use the alignment properties that are implemented in CSS Grids. The float no longer applies, and I can use the CSS Box Alignme...
...And 8 more matches
Using media queries - CSS: Cascading Style Sheets
To target specific media for the <style>, <link>, <source>, and other HTML elements with the media= attribute. To test and monitor media states using the Window.matchMedia() and MediaQueryList.addListener() JavaScript methods. ...
... To target specific media for the <style>, <link>, <source>, and other HTML elements with the media= attribute. To test and monitor media states using the Window.matchMedia() and MediaQueryList.addListener() JavaScript methods. ...
...ounded by parentheses. Name Summary Notes any-hover Does any available input mechanism allow the user to hover over elements? Added in Media Queries Level 4. any-pointer Is any available input mechanism a pointing device, and if so, how accurate is it? Added in Media Queries Level 4. aspect-ratio Width-to-height aspect ratio of the view
port color Number of bits per color component of the output device, or zero if the device isn't color color-gamut Approximate range of colors that are sup
ported by the user agent and output device Added in Media Queries Level 4. color-index Number of entries in the output device's color lookup table, or zero if the device does not use such a table ...
...And 8 more matches
CSS reference - CSS: Cascading Style Sheets
ont-variation-settings (@font-face)font-weightfont-weight (@font-face)format()fr<frequency><frequency-percentage>:fullscreenGgapgrad<gradient>grayscale()gridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-startgrid-rowgrid-row-endgrid-row-startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rowsHHzhanging-punctuationheightheight (@view
port)@historical-forms:hoverhsl()hsla()hue-rotate()hyphensI<ident><image>image()image-orientationimage-renderingimage-set()@im
portin:in-range:indeterminateinheritinitialinline-sizeinsetinset()inset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-start<integer>:invalidinvert()isolationJjustify-contentjustify-itemsjustify-selfKkHz@keyframesL:lang:last-child:last-of-typelead...
...-startmargin-bottommargin-inlinemargin-inline-endmargin-inline-startmargin-leftmargin-rightmargin-top::markermarks (@page)maskmask-bordermask-border-modemask-border-outsetmask-border-repeatmask-border-slicemask-border-sourcemask-border-widthmask-clipmask-compositemask-imagemask-modemask-originmask-positionmask-repeatmask-sizemask-typematrix()matrix3d()max()max-block-sizemax-heightmax-height (@view
port)max-inline-sizemax-widthmax-width (@view
port)max-zoom (@view
port)@mediamin()min-block-sizemin-heightmin-height (@view
port)min-inline-sizemin-widthmin-width (@view
port)min-zoom (@view
port)minmax()mix-blend-modemmmsN@namespacenegative (@counter-style):not:nth-child:nth-last-child:nth-last-of-type:nth-of-type<number>Oobject-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-rotate...
...min()min-block-sizemin-heightmin-height (@view
port)min-inline-sizemin-widthmin-width (@view
port)min-zoom (@view
port)minmax()mix-blend-modemmmsN@namespacenegative (@counter-style):not:nth-child:nth-last-child:nth-last-of-type:nth-of-type<number>Oobject-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-rotate:only-child:only-of-typeopacityopacity():optionalorderorientation (@view
port)@ornamentsornaments()orphans:out-of-rangeoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-blockoverflow-inlineoverflow-wrapoverflow-xoverflow-yoverscroll-behavioroverscroll-behavior-blockoverscroll-behavior-inlineoverscroll-behavior-xoverscroll-behavior-yPpad (@counter-style)paddingpadding-blockpadding-block-endpadding-block-startpadding-bottompadding-in...
...And 8 more matches
caption-side - CSS: Cascading Style Sheets
he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
element() - CSS: Cascading Style Sheets
a background. On Gecko browsers, you can use the non-standard document.mozSetImageElement() method to change the element being used as the background for a given CSS background element. Syntax element(id) where: id The ID of an element to use as the background, specified using the HTML attribute #id on the element. Examples These examples can be viewed live in builds of Firefox that sup
port -moz-element(). A somewhat realistic example This example uses a hidden <div> as a background. The background element uses a gradient, but also includes text that is rendered as part of the background. <div style="width:400px; height:400px; background:-moz-element(#myBackground1) no-repeat;"> <p>This box uses the element with the #myBackground1 ID as its background!</p> </div> <div style="o...
...tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
object-fit - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ttps://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetobject-fitChrome Full sup
port 31Edge Full sup
port 16Notes Full sup
port 16Notes Notes Edge sup
ports object-fit on img elements only. ...
...And 8 more matches
object-position - CSS: Cascading Style Sheets
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
outline-color - CSS: Cascading Style Sheets
*/ outline-color: invert; /* Global values */ outline-color: inherit; outline-color: initial; outline-color: unset; The outline-color property is specified as any one of the values listed below. Values <color> The color of the outline, specified as a <color>. invert To ensure the outline is visible, performs a color inversion of the background. Note that browsers are not required to sup
port this value; if they don't, this keyword is considered invalid. Description An outline is a line that is drawn around an element, outside the border. Unlike the element's border, the outline is drawn outside the element's frame, and may overlap other content. The border, on the other hand, will actually alter the page's layout to ensure that it fits without overlapping anything else (unless you...
... actually alter the page's layout to ensure that it fits without overlapping anything else (unless you explicitly set it to overlap). It is often more convenient to use the shorthand property outline when defining the appearance of an outline. Accessibility concerns Custom focus styles commonly involve making adjustments to the outline property. If the color of the outline is adjusted, it is im
portant to ensure that the contrast ratio between it and the background the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it. Color contrast ratio is determined by comparing the luminosity of the text and background color values. In order to meet current Web Content Accessibility Guidelines (WCAG), a ratio of 4.5:1 is required for text c...
...ibility Guidelines (WCAG), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and bold or larger, or 24px or larger. WebAIM: Color Contrast Checker MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0 Formal definition Initial valueinvert, for browsers sup
porting it, currentColor for the otherApplies toall elementsInheritednoComputed valueFor the keyword invert, the computed value is invert. For the color value, if the value is translucent, the computed value will be the rgba() corresponding one. If it isn't, it will be the rgb() corresponding one. The transparent keyword maps to rgba(0,0,0,0).Animation typea color Formal syntax <color> | invertwhere...
...And 8 more matches
pointer-events - CSS: Cascading Style Sheets
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
Cross-browser audio basics - Developer guides
Here we define an <audio> element with multi...
...tributes, properties, and events explained a guide to custom controls created using the Media API Basic Audio example The code below is an example of a basic audio implementation using HTML5: <audio controls> <source src="audiofile.mp3" type="audio/mpeg"> <source src="audiofile.ogg" type="audio/ogg"> <!-- fallback for non sup
porting browsers goes here --> <p>Your browser does not sup
port HTML5 audio, but you can still <a href="audiofile.mp3">download the music</a>.</p> </audio> Note: You can also use an MP4 file instead of MP3. MP4 files typically contain AAC encoded audio. You can use type="audio/mp4". (Currently, browsers that sup
port mp3 also sup
port mp4 audio). Here we define an <audio> element with multiple sources -- we do this as not all browsers sup
port the sam...
...rmats that will give maximum coverage are mp3 and ogg vorbis. We do this using the <source> element, which takes the attributes src and type. src contains the path to the audio file to be loaded (relative or absolute). type is used to inform the browser of the file type. If omitted, most browsers will attempt to guess this from the file extension. If the <audio> element is not sup
ported then <audio> and <source> will be ignored. However any sup
ported text or elements that you define within <audio> will be displayed or acted upon. So the ideal place to create a fallback or inform of incompatibility is before the closing </audio> tag. In this case, we've provided a simple paragraph including a link to download the audio directly. The controls attribute on the <audio> element is...
...And 8 more matches
<input type="week"> - HTML: Hypertext Markup Language
sy entry of a year plus the ISO 8601 week number during that year (i.e., week 1 to 52 or 53). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The control's user interface varies from browser to browser; cross-browser sup
port is currently a bit limited, with only Chrome/Opera and Microsoft Edge sup
porting it at this time. In non-sup
porting browsers, the control degrades gracefully to function identically to <input type="text">. In Chrome/Opera the week control provides slots to fill in week and year values, a pop-up calendar interface to select them more visually, and an "X" button to clear the control's value. Th...
...ra the week control provides slots to fill in week and year values, a pop-up calendar interface to select them more visually, and an "X" button to clear the control's value. The Edge week control is somewhat more elaborate, opening up week and year pickers with sliding reels. Value A DOMString representing a week and year, or empty Events change and input Sup
ported common attributes autocomplete, list, readonly, and step IDL attributes value, valueAsDate, valueAsNumber, and list. Methods select(), stepDown(), and stepUp() Value A DOMString representing the value of the week/year entered into the input. The format of the date and time value used by this input type is described in Format of a valid week string in Date and ...
...f "any" means for step when used with week inputs. This will be updated as soon as that information is determined. Using week inputs Week inputs sound convenient at first glance, since they provide an easy UI for choosing weeks, and they normalize the data format sent to the server, regardless of the user's browser or locale. However, there are issues with <input type="week"> because browser sup
port is not guaranteed across all browsers. We'll look at basic and more complex uses of <input type="week">, then offer advice on mitigating the browser sup
port issue later on (see Handling browser sup
port). Basic uses of week The simplest use of <input type="week"> involves a basic <input> and <label> element combination, as seen below: <form> <label for="week">What week would you like to star...
...And 8 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
icy applies to the favicon. If you encounter problems with the favicon not loading, verify that the Content-Security-Policy header's img-src directive is not preventing access to it. The HTML and XHTML specifications define event handlers for the <link> element, but it is unclear how they would be used. Under XHTML 1.0, empty elements such as <link> require a trailing slash: <link />. WebTV sup
ports the use of the value next for rel to preload the next page in a document series. Attributes This element includes the global attributes. as This attribute is only used when rel="preload" or rel="prefetch" has been set on the <link> element. It specifies the type of content being loaded by the <link>, which is necessary for request matching, application of correct content security policy, ...
...ed> elements fetch fetch, XHR This value also requires <link> to contain the crossorigin attribute. font CSS @font-face image <img> and <picture> elements with srcset or imageset attributes, SVG <image> elements, CSS *-image rules object <object> elements script <script> elements, Worker im
portScripts style <link rel=stylesheet> elements, CSS @im
port track <track> elements video <video> elements worker Worker, SharedWorker crossorigin This enumerated attribute indicates whether CORS must be used when fetching the resource. CORS-enabled images can be reused in the <canvas> element without being tainted. The allo...
...roperty in the DOM causes the stylesheet to be removed from the document's document.styleSheets list. href This attribute specifies the URL of the linked resource. A URL can be absolute or relative. hreflang This attribute indicates the language of the linked resource. It is purely advisory. Allowed values are determined by BCP47. Use this attribute only if the href attribute is present. ...
...And 8 more matches
Standard metadata names - HTML: Hypertext Markup Language
bars. The primary use for <meta name="color-scheme"> is to indicate compatibility with--and order of preference for--light and dark color modes. The value of the content property for color-scheme may be one of the following: normal The document is unaware of color schemes and should simply be rendered using the default color palette. ...
...By specification, only dark is not valid, because forcing a document to render in dark mode when it isn't truly compatible with it can result in unreadable content; all major browsers default to light mode if not otherwise configured. ...
...ta name="color-scheme" content="dark light"> This works at the document level in the same way that the CSS color-scheme property lets individual elements specify their preferred and accepted color schemes. Your styles can adapt to the current color scheme using the prefers-color-scheme CSS media feature. The CSS Device Adaptation specification defines the following metadata name: view
port: gives hints about the size of the initial size of the view
port. Used by mobile devices only. Values for the content of <meta name="view
port"> Value Possible subvalues Description width A positive integer number, or the text device-width Defines the pixel width of the view
port that you want the web site to be rendered at. ...
...And 8 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
You can use <video> for audio content as well, but the <audio> element may provide a more appropriate user experience. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The above example shows simple usage of the <video> element. ...
...<img> element, we include a path to the media we want to display inside the src attribute; we can include other attributes to specify information such as video width and height, whether we want it to autoplay and loop, whether we want to show the browser's default video controls, etc. The content inside the opening and closing <video></video> tags is shown as a fallback in browsers that don't sup
port the element. Attributes Like all other HTML elements, this element sup
ports the global attributes. autoplay A Boolean attribute; if specified, the video automatically begins to play back as soon as it can do so without stopping to finish loading the data. Note: Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoide...
...user agent is trying to fetch media data, but data is unexpectedly not forthcoming. suspend Media data loading has been suspended. timeupdate The time indicated by the currentTime attribute has been updated. volumechange The volume has changed. waiting Playback has stopped because of a temporary lack of data Usage notes Browsers don't all sup
port the same video formats; you can provide multiple sources inside nested <source> elements, and the browser will then use the first one it understands. <video controls> <source src="myVideo.mp4" type="video/mp4"> <source src="myVideo.webm" type="video/webm"> <p>Your browser doesn't sup
port HTML5 video. Here is a <a href="myVideo.mp4">link to the video</a> instead.</p> </video> We offer...
...And 8 more matches
Proxy Auto-Configuration (PAC) file - HTTP
5 onward, there is no way to disable path-stripping; as of Chrome 81, path-stripping does not apply to HTTP URLs, but there is interest in changing this behavior to match HTTPS); in Firefox, the preference is network.proxy.autoconfig_url.include_path. host The hostname extracted from the URL. This is only for convenience; it is the same string as between :// and the first : or / after that. The
port number is not included in this parameter. It can be extracted from the URL when necessary. Description Returns a string describing the configuration. The format of this string is defined in return value format below. Return value format The JavaScript function returns a single string If the string is null, no proxies should be used The string can contain any number of the following build...
...ring describing the configuration. The format of this string is defined in return value format below. ...
... string is defined in return value format below. ...
...And 8 more matches
WebAssembly.CompileError() constructor - JavaScript
his page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...compat-data and send us a pull request. ...
...And 8 more matches
WebAssembly.Global() constructor - JavaScript
This allows dynamic linking of multiple modules. Syntax new WebAssembly.Global(descriptor, value); Parameters descriptor A GlobalDescriptor dictionary object, which contains two properties: value: A USVString representing the data type of the global. This can be one of i32, i64, f32, and f64. mutable: A boolean value that determines whether the global is mutable or not. By default, this is false. ...
..., as specified by the DefaultValue algorithm. Examples Creating a new Global instance The following example shows a new global instance being created using the WebAssembly.Global() constructor. It is being defined as a mutable i32 type, with a value of 0. The value of the global is then changed, first to 42 using the Global.value property, and then to 43 using the incGlobal() function ex
ported out of the global.wasm module (this adds 1 to whatever value is given to it and then returns the new value). const output = document.getElementById('output'); function assertEq(msg, got, expected) { output.innerHTML += `Testing ${msg}: `; if (got !== expected) output.innerHTML += `FAIL!<br>Got: ${got}<br>Expected: ${expected}<br>`; else output.innerHTML += `SUCCESS...
... Specifications Specification WebAssembly JavaScript Inter...
...And 8 more matches
WebAssembly.LinkError() constructor - JavaScript
n this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ontribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...er-compat-data and send us a pull request. ...
...And 8 more matches
WebAssembly.Memory.prototype.grow() - JavaScript
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
WebAssembly.Module.customSections() - JavaScript
y table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
WebAssembly.RuntimeError() constructor - JavaScript
his page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...compat-data and send us a pull request. ...
...And 8 more matches
WebAssembly.Table.prototype.grow() - JavaScript
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
WebAssembly.Table.prototype.length - JavaScript
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...f you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
WebAssembly.compile() - JavaScript
tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
WebAssembly.validate() - JavaScript
ibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...b.com/mdn/browser-compat-data and send us a pull request. ...
...And 8 more matches
Performance fundamentals - Web Performance
means how fast the system provides outputs (possibly multiple ones) in response to user inputs. For example, when a user taps the screen, they expect the pixels to change in a certain way. For this interaction, the responsiveness metric is the time elapsed between the tap and the pixel change. Responsiveness sometimes involves multiple stages of feedback. Application launch is one particularly im
portant case discussed in more detail below. Responsiveness is im
portant simply because people get frustrated and angry when they're ignored. Your app is ignoring the user every second that it fails to respond to the user's input. Framerate Framerate is the rate at which the system changes pixels displayed to the user. This is a familiar concept: everyone prefers, say, games that display 60 frames ...
...ed and angry when they're ignored. Your app is ignoring the user every second that it fails to respond to the user's input. Framerate Framerate is the rate at which the system changes pixels displayed to the user. This is a familiar concept: everyone prefers, say, games that display 60 frames per second over ones that display 10 frames per second, even if they can't explain why. Framerate is im
portant as a "quality of service" metric. Computer displays are designed to "fool" user's eyes, by delivering photons to them that mimic reality. For example, paper covered with printed text reflects photons to the user's eyes in some pattern. By manipulating pixels, a reader app emits photons in a similar pattern to "fool" the user's eyes. As your brain infers, motion is not jerky and discrete, but ...
...emory usage closely approximates "user state". An ideal system would maintain 100% of user state at all times: all applications in the system would run simultaneously, and all applications would retain the state created by the user the last time the user interacted with the application (application state is stored in computer memory, which is why the approximation is close). From this comes an im
portant but counter-intuitive corollary: a well-designed system does not maximize the amount of free memory. Memory is a resource, and free memory is a unused resource. Rather, a well-designed system has been optimized to use as much memory as possible to maintain user state, while meeting other UPP goals. That doesn't mean the system should waste memory. When a system uses more memory than necessary...
...And 8 more matches
WebAssembly Concepts - WebAssembly
r low-level source languages like C, C++, Rust, etc. This has huge implications for the web platform -- it provides a way to run code written in multiple languages on the web at near-native speed, with client apps running on the web that previously couldn't have done so. What's more, you don't even have to know how to create WebAssembly code to take advantage of it. WebAssembly modules can be im
ported into a web (or Node.js) app, exposing WebAssembly functions for use via JavaScript. JavaScript frameworks could make use of WebAssembly to confer massive performance advantages and new features while still making functionality easily available to web developers. WebAssembly goals WebAssembly is being created as an open standard inside the W3C WebAssembly Community Group with the following goa...
... exposing WebAssembly functions for use via JavaScript. JavaScript frameworks could make use of WebAssembly to confer massive performance advantages and new features while still making functionality easily available to web developers. WebAssembly goals WebAssembly is being created as an open standard inside the W3C WebAssembly Community Group with the following goals: Be fast, efficient, and
portable -- WebAssembly code can be executed at near-native speed across different platforms by taking advantage of common hardware capabilities. Be readable and debuggable -- WebAssembly is a low-level assembly language, but it does have a human-readable text format (the specification for which is still being finalized) that allows code to be written, viewed, and debugged by hand. Keep secure -- We...
...e step, and has a huge ecosystem that provides powerful frameworks, libraries, and other tools. WebAssembly is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages with low-level memory models such as C++ and Rust with a compilation target so that they can run on the web. ...
...And 8 more matches
Loading and running WebAssembly code - WebAssembly
To use WebAssembly in JavaScript, you first need to pull your module into memory before compilation/instantiation. This article provides a reference for the different mechanisms that can be used to fetch WebAssembly bytecode, as well as how to compile/instantiate then run it. What are the options? WebAssembly is not yet integrated with <script type='module'> or ES2015 im
port statements, thus there is not a path to have the browser fetch modules for you using im
ports. The older WebAssembly.compile/WebAssembly.instantiate methods require you to create an ArrayBuffer containing your WebAssembly module binary after fetching the raw bytes, and then compile/instantiate it. This is analogous to new Function(string), except that we are substituting a string of characters (JavaScript source code) w...
...for fetching network resources. ...
...ming(fetch('simple.wasm'), im
portObject) .then(results => { // Do something with the results! }); If we used the older WebAssembly.instantiate() method, which doesn't work on the direct stream, we'd need an extra step of converting the fetched byte code to an ArrayBuffer, like so: fetch('module.wasm').then(response => response.arrayBuffer() ).then(bytes => WebAssembly.instantiate(bytes, im
portObject) ).then(results => { // Do something with the results! }); Aside on instantiate() overloads The WebAssembly.instantiate() function has two overload forms -- the one shown above takes the byte code to compile as an argument and returns a promise that resolves to an object containing both the compiled module object, and an instantiated instance of it. The object looks like this: { mo...
...And 8 more matches
ui/sidebar - Archive of obsolete content
ing the sidebar's url property. This will change the sidebar's content across all windows. Communicating with sidebar scripts You can't directly access your sidebar's content from your main add-on code, but you can send messages between your main add-on code and scripts loaded into your sidebar. On the sidebar end of the conversation, sidebar scripts get a global variable addon that contains a
port for sending and receiving messages. On the add-on side, you need to get a worker object for the sidebar before you can send or receive messages. There are two events emitted by the sidebar which will give you a worker: attach and ready. Listen to attach if the first message in your add-on goes from the sidebar scripts to the main add-on code, and listen to ready if the first message goes from th...
...On attach, "main.js" starts listening to the ping message, and responds with a pong: var sidebar = require("sdk/ui/sidebar").Sideb...
..., in the case where the sidebar script initiates communication: The HTML file includes just a script, "sidebar.js": <!DOCTYPE HTML> <html> <body> Content for my sidebar <script type="text/javascript" src="sidebar.js"></script> </body> </html> The "sidebar.js" file sends a ping message to main.js using
port.emit() as soon as it loads, and adds a listener to the pong message. addon.
port.emit("ping"); addon.
port.on("pong", function() { console.log("sidebar script got the reply"); }); The "main.js" file creates a sidebar object and adds a listener to its attach event. On attach, "main.js" starts listening to the ping message, and responds with a pong: var sidebar = require("sdk/ui/sidebar").Sidebar({ id: 'my-sidebar', title: 'My sidebar', url: require("sdk/self").data.u...
...And 7 more matches
Creating Event Targets - Archive of obsolete content
Modules as Event Targets We can adapt this code into a separate module that exposes the SDK's standard event interface. To do this...
... Modules as Event Targets We can adapt this code into a separate module that exposes the SDK's standard event interface. To do this we'll use the event/core module. Create a new file in "lib" called "bookmarks.js", and...
...ng code: var { emit, on, once, off } = require("sdk/event/core"); var {Cc, Ci} = require("chrome"); var { XPCOMUtils }= require("resource://gre/modules/XPCOMUtils.jsm"); var bookmarkService = Cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getService(Ci.nsINavBookmarksService); var bookmarkObserver = { onItemAdded: function(aItemId, aFolder, aIndex) { emit(ex
ports, "added", bookmarkService.getBookmarkURI(aItemId).spec); }, onItemVisited: function(aItemId, aVisitID, time) { emit(ex
ports, "visited", bookmarkService.getBookmarkURI(aItemId).spec); }, QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver]) }; bookmarkService.addObserver(bookmarkObserver, false); ex
ports.on = on.bind(null, ex
ports); ex
ports.once = once.bind(null, ex
port...
...And 7 more matches
Localization - Archive of obsolete content
See Limitations below. Localized strings Translated strings are kept in a directory called "locale" under your main add-on directory, one file for each locale. ...
...See Limitations below. Localized strings Translated strings are kept in a directory called "locale" under your main add-on directory, one file for each locale. ...
...xt, so you can't insert HTML using a statement like: # Does not work. HTML tags are inserted as text. ...
...And 7 more matches
File I/O - Archive of obsolete content
ile is preferred over the examples in this article. Only use these legacy interfaces if OS.File is not available to you. This article describes local file input/output in chrome JavaScript. You access the file system using Mozilla XPCOM components. Note: File objects are nsIFile. For legacy reasons, there is also an nsILocalFile interface. Creating an nsIFile object Components.utils.im
port("resource://gre/modules/FileUtils.jsm"); var file = new FileUtils.File("/home"); Or the same without using FileUtils.jsm: var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); file.initWithPath("/home"); Note: The path should be in the "native" form (for example"C:\\Windows"). If you need to use file:// URIs as initialize...
...\\Windows"). If you need to use file:// URIs as initializers, see discussion of nsIIOService below. Note: You can still get a file object even if the specified file does not exist, and no exception will be thrown. An exception is thrown only when methods that require the file to exist are called, e.g., isDirectory(), moveTo(), and so on. Getting files in special directories Components.utils.im
port("resource://gre/modules/FileUtils.jsm"); // get the "data.txt" file in the profile directory var file = FileUtils.getFile("ProfD", ["data.txt"]); Or the same without using FileUtils.jsm: // Get profile directory. var file = Components.classes["@mozilla.org/file/directory_service;1"]. getService(Components.interfaces.nsIProperties). get("ProfD", Components.interfaces.nsIF...
...onents.interfaces var file = Services.dirsvc.get("ProfD", Ci.nsIFile); // Append the file name. file.append("data.txt"); // Note: "file" is an object that implements nsIFile. If you want the // file system path, use file.path Note: file is an object that implements nsIFile. If you want the file system path, use file.path, . Here are some of the special locations the directory service sup
ports: (Scope: d = product-wide, f = profile wide) String Scope Meaning AChrom d %CurProcD%/chrome APlugns d %CurProcD%/plugins (Deprecated - use APlugnsDL) APlugnsDL d ComsD n/a %CurProcD%/components CurProcD n/a Current working directory (usually the application's installation directory). Def...
...And 7 more matches
Finding window handles - Archive of obsolete content
snippets below from the Scratchpad in Environment > Browser. ...
...Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem) .treeOwner .QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIBaseWindow); var hwndString = baseWindow.nativeHandle; Components.utils.im
port('resource://gre/modules/ctypes.jsm'); var user32 = ctypes.open('user32.dll'); /* http://msdn.microsoft.com/en-us/library/ms633539%28v=vs.85%29.aspx * BOOL WINAPI SetForegroundWindow( * __in_ HWND hWnd * ); */ var SetForegroundWindow = user32.declare('SetForegroundWindow', ctypes.winapi_abi, ctypes.bool, // return BOOL ctypes.voidptr_t // HWND ); var hwnd = ctypes.voidptr_t(ctypes...
...= user32.declare('SetForegroundWindow', ctypes.winapi_abi, ctypes.bool, // return BOOL ctypes.voidptr_t // HWND ); var hwnd = ctypes.voidptr_t(ctypes.UInt64(hwndString)); var rez_SetForegroundWindow = SetForegroundWindow(hwnd); console.log('rez_SetForegroundWindow:', rez_SetForegroundWindow, rez_SetForegroundWindow.toString()); user32.close(); Mac OS X Objective-C Components.utils.im
port('resource://gre/modules/Services.jsm'); var browserWindow = Services.wm.getMostRecentWindow('navigator:browser'); if (!browserWindow) { throw new Error('No browser window found'); } var baseWindow = browserWindow.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem) ...
...And 7 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
iles and manifests, installing the lot into the Firefox extensions/ directory and so forth. So it behooves us to piggyback on this infrastructure to build our extension. First of all, think of a catchy name for your extension and create a directory with that name under the /mozilla/extensions/ directory. Use only lowercase letters. You should see a bunch of other directories (inspector/, re
porter/ and so forth) at the same level in the build tree. Note that before actually building anything, the Mozilla build system invokes a configuration process that generates the actual makefiles used for the build from makefile templates called Makefile.in. The actual makefiles tend to be very similar or identical to the templates, but the extra flexibility gained from having the makefiles ge...
...e won't be available from JavaScript or other non-C++ languages) and encourage the use of XPCOM wherever possible. The makefile in the public/ directory should follow this model: DEPTH = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = myextension XPIDL_MODULE = myextension XPI_NAME = myextension EX
PORTS = \ myHeader.h \ $(NULL) XPIDLSRCS = \ myIFirstComponent.idl \ myISecondComponent.idl \ $(NULL) include $(topsrcdir)/config/rules.mk XPIDL_MODULE is the name of the generated XPT file that contains type information about your IDL interfaces. If you have multiple modules, make absolutely sure that you use a different value for XPIDL_MODULE for each one. Otherwise the first modu...
...is the name of the generated XPT file that contains type information about your IDL interfaces. If you have multiple modules, make absolutely sure that you use a different value for XPIDL_MODULE for each one. Otherwise the first module's XPT file will be overwritten by the second and you'll get NS_ERROR_XPC_BAD_IID errors when you try to access its IDL interfaces from your code. The files under EX
PORTS are copied directly to the /mozilla/$(MOZ_OBJDIR)/dist/include/ directory and are thus accessible from other modules (the value of MOZ_OBJDIR is defined in /mozilla/.mozconfig). XPIDLSRCS are run through the IDL processor, and the generated C++ headers are copied into the same include directory. In addition, an XPT (type library) file is generated and placed in the components/ subdirectory of yo...
...And 7 more matches
Signing an XPI - Archive of obsolete content
etwork Security Services (NSS) package from the Mozilla FTP site at https://ftp.mozilla.org/pub/mozilla.or.../nss/releases/. For Windows, you'll want the nss-3.11.4.zip package in the NSS_3_11_4_RTM/msvc6.0/WINNT5.0_OPT.OBJ/ folder - it is by 2010 the only one with the right binaries. 2. Extract the contents of the archive file to a local folder. In my case it's C:\Apps\nss-3.11.4\ Get Netscape
Portable Runtime 1. Download the latest Netscape
Portable Runtime from the Mozilla FTP site: http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/. For Windows you'll want the nspr-4.6.zip package in the v4.6/WINNT5.0_OPT.OBJ/ folder. 2. Extract the contents of the archive file to a local folder. In my case it's C:\Apps\nspr-4.6\ Add path Add the NSS tools bin/ and lib/, and the NSPR lib/ director...
...s are numbers, letters, spaces, and apostrophes. certificate common name: XPI Test organization: TJworld organization unit: Software state or province: Nottingham country (must be exactly 2 characters): GB username: tj email address: certificates@lan.tjworld.net generated public/private key pair certificate request generated certificate has been signed certificate "myTestCert" added to database Ex
ported certificate to x509.raw and x509.cacert. x509.cacert will be used to sign your XPI package. Check that it exists on the file system and in the certificate database: C:\Projects\CodeSigning\> dir x509* 14/12/2005 15:13 1,031 x509.cacert 14/12/2005 15:13 798 x509.raw C:\Projects\CodeSigning\> certutil -d . -L myTestCert ...
...chrome/fsb.jar (deflated 74%) adding: chrome.manifest (deflated 69%) adding: install.rdf (deflated 62%) Test your certificate To test your certificate, install it into your browser, and attempt to load the signed extension by following these steps: 1. Temporarily install the Test Certificate Authority into your Mozilla browser Rename the x509.cacert file generated earlier to x509.cert Im
port it into Mozilla Firefox as a Software Developer Certificate Authority. Don't forget to delete the certificate from Mozilla Firefox once you've finished testing Firefox 1.5: From the Tools menu choose Options->Advanced->Security->View Certificates->Authorities Firefox 1.0: From the Tools menu choose Options->Advanced->Certificates->Manage Certificates->Authorities Press the Im
port button. Nav...
...And 7 more matches
Promises - Archive of obsolete content
ons. These APIs allow asynchronous operation to be achieved with a coding style similar to synchronous variants. The following examples make use of the Task API, which harnesses generator functions to remove some of the syntactic clutter of raw Promises, such that asynchronous promise code more closely resembles synchronous, procedural code. ...
...hronous, procedural code. ...
...It is also available for use off-main-thread in Workers as a synchronous API. ...
...And 7 more matches
In-Depth - Archive of obsolete content
properties which may be useful to you; it is in no way all of the Mozilla specific properties available. Other sites which list Mozilla specific CSS properties XulPlanet.com [dead link, 26.03.13] Mozilla-prefixed properties on the standard track 26.03.13 -moz-appearance Makes a widget look like it's from your operating system. Possible are (This is probably an incomplete list): none - (!im
portant may be needed) Will override the operating system default. Use this when you want one or two controls to look different from the operating systems defaults. button, checkbox-container, checkbox, dialog, dualbutton, dualbutton-dropdown, listbox, menu, menulist-textfield, menulist-button, menulist, menulist-text, progressbar, progresschunk, radio-container, radio, resizer, resizerpanel, separato...
...t installed Mozilla you may have to run the installer again. Load mozilla and one browser window. Then open the DOM Inspector (Tools->Web Development->DOM Inspector). Click File->Inspect and select the browser window. What appears in a tree view below is the actual code for the interface. ...
...This is what we want. ...
...And 7 more matches
Layout System Overview - Archive of obsolete content
nd modes are explained in more detail in article Mozilla's DOCTYPE sniffing. Galley and Page Presentations: The presentation generally is constrained by the width of the window in which the presentation is to be displayed, and a height that extends as far as necessary. This is referred to as the Galley Mode presentation, and is what one expects from a typical browser. Additionally, layout must sup
port a paginated presentation, where the width of the presentation is constrained by the dimensions of the printed output (paper) and the height of each page is fixed. This paged presentation presents several challenges not present in the galley presentation, namely how to break up elements that are larger than a single page, and how to handle changes to page dimensions. The original design of the Lay...
...d by the dimensions of the printed output (paper) and the height of each page is fixed. This paged presentation presents several challenges not present in the galley presentation, namely how to break up elements that are larger than a single page, and how to handle changes to page dimensions. The original design of the Layout system allowed for multiple, possibly different, presentations to be sup
ported simultaneously from the same content model. In other words, the same HTML or XML document could be viewed as a normal galley presentation in a browser window, while simultaneously being presented in a paged presentation to a printer, or even an aural presentation to a speech-synthesizer. To date the only real use of this multiple presentation ability is seen in printing, where multiple presenta...
...the only real use of this multiple presentation ability is seen in printing, where multiple presentations are managed, all connected to the same content model. (note: it is unclear if this is really a benefit - it may have been better to use a copy of the content model for each presentation, and to remove the complexity of managing separate presentations - analysis is needed here). The idea of sup
porting a non-visual presentation is interesting. Layout's sup
port for aural presentations is undeveloped, though conceptually, it is possible and sup
ported by the architecture. How Layout Does its Job: Frames and Reflow So, layout is concerned with providing a presentation, in galley or paged mode. Given a content model, how does the layout system actually create the presentation? Through the creatio...
...And 7 more matches
The Joy of XUL - Archive of obsolete content
right away. Also described are some reasons application developers might choose to leverage XUL and Mozilla technology for building cross-platform applications. This same investigation will provide sufficient explanation of Mozilla's motivation to build XUL and why the Mozilla platform is constructed using it. The key features and benefits of XUL will be explored followed by an examination of sup
porting Mozilla technologies. Finally, a mini case study of a Calendar application written in XUL will reinforce the benefits of building applications with Mozilla. Key Features and Benefits Powerful widget-based markup language The goal of XUL is to build cross platform applications, in contrast with DHTML which is intended for developing web pages. For this reason, XUL is oriented towa...
...t with DHTML which is intended for developing web pages. For this reason, XUL is oriented toward application artifacts such as windows, labels, and buttons instead of pages, heading levels, and hypertext links. ...
...d without any sup
porting standards. Based on existing standards XUL is an XML language based on W3C standard XML 1.0. Applications written in XUL are based on additional W3C standard technologies featuring HTML 4.0; Cascading Style Sheets (CSS) 1 and 2; Document Object Model (DOM) Levels 1 and 2; JavaScript 1.5, including ECMA-262 Edition 3 (ECMAscript); XML 1.0. Platform
portability Like HTML, XUL is designed to be platform-neutral, making applications easily
portable to all of the operating systems on which Mozilla runs. Considering the broad range of platforms that currently sup
port Mozilla, this may be one of the most compelling features of XUL as a technology for building applications. Since XUL provides an abstraction of user interface components, it deliv...
...And 7 more matches
TCP/IP Security - Archive of obsolete content
yers to its destination. Essentially, the data produced by a layer is encapsulated in a larger container by the layer below it. The four TCP/IP layers, from highest to lowest, are shown below. Application Layer. This layer sends and receives data for particular applications, such as Domain Name System (DNS), HyperText Transfer Protocol (HTTP), and Simple Mail Transfer Protocol (SMTP). Trans
port Layer. This layer provides connection-oriented or connectionless services for trans
porting application layer services between networks. The trans
port layer can optionally assure the reliability of communications. Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) are commonly used trans
port layer protocols. Network Layer. This layer routes packets across networks. Internet...
...ata, they cannot protect TCP/IP information such as IP addresses because this information exists at a lower layer. Whenever possible, application layer controls for protecting network communications should be standards-based solutions that have been in use for some time. One example is Secure Multipurpose Internet Mail Extensions (S/MIME), which is commonly used to encrypt email messages. Trans
port Layer. Controls at this layer can be used to protect the data in a single communication session between two hosts. Because IP information is added at the network layer, trans
port layer controls cannot protect it. The most common use for trans
port layer protocols is securing HTTP traffic; the Trans
port Layer Security (TLS) protocol is usually used for this. (TLS is the standards-based version ...
...t layer protocols is securing HTTP traffic; the Trans
port Layer Security (TLS) protocol is usually used for this. (TLS is the standards-based version of SSL version 3. More information on TLS is available in RFC 4346, The TLS Protocol Version 1.1, available at https://www.ietf.org/rfc/rfc4346.txt. ...
...And 7 more matches
Developing cross-browser and cross-platform pages - Archive of obsolete content
The browser identification approach is now known to be complicated, unreliable and difficult to maintain. ...
...f the browser which loads your web page. As a web author, you understandably want to avoid script errors and page layout problems and you may want to ensure your scripts reach as wide an audience as possible. There are 2 known approaches for such goals: the browser identification approach (also known as userAgent string detection and often referred as "browser sniffing") and the Object/Feature sup
port detection approach. The browser identification approach is now known to be complicated, unreliable and difficult to maintain. Browser identification approach (aka "browser sniffing"): not best, not reliable approach This approach, still commonly used nowadays, attempts to identify the browser and makes the web author at design time decide what that implies in terms of capabilities of the visiti...
...y want in the navigator.userAgent string and this may trick your code into executing a "wrong" block of code. Moreover, there are many cases where even the accurately-identified browser does not perform as it is reputed/expected to. So if "browser sniffing" is unreliable and difficult, then how do you code safely for different browsers and different browser versions? ... Using Object/Feature sup
port detection approach: best and overall most reliable When you use object/feature sup
port detection, you only implement those features whose sup
port you have first tested and verified on the visiting browser. This method has the advantage of not requiring you to test for anything except whether the particular features you code are sup
ported in the visiting browser. Let's see a basic, simple object...
...And 7 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
be found embedded in leading software products such as Mozilla Firefox, Adobe Acrobat, and Aptana Jaxer. Rhino is a Java implementation of JavaScript which is commonly embedded in Java applications to expose scripting capability. The Helma web application framework is an example of Rhino in use. The Dojo Toolkit also has capabilities that run in Rhino. Let's take a closer look at Rhino and its im
portance to the JavaScript developer. Rhino offers a unique op
portunity for the JavaScript developer to tap into the power of Java classes using JavaScript. Armed with some basic Java knowledge, you can extend JavaScript to include some of the most desired capability such as database access, remote web requests, and XML processing. We'll start by taking a look at querying a SQ...
...g with some basic Rhino scripts. If you don't already have it, you'll need to also download the JDBC driver for mySQL, extract the class files, and include the path in your CLASSPATH environment variable. The code in Listing 1 is a sample JavaScript script which incorporates Java classes to handle the database query. ...
...ts. If you don't already have it, you'll need to also download the JDBC driver for mySQL, extract the class files, and include the path in your CLASSPATH environment variable. The code in Listing 1 is a sample JavaScript script which incorporates Java classes to handle the database query. ...
...And 7 more matches
Legacy layout methods - Learn web development
ods from time to time. It is worth understanding how they work, and why they are different to CSS Grid Layout. This lesson will explain how grid systems and grid frameworks based on floats and flexbox work. Having studied Grid Layout you will probably be surprised how complicated this all seems! This knowledge will be helpful to you if you need to create fallback code for browsers that do not sup
port newer methods, in addition to allowing you to work on existing projects which use these types of systems. It is worth bearing in mind, as we explore these systems, that none of them actually create a grid in the way that CSS Grid Layout creates a grid. They work by giving items a size, and pushing them around to line them up in a way that looks like a grid. A two column layout Let's start with...
...hould look like. First of all, we need some content to put into our columns. Replace whatever is inside the body currently with the following: <h1>2 column layout example</h1> <div> <h2>First column</h2> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. Duis felis orci, pulvinar id metus ut, rutrum luctus orci. Cras
porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. Sed auctor cursus massa at
porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula. Curabitur vehicula tellus neque, ac ornare ex malesuada et. In vitae convallis lacus. Aliquam erat volutpat. Suspendisse ac imperdiet turpis. Aenean finibus sollicitudin eros pharetra congue. Duis ornare egestas augue ut luctus. Pr...
...ts content and let us manipulate all of it at once. In this example case we've chosen <div>s, but you could choose something more semantically appropriate like <article>s, <section>s, and <aside>, or whatever. Now for the CSS. First, of all, apply the following to your HTML to provide some basic setup: body { width: 90%; max-width: 900px; margin: 0 auto; } The body will be 90% of the view
port wide until it gets to 900px wide, in which case it will stay fixed at this width and center itself in the view
port. By default, its children (the <h1> and the two <div>s) will span 100% of the width of the body. If we want the two <div>s to be floated alongside one another, we need to set their widths to total 100% of the width of their parent element or smaller so they can fit alongside one anot...
...And 7 more matches
Other form controls - Learn web development
on>Carrot</option> <option>Eggplant</option> <option>Potato</option> </optgroup> </select> Note: In the case of multiple choice select boxes, you'll notice that the select box no longer displays the values as drop-down content -- instead, all values are displayed at once in a list, with the optional size attribute determining the height of the widget. Note: All browsers that sup
port the <select> element also sup
port the multiple attribute. Autocomplete box You can provide suggested, automatically-completed values for form widgets using the <datalist> element with child <option> elements to specify the values to display. The <datalist> needs to be given an id. The data list is then bound to an <input> element (e.g. a text or email input type) using the list attribute, the ...
...ample. ...
...(With fallback)</label> <input type="text" id="myFruit" name="fruit" list="fruitList"> <datalist id="fruitList"> <label for="suggestion">or pick a fruit</label> <select id="suggestion" name="altFruit"> <optio...
...And 7 more matches
HTML text fundamentals - Learn web development
g and what is a paragraph. Furthermore: Users looking at a web page tend to scan quickly to find relevant content, often just reading the headings to begin with. (We usually spend a very short time on a web page.) If they can't see anything useful within a few seconds, they'll likely get frustrated and go somewhere else. Search engines indexing your page consider the contents of headings as im
portant keywords for influencing the page's search rankings. Without headings, your page will perform poorly in terms of SEO (Search Engine Optimization). Severely visually impaired people often don't read web pages; they listen to them instead. This is done with software called a screen reader. This software provides ways to get fast access to given text content. Among the various techniques used, t...
... meaning, function, or appearance. In this context the <h1> element is also a semantic element, which gives the text it wraps around the role (or meaning) of "a top level heading on your page." <h1>This is a top level heading</h1> By default, the browser will give it a large font size to make it look like a heading (although you could style it to look like anything you wanted using CSS). More im
portantly, its semantic value will be used in multiple ways, for example by search engines and screen readers (as mentioned above). On the other hand, you could make any element look like a top level heading. Consider the following: <span style="font-size: 32px; margin: 21px 0; display: block;">Is this a top level heading?</span> This is a <span> element. It has no semantics. You use it to wrap con...
...dd all the ingredients into a food processor.</li> <li>Process all the ingredients into a paste. <ul> <li>If you want a coarse "chunky" hummus, process it for a short time.</li> <li>If you want a smooth hummus, process it for a longer time.</li> </ul> </li> </ol> Try going back to the previous active learning example and updating the second list like this. Emphasis and im
portance In human language, we often emphasise certain words to alter the meaning of a sentence, and we often want to mark certain words as im
portant or different in some way. HTML provides various semantic elements to allow us to mark up textual content with such effects, and in this section, we'll look at a few of the most common ones. Emphasis When we want to add emphasis in spoken language, we ...
...And 7 more matches
Drawing graphics - Learn web development
wise manipulate) SVG vector images -- as they are represented by markup -- there was still no way to do the same for bitmap images, and the tools available were rather limited. The Web still had no way to effectively create animations, games, 3D scenes, and other requirements commonly handled by lower level languages such as C++ or Java. The situation started to improve when browsers began to sup
port the <canvas> element and associated Canvas API -- Apple invented it in around 2004, and other browsers followed by implementing it in the years that followed. As you'll see below, canvas provides many useful tools for creating 2D animations, games, data visualizations, and other types of app, especially when combined with some of the other APIs the web platform provides. The below example shows ...
...reate real 3D graphics inside your web browser; the below example shows a simple rotating WebGL cube: This article will focus mainly on 2D canvas, as raw WebGL code is very complex. We will however show how to use a WebGL library to create a 3D scene more easily, and you can find a tutorial covering raw WebGL elsewhere -- see Getting started with WebGL. Note: Basic canvas functionality is sup
ported well across browsers, with the exception of IE 8 and below for 2D canvas, and IE 11 and below for WebGL. Active learning: Getting started with a <canvas> If you want to create a 2D or 3D scene on a web page, you need to start with an HTML <canvas> element. This element is used to define the area on the page into which the image will be drawn. This is as simple as including the element on the...
...with an HTML <canvas> element. This element is used to define the area on the page into which the image will be drawn. This is as simple as including the element on the page: <canvas width="320" height="240"></canvas> This will create a canvas on the page with a size of 320 by 240 pixels. Inside the canvas tags, you can put some fallback content, which is shown if the user's browser doesn't sup
port canvas. <canvas width="320" height="240"> <p>Your browser doesn't sup
port canvas. Boo hoo!</p> </canvas> Of course, the above message is really unhelpful! In a real example you'd want to relate the fallback content to the canvas content. For example, if you were rendering a constantly updating graph of stock prices, the fallback content could be a static image of the latest stock graph, with ...
...And 7 more matches
Multimedia: Images - Learn web development
ow to reduce the impact of images on overall page load time. This is a high-level introduction to optimizing multimedia delivery on the web, covering general principles and techniques. For a more in-depth guide, see https://images.guide. Why optimize your multimedia? For the average website, 51% of its bandwidth comes from imagery, followed by video at 25%, so it's safe to say it's im
portant to address and optimize your multi-media content. You need to be considerate of data usage. Many people are on capped data plans or even pay-as-you-go where they are literally paying by the megabyte. This isn't an emerging market problem either. As of 2018, 24% of the United Kingdom still use pay-as-you-go. You also need to be considerate of memory as many mobile devices have limited RAM. It...
...o address and optimize your multi-media content. You need to be considerate of data usage. Many people are on capped data plans or even pay-as-you-go where they are literally paying by the megabyte. This isn't an emerging market problem either. As of 2018, 24% of the United Kingdom still use pay-as-you-go. You also need to be considerate of memory as many mobile devices have limited RAM. ...
... Loading strategy One of the biggest improvements to most websites is lazy-loading images beneath-the-fold, rather than downloading them all on initial page load regardless of whether a visitor scrolls to see them or not. ...
...And 7 more matches
Accessibility API cross-reference
le denotes interactive (not browsable) content operable in ways that differ from any of the other interactive ARIA roles, and may be only a part of the main document. APPLICATION FRAME n/a application See <Div> and <NonStruct> A region that contains mostly site-oriented content, rather than page-specific content. ...
...In Tagged PDF n/a n/a Expressed with aria-labelledby if visible on screen or aria-label otherwise <caption> (for tables), <figcaption> (for figures), and <label> with a for attribute (for input elements) a <TOC> or <L> may contain a <caption> as its first item <Caption> or <Lbl> A cell in a table CELL n/a ...
...UMNHEADER COLUMN_HEADER COLUMN_HEADER, TABLE_COLUMN_HEADER columnheader <th scope=col> Edit control with drop down list box, different from DROPLIST COMBOBOX COMBO_BOX COMBO_BOX combobox Abstract role - A form of widget that performs an action but does not receive input data. command A sup
porting section of the document, designed to be complementary to the main content at a similar level in the DOM hierarchy, but remains meaningful when separated from the main content. complementary <aside> n/a but <Div> or even <p> have been suggested for this purpose A widget that may contain navigable descendants or owned children. composite (...
...And 7 more matches
Mozilla's Section 508 Compliance
ation of the current focus shall be provided that moves among interactive interface elements as the input focus changes. The focus shall be programmatically exposed so that assistive technology can track focus and focus changes. Complete. We expose focus programmatically via MSAA (Windows) and ATK (Linux/UNIX). Incomplete, we show focus but need to expose it programmatically by sup
porting Carbon/Cocoa accessibility. (d) Sufficient information about a user interface element including the identity, operation and state of the element shall be available to assistive technology. When an image represents a program element, the information conveyed by the image must also be available in text. Complete. We expose this information to assistive technology vi...
...y of color selections capable of producing a range of contrast levels shall be provided. Complete. Mozilla's appearance preferences panel contains a large number of color possibilities. (k) Software shall not use flashing or blinking text, objects, or other elements having a flash or blink frequency greater than 2 Hz and lower than 55 Hz. Complete. Mozilla sup
ports of <blink> and text-decoration: blink in web pages. In these situations Mozilla blinks 1 Hz, which is within the allowable range and follows the stricter MIL-STD standard. (l) When electronic forms are used, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, ...
...utter accessibility. ...
...And 7 more matches
A bird's-eye view of the Mozilla framework
ose The purpose of this article is to provide a high-level technical overview of the architecture of the extensible, object-based Mozilla application framework. It examines what happens when the user performs a simple user interface (UI) action such as clicking a link in the Contents Panel of the Help Viewer window shown below. The article focuses on the architecture of the overall framework sup
porting the Mozilla application suite, not the architecture of the individual applications themselves. Prerequisites This article assumes you have access to Mozilla sources and are familiar with the directory structure of the source tree. The code samples in the article are based on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051104 SeaMonkey/1.1a from a new source tree check...
... with the JavaScript and C++ programming languages, object-oriented programming (OOP) terminology and design concepts, the Microsoft(R) Component Object Model (COM), and the CORBA OMG Interface Definition Language (IDL). Organization This article first covers some conceptual groundwork, then walks through a user scenario to illustrate how key Mozilla architectural components work together to sup
port a simpleHelp Viewer UI action. Framework Layers At a high level, you can think of the Mozilla framework as consisting of a suite of applications, each of which is organized into three basic layers depicted in Figure 1. Figure 1. User Interface (UI) Widgets and Services The X Window System Toolkit defines the termwidget as a pre-defined object that encapsulates both the command actions a...
... an RDF graph and calls nsIRDFDataSource.GetTarget(resource, NC_LINK, true) to obtain an nsIRDFNode representing a specific node in the graph, in this case a link to aHelp Viewer document page. The client is completely unaware of which C++ class (or other language) actually implements nsIRDFNode; it only interacts with the IDL interface. The client would like to ask the nsIRDFNode whether its sup
ports nsIRDFLiteral. An nsIRDFNode must be an nsIRDFLiteral or an nsIRDFResource. The link is a literal, so the client wants nsIRDFLiteral. Since all XPCOM interfaces inherit the base interface nsISup
ports, the client can ask whether nsIRDFNode sup
ports nsIRDFLiteral by calling nsIRDFNode.QueryInterface(), a method in the nsISup
ports interface. [scriptable, uuid(00000000-0000-0000-c000-000000000046)]...
...And 7 more matches
What to do and what not to do in Bugzilla
nfirm, you can still do good triaging by leaving comments with useful information on the bug that will help to confirm it. The same is true for editbugs: leave comments with the information you'd like to be able to edit into the bug, and that will help you get the editbugs permissions quickly. ...
...anconfirm privilege The canconfirm privilege allows you to confirm bugs and also to start your bug re
ports in the confirmed state (NEW). It also governs which bug entry form you are presented with first (either the guided or advanced forms). Confirming unconfirmed bugs A useful general guide for confirming unconfirmed bugs. A guide for confirming layout bugs (bugs in web page rendering) Re
porting new bugs You should re
port a bug in the NEW state after going through the triaging process as described in the two above-mentioned guides. You should look at all the open bugs you've re
ported (see the "My Bugs" link at the bottom of every Bugzilla page) at least every two months and test whether they still exist. Editbugs privilege The more powerful editbugs privilege gives you the privile...
... When in doubt about resolving a bug, leave it alone! Resolving bugs as DUPLICATE In general newer bugs should be marked as DUPLICATEs of older bugs, except when the newer bug contains more information (bug description clearer, patch already attached, lots of people already CC'ed, etc.). Resolving bugs as WORKSFORME You can resolve a bug as WORKSFORME (WFM) if it can't be reproduced on the re
ported hardware/OS. You should not resolve a bug as WFM if: the bug re
porter uses a different hardware/operating system (e.g. bug appears on Linux and you can't reproduce it on Windows). the bug has been reproduced by some people but can't be reproduced by other people. In general you can resolve a bug as WFM if: three or more people with a similar/the same setup can't reproduce the bug and ...
...And 7 more matches
Error codes returned by Mozilla APIs
called before other methods are used. NS_ERROR_ALREADY_INITIALIZED (0xC1F30002) An attempt is made to initialize a component or object again which has already been initialized. NS_ERROR_NOT_IMPLEMENTED (0x80004001) This error is caused by methods which are not implemented. This could occur because the implementation has not yet been written, or because the component intentionally does not sup
port the desired feature. NS_ERROR_NO_INTERFACE (0x80004002) An attempt was made to call QueryInterface to retrieve an interface which an object does not sup
port. NS_ERROR_NULL_POINTER (0x80004003) An error occurred because a value was set to null when this was not expected. NS_ERROR_ABORT (0x80004004) This error indicates that an operation failed and the caller should abort whatever action is b...
...t or resource was not available. NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154) Returned when a service could not be found. NS_ERROR_FACTORY_REGISTER_AGAIN (0x80040155) This error is returned when registering a component and the registration should try registering again later. NS_ERROR_FACTORY_NOT_LOADED (0x800401f8) NS_ERROR_FACTORY_EXISTS (0xC1F30100) NS_ERROR_FACTORY_NO_SIGNATURE_SUP
PORT (0xC1F30101) NS_ERROR_PROXY_INVALID_IN_PARAMETER (0x80010010) NS_ERROR_PROXY_INVALID_OUT_PARAMETER (0x80010011) NS_ERROR_CANNOT_CONVERT_DATA (0x80460001) NS_ERROR_OBJECT_IS_IMMUTABLE (0x80460002) NS_ERROR_LOSS_OF_SIGNIFICANT_DATA (0x80460003) NS_ERROR_ILLEGAL_DURING_SHUTDOWN (0x8046001E) Many operations cannot be performed once the application is being shutdown. This erro...
... enough data available to read without waiting for more. Document and Node Errors The following errors can occur when using documents, nodes and elements. NS_ERROR_DOM_INDEX_SIZE_ERR (0x80530001) An attempt was made to adjust the value of a text node using an index that was out of range. ...
...And 7 more matches
Mozilla Web Developer FAQ
g. Lengths other than zero should be followed by a proper unit without a space between the number and the unit (eg. 1.2em). The character to use between the property name and the value is the colon--not the equal sign. HTML markup, such as <style>, does not belong in .css files. font-face is not a real CSS property. The property is font-family and @font-face is an at-rule. If @im
port is used, it should be the first thing in a CSS file. CSS parsing errors are re
ported to the JavaScript console. Is the server sending the proper Content-Type header for CSS style sheets? The correct type is text/css. In the Standards mode and the Almost Standards mode only style sheets with the correct type are applied. You can see the HTTP headers sent by the server by using...
...e block box itself. A block is centered by setting its margin-left and margin-right to auto and its width to a value that makes the block narrower than its containing block. It is also possible, although not very likely, that you are seeing a bug. JavaScript doesn't work! Why? Some proprietary document objects such as document.all and document.layers are not part of the W3C DOM and are not sup
ported in Mozilla. (There is partial undetectable sup
port for document.all, though, in newer versions of Mozilla. However, that functionality only exists for compatibility with sites authored specifically for IE. You should not rely on Mozilla's document.all sup
port on new pages.) The method document.getElementById() can be used instead. In the Standards mode Mozilla does not generate implicit top-le...
...lay method is not required and some other browsers show the title attribute in the browser status bar, for example. At this point some people feel compelled to post a "But IE..." rant in the newsgroups or in Bugzilla. Please note that Mac IE 5 behaves in the same way as Mozilla when it comes to the alt and title attributes. Windows IE also shows the title attribute in a tooltip. Does Mozilla sup
port downloadable fonts? Downloadable fonts in TrueType and OpenType formats (.ttf and .otf) are sup
ported since Firefox 3.5. The fonts have to be served from the same origin (protocol, host,
port) as the content that uses them unless the fonts are served with the appropriate Cross-Origin Resource Sharing HTTP headers. Downloadable fonts in the EOT format are not sup
ported. If you use downloadable ...
...And 7 more matches
JSS FAQ
How can I debug my SSL connection? Can you explain JSS SSL certificate approval callbacks? Can I have multiple JSS instances reading separate db's? ...
... How can I debug my SSL connection? Can you explain JSS SSL certificate approval callbacks? Can I have multiple JSS instances reading separate db's? ...
...gn data in Java with JSS? How do I convert org.mozilla.jss.crypto.X509Certificate to org.mozilla.jss.pkix.cert.Certificate? How do I convert org.mozilla.jss.pkix.cert to org.mozilla.jss.crypto.X509Certificate? Is it possible to use JSS to access cipher functionality from pkcs11 modules? Can you explain token names and keys with regards to JSS? JSS 3.2 has JCA sup
port. ...
...And 7 more matches
Shell global objects
help([name ...]) Display usage and help messages. quit() Quit the shell. assertEq(actual, expected[, msg]) Throw if the first two arguments are not the same (both +0 or both -0, both NaN, or non-zero and ===). startTimingMutator() Start accounting time to mutator vs GC. stopTimingMutator() Stop accounting time to mutator vs GC and dump the results. throwError() Throw an error from JS_Re
portError. intern(str) Internalize str in the atom table. getslx(obj) Get script line extent. evalcx(s[, o]) Evaluate s in optional sandbox object o. if (s == '' && !o) return new o with eager standard classes, if (s == 'lazy' && !o) return new o with lazy standard classes evalInWorker(str) Evaluate str in a separate thread with its own runtime. getSharedArrayBuffer() Retrieve the SharedArra...
...obj1 and obj2 have the same shape, false otherwise. Both objects are unwrapped first, so this can be used on objects from different globals. sleep(dt) Sleep for dt seconds. compile(code) Compiles a string to bytecode, potentially throwing. parseModule(code) Parses source text as a module and returns a Module object. setModuleResolveHook(function(module, specifier) {}) Set the HostResolveIm
portedModule hook to function. This hook is used to look up a previously loaded module object. It should be implemented by the module loader. getModuleLoadPath() Return any --module-load-path argument passed to the shell. Used by the module loader. parse(code) Parses a string, potentially throwing. syntaxParse(code) Check the syntax of a string, returning success value offThreadCompileScript(co...
...al is treated as if its bits were 0xffff, for subsumption purposes. If this property is omitted, supply no principal. createMappedArrayBuffer(filename, [offset, [size]]) Create an array buffer that mmaps the given file. addPromiseReactions(promise, onResolve, onReject) Calls the JS::AddPromiseReactions JSAPI function with the given arguments. getMaxArgs() Return the maximum number of sup
ported args for a call. objectEmulatingUndefined() Return a new object obj for which typeof obj === "undefined", obj == null and obj == undefined (and vice versa for !=), and ToBoolean(obj) === false. isCachingEnabled() Return whether JS caching is enabled. setCachingEnabled(b) Enable or disable JS caching. cacheEntry(code) Return a new opaque object which emulates a cache entry of a script. T...
...And 7 more matches
WebReplayRoadmap
quires scanning the recording and the console will not update immediately. These messages will show up on the timeline and can be seeked to in the same way as other console messages. DOM/CSS Integration (partially implemented) When paused, the Inspector panel can be used to inspect the DOM and CSS state of the page. ...
...ing the recording and the console will not update immediately. These messages will show up on the timeline and can be seeked to in the same way as other console messages. DOM/CSS Integration (partially implemented) When paused, the Inspector panel can be used to inspect the DOM and CSS state of the page. ...
... Allowing CSS to be changed while paused somewhere in the recording and update graphics with the effects of those changes. ...
...And 7 more matches
XPCOM changes in Gecko 2.0
were loaded and called, asking them to register themselves. If you used XPCOMUtils.jsm, some of this was hidden from you, but it was still there. Starting in Gecko 2, however, components are registered using manifest files, similarly to how chrome is registered. In fact, the same chrome manifest file will be used to register components. All existing XPCOM components will need to be updated to sup
port this. However, it's very easy to do, and you can actually sup
port both types of registration for backward compatibility. Component manifests All component registration is now handled through manifest files. For extensions, this is the same chrome.manifest currently used to register chrome. XPT files The path of any XPT files must be listed explicitly in a manifest using an interfaces directive: i...
...t is loaded only when the XPCOM component manager needs to create a component. ...
...ger needs to create a component. chrome.manifest: # The {classID} here must match the classID in mycomponent.js component {e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8} components/mycomponent.js contract @foobar/mycomponent;1 {e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8} category profile-after-change MyComponent @foobar/mycomponent;1 The JavaScript code no longer ex
ports a NSGetModule() function. ...
...And 7 more matches
Language bindings
e result is structured cloned back to the original context, unless it is native (for example, if it returns a DOM node, this is not structured cloned, because the original context will see that through an XrayWrapper already), so it's guaranteed to behave predictably. This is useful for privileged code, such as add-on code, to access variables and APIs defined in web content.Components.utils.ex
portFunctionThis function provides a safe way to expose a function from a privileged scope to a less-privileged scope.Components.utils.forceGCComponents.utils.forceGC lets scripts force a garbage collection cycle. The Mozilla JavaScript engine will perform garbage collection automatically when the JavaScript heap grows beyond a certain size. This mechanism doesn't account for any native (C++) XPCOM ob...
...rform garbage collection automatically when the JavaScript heap grows beyond a certain size. This mechanism doesn't account for any native (C++) XPCOM objects hanging off JavaScript objects though. In many cases a JavaScript application will have internal knowledge of JavaScript objects referencing large (trees of) XPCOM objects and know when they are no longer reachable. In this case it can be im
portant to be able to force a garbage collection cycle from JavaScript. Components.utils.getGlobalForObjectThis method is used to determine the global object with which an object is associated. This is the global object in place at the time the object was created, which is to say the global object used when executing the script that created the object.Components.utils.getWeakReferenceThis method w...
...ssociated. This is the global object in place at the time the object was created, which is to say the global object used when executing the script that created the object.Components.utils.getWeakReferenceThis method was introduced in Firefox 3 and is used for obtaining a weak reference for an object. ...
...And 7 more matches
Observer Notifications
plications Application shutdown These are the topics that you can observe on shutdown, in order of appearance. Topic Description quit-application-requested Something has requested that the application be shutdown. You can cancel the shutdown from here by setting aSubject.data to true (aSubject is the first parameter to your observer, the data value is an nsISup
portsPRBool). quit-application-granted All observers have agreed to the shutdown. quit-application The application is about to quit. This can be in response to a normal shutdown, or a restart. Note: The data value for this notification is either 'shutdown' or 'restart'. profile-change-net-teardown The network connection is going offline at this point. No...
...rge-domain-data Sent after domain-specific history and other information have been purged. The data value is a string form of the domain. browser-lastwindow-close-requested Sent when the browser wishes to close the last open browser window. When this is sent, it is possible that other windows may still be open, such as the download manager or preferences. The data value is an nsISup
portsPRBool. Recipients may set this to true to abort the close. browser-lastwindow-close-granted Sent when all interested parties have responded to the browser-lastwindow-close-requested notification and none of them requested that the close be aborted. After this is sent and handled, the browser window will close. browser-delayed-startup-finished Sent when the browser window ...
...emoved from the backward/forward cache. See Working With BFCache for information about the bfcache, and Inner and outer windows for details about how the window hierarchy works. Extensions that cache information about windows may wish to observe this so they can release information when the window is destroyed. The window id can be obtained from subject.QueryInterface(Components.interfaces.nsISup
portsPRUint64).data outer-window-destroyed nsIDOMWindow Called when an outer window is disconnected from its docshell. See Inner and outer windows for details about how the window hierarchy works. Extensions that cache information about windows may wish to observe this so they can release information when the window is destroyed. The window id can be obtained from subject.QueryInterfa...
...And 7 more matches
nsIScriptableIO
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. nsIScriptableIO provides a convenient API for cre...
...nient API for creating files and streams, as well as for reading and writing data to them. For your convenience, this API is published through a global IO object. For more details about how to use this object, see the File and Stream Guide. network/base/public/nsIScriptableIO.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9 (Firefox 3) Inherits from: nsISup
ports A scriptable IO object can be used in an extension or chrome code by referring to the global IO object. For example: IO.getFile("Profile", "cookies.txt"); From an XPCOM component, however, you will need to get a reference as with other components: var scriptableIO = Components.classes["@mozilla.org/io/scriptable-io;1"] .getService(); scriptableIO.getFile("Profile", ...
...u will need to get a reference as with other components: var scriptableIO = Components.classes["@mozilla.org/io/scriptable-io;1"] .getService(); scriptableIO.getFile("Profile", "cookies.txt"); Method overview nsIFile getFile(in AString aLocation, in AString aFileName); nsIFile getFileWithPath(in AString aFilePath); nsISup
ports newInputStream(in nsIVariant aBase, in AString aMode, [optional] in AString aCharSet, [optional] in AString aReplaceChar, [optional] in unsigned long aBufferSize); nsISup
ports newOutputStream(in nsIVariant aBase, in AString aMode, [optional] in AString aCharSet, [optional] in AString aReplaceChar, [optional] in unsigned long aBufferSize, [optional] in unsigned long aPermissions);...
...And 7 more matches
nsIXULTemplateQueryProcessor
emplateQueryProcessor.idlScriptable A query processor takes a template query and generates results for it given a datasource and a reference point. There is a one-to-one relationship between a template builder and a query processor. The template builder creates the query processor, and there is no other means to retrieve it. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) A query processor takes a template query and generates results for it given a datasource and a reference point. There is a one-to-one relationship between a template builder and a query processor. The template builder creates the query processor, and there is no other means to retrieve it. A template query is the contents inside a <query> element within the...
...ill allow the generation of a list of results. The template builder will supply two variables, the reference variable and the member variable to further indicate what part of the datasource is to be examined in addition to the query itself. The reference is always a placeholder for the starting point and the member is always a placeholder for the end points (the results). The reference point is im
portant when generating output recursively, as the query will be the same for each iteration, however, the reference point will differ. For instance, when examining an XML source, an XML query processor might begin at the node referred by the reference variable and end at a list of that node's children. Some queries may not need the reference variable if the syntax or the form of the data implies the ...
...thods will always be an nsIRDFDataSource or a DOM node, and will always be the same one in between calls to initializeForBuilding() and done(). ...
...And 7 more matches
Reference Manual
t runtime in the bad assignment. // Given two un-related interfaces |nsIFoo| and |nsIBar|... nsIBar* bar = ...; // ... nsCOMPtr<nsIFoo> foo = bar; // NS_ASSERTION: "QueryInterface needed" // ...even assuming you can get the line to compile // (either by casting, or because the types are related by C ) This invariant is relaxed for nsCOMPtr<nsISup
ports>. Like nsISup
ports* (or even void*), people generally use nsCOMPtr<nsISup
ports> to mean "any XPCOM interface." It would be annoying if nsCOMPtr forced you to QueryInterface to the XPCOM-correct nsISup
ports within an object in places where you don't care to know the exact type. NULL-dereference Safeguards An nsCOMPtr will also assert at runtime if you try to dereference it when it is void, e.g., ...
...lying raw pointer out of an nsCOMPtr use a C trick to implement another safety feature. The pointer returned cannot be AddRefed, Released, or deleted. nsCOMPtr<nsIFoo> foo = ...; foo->AddRef(); // Error: |AddRef| is private delete foo.get(); // Error: |operator delete| is private NS_RELEASE(foo); // Error: |Release| is private Of course, the most im
portant safety feature provided by nsCOMPtr is that it AddRefs and Releases automatically at the appropriate times. Casting Never use old-style C/C++ casts on an nsCOMPtr. An old-style cast is guaranteed to compile, even if it can't do the right thing. Old-style casts degenerate into the equivalent of reinterpret_cast if no conversion is defined. Such a cast can easily by-pass nsCOMPtrs machinery, cau...
... To help prevent this, we are trying to make the first form, above, illegal by making operator& private. See bug 59414. Implementation Details and Debugging Machinery Although it is a class, nsCOMPtr has no virtual methods, and therefore, no vtable or vptr. Because a few key routines are factored out into a common non-template base class, the actual underlying pointer is stored as an nsISup
ports* (except in debug builds where NSCAP_FEATURE_DEBUG_PTR_TYPES is turned on). It is because of these factored routines that nsCOMPtr users must link with the XPCOM library. When NSCAP_FEATURE_DEBUG_PTR_TYPES is turned on, instead of holding its underlying pointer in a variable of type nsISup
ports*, the nsCOMPtr holds it in a pointer matching the underlying type. This allows source level debuggers ...
...And 7 more matches
BasicCardResponse.billingAddress - Web APIs
The billingAddress property of the BasicCardResponse dictionary contains the billing address of the card used to make the payment. Syntax "billingAddress" : PaymentAddress Value A PaymentAddress object representing the billing address of the card. Example Let's look at a sample payment request: var request = new PaymentRequest(sup
portedInstruments, details, options); // Call show() to trigger the browser's payment flow. request.show().then(function(instrumentResponse) { // Do something with the response from the UI. console.log(instrumentResponse.details); }) .catch(function(err) { // Do something with the error from request.show(). }); Once the payment flow has been triggered using PaymentRequest.show() and the promise resolves successfully, the PaymentResponse object avail...
...he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetbillingAddressChrome No sup
port NoEdge No sup
port <=18 -- 79Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE ...
...And 7 more matches
BasicCardResponse.cardNumber - Web APIs
request.show().then(function(instrumentResponse) { // Do something with the response from the UI. ...
... The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetcardNumberChrome No sup
port NoEdge No sup
port <=18 -- 79Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE ...
...And 7 more matches
BasicCardResponse.cardSecurityCode - Web APIs
The cardSecurityCode property of the BasicCardResponse dictionary contains the security code of the card used to make the payment. Syntax "cardSecurityCode" : "number" Value A DOMString representing the card security code. Example Let's look at a sample payment request: var request = new PaymentRequest(sup
portedInstruments, details, options); // Call show() to trigger the browser's payment flow. request.show().then(function(instrumentResponse) { // Do something with the response from the UI. console.log(instrumentResponse.details); }) .catch(function(err) { // Do something with the error from request.show(). }); Once the payment flow has been triggered using PaymentRequest.show() and the promise resolves successfully, the PaymentResponse object available inside the fulfilled...
... compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetcardSecurityCodeChrome No sup
port NoEdge No sup
port <=18 -- 79Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE ...
...And 7 more matches
BasicCardResponse.cardholderName - Web APIs
The cardNumber property of the BasicCardResponse dictionary contains the cardholder name of the card used to make the payment. Syntax name = basicCardResponse.cardholderName; Value A DOMString indicating the name of the cardholder. Example Let's look at a sample payment request: var request = new PaymentRequest(sup
portedInstruments, details, options); // Call show() to trigger the browser's payment flow. request.show().then(function(instrumentResponse) { // Do something with the response from the UI. console.log(instrumentResponse.details); }) .catch(function(err) { // Do something with the error from request.show(). }); Once the payment flow has been triggered using PaymentRequest.show() and the promise resolves successfully, the PaymentResponse object available inside the ...
...he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetcardholderNameChrome No sup
port NoEdge No sup
port <=18 -- 79Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE ...
...And 7 more matches
BasicCardResponse.expiryMonth - Web APIs
The expiryMonth property of the BasicCardResponse dictionary contains the expiry month of the card used to make the payment. Syntax "expiryMonth" : "number" Value A DOMString representing the card expiry month as a two-digit number in the range 01 to 12. Example Let's look at a sample payment request: var request = new PaymentRequest(sup
portedInstruments, details, options); // Call show() to trigger the browser's payment flow. request.show().then(function(instrumentResponse) { // Do something with the response from the UI. console.log(instrumentResponse.details); }) .catch(function(err) { // Do something with the error from request.show(). }); Once the payment flow has been triggered using PaymentRequest.show() and the promise resolves successfully, the PaymentResponse objec...
... The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetexpiryMonthChrome No sup
port NoEdge No sup
port <=18 -- 79Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE ...
...And 7 more matches
BasicCardResponse.expiryYear - Web APIs
The expiryYear property of the BasicCardResponse dictionary contains the expiry year of the card used to make the payment. Syntax "expiryYear" : "number" Value A DOMString representing the card expiry year as a four-digit number in the range 0000 to 9999. Example Let's look at a sample payment request: var request = new PaymentRequest(sup
portedInstruments, details, options); // Call show() to trigger the browser's payment flow. request.show().then(function(instrumentResponse) { // Do something with the response from the UI. console.log(instrumentResponse.details); }) .catch(function(err) { // Do something with the error from request.show(). }); Once the payment flow has been triggered using PaymentRequest.show() and the promise resolves successfully, the PaymentResponse obje...
... The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetexpiryYearChrome No sup
port NoEdge No sup
port <=18 -- 79Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE ...
...And 7 more matches
HTMLImageElement.complete - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
HTMLImageElement.crossOrigin - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
HTMLImageElement.naturalHeight - Web APIs
e compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...s://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
HTMLImageElement.naturalWidth - Web APIs
he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
HTMLImageElement.sizes - Web APIs
ition is typically (but not necessarily) based entirely on width information. See Syntax in Using media queries for details on how to construct a media condition. Source size values The source size value is a CSS length. It may be specified using font-relative units (such as em or ex), absolute units (such as px or cm), or the vw unit, which lets you specify the width as a percentage of the view
port width (1vw being 1% of the view
port width). Note: The source size value must not be specified as a percentage of the container size; that is, lengths such as 50% or 100% are not allowed, as there would be uncertainty as to what the specified value is a percentage of. Example In this example, a blog-like layout is created, displaying some text and an image which for which three size points ar...
... let image = document.querySelector("article img"); let break40 = document.getElementById("break40"); let break50 = document.getElementById("break50"); break40.addEventListener("click", event => image.sizes = image.sizes.replace(/50em,/, "40em,")); break50.addEventListener("click", event => image.sizes = image.sizes.replace(/40em,/, "50em,")); Result This res...
...patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
HTMLImageElement.vspace - Web APIs
laying out the page. Syntax htmlImageElement.vspace = marginHeight; marginHeight = htmlImageElement.vspace; Value An integer value specifying the height, in pixels, of the vertical margin to apply to the top and bottom sides of the image. Usage notes The value specified for vspace is mapped to the margin-top and margin-bottom properties to specify the height of those margins in pixels. Im
portant: This property is obsolete. You should instead use the CSS margin property and its longhand forms to establish margins around an <img>. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLImageElement.vspace' in that specification. Living Standard HTML 4.01 SpecificationThe definition of 'HTMLImageElement.vspace'...
...ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
HTMLImageElement.width - Web APIs
image's width is represented using its natural (intrinsic) width, adjusted for the display density as indicated by naturalWidth. Example In this example, two different sizes are provided for an image of a clock using the srcset attribute. One is 200px wide and the other is 400px wide. Further, the sizes attribute is provided to specify the width at which the image should be drawn given the view
port's width. HTML Specifically, for view
ports up to 400px wide, the image is drawn at a width of 200px; otherwise, it's drawn at 400px. <p>Image width: <span class="size">?</span>px (resize to update)</p> <img src="/files/16864/clock-demo-200px.png" alt="Clock" srcset="/files/16864/clock-demo-200px.png 200w, /files/16797/clock-demo-400px.png 400w" sizes="(max-width: 400...
...lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursor.advance() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...lease check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursor.continue() - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ease check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursor.delete() - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursor.direction - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ase check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursor.primaryKey - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursor.request - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursor.source - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursor.update() - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBCursorWithValue.value - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.close() - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.deleteObjectStore() - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...k out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.name - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
..., please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.objectStoreNames - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.onabort - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...lease check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.onclose - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ed data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.onerror - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...lease check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.onversionchange - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabase.version - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...lease check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBDatabaseException - Web APIs
page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...refoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetIDBDatabaseException DeprecatedNon-standardChrome Full sup
port 12Prefixed Full sup
port 12Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port <=79Prefixed Full sup
port <=79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox No sup
port 4 -- 14IE No sup
port NoOpera No sup
port NoSafari No sup
port ...
...And 7 more matches
IDBKeyRange.bound() - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBKeyRange.includes() - Web APIs
escription DataError The supplied key was not a valid key. Example var keyRangeValue = IDBKeyRange.bound('A', 'K', false, false); var myResult = keyRangeValue.includes('F'); // Returns true var myResult = keyRangeValue.includes('W'); // Returns false Polyfill The includes() method was added in the second edition of the Indexed DB specification. For browsers that do not sup
port it, the following polyfill can be used. IDBKeyRange.prototype.includes = IDBKeyRange.prototype.includes || function(key) { var r = this, c; if (r.lower !== undefined) { c = indexedDB.cmp(key, r.lower); if (r.lowerOpen && c <= 0) return false; if (!r.lowerOpen && c < 0) return false; } if (r.upper !== undefined) { c = indexedDB.cmp(key, r.upper); if (r.upperOpen && c >...
... The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBKeyRange.lower - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBKeyRange.lowerBound() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBKeyRange.lowerOpen - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ase check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBKeyRange.only() - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
..., please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBKeyRange.upper - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBKeyRange.upperBound() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBKeyRange.upperOpen - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ase check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBRequest.onsuccess - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBRequest.readyState - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...heck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBRequest.result - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBRequest.source - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...se check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
IDBRequest.transaction - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
KeyboardEvent.getModifierState() - Web APIs
Fn...
...Fn key on Mac keyboard doesn't cause this active. "FnLock" Not sup...
...ed Level 3 Shift key (or Level 5 Shift key ) pressed ? Option key pressed Not sup
ported "CapsLock" During LED for ? ...
...And 7 more matches
MessageEvent - Web APIs
The MessageEvent interface represents a message received by a target object. This is used to represent messages in: Server-sent events (see EventSource.onmessage). Web sockets (see the onmessage property of the WebSocket interface). Cross-document messaging (see Window.postMessage() and Window.onmessage). Channel messaging (see Message
Port.postMessage() and Message
Port.onmessage). Cross-worker/document messaging (see the above two entries, but also Worker.postMessage(), Worker.onmessage, ServiceWorkerGlobalScope.onmessage, etc.) Broadcast channels (see Broadcastchannel.postMessage()) and BroadcastChannel.onmessage). WebRTC data channels (see RTCDataChannel.onmessage). The action triggered by this event is defined in a function set as the event handler for the relevant message even...
...erface also inherits properties from its parent, Event. MessageEvent.data Read only The data sent by the message emitter. MessageEvent.origin Read only A USVString representing the origin of the message emitter. MessageEvent.lastEventId Read only A DOMString representing a unique ID for the event. MessageEvent.source Read only A MessageEventSource (which can be a WindowProxy, Message
Port, or ServiceWorker object) representing the message emitter. MessageEvent.
ports Read only An array of Message
Port objects representing the
ports associated with the channel the message is being sent through (where appropriate, e.g. in channel messaging or when sending a message to a shared worker). Methods This interface also inherits methods from its parent, Event. initMessageEvent() ...
...he different scripts are using the same worker file to perform the calculation -- they can both access it, even if their pages are running inside different windows. The following code snippet shows creation of a SharedWorker object using the SharedWorker() constructor. Both scripts contain this: var myWorker = new SharedWorker('worker.js'); Both scripts then access the worker through a Message
Port object created using the SharedWorker.
port property. If the onmessage event is attached using addEventListener, the
port is manually started using its start() method: myWorker.
port.start(); When the
port is started, both scripts post messages to the worker and handle messages sent from it using
port.postMessage() and
port.onmessage, respectively: first.onchange = function() { myWorker.
port.p...
...And 7 more matches
Metadata - Web APIs
e on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...romeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetMetadata ExperimentalNon-standardChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port <=79Prefixed Full sup
port <=79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox No sup
port NoIE No sup
port NoOpera No sup
port NoSafari No sup
port ...
...And 7 more matches
NonDocumentTypeChildNode.nextElementSibling - Web APIs
s div-02</div> <script type="text/javascript"> var el = document.getElementById('div-01').nextElementSibling; console.log('Siblings of div-01:'); while (el) { console.log(el.nodeName); el = el.nextElementSibling; } </script> This example outputs the following into the console when it loads: Siblings of div-01: DIV SCRIPT Polyfill for Internet Explorer 8 This property is unsup
ported prior to IE9, so the following snippet can be used to add sup
port to IE8: // Source: https://github.com/Alhadis/Snippets/blob/master/js/polyfills/IE8-child-elements.js if(!("nextElementSibling" in document.documentElement)){ Object.defineProperty(Element.prototype, "nextElementSibling", { get: function(){ var e = this.nextSibling; while(e && 1 !== e.nodeType...
...patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
PaymentRequest.prototype.id - Web APIs
bility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetidChrome Full sup
port 61Edge Full sup
port 16Firefox Full sup
port 55Notes Disabled Full sup
port 55Notes Disabled Notes Available only in nightly builds.Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
... 16Firefox Full sup
port 55Notes Disabled Full sup
port 55Notes Disabled Notes Available only in nightly builds.Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). ...
...And 7 more matches
PaymentRequest.shippingOption - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetshippingOptionChrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 55Notes Disabled Full sup
port 55Notes Disabled Notes Available only in nightly builds.Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
... 15Firefox Full sup
port 55Notes Disabled Full sup
port 55Notes Disabled Notes Available only in nightly builds.Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). ...
...And 7 more matches
PaymentRequest.shippingType - Web APIs
he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetshippingTypeChrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 55Notes Disabled Full sup
port 55Notes Disabled Notes Available only in nightly builds.Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
... 15Firefox Full sup
port 55Notes Disabled Full sup
port 55Notes Disabled Notes Available only in nightly builds.Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). ...
...And 7 more matches
PaymentResponse.details - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetdetailsChrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
... 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). ...
...And 7 more matches
PaymentResponse.payerEmail - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetpayerEmailChrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
... 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). ...
...And 7 more matches
PaymentRequest.payerName - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ed data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetpayerNameChrome Full sup
port 61Edge Full sup
port 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
... 15Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). ...
...And 7 more matches
PaymentResponse.requestId - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ed data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetrequestIdChrome Full sup
port 61Edge Full sup
port 16Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:conf...
... 16Firefox Full sup
port 56Notes Disabled Full sup
port 56Notes Disabled Notes Available only in nightly builds.Disabled From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). ...
...And 7 more matches
RTCConfiguration - Web APIs
RTCConfiguration dictionary is used to provide configuration options for an RTCPeerConnection. It may be passed into the constructor when instantiating a connection, or used with the RTCPeerConnection.getConfiguration() and RTCPeerConnection.setConfiguration() methods, which allow inspecting and changing the configuration while a connection is established. The options include ICE server and trans
port settings and identity information. Properties bundlePolicy Optional Specifies how to handle negotiation of candidates when the remote peer is not compatible with the SDP BUNDLE standard. This must be one of the values from the enum RTCBundlePolicy. If this value isn't included in the dictionary, "balanced" is assumed. certificates Optional An Array of objects of type RTCCertificate which a...
... the size of the ICE candidate pool may trigger the beginning of ICE gathering. iceServers Optional An array of RTCIceServer objects, each describing one server which may be used by the ICE agent; these are typically STUN and/or TURN servers. If this isn't specified, the connection attempt will be made with no STUN or TURN server available, which limits the connection to local peers. iceTrans
portPolicy Optional The current ICE trans
port policy; this must be one of the values from the RTCIceTrans
portPolicy enumeration. If the policy isn't specified, all is assumed by default, allowing all candidates to be considered. A value of relay limits the candidates to those relayed through another server, such as a STUN or TURN server. peerIdentity Optional A DOMString which specifies the target ...
...rver, such as a STUN or TURN server. peerIdentity Optional A DOMString which specifies the target peer identity for the RTCPeerConnection. If this value is set (it defaults to null), the RTCPeerConnection will not connect to a remote peer unless it can successfully authenticate with the given name. rtcpMuxPolicy Optional The RTCP mux policy to use when gathering ICE candidates, in order to sup
port non-multiplexed RTCP. The value must be one of those from the RTCRtcpMuxPolicy enum. The default is "require". Constants RTCBundlePolicy enum The RTCBundlePolicy enum defines string constants which are used to request a specific policy for gathering ICE candidates if the remote peer isn't "BUNDLE-aware" (compatible with the SDP BUNDLE standard for bundling multiple media streams on a single t...
...And 7 more matches
SVGLength - Web APIs
ect itself is read only. Methods Name & Arguments Return Description newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits) void Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object. Exceptions: a DOMException with code NOT_SUP
PORTED_ERR is raised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface). a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only. convertToSpecifiedUnits(in unsigned short unitType) void...
... The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
UIEvent.initUIEvent() - Web APIs
on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ser-compat-data and send us a pull request. ...
...And 7 more matches
WebRTC Statistics API - Web APIs
on and to make use of that data. ...
...that data. ...
...ion = new RTCPeerConnection(pcOptions); statsInterval = window.setInterval(getConnectionStats, 1000); /* add event handlers, etc */ } catch(err) { console.error("Error creating RTCPeerConnection: " + err); } function getConnectionStats() { myPeerConnection.getStats(null).then(stats => { var statsOutput = ""; stats.forEach(re
port => { if (re
port.type === "inbound-rtp" && re
port.kind === "video") { Object.keys(re
port).forEach(statName => { statsOutput += `<strong>${statName}:</strong> ${re
port[statName]}<br>\n`; }); } }); document.querySelector(".stats-box").innerHTML = statsOutput; }); } When the promise returned by getStats() is fulfilled, the resolution handler receives as input an RTCStatsRe
port object containing the statis...
...And 7 more matches
Using bounded reference spaces - Web APIs
stem may provide automated detection and protection against exiting the safe area, it is always good practice to handle this yourself, watching for collisions between the user's position and the boundary of the world, and providing guidance to move back toward the origin point, or at least to stay inside the safe zone. XR hardware that does not have an inherent boundary defined may or may not sup
port the bounded reference space. If it does, it likely has a system in place to allow the user to specify or select the boundaries to apply if a bounded space is to be used. However, it's entirely possible that the device will simply decline to sup
port bounded spaces at all, so you should be prepared to fall back to some other type of reference space. Understanding boundaries As mentioned previousl...
...ect to hit test against. As the user grows close to the boundary, you might warn them by displaying a message, flashing a warning indicator, playing an audio warning, or the like. And if the user actually collides with the boundary, don't let them continue past it. <<<--- example --->>> Creating a bounded reference space Before creating a project that relies on bounded reference spaces, it's im
portant to keep in mind that not all XR devices are capable of creating them. By their very nature, bounded reference spaces have special hardware requirements, since they need to allow for the user to physically move around in space while their movements are tracked. In this section, we'll look at how to safely create a session that will work whether bounded spaces are sup
ported or not. Safely creat...
...l hardware requirements, since they need to allow for the user to physically move around in space while their movements are tracked. In this section, we'll look at how to safely create a session that will work whether bounded spaces are sup
ported or not. Safely creating a bounded-preferred space Before actually attempting to create a bounded reference space, you need to create a session that sup
ports them. ...
...And 7 more matches
Inputs and input sources - Web APIs
A full WebXR experience isn't just about showing the user a wholly virtual scene or augmenting reality by adding to or altering the world around them. In order to make an experience that's fulfilling and engaging, the user needs to be able to interact with it. To that end, WebXR provides sup
port for a variety of kinds of input devices. In this guide, we'll look at how to use WebXR's input device management features to determine what input sources are available and how to then monitor those sources for inputs in order to handle user interactivity with your virtual or augmented environment. Inputs in WebXR Fundamentally, inputs in WebXR fall into two basic categories: targeting and actions. Targeting is the specification of a point in space by the user's input. This may involve the user s...
... cursor. Actions include both selection actions, such as clicking on a button, and squeeze actions, such as pulling a trigger or tightening your grip while wearing haptic gloves. By combining these two types of input with the changing of viewing position and/or orientation through the headset or other mechanisms, you can create an interactive simulated environment. Input device types WebXR sup
ports a variety of different types of devices to handle targeting and action inputs. These devices include but aren't limited to: Screen taps (particularly but not necessarily only on phones or tablets) can be used to simultaneously perform both targeting and selection. Motion-sensing controllers, which use accelerometers, magnetometers, and other sensors for motion tracking and targeting and may ...
...targetRayMode property. It describes the technique used to determine the targeting ray and how it should be shown to the user if presented visually. When the targeting ray mode is gaze, the ray's origin is at the viewer and simply aims in the direction the user is facing. This gaze input method is fairly simple, and doesn't need any special controls, as it will be based on the facing direction re
ported by the headset or whatever device is used to determine what direction the viewer's face is pointing in. The target ray should extend outward from between the eyes in a direction perpendicular to the viewer's face. More flexible is the tracked-pointer mode, in which the ray's origin is at a handheld controller or hand tracking system's origin and extends outward in the direction in which the co...
...And 7 more matches
Window.print() - Web APIs
lity The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...iAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetprintChrome Full sup
port 1Notes Full sup
port 1Notes Notes Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.Edge Full sup
port 12Firefox Full sup
port 1IE Full sup
port 5Opera Full sup
port 6Notes Full sup
port 6Notes Notes Starting with Opera 33, this method is blocked inside an <iframe> unless its sandbox attribute h...
...And 7 more matches
WorkerNavigator.permissions - Web APIs
A Permissions object. Examples self.navigator.permissions.query({name:'notifications'}).then(function(result) { if (result.state === 'granted') { showNotification(); } else if (result.state === 'prompt') { requestNotificationPermission() } }); Specification Specification Status Comment Permissions Working Draft Initial definition. Browser Sup
port The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetpermissions ExperimentalChrome ...
...lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
Accessibility Information for Web Authors - Accessibility
The European Union is looking to base their upcoming accessibility regulations on these guidelines. ...
...d to identify errors in webpage related to Section 508 standards and/or the WCAG guidelines. It can perform a "Complete Webpage Quality Check" for accessibility, privacy, searchability, metadata and even alt text attribute quality. The web author chooses the guidelines (as a basis for errors and warnings) to be used by "Cynthia says(TM)": Section 508, WCAG Priorities 1, 2 and 3. The output data re
port is displayed in a clear and well structured table where each and all checkpoints are identified and described (along with an helpful clickable link to the related reference guideline) into logical groups and according to measurable results: passed, warning, failed for automated verification, warning for manual verification, not selected, not available, not related, etc. Accessibility Valet fro...
...rification, not selected, not available, not related, etc. Accessibility Valet from WebThing Description and summary to be written. ...
...And 7 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
Overview Colors, and how they are used, are a major component of accessibility. At the surface, the subject seems simple, but it is actually a complex subject because color is as much about the physiology of the eye and human perception as it is about light emitting from a computer screen. Environment matters. ...
... his eyes is yet another matter, and can be affected by overall health. Luckily, CSS Media Queries Level 5 will be a game-changer in accessibility initiatives, because it will allow users to select settings that accomodate their needs best. Color, contrast, and luminance are among the most central and critical concepts to creating accessible web content with color. Luminance is of particular im
portance, however, because at the end of the day, understanding of what it is and how it is employed enables accessibility for those who are color-blind, as well as those who can perceive color. It is the luminance contrast that enable the color-blind to distinguish dark against light. Luminance must be established before the contrast may be. When speaking of color contrast, W3C formulas are actual...
...rast that enable the color-blind to distinguish dark against light. Luminance must be established before the contrast may be. When speaking of color contrast, W3C formulas are actually incorporating luminance, not just the colors ("hues") themselves. Terminology can be confusing, because different terms are often used to describe the same thing. "Luminance" and "Saturation" are particularly im
portant to get right. For example, "saturation" is known as "chroma" in some circles. In others, "chroma" and "saturation" are two different concepts. The "L" in the HSL color space is sometimes referred to as "luminosity," other times as "lightness." Even something seemingly simple like naming common colors can be open to debate. For example, the color "crimson red" may be described in hex values...
...And 7 more matches
:checked - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ed data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...request. ...
...And 7 more matches
@charset - CSS: Cascading Style Sheets
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
background-position - CSS: Cascading Style Sheets
t.gif"), url("https://mdn.mozillademos.org/files/7693/catfront.png"); background-position: 0px 0px, right 3em bottom 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'background-position' in that specification. Candidate Recommendation Adds sup
port for multiple backgrounds and the four-value syntax. Modifies the percentage definition to match implementations. CSS Level 2 (Revision 1)The definition of 'background-position' in that specification. Recommendation Allows for keyword values and <length> and <percentage> values to be mixed. CSS Level 1The definition of 'background-position' in that specification. Recomme...
...atibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
font-variant-caps - CSS: Cascading Style Sheets
font-variant-caps: all-small-caps; font-variant-caps: petite-caps; font-variant-caps: all-petite-caps; font-variant-caps: unicase; font-variant-caps: titling-caps; /* Global values */ font-variant-caps: inherit; font-variant-caps: initial; font-variant-caps: unset; The font-variant-caps property is specified using a single keyword value from the list below. In each case, if the font doesn't sup
port the OpenType value, then it synthesizes the glyphs. Values normal Deactivates of the use of alternate glyphs. small-caps Enables display of small capitals (OpenType feature: smcp). Small-caps glyphs typically use the form of uppercase letters but are reduced to the size of lowercase letters. all-small-caps Enables display of small capitals for both upper and lowercase letters (OpenType f...
...mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetfont-variant-capsChrome Full sup
port 52Edge Full sup
port 79Firefox Full sup
port 34 Full sup
port 34 No sup
port 24 -- 34Disabled Disabled From version 24 until version 34 (exclusive): this feature is behind the layout.css.font-features.enabled preference (needs to be set to true). To change preferences in Firefo...
...And 7 more matches
Content-Security-Policy - HTTP
ricts the URLs which can be used as the target of a form submissions from a given context. frame-ancestors Specifies valid parents that may embed a page using <frame>, <iframe>, <object>, <embed>, or <applet>. navigate-to Restricts the URLs to which a document can initiate navigation by any means, including <form> (if form-action is not specified), <a>, window.location, window.open, etc. ...
...an be used as the target of a form submissions from a given context. frame-ancestors Specifies valid parents that may embed a page using <frame>, <iframe>, <object>, <embed>, or <applet>. navigate-to Restricts the URLs to which a document can initiate navigation by any means, including <form> (if form-action is not specified), <a>, window.location, window.open, etc. ...
...m submissions from a given context. frame-ancestors Specifies valid parents that may embed a page using <frame>, <iframe>, <object>, <embed>, or <applet>. navigate-to Restricts the URLs to which a document can initiate navigation by any means, including <form> (if form-action is not specified), <a>, window.location, window.open, etc. Re
porting directives Re
porting directives control the re
porting process of CSP violations. ...
...And 7 more matches
WebAssembly.Memory() constructor - JavaScript
embly.Memory object. The first way is to construct it from JavaScript. The following example creates a new WebAssembly Memory instance with an initial size of 10 pages (640KiB), and a maximum size of 100 pages (6.4MiB). Its buffer property will return an ArrayBuffer. var memory = new WebAssembly.Memory({initial:10, maximum:100}); The second way to get a WebAssembly.Memory object is to have it ex
ported by a WebAssembly module. The following example (see memory.html on GitHub, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the WebAssembly.instantiateStreaming() method, while im
porting the memory created in the line above. It then stores some values in that memory, then ex
ports a function and uses it to sum some values. WebAssembly.instantiateStreaming(f...
...You can create a shared memory by passing shared: true in the constructor's initialization object: let memory = new WebAssembly.Memory({initial:10, maximum:100, shared:true}); This memory's buffer property will return a SharedArrayBuffer. ...
...e on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 7 more matches
Digital audio concepts - Web media technologies
an insane amount of network bandwidth to use for a relatively short piece of audio. That's why most digital audio is compressed. The process of compressing and decompressing audio is performed by encoding and decoding it using an audio codec (COder/DEcoder). Over the years, a large variety of codecs have been developed, several of which are commonly used on the web. For details about the most im
portant and useful ones for web developers to be familiar with, see the article Guide to audio codecs used on the web. Audio channels and frames There are two types of audio channel. Standard audio channels are used to present the majority of the audible sound. The sound for the left and right main channels, as well as all of your surround sound speakers (center, left and right rear, left and right ...
... know what kind of audio you're most likely to handle, you can potentially find special filtering techniques applicable specifically to that kind of sound, that will optimize the encoding. The most commonly-used compression methods for audio apply the science of psychoacoustics. This is the science that studies how humans percieve sound, and what parts of the audio frequencies we hear are most im
portant to how we respond to those sounds, given the context and content of the sound. Factors such as the ability to sense the change in frequency of a sound, the overall range of human hearing versus the frequencies of the audio signal, audio localization, and so forth all can be considered by a codec. By using a sound (no pun intended) understanding of psychoacoustics, it's possible to design a co...
... Lossy compression algorithms generally use psychoacou...
...And 7 more matches
OpenSearch description format
The OpenSearch description format lets a website describe a search engine for itself, so that a browser or other client application can use that search engine. OpenSearch is sup
ported by (at least) Firefox, Edge, Internet Explorer, Safari, and Chrome. (See Reference Material for links to other browsers' documentation.) Firefox also sup
ports additional features not in the OpenSearch standard, such as search suggestions and the <SearchForm> element. This article focuses on creating OpenSearch-compatible search plugins that sup
port these additional Firefox features. OpenSearch description files can be advertised as described in Autodiscovery of search plugins, and can be installed programmatically as described in Adding search engines from web pages. OpenSearch description file The XML file ...
... stored in the profile's searchplugins/ folder). http: and https: URLs are converted to data: URIs when this is done. Note: For icons loaded remotely (that is, from https:// URIs as opposed to data: URIs), Firefox will reject icons larger than 10 kilobytes. Url Describes the URL or URLs to use for the search. The template attribute indicates the base URL for the search query. ...
... For search suggestions, the application/x-suggestions+json URL template is used to fetch a suggestion list in JSON format. ...
...And 7 more matches
Web Performance
are buttons clickable? Are pop-ups quick to load and display, and do they animate smoothly as they do so? Web performance includes both objective measurements like time to load, frames per second, and time to become interactive, and subjective experiences of how long it felt like it took the content to load. The longer it takes for a site to respond, the more users will abandon the site. It is im
portant to minimize the loading and response times and add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience. There are tools, APIs, and best practices that help us measure and improve web performance. We cover them in this section: Key performance guid...
...re metrics measuring a browser's document navigation events. Resource timings are detailed network timing measurements regarding the loading of an application's resources.Optimizing startup performanceRegardless of platform, it's always a good idea to start up as quickly as possible. Since that's a universal issue, we won't be focusing on it too much here. Instead, we're going to look at a more im
portant issue when building Web apps: starting up as asynchronously as possible. That means not running all your startup code in a single event handler on the app's main thread.Performance budgetsA performance budget is a limit to prevent regressions. It can apply to a file, a file type, all files loaded on a page, a specific metric (e.g. Time to Interactive), a custom metric (e.g. Time to Hero Elemen...
...to understand how the browser works.Recommended Web Performance Timings: How long is too long?There are no clear set rules as to what constitutes a slow pace when loading pages, but there are specific guidelines for indicating content will load (1 second), idling (50ms), animating (16.7s) and responding to user input (50 to 200ms).The business case for web performanceYou know web performance is im
portant, but how do you convince clients and management to invest in performance and make it a priority. In this article, we'll discuss creating a clear business case to convince decision-makers to make the investment.Understanding latencyLatency is the time it takes for a packet of data to travel from source to a destination. In terms of performance optimization, it's im
portant to optimize to reduce ...
...And 7 more matches
jpm - Archive of obsolete content
Installing npm There are two ways to get npm. ...
... to, install jpm globally, you may instead install it locally: cd $HOME && npm install jpm To run jpm from a terminal when installed locally, you must add the directory "$HOME/node_modules/.bin/" to your terminal's PATH first. Add the following line to the end of the file $HOME/.profile to add it to your PATH permanently (as the file .profile is executed every time a new terminal is opened): ex
port PATH="$HOME/node_modules/.bin/:$PATH" Installing jpm from git Alternatively, you can also get the latest version of jpm using git: git clone https://github.com/mozilla-jetpack/jpm.git cd jpm npm install npm link After installing jpm After installation, at the command prompt, type: jpm You should see a screen summarizing the available jpm commands. Note that unlike cfx, jpm is available in...
...ee Selecting a browser version. Problems? If you do not see this, ask for help. SDK users and project team members discuss problems and proposals on the project mailing list. Someone else may have had the same problem you do, so try searching the list. You are welcome to post a question, too. You can also chat with other SDK users in #jetpack on Mozilla's IRC network. Command reference jpm sup
ports the following commands: jpm init Create a skeleton add-on as a starting point for your add-on. jpm run Launch an instance of Firefox with your add-on installed. jpm test Runs your add-on's unit tests. jpm xpi Package your add-on as an XPI file, which is the install file format for Firefox add-ons. jpm post Package your add-on as an XPI...
...And 6 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
e content area is chrome. Extensions also can be considered XUL applications with chrome. Three kinds of packages make up chrome The content package This package is used to contain the main XUL and JavaScript source files. Most extensions consist of a single content package2 The locale package This package is used to contain language data that can be translated. To make an extension's GUI sup
port multiple languages, you can include multiple locale packages, one for each language. The skin package This is used to include source files used as visual elements in the GUI, including style sheets and images. Most extensions include only one skin package, but you can include multiple skin packages to allow the GUI to change with different themes. Chrome URL Use a file called a "chrome manife...
...f you keep in mind the following three points at the very least, the next section, Developing a Simple Extension, should help flesh out your understanding. An extension's GUI, or chrome, can consist of three kinds of package: content, locale, and skin. Use a cross-package overlay on top of browser.xul to add a button or menu item to the Firefox browser window. The chrome manifest plays two im
portant roles: it registers the contents of the chrome packages, and invokes the cross-package overlay. Developing a Simple Extension: Hello World In this section, we will write an extremely simple "hello world" extension that only displays the time.3 Phase 1: test install Our first step will be to perform a test installation consisting of the minimum code needed to add a new menu item to the T...
...nt for clock.js function initClock() { showCurrentTime(); window.setInterval(showCurrentTime, 1000); } function showCurrentTime() { var textbox = document.getElementById("currentTime"); textbox.value = new Date().toLocaleTimeString(); textbox.select(); } Operations check Perform an operations check to make sure that your changes to the source file are correct. At this point, it's im
portant that you disabled the XUL cache as discussed in the earlier section, "Setting up your development environment". Assuming you've done that, you'll be able to confirm the changes to overlay.xul and clock.xul without the bother of relaunching Firefox or reinstalling the extension. If the browser.xul file, which is the target of the overlay in overlay.xul is being read in again, the changes will b...
...And 6 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
ng and possible approaches for its implementation. It also provides two implementation examples using the model. The first one looks like a traditional DHTML ticker application and uses hidden IFRAMES and JavaScript to provide updates inside the webpage's ticker headlines section. This sample was made using IFRAMEs to illustrate a possible implementation. An implementation can also use other trans
port technologies such as SOAP-based remote procedure calls, XMLHTTPRequest interfaces, or DOM 3 Load. The second example shows a tabbed menu that dynamically loads news headlines into the current web page. This implementation uses XMLHTTPRequest. Extending Traditional Hypertext Navigation The hypertext approach to developing web pages, in which developers format text layouts into pages and link those...
...on The hypertext approach to developing web pages, in which developers format text layouts into pages and link those pages to related content, is analogous to a book or a magazine: readers view pages, go to other pages for more information, and view resources listed as references on that page. HTML and web standards have evolved and now offer flexible and fine-grained control to layout as well sup
porting DHTML, powerful programming languages like JavaScript, and additional media through embeddable third-party resources like Flash, Java, VRML, etc. Additionally, server-side technologies have also evolved, sup
porting and connecting different resources to different browsers. Despite all the evolution, we still see the underpinnings of the original model in modern web sites. We still connect throu...
... simple ticker element implemented in DHTML statically includes the data in the page. If the data changes, it will not update unless you reload the web page. This article includes a ticker example demonstrating that the inner-browsing model can be used to dynamically request new data from the server side and provide updates to the ticker. Spell Check Suppose you have a web publishing system for a
portal, and a spell check application on your server. Today, this publishing system allows your users to modify content for the
portal, but in order to have their text spell checked they must click somewhere and wait for the response page. The inner-browsing model is able to provide users with automatic spell check without leaving the page being edited, a similar experience to a word processor applica...
...And 6 more matches
Source code directories overview - Archive of obsolete content
rticular module. doc contains any documentation associated with this module. idl contains the XPIDL (Cross Platform Interface Definition Language) interface files. Interfaces are used so functionality can be available to both Javascript scripts and C code with as little effort as possible. XPIDL files have their own mini-language and processing tools. public contains source code that will be ex
ported to the dist/include directory. They are not all necessarily public in the general sense; some are only meant for internal use in a certain module. As more code is written with or converted to XPIDL interfaces, the value of the public directory diminishes. src contains the bulk of the source code. tests contains C harnesses, HTML or XUL that exercise this module. tools contains scripts for au...
...S. qt contains source code for the QT toolkit, a C class library which runs on X-Windows on Unix, Windows 95, Windows 98 and Window NT 4.0. photon contains source code for Photon, a microkernel windowing system used in several real-time operating systems from QNX Software Systems Ltd. SeaMonkey SeaMonkey is the development name for the Mozilla browser suite. accessible contains code to sup
port Microsoft Active Accessibility and Sun's ATK accessibility API for Linux. browser contains the code for Firefox. This will be covered below. build contains scripts (usually Perl) and programs used by the Mozilla build team for building and managing the Mozilla code base. These programs coordinate the running of makefiles and the creation of the dist directory. calendar contains the code for th...
...r code level things instead of build level things (which are a stored in the build directory). content was split off from layout and contains objects as they are exposed to the DOM. db contains C code for the mdb/Mork database which is a low-level, general-purpose and cross-platform file library. It is used to store mail box data, news data and global history data. It has not been updated to sup
port XPCOM yet. This code originated in the Mozilla Classic code base. dbm contains C code for managing, reading and writing hash tables. It is used for the auto-completion feature on the URL edit box (stored in netscape.hst in Mozilla Classic) and for the cached pages index (stored in fat.db in Mozilla Classic). This code originated at UC Berkeley. directory contains the LDAP SDK. docshell contain...
...And 6 more matches
Index - Archive of obsolete content
options to specify text or binary writing, the character set, and whether to append to an existing file or create a new one. 434 How to Quit a XUL Application XUL, XULRunner Script can attempt to quit a XUL application, or force the application to quit, using the nsIAppStartup interface. 435 How to implement a custom XUL query processor component XUL sup
ports templating to create a block of content from a datasource query. The XUL Template Guide has lots of detailed information on using XUL templates. XUL provides template query processors for RDF, XML and SQL (mozStorage). The templating system also sup
ports building custom query processors. Custom query processors are XPCOM components, must implement the nsIXULTemplateQueryProcessor interface and ...
...COM components, must implement the nsIXULTemplateQueryProcessor interface and follow some conventions for when registering the component. 436 Index Found 1218 pages: 437 International characters in XUL JavaScript Firefox, Gecko, Guide, Internationalization, JavaScript, Mozilla, XPCOM, XUL Gecko 1.8, as used in Firefox 1.5 and other applications, added sup
port for non-ASCII characters in JavaScript files loaded from XUL files. 438 Introduction to XUL Guide, XUL Mozilla has configurable, downloadable chrome, meaning that the arrangement and even presence or absence of controls in the main window is not hardwired into the application, but loaded from a separate UI description. In fact, most of Mozilla's windows (and dialogs) will be ...
...d property inspector panels. It will have a titlebar which the user may use to move the panel around on the screen. A floating panel can be created using the panel element with at least two additional attributes as in the following example: 601 MenuButtons XUL, XUL Popup Guide Menus may be attached to buttons in several ways. Both the button and the toolbar button elements sup
port two special types used for creating menu buttons. 602 MenuItems XUL, XUL Popup Guide The menuitem element has a number of features beyond just being a label for a menu command. 603 MenuModification XUL, XUL Popup Guide Menus have a number of methods which may be used to add and remove items. 604 Menus XUL, XUL Popup Guide A menu provi...
...And 6 more matches
Complete - Archive of obsolete content
her pages. This page is for readers who have followed the Custom Toolbar Button tutorial for Firefox, Thunderbird and Sunbird, or the Custom Toolbar Button:SeaMonkey tutorial for SeaMonkey, and who want to learn more about developing extensions. Introduction You can use the Custom Toolbar Button tutorial as a very simple introduction to extensions. However, because it is so simple it does not sup
port some of the usual features of extensions. This page describes how to structure the extension in a more conventional way. This page is not a step-by-step tutorial. Instead it explains the missing features, and outlines how to add them. If you want to see these techniques in action, then you can download and install the complete AllCustom extension: allcustom.xpi (The link is external only because...
...ures of extensions. This page describes how to structure the extension in a more conventional way. This page is not a step-by-step tutorial. Instead it explains the missing features, and outlines how to add them. If you want to see these techniques in action, then you can download and install the complete AllCustom extension: allcustom.xpi (The link is external only because this wiki does not sup
port XPI files.) The extension does not contain any useful functions. It is just an extended code sample. To see the code, use a jar tool or zip tool to unpack the XPI file that you downloaded. For more information about developing extensions, see the main Extensions page here. Features of this extension This extension is a more complex version of the original Custom Toolbar Button extension. It provi...
...It is just an extended code sample. To see the code, use a jar tool or zip tool to unpack the XPI file that you downloaded. For more information about developing extensions, see the main Extensions page here. Features of this extension This extension is a more complex version of the original Custom Toolbar Button extension. It provides a user interface in two languages (English and French). It sup
ports Firefox, Thunderbird, Sunbird and Flock--these are referred to as "Firefox etc." in the rest of this page. It also sup
ports SeaMonkey. In SeaMonkey it sup
ports two themes (Classic and Modern). It provides all five custom toolbar buttons on all the toolbars, and it provides corresponding menu choices in SeaMonkey's ChatZilla window. The following sections describe this extension's overall structu...
...And 6 more matches
Visual typescript game engine - Game development
er /build/app.html to see client app in action -The client part is a browser web application. No reloading or redirecting. This is a single page application. I use HTML request only for loading local/staged HTML (like register, login etc.). Networking is based on WebSocket full-duplex communication only.You must be conform with classic socket connection methodology. webRTC can be used for any pro
portion. Already implemented: -video chat webRTC (SIP) chat and data communication. Look back on main staff : -Class 'Connector' (native WebSocket) used for user session staff. For main account session staff like login, register etc. Client config If you want web app without any networking then setup: appUseNetwork: boolean = false; You want to use communication for multiplayer but you don'...
...ant test app with server. */ private domain: string = "maximumroulette.com"; /** * networkDeepLogs control of dev logs for webRTC context only. */ private networkDeepLogs: boolean = false; /** * masterServerKey is channel access id used to connect * multimedia server channel. */ private masterServerKey: string = "multi-platformer-sever1.maximum"; /** * rtcServer
Port Port used to connect multimedia server. * Default value is 12034 */ private rtcServer
Port: number = 12034; /** * connector
Port is access
port used to connect * session web socket. */ private connector
Port: number = 1234; /** * broadcaster
Port Port used to connect multimedia server MultiRTC3. * I will use it for explicit video chat multiplatform sup
port. * Default...
...Use 'false' if you wanna make single player game. * In other way keep it 'true'. ...
...And 6 more matches
Positioning - Learn web development
This article explains the different position values, and how to use them. Prerequisites: HTML basics (study Introduction to HTML), and an idea of How CSS works (study Introduction to CSS.) Objective: To learn how CSS positioning works. ...
...roperty of the ancestors of the positioned element (See Identifying the containing block). If no ancestor elements have their position property explicitly defined, then by default all ancestor elements will have a static position. The result of this is, the absolutely positioned element will be contained in the initial containing block. The initial containing block has the dimensions of the view
port, and is also the block that contains the <html> element. Simply put, the absolutely positioned element will be displayed outside of the <html> element, and be positioned relative to the initial view
port. The positioned element is nested inside the <body> in the HTML source, but in the final layout, it is 30px away from the top and left of the edge of the page. We can change the positioning cont...
...-index.html (see source code). Fixed positioning Let's now look at fixed positioning. This works in exactly the same way as absolute positioning, with one key difference: whereas absolute positioning fixes an element in place relative to its nearest positioned ancestor (the initial containing block if there isn't one), fixed positioning usually fixes an element in place relative to the visible
portion of the view
port, except if one of its ascendants is a fixed containing block due to its transform property being different from none. This means that you can create useful UI items that are fixed in place, like persisting navigation menus that are always visible no matter how much the page scrolls. Let's put together a simple example to show what we mean. First of all, delete the existing p:n...
...And 6 more matches
UI pseudo-classes - Learn web development
te state (neither checked or not checked), and the default selected option when the page loads (e.g. an <input type="checkbox"> with the checked attribute set, or an <option> element with the selected attribute set). There are many others too, but the ones listed above are the most obviously useful. Some of the others are aimed at solving very specific niche problems, or simply not very well sup
ported in browsers yet. The ones listed above all have pretty good browser sup
port, but of course, you should test your form implementations carefully to make sure they work for your target audience. Note: A number of the pseudo-classes discussed here are concerned with styling form controls based on their validation state (is their data valid, or not?) You'll learn much more about setting and contr...
...g label (see it live here, and see the source code here). First of all, we'll add a paragraph to the top of the form to say what you are looking for: <p>Required fields are labelled with "required".</p> Screenreader users will get "required" read out as an extra bit of information when they get to each required input, which sighted users will get our label. ...
... <span> rather than the <body> (The generated content acts as though it is a child node of the element it is generated on, for the purposes of positioning). Then we give the generated content the content "required", which is what we wanted our label to say, and style and position it as we want. The result is seen below. Styling controls based on whether their data is valid The other really im
portant, fundamental concept in form validation is whether a form control's data is valid or not (in the case of numerical data, we can also talk about in-range and out-of-range data). Form controls with constraint limitations can be targeted based on these states. :valid and :invalid You can target from control using the :valid and :invalid pseudo-classes. Some points worth bearing in mind: Cont...
...And 6 more matches
Introduction to events - Learn web development
Previous Overview: Building blocks Next Events are actions or occurrences that happen in the system you are programming, which the system tells you about so you can respond to them in some way if desired. For example, if the user selects a button on a webpage, you might want to respond to that action by displaying an information box. In this article, we discuss some im
portant concepts surrounding events, and look at how they work in browsers. This won't be an exhaustive study; just what you need to know at this stage. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript first steps. Objective: To understand the fundamental theory of events, how they work in browsers, and how events may differ in different programming envir...
...n different programming environments. A series of fortunate events As mentioned above, events are actions or occurrences that happen in the system you are programming -- the system produces (or "fires") a signal of some kind when an event occurs, and provides a mechanism by which an action can be automatically taken (that is, some code running) when the event occurs. For example, in an air
port, when the runway is clear for take off, a signal is communicated to the pilot. As a result, the plane can safely takeoff. In the case of the Web, events are fired inside the browser window, and tend to be attached to a specific item that resides in it -- this might be a single element, set of elements, the HTML document loaded in the current tab, or the entire browser window. There are many di...
...stener() and removeEventListener() reference pages. What mechanism should I use? Of the three mechanisms, you shouldn't use the HTML event handler attributes -- these are outdated, and bad practice, as mentioned above. The other two are relatively interchangeable, at least for simple uses: Event handler properties have less power and options, but better cross-browser compatibility (being sup
ported as far back as Internet Explorer 8). You should probably start with these as you begin learning. DOM Level 2 Events (addEventListener(), etc.) are more powerful, but can also become complex and are less well sup
ported (sup
ported as far back as Internet Explorer 9). You should also experiment with these, and try to use them where possible. The main advantages of the third mechanism are that y...
...And 6 more matches
Accessibility in React - Learn web development
back to the "Edit" button. Targeting our elements In order to focus on an element in our DOM, we need to tell React which element we want to focus on and how to find it. React's useRef hook creates an object with a single property: current. This property can be a reference to anything we want and look that reference up later. It's particularly useful for referring to DOM elements. Change the im
port statement at the top of Todo.js so that it includes useRef: im
port React, { useRef, useState } from "react"; Then, create two new constants beneath the hooks in your Todo() function. Each should be a ref - one for the "Edit" button in the view template and one for the edit field in the editing template. const editFieldRef = useRef(null); const editButtonRef = useRef(null); These refs have a d...
...useEffect() is so named because it runs after React renders a given component, and will run any side-effects that we'd like to add to the render process, which we can't run inside the main function body. useEffect() is useful in the current situation because we cannot focus on an element until after the <Todo /> component renders and React knows where our refs are...
...ook: useEffect(). useEffect() is so named because it runs after React renders a given component, and will run any side-effects that we'd like to add to the render process, which we can't run inside the main function body. useEffect() is useful in the current situation because we cannot focus on an element until after the <Todo /> component renders and React knows where our refs are. Change the im
port statement of Todo.js again to add useEffect: im
port React, { useEffect, useRef, useState } from "react"; useEffect() takes a function as an argument; this function is executed after the component renders. Let's see this in action; put the following useEffect() call just above the return statement in the body of Todo(), and pass into it a function that logs the words "side effect" to your consol...
...And 6 more matches
Rendering a list of Vue components - Learn web development
nt object, containing a ToDoItems field whose value is an array of todo items. While we'll eventually add a mechanism to add new todo items, we can start with some mock to do items. Each to-do item will be represented by an object with a name and a done property. Add a few sample to-do items, along the lines of those seen below. This way you have some data available for rendering using v-for. ...
... same element that you attach v-for to. To make sure that Vue can accurately compare the key attributes, they need to be string or numeric values. While it would be great to use the name field, this field will eventually be controlled by user input, which means we can't guarantee that the names would be unique. We could use lodash.uniqueid(), however, like we did in the previous article. ...
...need to be string or numeric values. While it would be great to use the name field, this field will eventually be controlled by user input, which means we can't guarantee that the names would be unique. We could use lodash.uniqueid(), however, like we did in the previous article. ...
...And 6 more matches
Introduction to cross browser testing - Learn web development
developer, it is your responsibility to make sure that not only do your projects work, but they work for all your users, no matter what browser, device, or additional assistive tools they are using. You need to think about: Different browsers other than the one or two that you use regularly on your devices, including slightly older browsers that some people might still be using, which don't sup
port all the latest, shiniest CSS and JavaScript features. Different devices with different capabilities, from the latest greatest tablets and smartphones, through smart TVs, right down to cheap tablets and even older feature phones that may run browsers with limited capabilities. People with disabilities, who use the Web with the aid of assistive technologies like screenreaders, or don't use a mous...
... back when IE4 and Netscape 4 were competing to be the dominant browser in the 1990s, browser companies deliberately implemented things differently to each other to try to gain competitive advantage, which made life hell for developers. Browsers are much better at following standards these days, but differences and bugs still creep through sometimes. some browsers may have different levels of sup
port for technology features than others. This is inevitable when you are dealing with bleeding edge features that browsers are just getting round to implementing, or if you have to sup
port really old browsers that are no longer being developed, which may have been frozen (i.e. no more new work done on them) a long time before a new feature was even invented. As an example, if you want to use cutting ...
... some devices may have constraints that cause a web site to run slowly, or display badly. ...
...And 6 more matches
mach
use the file pointed to in that variable. If the current working directory mach is invoked with is inside an object directory, the mozconfig used when creating that object directory is used. The default mozconfig search logic is applied. Here are some examples: # Use an explicit mozconfig file. $ MOZCONFIG=/path/to/mozconfig ./mach build # Alternatively (for persistent mozconfig usage): $ ex
port MOZCONFIG=/path/to/mozconfig $ ./mach build # Let's pretend the MOZCONFIG environment variable isn't set. This will use # the mozconfig from the object directory. $ cd objdir-firefox $ mach build Adding mach to your shell's search path If you add mach to your path (by modifying the PATH environment variable to include your source directory, or by copying mach to a directory in the default path...
...default system encoding). Failed commands spew lots of extra error output, e.g. you will see a big mach error message when all that happened was an invoked command returned a non-0 exit code - possibly expectedly so in Mozilla! Generally, mach is known to work pretty well without issues for most people and works terribly for others with even the "basics" being quite unsatisfactory. How do I re
port bugs? Bugs against the mach core can be filed in Bugzilla in the Firefox Build System::Mach Core. Most mach bugs are bugs in individual commands, not bugs in the core mach code. Bugs for individual commands should be filed against the component that command is related to. For example, bugs in the build command should be filed against Firefox Build System :: General. Bugs against testing comman...
...here should not be any ideally). However - mach does offer some additional features over manual invocation of client.mk: If on Windows, mach will automatically use pymake instead of GNU make, as that is preferred on Windows. mach will print timings with each line of output from the build. This gives you an idea of how long things take. mach will colorize terminal output (on terminals that sup
port it - typically most terminals except on Windows) mach will scan build output for compiler warnings and will automatically record them to a database which can be queried with mach warnings-list and mach warnings-summary. Not all warnings are currently detected. Do not rely on mach as a substitute for raw build output. mach will invoke make in silent mode. This suppresses excessive (often unncess...
...And 6 more matches
IME handling guide
ositionUpdate into the DOM tree directly and modifies the last data. The eCompositionUpdate event will cause a DOM compositionupdate event. When this receives eCompositionCommitAsIs or eCompositionCommit, this dispatches an eCompositionEnd event which will cause a DOM compositionend event after dispatching eCompositionUpdate event and/or eCompositionChange event if necessary. One of the other im
portant jobs of this is, when a focused editor handles a dispatched eCompositionChange event, this modifies the stored composition string and its clause information. The editor refers the stored information for creating or modifying a text node representing a composition string. And before dispatching eComposition* events, this class removes ASCII control characters from dispatching composition event...
...ming may not be safe actually, but it causes a lot of oranges of automated tests. See also Notifications to IME section for the detail of sending notifications. Currently, WidgetQueryContentEvent is handled via IMEContentObserver because if it has a cache of selection, it can set reply of eQuerySelectedText event only with the cache. That is much faster than using ContentEventHandler. e10s sup
port Even when a remote process has focus, native IME handler in chrome process does its job. So, there is process boundary between native IME handler and focused editor. Unfortunately, it's not allowed to use syncronous communication from chrome process to a remote process. This means that chrome process (and also native IME and our native IME handler) cannot query the focused editor contents direct...
...en TabParent receives notification from corresponding remote process, it assigns ContentCacheInParent new ContentCache and post the notification to ContentCacheInParent. If all sent WidgetCompositionEvents and WidgetSelectionEvents are already handled in the remote process, ContentCacheInParent sending the notifications to widget. And also this handles WidgetQueryContentEvents with its cache. Sup
ported event messages of them are: eQuerySelectedText (only with SelectionType::eNormal) eQueryTextContent eQueryTextRect eQueryCaretRect eQueryEditorRect Additionally, this does not sup
port query content events with XP line breakers but this must not be any problem since native IME handlers query contents with native line breakers. ContentCacheInParent also manages sent WidgetCompositionEve...
...And 6 more matches
Downloads.jsm
The Downloads.jsm JavaScript code module provides a single entry point to interact with the downloading capabilities of the platform, including starting new downloads, controlling ongoing downloads, and retrieving download-related configuration. To use it, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/Downloads.jsm"); Method overview Promise<Download> createDownload(Object aProperties); Promise<void> fetch(aSource, aTarget, [optional] Object aOptions); Promise<DownloadList> getList(aType); Promise<DownloadSummary> getSummary(aType); Constants Constant Description PUBLIC Work on downloads that were not started from a private browsing window. PR...
...e present until the getList() method is called. Promise<DownloadSummary> getSummary(aType); Parameters aType This can be Downloads.PUBLIC, Downloads.PRIVATE, or Downloads.ALL. Promise resolves to The requested DownloadSummary object. Examples Downloading to a local file This example downloads an HTML file without showing progress, handling errors programmatically. ...
...Summary> getSummary(aType); Parameters aType This can be Downloads.PUBLIC, Downloads.PRIVATE, or Downloads.ALL. Promise resolves to The requested DownloadSummary object. Examples Downloading to a local file This example downloads an HTML file without showing progress, handling errors programmatically. ...
...And 6 more matches
PromiseWorker.jsm
Like ChromeWorker objects, PromiseWorker is mostly used for js-ctypes but it is not limited to that. There is no XPCOM access, similar to ChromeWorker. This answers the question "When should I use a PromiseWorker?", and the answer is, whenever you would normally use a ChromeWorker, but want postMessage to return promises. ...
...e a PromiseWorker. As well known with workers, there is a minimum of two files required. The worker file, and the main thread file. The following sections tell you which content to use in your worker and main thread files, in order to use PromiseWorker objects. Worker file There is some standard templating that must be dropped into the worker file by the developer. ...
... with workers, there is a minimum of two files required. The worker file, and the main thread file. The following sections tell you which content to use in your worker and main thread files, in order to use PromiseWorker objects. Worker file There is some standard templating that must be dropped into the worker file by the developer. The require.js file must be im
ported with WorkerGlobalScope/im
portScripts(). Next, the PromiseWorker.js file should be brought in with the require() method. Finally, the template code should be added in. The code below is what should be copied and pasted: im
portScripts('resource://gre/modules/workers/require.js'); let PromiseWorker = require('resource://gre/modules/workers/PromiseWorker.js'); // Instantiate AbstractWorker (see below). let worker = new PromiseW...
...And 6 more matches
Localization content best practices
ibute to the localization of Mozilla products, you might want to read our Localization quick start guide for information on localizing Mozilla code. Note on localizers Mozilla localizers are volunteers with very diverse technical skills: some of them rely exclusively on translation tools, others prefer to work directly with text editors and don't have problems working with VCS systems. It's im
portant to consider this when adding strings, and especially localization comments for strings that contain references, or obscure technical details. Localization files Choose good key IDs The IDs (names) chosen for your keys, regardless of the file format, should always be descriptive of the string, and its role in the interface (button label, title, etc.). Think of them as long variable names. Wh...
...neweventbtn.accesskey = A neweventbtn.tooltip = Add a new event Don't duplicate IDs If you're adding new strings, check that you're not duplicating an existing ID. Depending on the parser logic, one of these two translations will be ignored. Add localization notes Localizers usually work on the localizable files without the context of the source files including the localized strings; it is im
portant to add comments to the localizable files themselves, too. These comments are generally referred to as localization notes. Don't forget to add a localization note when: Part of the string is not supposed to be localized (for example, the name of an HTML attribute in a warning). String includes variables: always explain what will be the value of these variables at run-time. English could b...
...(for example, the name of an HTML attribute in a warning). String includes variables: always explain what will be the value of these variables at run-time. English could be ambiguous. For example: bookmark. Is this a noun or a verb? Using meaningful IDs could also help in these cases. Strings are used in a specific context. For example accessibility (a11y) strings: in this case space is less im
portant than clarity, since these strings are not displayed in the UI but used by tools like screen readers. There is an established format for localization comments: it's im
portant to follow the format as closely as possible, since there are a number of automated tools that parse these comments for easier access and use by localizers. DTD files <!-- LOCALIZATION NOTE (entity name): {{privacy}} wi...
...And 6 more matches
Localizing with Mozilla Translator
If you decide to use MozillaTranslator, be sure you have Java 1.7 or above installed on your system. Like most CAT tools, MozillaTranslator employs glossaries and translation memory to leverage your work from previous translations, thus cutting time and effort when localizing new versions of Mozilla applications. ...
...he strings have yet to be translated. You can save your work in progress and reopen it to continue working by selecting View Fuzzy from the Edit menu. After translating those strings (if using the Edit Phrase dialog, you can get translation suggestions for strings having an original text equal to existing translations), you can run some automated tests to detect typical errors. After that, you ex
port either the whole product or indvididual files. Finally, you commit your changes outside of MT, using your favorite repository tools. Recipes Introduction We aim to put here some recipes that may be useful at a certain moment for MT users, but that, due to its temporary nature, don't fit in the user manual. Migrating contents when the directory structure changes Overall, if you are a ''g...
...rall, if you are a ''good'' MT user and you do things like: checking "Keep Original" flags for strings not needing translation, instead of just leaving the translation empty struggling to get empty lists when running "Untranslated strings" and "View Fuzzy" if you are up to date in localization regularly running QA checks and trying to minimize them. you will always do better if you can ex
port a partial glossary and reim
port it as needed. See the following example. Let's assume you have a Firefox product in MT with the directory layout present in language packs, as you probably would need for a initial localization. The directory structure will look like this: (ab-CD JAR root) locale |-- branding | |-- brand.dtd | `-- brand.properties |-- browser | |-- aboutDialog...
...And 6 more matches
Mozilla DOM Hacking Guide
Mozilla's DOM is coded almost entirely in C++. Seriously hacking on it requires excellent knowledge of C++ and XPCOM, Mozilla's own component model. In this document I will try to outline the main aspects of the implementation, beginning with the Class Info mechanism, which lies at the heart of the DOM, then with the description of various interfaces and classes. Since I am myself still learning how it works, don't expect this to be a complete reference quite yet. ...
...PCOM for the DOM. Otherwise, for more detailed XPCOM documentation, please see the XPCOM project page. Class Info and Helper Classes Introduction to Class Info Class Info is what gives the DOM classes their correct behavior when used through XPConnect. It lies at the heart of the famous "XPCDOM landing" that happened in May. We will talk a lot about XPConnect in this document, since it is so im
portant for the DOM. By "correct behavior", I mean "the intended behavior with respect to the specification or de facto standard". We will see that Class Info is mainly used to implement the DOM Level 0. The W3C DOM is mainly implemented in IDL. The goals of Class Info are twofold: Interface flattening, and implementing behaviors that are not possible with IDL alone. A brief introduction to JavaScrip...
...nt passed to NS_DEFINE_CLASSINFO_DATA_WITH_NAME. PRBool mHasClassInterface: 1; : Help me? mName and mConstructorFptr, mScriptableFlags and mHasInterface are initialized by NS_DEFINE_CLASSINFO_DATA_WITH_NAME. mCachedClassInfo, mProtoChainInterface and mInterfaces, however, are initialized in nsDOMClassInfo::Init(), described in Section 1.5. Interface flattening One of the nicest -- and most im
portant -- features of the XPConnect'ed DOM is the interface flattening. "Interface flattening is the ability to call methods on an object regardless of the interface it was defined on." For example, when we have the document object in JavaScript, we can call indistinctly document.getElementById(), or document.addEventListener(), although they are defined on two different interfaces (DOMDocument and D...
...And 6 more matches
NSS Sample Code Sample_2_Initialization of NSS
"Enter a password which will be used to encrypt your keys.\n" "The password should be at least 8 characters long,\n" "and should contain at least one non-alphabetic character.\n\n"); output = fopen("/dev/tty", "w"); if (output == NULL) { PR_fprintf(PR_STDERR, "Error opening output terminal for write\n"); return NULL; } for (;;) { if (p0)
PORT_Free(p0); p0 = GetPassword(input, output, "Enter new password: ", CheckPassword); if (p1)
PORT_Free(p1); p1 = GetPassword(input, output, "Re-enter password: ", CheckPassword); if (p0 && p1 && !
PORT_Strcmp(p0, p1)) { break; } PR_fprintf(PR_...
...eckPassword); if (p1)
PORT_Free(p1); p1 = GetPassword(input, output, "Re-enter password: ", CheckPassword); if (p0 && p1 && !
PORT_Strcmp(p0, p1)) { break; } PR_fprintf(PR_STDERR, "Passwords do not match. ...
... if (p1)
PORT_Free(p1); p1 = GetPassword(input, output, "Re-enter password: ", CheckPassword); if (p0 && p1 && !
PORT_Strcmp(p0, p1)) { break; } PR_fprintf(PR_STDERR, "Passwords do not match. ...
...And 6 more matches
Initialize NSS database - sample 2
"Enter a password which will be used to encrypt your keys.\n" "The password should be at least 8 characters long,\n" "and should contain at least one non-alphabetic character.\n\n"); output = fopen("/dev/tty", "w"); if (output == NULL) { PR_fprintf(PR_STDERR, "Error opening output terminal for write\n"); return NULL; } for (;;) { if (p0)
PORT_Free(p0); p0 = GetPassword(input, output, "Enter new password: ", CheckPassword); if (p1)
PORT_Free(p1); p1 = GetPassword(input, output, "Re-enter password: ", CheckPassword); if (p0 && p1 && !
PORT_Strcmp(p0, p1)) { break; } PR_fprintf(PR_...
...eckPassword); if (p1)
PORT_Free(p1); p1 = GetPassword(input, output, "Re-enter password: ", CheckPassword); if (p0 && p1 && !
PORT_Strcmp(p0, p1)) { break; } PR_fprintf(PR_STDERR, "Passwords do not match. ...
... if (p1)
PORT_Free(p1); p1 = GetPassword(input, output, "Re-enter password: ", CheckPassword); if (p0 && p1 && !
PORT_Strcmp(p0, p1)) { break; } PR_fprintf(PR_STDERR, "Passwords do not match. ...
...And 6 more matches
NSS tools : modutil
c to load into the security database. -ciphers cipher-enable-list Enable specific ciphers in a module that is being added to the database. The cipher-enable-list is a colon-delimited list of cipher names. Enclose this list in quotation marks if it contains spaces. -dbdir [sql:]directory Specify the database directory in which to access or create security module database files. modutil sup
ports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new SQLite databases (cert9.db, key4.db, and pkcs11.txt). If the prefix sql: is not used, then the tool assumes that the given databases are in the old format. --dbprefix prefix Specify the prefix used on the database files, such as my_ for my_cert8.db. This option is provided as a special case. C...
...lagged as a default provider. The mechanism-list is a colon-delimited list of mechanism names. Enclose this list in quotation marks if it contains spaces. The module becomes a default provider for the listed mechanisms when those mechanisms are enabled. If more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. modutil sup
ports several mechanisms: RSA, DSA, RC2, RC4, RC5, AES, DES, DH, SHA1, SHA256, SHA512, SSL, TLS, MD5, MD2, RANDOM (for random number generation), and FRIENDLY (meaning certificates are publicly readable). -newpwfile new-password-file Specify a text file containing a token's new or replacement password so that a password can be entered automatically with the -changepw option. -nocertdb Do not ...
...y is used. Usage and Examples Creating Database Files Before any operations can be performed, there must be a set of security databases available. modutil can be used to create these files. The only required argument is the database that where the databases will be located. modutil -create -dbdir [sql:]directory Adding a Cryptographic Module Adding a PKCS #11 module means submitting a sup
porting library file, enabling its ciphers, and setting default provider status for various security mechanisms. This can be done by supplying all of the information through modutil directly or by running a JAR file and install script. For the most basic case, simply upload the library: modutil -add modulename -libfile library-file [-ciphers cipher-enable-list] [-mechanisms mechanism-list] For e...
...And 6 more matches
NSS tools : modutil
Enable specific ciphers in a module that is being added to the database. The cipher-enable-list is a colon-delimited list of cipher names. Enclose this list in quotation marks if it contains spaces. -dbdir [sql:]directory Specify the database directory in which to access or create security module database files. modutil sup
ports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new SQLite databases (cert9.db, key4.db, and pkcs11.txt). If the prefix sql: is not used, then the tool assumes that the given databases are in the old format. --dbprefix prefix Specify the prefix used on the database files, such as my_ for ...
...elimited list of mechanism names. Enclose this list in quotation marks if it contains spaces. The module becomes a default provider for the listed mechanisms when those mechanisms are enabled. If more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. modutil sup
ports several mechanisms: RSA, DSA, RC2, RC4, RC5, AES, DES, DH, SHA1, SHA256, SHA512, SSL, TLS, MD5, MD2, RANDOM (for random number generation), and FRIENDLY (meaning certificates are publicly readable). -newpwfile new-password-file Specify a text file containing a token's new or replacement password so that a password can be entered automat...
...nd Examples Creating Database Files Before any operations can be performed, there must be a set of security databases available. modutil can be used to create these files. The only required argument is the database that where the databases will be located. modutil -create -dbdir [sql:]directory Adding a Cryptographic Module Adding a PKCS #11 module means submitting a sup
porting library file, enabling its ciphers, and setting default provider status for various security mechanisms. This can be done by supplying all of the information through modutil directly or by running a JAR file and install script. For the most basic case, simply upload the library: modutil -add modulename -libfile library-file [-ciphers cipher-enable-list] [-mechanisms mechanism-lis...
...And 6 more matches
Creating JavaScript jstest reftests
The js/src/tests directories test files are run by the jstest harness in the shell and the reftest harness in the browser. This directory contains tests of SpiderMonkey conformance to ECMAScript as well as SpiderMonkey non-standard extenstions to ECMAScript. Directory Overview In the js/src/tests directory, there are a few im
portant subdirectories. non262 tests The directory js/src/tests/non262/ should contain all tests of the following type: Regressions of SpiderMonkey Non-standard SpiderMonkey extensions to the JavaScript language Test of "implementation-defined" details of the ECMAScript Standard For example, the exact definition of pi or some details of array sorting. You should not add tests of the following type: Tests of the JIT Test of JIT corre...
... ECMAScript, and many of those tests remain in the js/src/non262 directory as regressions. test262 tests Test262 is the implementation conformance test suite for the latest drafts of ECMAScript Language Specification, as well as Internationalization API Specification and The JSON Data Interchange Format. It is maintained by TC39, the ECMAScript Standard's technical committee. Mozilla manually im
ports these tests into the js/src/tests/test262 directory. You should contribute directly to Test262 in the following scenarios: You are writing tests for the implementation of a new feature or feature proposal for ECMAScript. If tests for the new feature proposal do not yet exist in Test262 (they might!), contributing to Test262 will allow all other JavaScript implementors to use your test...
...ntation of a new feature or feature proposal for ECMAScript. If tests for the new feature proposal do not yet exist in Test262 (they might!), contributing to Test262 will allow all other JavaScript implementors to use your tests as well. You would like to contribute tests of an ECMAScript, Intl or JSON feature insufficiently covered by Test262. At the time of this writing, Mozilla im
ports Test262 tests in to the directory js/src/tests/test262. When im
porting Test262, the test file's in-file metadata is translated from Test262 format to a format readibly by the jstest harness. If you are contributing directly to Test262, you must submit the tests in the Test262 format, which you can see in the Test262 git repository and read about here. An update script exists in the js/src/test...
...And 6 more matches
Places Developer Guide
ccess other properties of the visit. // The time is the time at which the visit occurred, in microseconds. }, onItemMoved: function(id, oldParent, oldIndex, newParent, newIndex) { // oldParent and newParent are the ids of the old and new parent folders of the moved item. ...
...ver) || iid.equals(Ci.nsISup
ports)) { return this; } throw Cr.NS_ERROR_NO_INTERFACE; }, }; // Register the observer with the bookmarks service var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getService(Ci.nsINavBookmarksService); bmsvc.addObserver(observer, false); // Un-register the observer when done. bmsvc.removeObserver(observer); HTML Im
port/Ex
port The nsIPlacesIm
portEx
portService service is used for im
port and ex
port of bookmarks in the Netscape Bookmarks HTML format. Note that this service is only currently available for Firefox, not other toolkit-based applications. ...
... .getService(Ci.nsINavBookmarksService); bmsvc.addObserver(observer, false); // Un-register the observer when done. bmsvc.removeObserver(observer); HTML Im
port/Ex
port The nsIPlacesIm
portEx
portService service is used for im
port and ex
port of bookmarks in the Netscape Bookmarks HTML format. Note that this service is only currently available for Firefox, not other toolkit-based applications. Im
porting: im
portHTMLFromFile (nsILocalFile aFile, boolean aIsInitialIm
port) - This im
ports all the bookmarks in the specified file into the current bookmarks collection. ...
...And 6 more matches
Accessing the Windows Registry Using XPCOM
nting Windows-specific functionality, it is often useful to access the Windows registry for information about the environment or other installed programs. To this end, there exist XPCOM interfaces to read and write registry data. This article will show you how to use the available interfaces in several Mozilla products. The examples in this document are all written in JavaScript using XPCOM. Sup
port in Firefox 1.5 or newer In Firefox 1.5, a new API was added, nsIWindowsRegKey, which provides extensive registry functionality. The interface follows the Windows API fairly closely, but with many of the low-level details taken care of for you. If you are writing an extension that only needs to sup
port Firefox 1.5 or newer, then you only need to read this section. A simple example Here's a simp...
...First, you must use createInstance() to get an object implementing this interface, not getService(). Second, you must call open() on the key before attempting to read a value. Notice in the open() call that the root key to use is specified using the named constants available on the nsIWindowsRegKey interface, in this case ROOT_KEY_LOCAL_MACHINE, which corresp...
...stants available on the nsIWindowsRegKey interface, in this case ROOT_KEY_LOCAL_MACHINE, which corresponds to HKEY_LOCAL_MACHINE in the Windows registry. Also notice that the path to the key has backslashes escaped, a necessity in JavaScript and C++ string constants. The desired access rights are specified using a named constant from the interface, in this example ACCESS_READ. This can be very im
portant when dealing with non-Administrator accounts with restricted privileges. The value is read using readStringValue(). You have to specify what type of data you expect to read, which we will expand on later. Finally, note that you should close the key when you are done to avoid wasting system resources. Opening Registry Keys Before doing anything with a registry key you must first open the key...
...And 6 more matches
Generic factory
mentation of nsIFactory is needed. Here is the interface, and a description of its use. /** * Provides a Generic nsIFactory implementation that can be used by * DLLs with very simple factory needs. */ class nsIGenericFactory : public nsIFactory { public: static const nsIID& IID() { static nsIID iid = NS_IGENERICFACTORY_IID; return iid; } typedef NS_CALLBACK(ConstructorProcPtr) (nsISup
ports *aOuter, REFNSIID aIID, void **aResult); /** * Establishes the generic factory's constructor function, which will be called * by CreateInstance. */ NS_IMETHOD SetConstructor(ConstructorProcPtr constructor) = 0; }; Using nsIGenericFactory is simple. Create a new instance from the repository with a CID of NS_GENERICFACTORY_CID, and and IID of NS_IGENERICFACTORY_IID. Defin...
...ericFactory is simple. Create a new instance from the repository with a CID of NS_GENERICFACTORY_CID, and and IID of NS_IGENERICFACTORY_IID. Define a constructor function that matches the ConstructorProcPtr prototype, and call nsIGenericFactory::SetConstructor with a pointer to that function. You're done. You now have a fully functional factory object. ...
...tches the ConstructorProcPtr prototype, and call nsIGenericFactory::SetConstructor with a pointer to that function. You're done. You now have a fully functional factory object. ...
...And 6 more matches
nsIClipboard
widget/nsIClipboard.idlScriptable This interface sup
ports basic clipboard operations such as: setting, retrieving, emptying, matching and sup
porting clipboard data. ...
... widget/nsIClipboard.idlScriptable This interface sup
ports basic clipboard operations such as: setting, retrieving, emptying, matching and sup
porting clipboard data. ...
... The kSelectionClipboard is peculiar to the X Windows System, where it refers to the PRIMARY selection, which is the one that simple mouse selection and middle-click paste oper...
...And 6 more matches
nsIDOMNSHTMLDocument
dom/interfaces/html/nsIDOMNSHTMLDocument.idlScriptable This interface defines methods and properties sup
ported by Gecko on the document object that are not part of DOM Level 2. ...
... dom/interfaces/html/nsIDOMNSHTMLDocument.idlScriptable This interface defines methods and properties sup
ported by Gecko on the document object that are not part of DOM Level 2. ...
...execCommandShowHelp(in DOMString commandID); Obsolete since Gecko 14.0 DOMString getSelection(); nsIDOMDocument open(in ACString aContentType, in boolean aReplace); boolean queryCommandEnabled(in DOMString commandID); boolean queryCommandIndeterm(in DOMString commandID); boolean queryCommandState(in DOMString commandID); boolean queryCommandSup
ported(in DOMString commandID); DOMString queryCommandText(in DOMString commandID); Obsolete since Gecko 14.0 DOMString queryCommandValue(in DOMString commandID); void releaseEvents(in long eventFlags); void routeEvent(in nsIDOMEvent evt); void write(); Obsolete since Gecko 2.0 void writeln(); Obsolete since Gecko 2.0 Attributes Attr...
...And 6 more matches
nsIURI
netwerk/base/public/nsIURI.idlScriptable This is an interface for an uniform resource identifier with internationalization sup
port, offering attributes that allow setting and querying the basic components of a URI, and methods for performing basic operations on URIs. Inherits from: nsISup
ports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) See the following RFCs for details: RFC3490: Internationalizing Domain Names in Applications (IDNA) RFC3986: Uniform Resource Identifier (URI): Generic Syntax RFC3987: Internationalized Resource Identifiers Subclasses of nsIURI, such as nsIURL, impose further structure on the URI. To create an nsIURI object, you should use nsIIOService.newURI(), like this: function makeURI(aURL, aOriginCharset, aBaseURI) { ...
...hould use nsIIOService.newURI(), like this: function makeURI(aURL, aOriginCharset, aBaseURI) { var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); return ioService.newURI(aURL, aOriginCharset, aBaseURI); } Components of a URI prePath path scheme userPass host
port ref ftp :// username@password @ hostname :
portnumber /pathname?query=value #ref Method overview nsIURI clone(); nsIURI cloneIgnoringRef(); boolean equals(in nsIURI other); boolean equalsExceptRef(in nsIURI other); AUTF8String resolve(in AUTF8String relativePath); boolean schemeIs(in strin...
... The URI host with an ASCII compatible encoding. Follows the IDNA draft specification for converting internationalized domain names (UTF-8) to ASCII for compatibility with existing Internet infrastructure. Read only. Note: IPv6 addresses are not enclosed in square brackets. asciiSpec ACString (US-ASCII) The URI spec with an ASCII compatible encoding. The host
portion follows the IDNA draft spec. Other parts are URL-escaped per the rules of RFC3986. The result is strictly ASCII. Read only. hasRef boolean Returns if there is a reference
portion (the part after the "#") of the URI. host AUTF8String The host is the Internet domain name to which this URI refers. It could be an IPv4 (or IPv6) address literal. If suppo...
...And 6 more matches
nsIWebSocketListener
netwerk/protocol/websocket/nsIWebSocketListener.idlScriptable Implement this interface to receive WebSocket traffic events asynchronously after calling nsIWebSocketChannel.asyncOpen(). ...
... netwerk/protocol/websocket/nsIWebSocketListener.idlScriptable Implement this interface to receive WebSocket traffic events asynchronously after calling nsIWebSocketChannel.asyncOpen(). ...
...his interface to receive WebSocket traffic events asynchronously after calling nsIWebSocketChannel.asyncOpen(). ...
...And 6 more matches
Weak reference
owed to dangle, therefore, the pointer should be a owning reference. This design, however, is flawed, as it holds the observer in existence longer than would otherwise be necessary. The observer may only need a short life compared to the thing being observed. It might go away after the first interesting event, even. But in this design, by hitching its life to the observable, it is kept on life-sup
port long past any need or use. What is actually needed in this case, is either out-of-band signaling, where when the observer wants to go away, it unregisters itself from the observable, which then releases its owning reference, allowing the observer to die, or else a new kind of reference. This document describes an implementation ofweak references. A weak reference does not hold its referent in ex...
...ved) owning reference nsCOMPtr<nsIFoo> tempFooPtr = do_QueryReferent(weakPtr); if ( tempFooPtr ) tempFooPtr->SomeFooMethod(...); // else, the `real' object has gone away } In a real world example, however, you are more likely to be holding a weak reference in a member variable. ...
...You can extrapolate from managing a single observer to managing a list of observers. class nsObservable { public: // ... nsresult AddObserver( nsIObserver* ); nsresult NotifyObservers( nsIMessage* ); // ... private: nsWeakPtr mObserver; // ...or imagine a list of observers here }; // ... ...
...And 6 more matches
Version, UI, and Status Information - Plugins
nor version numbers for the browser and the Plug-in API. int plugin_major, plugin_minor, netscape_major, netscape_minor; // declare variables to hold version numbers void NPN_Version( &plugin_major, &plugin_minor, &netscape_major, &netscape_minor ); // find version numbers Finding Out if a Feature Exists A plug-in can figure out whether it is running in a version of the browser that sup
ports a particular feature by using version or NPVERS constants (see Version Feature Constants). Each NPVERS constant represents a feature. The plug-in can compare the NPVERS constant to the version number. If the version sup
ports the feature, the plug-in can operate according to plan. If not, the plug-in cannot use some functionality. If an essential feature is unavailable, the developer must arrange...
... It starts by using NPN_Version to get the version numbers. ...
... can operate according to plan. If not, the plug-in cannot use some functionality. If an essential feature is unavailable, the developer must arrange for alternative behavior, shut down the plug-in, or give the user a chance to decide what to do. Detecting Windowless Sup
port on MS Windows and Mac OS X In this example, the has_windowless method finds out whether the current version of the API sup
ports windowless plug-ins. This method for detecting sup
port is only useful on MS Windows and Mac OS X. It starts by using NPN_Version to get the version numbers. It then uses the netscape_minor version number to find out if the windowless feature, represented by the NPVERS_HAS_WINDOWLESS constant, is sup
ported. If the method returns true, a windowless plug-in can confidently proceed. If false is ret...
...And 6 more matches
DOMException.code - Web APIs
ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
DOMException.message - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
Document.evaluate() - Web APIs
be achieved by careful use of the context parameter. For example, if you know the content you are looking for is somewhere inside the body tag, you can use this: document.evaluate(".//h2", document.body, null, XPathResult.ANY_TYPE, null); Notice in the above document.body has been used as the context instead of document so the XPath starts from the body element. (In this example, the "." is im
portant to indicate that the querying should start from the context node, document.body. If the "." was left out (leaving //h2) the query would start from the root node (html) which would be more wasteful.) See Introduction to using XPath in JavaScript for more information. Notes XPath expressions can be evaluated on HTML and XML documents. While using document.evaluate() works in FF2, in FF3 on...
... which would be more wasteful.) See Introduction to using XPath in JavaScript for more information. Notes XPath expressions can be evaluated on HTML and XML documents. While using document.evaluate() works in FF2, in FF3 one must use someXMLDoc.evaluate() if evaluating against something other than the current document. Result types (Merge with Template:XPathResultConstants? These are sup
ported values for the resultType parameter of the evaluate method: Result Type Value Description ANY_TYPE 0 Whatever type naturally results from the given expression. NUMBER_TYPE 1 A result set containing a single number. Useful, for example, in an XPath expression using the count() function. STRING_TYPE 2 A result set containing a single st...
...y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
Document.fonts - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetfontsChrome Full sup
port 60Edge Full sup
port 79Firefox Full sup
port 41 Full sup
port 41 No sup
port 35 -- 41Disabled Disabled From version 35 until version 41 (exclusive): this feature is behind the layout.css.font-loading-api.enabled preference (needs to be set to true). To change preferences in Fir...
... Full sup
port 41 Full sup
port 41 No sup
port 35 -- 41Disabled Disabled From version 35 until version 41 (exclusive): this feature is behind the layout.css.font-loading-api.enabled preference (needs to be set to true). ...
...And 6 more matches
Document.forms - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
DocumentOrShadowRoot.getSelection() - Web APIs
ity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
DynamicsCompressorNode() - Web APIs
ssorNode(context, options) Parameters context A reference to an AudioContext. options Optional Options are as follows: attack: The amount of time (in seconds) to reduce the gain by 10dB. Its default value is 0.003. This parameter is k-rate. Its nominal range is [0, 1]. knee: A decibel value representing the range above the threshold where the curve smoothly transitions to the "ratio"
portion. Its default value is 30. This parameter is k-rate. Its nominal range is [0, 40]. ratio: The amount of dB change in input for a 1 dB change in output. Its default value is 12. This parameter is k-rate. Its nominal range is [1, 20]. release: The amount of time (in seconds) to increase the gain by 10dB. Its default value is 0.250. This parameter is k-rate. Its nominal range is [0, 1]. thre...
...n this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
Element.slot - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...t https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
FileException - Web APIs
le on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ull request. ...
...And 6 more matches
FileSystemDirectoryEntry.getDirectory() - Web APIs
Error.PATH_EXISTS_ERR The create and exclusive options were both true, indicating that the directory should be created but must not already exist, but the directory does in fact already exist. FileError.SECURITY_ERR The request to access the directory was denied for security reasons. FileError.TYPE_MISMATCH_ERR The path specified is not a directory; it's probably a file, but might be an unsup
ported file descriptor such as a pipe; this depends on the user agent to some extent. FileSystemFlags The options parameter is an object which is based on the FileSystemFlags dictionary; it provides flags which make it possible to adjust the behavior of the getDirectory() method. create Optional If this property is true, and the requested file or directory doesn't exist, the user agent should c...
...ity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
FileSystemDirectoryEntry.getFile() - Web APIs
't exist. FileError.PATH_EXISTS_ERR The create and exclusive options were both true, indicating that the file should be created but must not already exist, but the file does in fact already exist. FileError.SECURITY_ERR The request to access the file was denied for security reasons. FileError.TYPE_MISMATCH_ERR The path specified is not a file; it's probably a directory, but might be an unsup
ported file descriptor such as a pipe; this depends on the user agent to some extent. FileSystemFlags The options parameter is an object which is based on the FileSystemFlags dictionary; it provides flags which make it possible to adjust the behavior of the getFile() method. create Optional If this property is true, and the requested file or directory doesn't exist, the user agent should create...
...tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...f you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
FileSystemEntry.toURL() - Web APIs
used to help deal with files whose types aren't recognized automatically by the user agent. If this parameter is omitted, the user agent uses its standard algorithms to identify the file. Return value A DOMString containing a URL that can then be used as a document reference in HTML content, or an empty string if the URL can't be generated (such as if the file system implementation doesn't sup
port toURL()). Example If you have a FileSystemFileEntry corresponding to an image file in a file system available to your Web site or app, you can call toURL() to get its URL for use in HTML. If your site is located at http://my-awesome-website.woot, and you have a temporary file system that contains an image file named awesomesauce.jpg, the URL returned by toURL() might be (depending on the browse...
...is page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
FontFace.display - Web APIs
tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
FontFaceSetLoadEvent - Web APIs
e on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...o contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ser-compat-data and send us a pull request. ...
...And 6 more matches
HTMLIFrameElement.src - Web APIs
bility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
HTMLImageElement.currentSrc - Web APIs
sizes and/or HTMLImageElement.srcset properties. currentSrc lets you determine which image from the set of provided images was selected by the browser. Example In this example, two different sizes are provided for an image of a clock. One is 200px wide and the other is 400px wide. The sizes attribute is provided to indicate that the image should be drawn at 50% of the document width if the view
port is under 400px wide; otherwise, the image is drawn at 90% width of the document. HTML <img src="/files/16797/clock-demo-400px.png" alt="Clock" srcset="/files/16864/clock-demo-200px.png 200w, /files/16797/clock-demo-400px.png 400w" sizes="(max-width: 400px) 50%, 90%"> JavaScript var clockImage = document.querySelector("img"); let p = document.createElement("p"); if (!clockI...
...ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetcurrentSrc ExperimentalChrome Full sup
port 45Edge Full sup
port 13Firefox Full sup
port 38 Full sup
port 38 No sup
port 32 -- 52Disabled Disabled From version 32 until version 52 (exclusive): this feature is behind the dom.image.srcset.enabled preference (needs to be set to true). To change preferences in Firefox, visit...
...And 6 more matches
HTMLImageElement.height - Web APIs
ge's height is represented using its natural (intrinsic) height, adjusted for the display density as indicated by naturalHeight. Example In this example, two different sizes are provided for an image of a clock using the srcset attribute. One is 200px wide and the other is 400px wide. Further, the sizes attribute is provided to specify the width at which the image should be drawn given the view
port's width. HTML Specifically, for view
ports up to 400px wide, the image is drawn at a width of 200px; otherwise, it's drawn at 300px. <p>Image height: <span class="size">?</span>px (resize to update)</p> <img src="/files/17373/clock-demo-200px.png" alt="Clock" srcset="/files/17373/clock-demo-200px.png 200w, /files/17374/clock-demo-400px.png 400w" sizes="(max-width: 40...
...ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
HTMLImageElement.hspace - Web APIs
HTML hspace attribute. Syntax htmlImageElement.hspace = marginWidth; marginWidth = htmlImageElement.hspace; Value An integer value specifying the width, in pixels, of the horizontal margin to apply to the left and right sides of the image. Usage notes The value specified for hspace is mapped to the margin-left and margin-right properties to specify the width of those margins in pixels. Im
portant: This property is obsolete. You should instead use the CSS margin property and its longhand forms to establish margins around an <img>. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLImageElement.hspace' in that specification. Living Standard HTML 4.01 SpecificationThe definition of 'HTMLImageElement.hspace'...
...ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
HTMLImageElement.name - Web APIs
The HTMLImageElement interface's deprecated name property specifies a name for the element. This has been replaced by the id property available on all elements. Syntax htmlImageElement.name = nameString; nameString = htmlImageElement.name; Value A DOMString providing a name by which the image can be referenced. Im
portant: This property is deprecated and is only in the specification still for backward compatibility purposes. Since it functions identically to id, you can and should use it instead. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLImageElement.name' in that specification. Living Standard HTML 4.01 SpecificationThe definition of 'HTMLImageElement.name' in that specification. Recommenda...
...ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
HTMLImageElement.useMap - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...t https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
HTMLLinkElement.as - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
HTMLSlotElement.name - Web APIs
e) { let nodes = slots[1].assignedNodes(); console.log('Element in Slot "' + slots[1].name + '" changed to "' + nodes[0].outerHTML + '".'); }); Here we grab references to all the slots, then add a slotchange event listener to the 2nd slot in the template -- which is the one that keeps having its contents changed in the example. Every time the element inserted in the slot changes, we log a re
port to the console saying which slot has changed, and what the new node inside the slot is. Specifications Specification Status Comment HTML Living StandardThe definition of 'name' in that specification. Living Standard Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, pleas...
...mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetname ExperimentalChrome Full sup
port 53Edge Full sup
port 79Firefox Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Fir...
...And 6 more matches
Recommended Drag Types - Web APIs
The HTML Drag and Drop API sup
ports dragging various types of data, including plain text, URLs, HTML code, files, etc. The document describes best practices for common draggable data types. Caution: All methods and properties in this document with a moz prefix, such as mozSetDataAt(), will only work with Gecko-based browsers. Dragging Text For dragging text, use the text/plain type. The second data parameter should be the dragged string. For example: event.dataTransfer.setData("text/plain", "This is text to drag"); Dragging text in textboxes and selections on web pages is done automatically by the browser, so you do not need to handle it yourself. ...
...pe. The second data parameter should be the dragged string. For example: event.dataTransfer.setData("text/plain", "This is text to drag"); Dragging text in textboxes and selections on web pages is done automatically by the browser, so you do not need to handle it yourself. It is recommended to always add data of the text/plain type as a fallback for applications or drop targets that do not sup
port other types, unless there is no logical text alternative. Always add this text/plain type last, as it is the least specific and shouldn't be preferred. Note: In older code, you may find text/unicode or the Text types. These are equivalent to text/plain, and will store and retrieve plain text data. Dragging Links Dragged hyperlinks should include data of two types: text/uri-list, and text/plain...
...vent.currentTarget.appendItem(file.leafName); } } </script> In this example, the event returns false only if the data transfer contains the application/x-moz-file type. During the drop event, the data associated with the file type is retrieved, and the filename of the file is added to the listbox. Note that the instanceof operator is used here as the mozGetDataAt() method will return an nsISup
ports that needs to be checked and converted into an nsIFile. This is also a good extra check in case someone made a mistake and added a non-file for this type. Updates to DataTransfer.types The latest spec dictates that DataTransfer.types should return a frozen array of DOMStrings rather than a DOMStringList (this is sup
ported in Firefox 52 and above). As a result, the contains method no longer wo...
...And 6 more matches
databases - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...b.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
IDBObjectStore.getKey() - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
IDBTransaction.objectStoreNames - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...thub.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
Using IndexedDB - Web APIs
exedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. // Moreover, you may need references to some window.IDB* objects: window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction || {READ_WRITE: "readwrite"}; // This line should only be needed if it is needed to sup
port the object's constants for older browsers window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange; // (Mozilla has never prefixed these objects, so we don't need window.mozIDB*) Beware that implementations that use a prefix may be buggy, or incomplete, or following an old version of the specification. Therefore, it is not recommended to use it in production co...
...rowsers window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange; // (Mozilla has never prefixed these objects, so we don't need window.mozIDB*) Beware that implementations that use a prefix may be buggy, or incomplete, or following an old version of the specification. Therefore, it is not recommended to use it in production code. It may be preferable to not sup
port a browser than to claim to sup
port it and fail: if (!window.indexedDB) { console.log("Your browser doesn't sup
port a stable version of IndexedDB. Such and such feature will not be available."); } Opening a database We start the whole process like this: // Let us open our database var request = window.indexedDB.open("MyTestDatabase", 3); See that? Opening a database is just like any oth...
...nupgradeneeded event is triggered and you create the database schema in the handler for this event. If the database does exist but you are specifying an upgraded version number, an onupgradeneeded event is triggered straight away, allowing you to provide an updated schema in its handler. More on this later in Updating the version of the database below, and the IDBFactory.open reference page. Im
portant: The version number is an unsigned long long number, which means that it can be a very big integer. It also means that you can't use a float, otherwise it will be converted to the closest lower integer and the transaction may not start, nor the upgradeneeded event trigger. So for example, don't use 2.4 as a version number: var request = indexedDB.open("MyTestDatabase", 2.4); // don't do this,...
...And 6 more matches
Performance.timeOrigin - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
PerformanceLongTaskTiming - Web APIs
The PerformanceLongTaskTiming interface of the the Long Tasks API re
ports instances of long tasks. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/PerformanceEntry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceEntry</text></a><polyline points="161,25 171,20 171,30 161,25" stroke="#D4...
...this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
RTCIceCandidatePairStats - Web APIs
The WebRTC RTCIceCandidatePairStats dictionary re
ports statistics which provide insight into the quality and performance of an RTCPeerConnection while connected and configured as described by the specified pair of ICE candidates. If a RTCStats-based object's type is candidate-pair, it's an RTCIceCandidatePairStats object. Properties RTCIceCandidatePairStats is based upon RTCStats and inherits its properties. In addition, it adds the following new properties: availableIncomingBitrate Optional Provides an informative value representing the available inbound capacity of the network by re
porting the total number of bits per second available for all of the candidate pair's incoming RTP streams. ...
...and inherits its properties. In addition, it adds the following new properties: availableIncomingBitrate Optional Provides an informative value representing the available inbound capacity of the network by re
porting the total number of bits per second available for all of the candidate pair's incoming RTP streams. This does not take into account the size of the IP overhead, nor any other trans
port layers such as TCP or UDP. availableOutgoingBitrate Optional Provides an informative value representing the available outbound capacity of the network by re
porting the total number of bits per second available for all of the candidate pair's outoing RTP streams. This does not take into account the size of the IP overhead, nor any other trans
port layers such as TCP or UDP. bytesReceieved Option...
...otal number of payload bytes sent (that is, the total number of bytes sent minus any headers, padding, or other administrative overhead) so far on this candidate pair. circuitBreakerTriggerCount Optional An integer value indicating the number of times the circuit-breaker has been triggered for this particular 5-tuple (the set of five values comprising a TCP connection: source IP address, source
port number, destination IP address, destination
port number, and protocol). The circuit breaker is triggered whenever a connection times out or otherwise needs to be automatically aborted. consentExpiredTimestamp Optional A DOMHighResTimeStamp value indicating the time at which the most recent STUN binding response expired. This value is undefined if no valid STUN binding responses have been sent o...
...And 6 more matches
SVGAnimatedAngle - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedBoolean - Web APIs
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...f you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...b.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedEnumeration - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedInteger - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
....com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedLength - Web APIs
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...f you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...b.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedLengthList - Web APIs
ibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedNumber - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedNumberList - Web APIs
ibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedPreserveAspectRatio - Web APIs
able on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...owser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedRect - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...thub.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedString - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGAnimatedTransformList - Web APIs
lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGLengthList - Web APIs
e compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGNumberList - Web APIs
e compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGPreserveAspectRatio - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SVGTransform - Web APIs
he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
Using the Screen Capture API - Web APIs
In this article, we will examine how to use the Screen Capture API and its getDisplayMedia() method to capture part or all of a screen for streaming, recording, or sharing during a WebRTC conference session. Note: It may be useful to note that recent versions of the WebRTC adapter.js shim include implementations of getDisplayMedia() to enable screen sharing on browsers that sup
port it but do not implement the current standard API. This works with at least Chrome, Edge, and Firefox. Capturing screen contents Capturing screen contents as a live MediaStream is initiated by calling navigator.mediaDevices.getDisplayMedia(), which returns a promise that resolves to a stream containing the live screen contents. Starting screen capture: async/await style async function startCapture(displayMed...
... is entirely visible on the screen, such as the frontmost window or tab, or the entire screen. A logical display surface is one which is in part or completely obscured, either by being overlapped by another object to some extent, or by being entirely hidden or offscreen. How these are handled by the Screen Capture API varies. Generally, the browser will provide an image which obscures the hidden
portion of the logical display surface in some way, such as by blurring or replacing with a color or pattern. This is done for security reasons, as the content that cannot be seen by the user may contain data which they do not want to share. A user agent might allow the capture of the entire content of an obscured window after gaining permission from the user to do so. In this case, the user agent ma...
... a color or pattern. This is done for security reasons, as the content that cannot be seen by the user may contain data which they do not want to share. A user agent might allow the capture of the entire content of an obscured window after gaining permission from the user to do so. In this case, the user agent may include the obscured content, either by getting the current contents of the hidden
portion of the window or by presenting the most-recently-visible contents if the current contents are not available. Options and constraints The constraints object passed into getDisplayMedia() is a DisplayMediaStreamConstraints object which is used to configuring the resulting stream. Note: Unlike most uses of constraints in media APIs, here it's solely used to define the stream configuration, an...
...And 6 more matches
Selection.removeAllRanges() - Web APIs
table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ke to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...n/browser-compat-data and send us a pull request. ...
...And 6 more matches
Selection.removeRange() - Web APIs
lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
SharedWorkerGlobalScope: connect event - Web APIs
The connect event is fired in shared workers at their SharedWorkerGlobalScope when a new client connects. Bubbles No Cancelable No Interface MessageEvent Event handler property SharedWorkerGlobalScope.onconnect Examples This example shows a shared worker file -- when a connection to the worker occurs from a main thread via a Message
Port, the onconnect event handler fires. The event object is a MessageEvent. The connecting
port can be referenced through the event object's
ports parameter; this reference can have an onmessage handler attached to it to handle messages coming in through the
port, and its postMessage() method can be used to send messages back to the main thread using the worker. self.onconnect = function(e) { var
port ...
...ect event handler fires. The event object is a MessageEvent. The connecting
port can be referenced through the event object's
ports parameter; this reference can have an onmessage handler attached to it to handle messages coming in through the
port, and its postMessage() method can be used to send messages back to the main thread using the worker. ...
...er fires. The event object is a MessageEvent. The connecting
port can be referenced through the event object's
ports parameter; this reference can have an onmessage handler attached to it to handle messages coming in through the
port, and its postMessage() method can be used to send messages back to the main thread using the worker. ...
...And 6 more matches
StereoPannerNode.StereoPannerNode() - Web APIs
able on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...s a pull request. ...
...And 6 more matches
HTMLSlotElement.assignedSlot - Web APIs
he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...//github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
Using Touch Events - Web APIs
Today, most Web content is designed for keyboard and mouse input. However, devices with touch screens (especially
portable devices) are mainstream and Web applications can either directly process touch-based input by using Touch Events or the application can use interpreted mouse events for the application input. A disadvantage to using mouse events is that they do not sup
port concurrent user input, whereas touch events sup
port multiple simultaneous inputs (possibly at different locations on the touch surface), thus enhancing user experiences. The touch events interfaces sup
port application specific single and multi-touch interactions such as a two-finger gesture. A multi-touch interaction starts when a finger (or stylus) first touches the contact surface. Other fingers may subsequently touc...
...represents a single contact point on a touch-sensitive device. The contact point is typically referred to as a touch point or just a touch. A touch is usually generated by a finger or stylus on a touchscreen, pen or trackpad. A touch point's properties include a unique identifier, the touch point's target element as well as the X and Y coordinates of the touch point's position relative to the view
port, page, and screen. The TouchList interface represents a list of contact points with a touch surface, one touch point per contact. Thus, if the user activated the touch surface with one finger, the list would contain one item, and if the user touched the surface with three fingers, the list length would be three. The TouchEvent interface represents an event sent when the state of contacts with a...
...urrent event. For the touchmove event, it is a list of the touch points that have changed since the last event. For the touchend event, it is a list of the touch points that have been removed from the surface (that is, the set of touch points corresponding to fingers no longer touching the surface). Together, these interfaces define a relatively low-level set of features, yet they sup
port many kinds of touch-based interaction, including the familiar multi-touch gestures such as multi-finger swipe, rotation, pinch and zoom. From interfaces to gestures An application may consider different factors when defining the semantics of a gesture. For instance, the distance a touch point traveled from its starting location to its location when the touch ended. Another potential factor is t...
...And 6 more matches
Migrating from webkitAudioContext - Web APIs
h as Gecko) will only implement the official, final version of the specification, which means that code using webkitAudioContext or old naming conventions in the Web Audio specification may not immediately work out of the box in a compliant Web Audio implementation. This article attempts to summarize the areas where developers are likely to encounter these problems and provide examples on how to
port such code to standards based AudioContext, which will work across different browser engines. Note: There is a library called webkitAudioContext monkeypatch, which automatically fixes some of these changes to make most code targetting webkitAudioContext to work on the standards based AudioContext out of the box, but it currently doesn't handle all of the cases below. Please consult the README f...
...udioBufferSourceNode has yet another way of starting output: the noteGrainOn() method.) The noteOn()/noteGrainOn()/noteOff() methods were the original way to start/stop output in these nodes, and in the newer versions of the specification, the noteOn() and noteGrainOn() methods were consolidated into a single start() method, and the noteOff() method was renamed to the stop() method. ...
...() method, and the noteOff() method was renamed to the stop() method. In order to
port your code, you can just rename the method that you're using. ...
...And 6 more matches
window.requestIdleCallback() - Web APIs
le in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...rowser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetrequestIdleCallback ExperimentalChrome Full sup
port 47Edge Full sup
port 79Firefox Full sup
port 55Notes Full sup
port 55Notes Notes Enabled by default. ...
...And 6 more matches
XRSession - Web APIs
ssion interface represents an ongoing XR session, providing methods and properties used to interact with and control the session. To open a WebXR session, use the XRSystem interface's requestSession() method. With XRSession methods, you can poll the viewer's position and orientation (the XRViewerPose), gather information about the user's environment, and present imagery to the user. XRSession sup
ports both inline and immersive virtual and augmented reality modes. Properties In addition to the properties listed below, XRSession inherits properties from its parent interface, EventTarget. environmentBlendMode Read only Returns this session's blend mode which denotes how much of the real-world environment is visible through the XR device and how the device will blend the device imagery...
... be used to identify the request for the purposes of canceling the callback using cancelAnimationFrame(). This method is comparable to the Window.requestAnimationFrame() method. requestReferenceSpace() Requests that a new XRReferenceSpace of the specified type be created. Returns a promise which resolves with the XRReferenceSpace or XRBoundedReferenceSpace which was requested, or throws a NotSup
portedError if the requested space type isn't sup
ported by the device. updateRenderState() Updates the properties of the session's render state to match the values specified in the specified XRRenderStateInit dictionary. Any properties not included in the given dictionary are left unchanged from their current values. Events The following events are delivered to XRSession objects. Event ...
... Working Draft Initial defin...
...And 6 more matches
Cognitive accessibility - Accessibility
time management letters and language numbers symbols and math understanding and making choices A solid approach to providing accessible solutions for people with cognitive impairments includes: delivering content in more than one way, such as by text-to-speech or by video; providing easily-understood content, such as text written using plain-language standards; focusing attention on im
portant content; minimizing distractions, such as unnecessary content or advertisements; providing consistent web page layout and navigation; incorporating familiar elements, such as underlined links that are blue when not visited and purple when visited; dividing processes into logical, essential steps with progress indicators; making website authentication as easy as possible without compromisi...
...rmation, including structure and relationships conveyed through the presentation, should be available in a form that can be perceived by all users to achieve this goal. For example, the information could be spoken aloud via a narration tool. Making your content capable of being understood by the software is a good way to help ensure it can be used by alternate presentational modes. Time It is im
portant to allow users the time they require to complete tasks. Guideline 2.2 states "provide users enough time to read and use content." A time limit is any process that happens without user initiation after a set time or on a periodic basis, such as being logged out after 30 minutes or having 15 minutes to make a purchase. People with cognitive disabilities may require more time to read content, or...
...a factor of 10 with a simple action, such as hitting the space bar. Provide a toggle on content that allows users to enable a longer session time limit, or no session time limit at all. Examples of timed content include forms, timed reading exercises, and training materials. If the time limit is longer than 20 hours, accommodations are not required. Moving, blinking, scrolling It is im
portant not to distract users, especially ones with cognitive disabilities. If moving, blinking, scrolling, or auto-updating information starts automatically, lasts more than five seconds, and is presented in parallel with other content, the user must able to pause, stop, hide or control it, unless it's an essential functionality. "Essential" means that removing the moving, blinking, scrolling, or au...
...And 6 more matches
Accessibility documentation index - Accessibility
entors Guide ARIA, Accessibility This is just a guide. Live region markup is a complex area which is somewhat open to interpretation. The following is intended to provide implementation guidance that respects screen readers developers' need to try different things. The intention is to strike a balance between providing useful guidance on how to use the markup's intended meaning while sup
porting live regions as an area for screen readers to innovate and compete. 4 ARIA Test Cases ARIA, Accessibility For each example we test the "Expected" results with assistive technologies, for each browser that AT sup
ports WAI-ARIA in. Where a failure occurs we will test the browser for API incorrectness, using tools such as MSAA Inspect. This must be done in order to determine ...
... have a form -- a contact form, for example -- that you want to put some accessible error checking into. Examples of common problems include e-mail addresses which are not valid, or a name field which does not contain at least a first name or a surname. 10 Basic form hints ARIA, Accessibility, Forms When implementing forms using traditional HTML form-related elements, it is im
portant to provide labels for controls, and explicitly associate a label with its control. 11 Multipart labels: Using ARIA for labels with embedded fields inside them ARIA, Accessibility, Ben Millard, Firefox, Guide, HELP, HTML, HTML 4, JAWS, NeedsContent, aria-labelledby, label, solution, trouble shoot, troubleshoot The solution is in an ARIA attribute called aria-labelledby. Its...
...ty. If you notice an implementation issue, please take a little time and let the developers know. Here's where to file bugs: 13 Using ARIA: Roles, states, and properties ARIA, Accessibility, Overview, Reference ARIA defines semantics that can be applied to elements, with these divided into roles (defining a type of user interface element) and states and properties that are sup
ported by a role. Authors must assign an ARIA role and the appropriate states and properties to an element during its life-cycle, unless the element already has appropriate ARIA semantics (via use of an appropriate HTML element). Addition of ARIA semantics only exposes extra information to a browser's accessibility API, and does not affect a page's DOM. 14 ARIA Technique Template Access...
...And 6 more matches
::slotted() - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ed data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet::slottedChrome Full sup
port 50Edge Full sup
port 79Firefox Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Fir...
... Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). ...
...And 6 more matches
:has() - CSS: Cascading Style Sheets
The :has() CSS pseudo-class represents an element if any of the selectors passed as parameters (relative to the :scope of the given element) match at least one element. ...
... relative selector list as an argument. In earlier revisions of the CSS Selectors Level 4 specification, :has had a limitation that it couldn't be used within stylesheets. Instead, it could only be used with functions like document.querySelector(); this was due to performance concerns. This limitation has been removed because no browser implemented it that way. Instead, browsers currently only sup
port the use of :has() within stylesheets. Examples Matching <a> elements that directly contain an <img> The following selector matches only <a> elements that directly contain an <img> child: a:has(> img) Matching <h1> elements that are followed by a <p> The following selector matches <h1> elements only if they have a <p> element directly following them: h1:has(+ p) Specifications S...
...ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
:host-context() - CSS: Cascading Style Sheets
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
:host - CSS: Cascading Style Sheets
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet:hostChrome Full sup
port 54Edge Full sup
port 79Firefox Full sup
port 63 Full sup
port 63 No sup
port 61 -- 63Disabled Disabled From version 61 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Fir...
... Full sup
port 63 Full sup
port 63 No sup
port 61 -- 63Disabled Disabled From version 61 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). ...
...And 6 more matches
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
The history of flexbox As with all CSS specifications the Flexbox specification went through a large number of changes before it became the Candidate Recommendation that we have today. As a Candidate Recommendation we should not see large changes at this point to the spec, however this has not been the case with past flexbox iterations. Flexbox was implemented in an experimental way in several web browsers. ...
... different. To create a flex container you would use display: box and there were a number of box-* properties, which did things that you will recognise from flexbox today. There was an update to the spec that updated the syntax to display: flexbox -- this was again vendor-prefixed. Ultimately the specification was updated to define display: flex as the way to create a flex container. Browser sup
port for the up-to-date version of the specification is excellent from this point forward. There are a few old articles in existence that refer to the older versions of flexbox, which are pretty easy to identify due to the change in the way that a flex container is created. If you find something referring to display: box or display: flexbox this is outdated information. Status in browsers Browser s...
...or the up-to-date version of the specification is excellent from this point forward. There are a few old articles in existence that refer to the older versions of flexbox, which are pretty easy to identify due to the change in the way that a flex container is created. If you find something referring to display: box or display: flexbox this is outdated information. Status in browsers Browser sup
port for flexbox is excellent, and the majority of browsers do not need a prefix at this point. Safari was the last of the major browsers to remove prefixes, with the release of Safari 9 in 2015. The two browsers you should still keep in mind for cross-browser compatibility are: Internet Explorer 10, which implemented the display: flexbox version of the specification with the -ms- prefix. UC Brows...
...And 6 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
These extensions are generally prefixed with -webkit-. Most -webkit- prefixed properties also work with an -apple- prefix. A few are prefixed with -epub-. WebKit-only properties Note: Avoid using on websites. These properties will only work in WebKit applications. ...
... -webkit-text-security -webkit-text-stroke-color -webkit-text-stroke-width -webkit-text-stroke -webkit-text-zoom -webkit-transform-origin-x -webkit-transform-origin-y -webkit-transform-origin-z U -webkit-user-drag -webkit-user-modify * A few are on the standards, unprefixed track ** New syntax has been standardized. Property links to the new synax. Old prefixed syntax is still sup
ported in some browsers. WebKit-prefixed properties on the standards track -webkit-appearance -webkit-font-size-delta -webkit-mask-composite -webkit-mask-position-x -webkit-mask-position-y -webkit-mask-repeat-x -webkit-mask-repeat-y Formerly proprietary properties that are now standard Note: To maximize the compatibility of your CSS, you should use the unprefixed standard properties in...
...sis-style -webkit-text-justify -webkit-text-orientation -webkit-text-size-adjust -webkit-text-underline-position -webkit-transform -webkit-transform-origin -webkit-transform-style -webkit-transition -webkit-transition-delay -webkit-transition-duration -webkit-transition-property -webkit-transition-timing-function U-W -webkit-user-select -epub-word-break -epub-writing-mode Sup
ported in non-webkit browsers without a prefix, but not standard The following properties are sup
ported in at least one browser without a prefix, but are not on the standards track. -webkit-mask-position-x* -webkit-mask-position-y* * Sup
ported unprefixed in Firefox, with prefix in Safari. Sup
ported in Firefox with -webkit- prefix The following properties are sup
ported with the -webkit- pref...
...And 6 more matches
box-align - CSS: Cascading Style Sheets
le on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ontribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetbox-align DeprecatedNon-standardChrome Full sup
port 1Prefixed Full sup
port 1Prefixed Prefixed Implemented with the vendor prefix: -webkit-Edge Full sup
port 12Prefixed Full sup
port 12Prefixed Prefixed Implemented with the vendor prefix: -webkit-Firefox Full sup
port 1Prefixed Full sup
port 1Prefixed Prefixed Implemented with the vendor prefix: -moz- Full sup
port ...
...And 6 more matches
column-count - CSS: Cascading Style Sheets
he compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 6 more matches
font-variant-position - CSS: Cascading Style Sheets
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetfont-variant-positionChrome No sup
port NoEdge No sup
port NoFirefox Full sup
port 34 Full sup
port 34 No sup
port 24 -- 34Disabled Disabled From version 24 until version 34 (exclusive): this feature is behind the layout.css.font-features.enabled preference (needs to be set to true). To change preferences in Firefo...
... Full sup
port 34 Full sup
port 34 No sup
port 24 -- 34Disabled Disabled From version 24 until version 34 (exclusive): this feature is behind the layout.css.font-features.enabled preference (needs to be set to true). ...
...And 6 more matches
Adding captions and subtitles to HTML5 video - Developer guides
-size:1rem; font-weight:bold; color:#666; background:#000; border-radius:2px; } There are also other CSS changes that are specific to some extra JavaScript implementation, but these will be mentioned at the appropriate place below. Subtitle implementation A lot of what we do to access the video subtitles revolves around JavaScript. Similar to the video controls, if a browser sup
ports HTML5 video subtitles, there will be a button provided within the native control set to access them. However, since we have defined our own video controls, this button is hidden, and we need to define our own. Browsers do vary as to what they sup
port, so we will be attempting to bring a more unified UI to each browser where possible. There's more on browser compatibility issues later on. Initi...
... The ::cue pseudo-element is the key to targetting individual text track cues for styling, as it matches any defined cue. There are only a handful of CSS properties that can be applied to a text cue: color opacity visibility text-decoration text-shadow background shorthan...
...oice spans, which allow cues to be defined as having a particular "voice": 0 00:00:00.000 --> 00:00:12.000 <v Test>[Test]</v> Then this specific 'voice' will be stylable like so: ::cue(v[voice='Test']) { color:#fff; background:#0095dd; } Note: Some of the styling of cues with ::cue currently works on Chrome, Opera, and Safari, but not yet on Firefox. Browser Compatibility Browser sup
port for WebVTT and the <track> element is fairly good, although some browsers differ slightly in their implementation. Internet Explorer Internet Explorer 10+ subtitles are enabled by default, and the default controls contain a button and a menu that offers the same functionality as the menu we just built. The default attribute is also sup
ported. Note: IE will completely ignore WebVTT files unles...
...And 6 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
n a similar manner to the <img> element, we include a path to the media we want to embed inside the src attribute; we can include other attributes to specify information such as whether we want it to autoplay and loop, whether we want to show the browser's default audio controls, etc. The content inside the opening and closing <audio></audio> tags is shown as a fallback in browsers that don't sup
port the element. Attributes This element's attributes include the global attributes. autoplay A Boolean attribute: if specified, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading. Note: Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avo...
...user agent is trying to fetch media data, but data is unexpectedly not forthcoming. suspend Media data loading has been suspended. timeupdate The time indicated by the currentTime attribute has been updated. volumechange The volume has changed. waiting Playback has stopped because of a temporary lack of data Usage notes Browsers don't all sup
port the same file types and audio codecs; you can provide multiple sources inside nested <source> elements, and the browser will then use the first one it understands: <audio controls> <source src="myAudio.mp3" type="audio/mpeg"> <source src="myAudio.ogg" type="audio/ogg"> <p>Your browser doesn't sup
port HTML5 audio. Here is a <a href="myAudio.mp4">link to the audio</a> instead.</p> </aud...
... Other usage notes: If you don't specify the controls attribute, the audio player won't include the browser's default controls. You can, however, create your own custom controls using JavaScript and the HTMLMediaElement API. ...
...And 6 more matches
<content>: The Shadow DOM Content Placeholder element (obsolete) - HTML: Hypertext Markup Language
butes This element includes the global attributes. select A comma-separated list of selectors. These have the same syntax as CSS selectors. They select the content to insert in place of the <content> element. Example Here is a simple example of using the <content> element. It is an HTML file with everything needed in it. Note: For this code to work, the browser you display it in must sup
port Web Components. See Enabling Web Components in Firefox. <html> <head></head> <body> <!-- The original content accessed by <content> --> <div> <h4>My Content Heading</h4> <p>My content text</p> </div> <script> // Get the <div> above. var myContent = document.querySelector('div'); // Create a shadow DOM on the <div> var shadowroot = myContent.createShadowRoot(); // ...
...able in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetcontent DeprecatedNon-standardChrome Full sup
port 35Edge Full sup
port 79Firefox No sup
port 33 -- 59Disabled No sup
port 33 -- 59Disabled Disabled From version 33 until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true). To change preferences in Firefox, visit ...
... Full sup
port 79Firefox No sup
port 33 -- 59Disabled No sup
port 33 -- 59Disabled Disabled From version 33 until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true). ...
...And 6 more matches
<input type="number"> - HTML: Hypertext Markup Language
rowser may opt to provide stepper arrows to let the user increase and decrease the value using their mouse or by simply tapping with a fingertip. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. On browsers that don't sup
port inputs of type number, a number input falls back to type text. Value Any floating-point number, or empty. Events change and input Sup
ported common attributes autocomplete, list, placeholder, readonly IDL attributes list, value, valueAsNumber Methods select(), stepUp(), stepDown() Value Any floating-point number, or empty. You ca...
... list, placeholder, readonly IDL attributes list, value, valueAsNumber Methods select(), stepUp(), stepDown() Value Any floating-point number, or empty. ...
... list, value, valueAsNumber Methods select(), stepUp(), stepDown() Value Any floating-point number, or empty. ...
...And 6 more matches
<input type="url"> - HTML: Hypertext Markup Language
ps://github.com/mdn/interactive-examples and send us a pull request. The input value is automatically validated to ensure that it's either empty or a properly-formatted URL before the form can be submitted. The :valid and :invalid CSS pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid URL or not. ...
...m can be submitted. The :valid and :invalid CSS pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid URL or not. On browsers that don't sup
port inputs of type url, a url input falls back to being a standard text input. Value A DOMString representing a URL, or empty Events change and input Sup
ported Common Attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size IDL attributes list, value, selectionEnd, selectionDirection Methods select(), setRangeText() and setSelectionRange(). Value The <input> element's value attribute contains a DOMString which is automatically validated as conforming to URL syntax. More s...
...erly-formed absolute URL. This doesn't necessarily mean the URL address exists, but it is at least formatted correctly. In simple terms, this means urlscheme://restofurl. See Validation for details on how URLs are validated to ensure that they're formatted properly. ...
...And 6 more matches
Expect-CT - HTTP
The Expect-CT header lets sites opt in to re
porting and/or enforcement of Certificate Transparency requirements, to prevent the use of misissued certificates for that site from going unnoticed. CT requirements can be satisfied via any one of the following mechanisms: X.509v3 certificate extension to allow embedding of signed certificate timestamps issued by individual logs A TLS extension of type signed_certificate_timestamp sent during the handshake Sup
porting OCSP stapling (that is, the status_request TLS extension) and providing a SignedCertificateTimestampList When a site enables the Expect-CT header, they are requesting that the browser check that any certificate for that site appears in public CT logs. Browsers ignore the Expect-CT header over HTTP; the header only has effec...
...viding a SignedCertificateTimestampList When a site enables the Expect-CT header, they are requesting that the browser check that any certificate for that site appears in public CT logs. Browsers ignore the Expect-CT header over HTTP; the header only has effect on HTTPS connections. The Expect-CT will likely become obsolete in June 2021. ...
...ader only has effect on HTTPS connections. The Expect-CT will likely become obsolete in June 2021. Since May 2018 new certificates are expected to sup
port SCTs by default. Certificates before March 2018 were allowed to have a lifetime of 39 months, those will all be expired in June 2021. Header type Response header Forbidden header name yes Syntax Expect-CT: re
port-uri="<uri>", enforce, max-age=<age> Directives max-age The number of seconds after reception of the Expect-CT header field during which the user agent should regard the host of the received message as a known Expect-CT host. If a cache receives a value greater than it can represent, or if any of its subsequent calculations overflows, the cache will consider this va...
...And 6 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
Why a re-introduction? Because JavaScript is notorious for being the world's most misunderstood programming language. It is often derided as being a toy, but beneath its layer of deceptive simplicity, powerful language features await. JavaScript is now used by an incredible number of high-profile applications, showing that deeper knowledge of this technology is an im
portant skill for any web or mobile developer. It's useful to start with an overview of the language's history. JavaScript was created in 1995 by Brendan Eich while he was an engineer at Netscape. JavaScript was first released with Netscape 2 early in 1996. It was originally going to be called LiveScript, but it was renamed in an ill-fated marketing decision that attempted to capitalize on the popularity of Sun Microsystem's Java...
...chDB, embedded computers, complete desktop environments like GNOME (one of the most popular GUIs for GNU/Linux operating systems), and others. Overview JavaScript is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods. Its syntax is based on the Java and C languages -- many structures from those languages apply to JavaScript as well. JavaScript sup
ports object-oriented programming with object prototypes, instead of classes (see more about prototypical inheritance and ES2015 classes). JavaScript also sup
ports functional programming -- because they are objects, functions may be stored in variables and passed around like any other object. Let's start off by looking at the building blocks of any language: the types. JavaScript programs manipulate ...
... // 1.5, not 1 console.log(Math.floor(3 / 2)); // 1 So an apparent integer is in fact implicitly a float. Also, watch out for stuff like: 0.1 + 0.2 == 0.30000000000000004; In practice, integer values are treated as 32-bit ints, and some implementations even store it that way until they are asked to perform an instruction that's valid on a Number but not on a 32-bit integer. This can be im
portant for bit-wise operations. The standard arithmetic operators are sup
ported, including addition, subtraction, modulus (or remainder) arithmetic, and so forth. There's also a built-in object that we did not mention earlier called Math that provides advanced mathematical functions and constants: Math.sin(3.5); var circumference = 2 * Math.PI * r; You can convert a string to an integer using the...
...And 6 more matches
WebAssembly.instantiateStreaming() - JavaScript
The WebAssembly.instantiateStreaming() function compiles and instantiates a WebAssembly module directly from a streamed underlying source. This is the most efficient, optimized way to load wasm code. Syntax Promise<ResultObject> WebAssembly.instantiateStreaming(source, im
portObject); Parameters source A Response object or a promise that will fulfill with one, representing the underlying source of a .wasm module you want to stream, compile, and instantiate. im
portObject Optional An object containing the values to be im
ported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared im
port of the compiled module or else a WebAssembly.LinkError is thrown. Return value A Promise that resolves to a ResultObje...
... Exceptions If either of the parameters are not of the correct type or structure, a TypeError is thrown. If the operation fails, the promise rejects with a WebAssembly.CompileError, WebAssembly.LinkError, or WebAssembly.RuntimeError, depending on the cause of the failure. ...
...mo on GitHub, and view it live also) directly streams a .wasm module from an underlying source then compiles and instantiates it, the promise fulfilling with a ResultObject. Because the instantiateStreaming() function accepts a promise for a Response object, you can directly pass it a WindowOrWorkerGlobalScope.fetch() call, and it will pass the response into the function when it fulfills. var im
portObject = { im
ports: { im
ported_func: arg => console.log(arg) } }; WebAssembly.instantiateStreaming(fetch('simple.wasm'), im
portObject) .then(obj => obj.instance.ex
ports.ex
ported_func()); The ResultObject's instance member is then accessed, and the contained ex
ported function invoked. Note: For this to work, .wasm files should be returned with an application/wasm MIME type by the server. Spec...
...And 6 more matches
Index - XSLT: Extensible Stylesheet Language Transformations
t. These are the same files used in the Generating HTML example in the XSLT in Netscape Gecko article. The XML file describes an article and the XSL file formats the information for display. 8 Interface List NeedsContent, Reference See XSLTProcessor in the Web API documentation section. 9 Introduction Gecko, Intro, JavaScript, XSLT With modern browsers sup
porting XSLT, developers can now use JavaScript to access the power that XSLT provides. JavaScript can enable a web application to load XML data, process it via XSLT into a presentable form and then add it into an existing document. Since the XML data loaded only contains the raw information without any presentation data, it can load quickly even on dialup. 10 JavaScript/XSLT Bindings D...
...o a presentable form and then add it into an existing document. Since the XML data loaded only contains the raw information without any presentation data, it can load quickly even on dialup. 10 JavaScript/XSLT Bindings DOM, JavaScript, XML, XSLT JavaScript can run XSLT transformations through the XSLTProcessor object. Once instantiated, an XSLTProcessor has an XSLTProcessor.im
portStylesheet() method that takes as an argument the XSLT stylesheet to be used in the transformation. The stylesheet has to be passed in as an XML document, which means that the .xsl file has to be loaded by the page before calling XSLTProcessor.im
portStylesheet(). This can be done via XMLHttpRequest or XMLDocument.load(). 11 Resources XSLT No summary! 12 Setting Para...
...JavaScript and XSLT could be used to sort XML data and then display it. The sorting would have to alternate between ascending and descending sorting. 13 Transforming XML with XSLT NeedsMigration, Transforming_XML_with_XSLT, XML, XSLT The separation of content and presentation is a key design feature of XML. The structure of an XML document is designed to reflect and clarify im
portant relationships among the individual aspects of the content itself, unhindered by a need to provide any indication about how this data should eventually be presented. This intelligent structuring is particularly im
portant as more and more data transfers are automated and take place between highly heterogeneous machines linked by a network. 14 An Overview NeedsHelp, NeedsMarkupWork...
...And 6 more matches
Caching compiled WebAssembly modules - WebAssembly
Caching is useful for improving the performance of an app -- we can store compiled WebAssembly modules on the client so they don't have to be downloaded and compiled every time. This article explains the best practices around this. Caching via IndexedDB IndexedDB is a transactional database system that allows you to store and retrieve structured data on the client-side. It is ideal for persisting assets locally for the saved state of an application, including text, blobs, and any other type of cloneable object. ...
... Setting up a caching library Because IndexedDB is a somewhat old-fashioned API, we wanted to provide a library function to speed up writing caching code, and make it work better along with today's more modern APIs. In our wasm-utils.js library script, you'll find instantiateCachedURL() -- this function fetches the wasm module at url with a version of dbVersion, instantiates it with the given im
portObject, and returns a promise resolving to the finished wasm Instance. Additionally, it handles creating a database to cache the compiled wasm modules in, attempts to store new modules in the database, and retrieves previously cached modules from the database, saving you from having to download them again. Note: The entire site's wasm cache (not just the given URL) is versioned by the specified ...
...versioned by the specified dbVersion passed into the function. If the wasm module code is updated, or its URL changes, you will need to update dbVersion. Any subsequent call to instantiateCachedURL() will then clear out the entire cache, allowing you to avoid using out-of-date modules. The function starts off by defining some necessary constants: function instantiateCachedURL(dbVersion, url, im
portObject) { const dbName = 'wasm-cache'; const storeName = 'wasm-cache'; Setting up the database The first helper function contained inside instantiateCachedURL() -- openDatabase() -- creates an object store for storing wasm modules, and also handles clearing out the database if the dbVersion is updated; it returns a promise resolving to the new database. function openDatabase() { retur...
...And 6 more matches
/loader - Archive of obsolete content
t appear to work as of 02.2016 due to "use strict" being added to the file): <script type='application/javascript' src='resource://gre/modules/commonjs/toolkit/loader.js'></script> This will expose a single loader object containing all of the API functions described in this document. It can be loaded as a JavaScript code module: let { Loader, Require, unload } = Components.utils.im
port('resource://gre/modules/commonjs/toolkit/loader.js'); It can be required as a CommonJS module from a module loaded in the loader itself: let { Loader, Require, unload } = require('toolkit/loader'); What is it good for ? Create somewhat standardized JS environments that people doing non-browser JS are familiar with. Provide an environment for loading CommonJS style modules, which ...
... Require, unload } = require('toolkit/loader'); What is it good for ? Create somewhat standardized JS environments that people doing non-browser JS are familiar with. Provide an environment for loading CommonJS style modules, which makes it possible to consume lots of interesting code that has already been developed. Secure each module in an isolated JS sandbox and makes any capability im
ports explicit via calls to the require() function. create task specific loaders with restricted module access. Provide unload hooks that may be used to undo changes made by anything loaded into it. Instantiation The loader module provides a Loader() function that may be used to instantiate new loader instances: let loader = Loader(options); Configuration Loader() may be provided with a set of...
...o changes made by anything loaded into it. Instantiation The loader module provides a Loader() function that may be used to instantiate new loader instances: let loader = Loader(options); Configuration Loader() may be provided with a set of configuration options: paths: describes where the loader should find the modules it is asked to load. Mandatory. modules: provides a set of module ex
ports. Optional. globals: provides a set of globals shared across modules loaded via this loader. Optional. resolve: provide customized module resolution logic. Optional. id: provide add-on id to attach to loaded modules. Optional. paths The loader needs to be provided with a set of locations to indicate where to find modules loaded using require(). This is provided by a mandatory options.paths ...
...And 5 more matches
Preferences - Archive of obsolete content
a pref (accessibility.typeaheadfind) prefs.setBoolPref("typeaheadfind", !value); // set a pref (accessibility.typeaheadfind) Complex types As noted in the previous section, each entry in the preferences database (prefs.js) must have a string, an integer, or a boolean value. However, there is a concept of complex types, which makes it easier for developers to save and load nsILocalFile and nsISup
portsString objects in preferences (as strings -- note that from the preferences system's point of view, complex values have a nsIPrefBranch.PREF_STRING type.) There are two nsIPrefBranch methods implementing the concept -- setComplexValue() and getComplexValue(). You can look up their implementations in nsPrefBranch.cpp. Here are the IDL definitions: void getComplexValue(in string aPrefName, in nsI...
...e.) There are two nsIPrefBranch methods implementing the concept -- setComplexValue() and getComplexValue(). You can look up their implementations in nsPrefBranch.cpp. Here are the IDL definitions: void getComplexValue(in string aPrefName, in nsIIDRef aType, [iid_is(aType), retval] out nsQIResult aValue); void setComplexValue(in string aPrefName, in nsIIDRef aType, in nsISup
ports aValue); As you can see, both of them take a parameter, aType, which can have one of the following values (to be precise, you should pass Components.interfaces.nsIWhatever instead of just nsIWhatever, which is undefined). nsISup
portsString Used to handle Unicode strings in preferences. Use this when the preference value may contain non-ASCII characters (for example, a user's name). nsIPr...
...ke a parameter, aType, which can have one of the following values (to be precise, you should pass Components.interfaces.nsIWhatever instead of just nsIWhatever, which is undefined). nsISup
portsString Used to handle Unicode strings in preferences. Use this when the preference value may contain non-ASCII characters (for example, a user's name). nsIPrefLocalizedString Almost the same as nsISup
portsString, but it is handled differently in getComplexValue() when there's no user value for the given preference; see below for details. nsILocalFile and nsIRelativeFilePref Store paths in preferences. ...
...And 5 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
Add-on Versioning Add-ons should specify their versions using the Toolkit version format. As a rough overview this is a version string split by periods, some examples: 2.0 1.0b1 3.0pre1 5.0.1.2 Note: Before Firefox 1.5 the more basic Firefox Version Format was used: major.minor.release.build[+] where only digits were allowed. The toolkit version format sup
ports the Firefox version format but allows greater flexibility. How Applications Determine Compatibility When installing add-ons applications look at the targetApplication entries in the add-on's install.rdf. An entry must exist with an ID matching the ID of the application. Additionally the minVersion and maxVersion of this entry must be a range that includes the version of the running application. If the application has...
...maxVersion that is larger than the currently available version of the application since you do not know what API and UI changes are just around the corner. With compatibility updating it is not necessary to release a whole new version of the extension just to increase its maxVersion. For the maxVersion it is generally permissible to use a * in place of the minor version of the application you sup
port, for example 2.0.0.* would mean that you sup
port any minor update to version 2 of the application. The application will usually suggest to extension authors which version part it is sensible to do this with. Do not mistakenly think that * in a version represents any version. The * actually represents an infinitely high number and so is really only sensibly used in the maxVersion. Using it in a m...
...tomatic Add-on Update Checking Applications will periodically check for updates to installed add-ons by retrieving the updateURL. The information returned can be used to notify the user of an updated version to the add-on as well as inform the application of new application versions that the add-on is compatible with. Note: Starting in Gecko 2.0, the automatic add-on update process properly sup
ports cases in which the add-on's GUID changes by uninstalling the old version and then installing the new one. Previously, it was possible to wind up with two copies of the same add-on installed. Compatibility Updates During the automatic update checks, applications look for both new versions and updated compatibility information about the currently installed version of an add-on. This means that ...
...And 5 more matches
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
value; ptr->GetterMethod(getter_Copies(value)); - const PRUnichar *strvalue = value; + // nsString doesn't cast directly to PRUnichar*, use .get()+ const PRUnichar *strvalue = value.get(); The frozen string API doesn't accept a length for .Truncate(). Use .SetLength() instead: nsString myString = someString; - myString.Truncate(4); + myString.SetLength(4); The frozen string API doesn't sup
port the iterator or const_iterator classes, but you can use pointers the same way: nsString myString = someString; - nsString::const_iterator begin, end;- myString.BeginReading(begin); myString.EndReading(end); + const PRUnichar *begin, *end;+ myString.BeginReading(&begin, &end); The frozen string API uses comparator functions instead of a virtual comparator class. unicharutils has been modified t...
...s about undeclared do_CreateInstance: #include "nsComponentManagerUtils.h" For errors about undeclared do_GetService: #include "nsServiceManagerUtils.h" For errors about undeclared NS_GetSpecialDirectory: #include "nsDirectoryServiceUtils.h" Utility Classes Some utility classes could previously be created with NS_New* utility functions. ...
...Don't use it in new code. Use nsIArray instead. ...
...And 5 more matches
Appendix D: Loading Scripts - Archive of obsolete content
ynamically load and execute JavaScript files. Each of these means has its own advantages and disadvantages, as well as its own quirks which may trap the unwary. Below is an overview of the more common means of loading scripts, along with some of their primary advantages, disadvantages, quirks, and use cases. The examples below which make use of the Services global assume that you're previously im
ported the Services.jsm module. As this module only exists on Firefox 4 and other Gecko 2-based platforms, the services in question will have to be manually loaded on other platforms. <script> tags XUL script tags are traditionally the primary means of loading scripts for extension developers. These tags are generally inserted into XUL overlay files or other XUL documents, after which they are a...
... tags may or may not be loaded from pre-compiled bytecode in the fastload cache (Gecko 1.x) or startup cache (Gecko 2), which means they don't necessarily need to read as source and compiled with each restart. Flexibility: Script tags provide a means to specify the character set and JavaScript version of the scripts to be loaded, which many other methods do not. Debuggable: development tools sup
port debugging JavaScript loaded by script tags Disadvantages Scoping: Scripts loaded via script tags share the global scope with all other scripts loaded into the same window. These tags provide no means to load scripts into a private or otherwise specific scope. Speed: Even if these scripts are loaded from a cache, only read and compile time are reduced. The scripts still need to execute all o...
...he possible performance concerns, passing data between these compartments is not entirely transparent. Some known issues include: E4X XML objects cannot be wrapped for passage between compartments: bug 613142 There are a number of type detection issues, including: String.replace does not recognize RegExp objects from foreign compartments: bug 633830 Debugging: Sup
port for Sandbox evaluation in development tools is uneven. Chromebug sup
ports Firebug based Sandboxes. Examples The following code will execute a simple script in a Sandbox with the privilege level of the current content page. The globals of the current content window will be available in the scripts global scope. In stack traces, the script will appear to have been loaded from the file "zz-9://pl...
...And 5 more matches
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
ing team actually needed the least convincing to convert over to a standards-based design, because they could also immediately envision the benefits to their workload and maintenance of the site. How is the site styled now that you've ripped out all the HTML-based presentation? Technically, there are 13 total stylesheets used at any one time. ...
... The breakdown: 1 master screen media file which im
ports 4 files: a base file (bulk of formatting) a file for finance/table formatting color file (override colors and background images for specific color scheme) temp file (used for styles associated with temporary features and ad-related pages) 1 print media file 1 aural media file 3 master alternate style sheets which im
port 1 file each the 3 im
ported files set alternate font sizes (small, large, larger) How much did the size of a typical Wired News page shrink? The HTML went from 32 KB down to 19 KB, but images increased from 8 to 13 KB. We've noted that some of the file size comparison's aren't necessarily fair, because we're not comparing apples to apples-- we're comparing an old design using html, t...
...at both floated divs and positioned divs. I went back and forth between each one for two weeks, and finally narrowed in on positioned divs as the choice for Wired News. Why did you choose positioning over floats? Floats had a few disadvantages from my perspective. One was the required order of content within generic markup. For Wired News, the center (or main) column usually contains the most im
portant content for each page. I wanted center column content to appear first in browsers that got the un-styled version. With floats, either the left column or the right column always had to be drawn first. For sites that rely on a left or right column for primary navigation, this content order requirement of float usage may produce desired and advantageous behavior. I also found a lot of trouble en...
...And 5 more matches
MMgc - Archive of obsolete content
from being destroyed. Sometimes, it is desirable to hold a pointer to a GCObject, but to let the object be destroyed if there are no other references. GCWeakRef can be used for this purpose. It has a get method which returns the pointer to the original object, or NULL if that object has already been destroyed. GCFinalizedObject Base class: GCObject A garbage collected object with finalization sup
port. All of the rules from GCObject above apply to GCFinalizedObject. The finalizer (C++ destructor) of a GCFinalizedObject will be invoked when MMgc collects the object. class MyFinalizedObject : public MMgc::GCFinalizedObject { public: ~MyFinalizedObject() { // Do finalization behavior, like closing network connections, // freeing unmanaged memory owned by this object, etc. } }; RCOb...
... memory that was freed by an explicit call to GC::Free (including DRC reaping) 0xdeadbeef This is written to the 4 bytes just after any object allocated via MMgc. It is used for overwrite detection. 0xfbfbfbfb A block given back to the heap manager is memset to this (fb == free block). Finalizers If your C++ class is a subclass of GCFinalizedObject or RCFinalizedObject, it has finalizer sup
port. A finalizer is a method which will be invoked by the GC when an unreachable object is about to be destroyed. It's similar to a destructor. It differs from a destructor in that it is usually called nondeterministically, i.e. in whatever random order the GC decides to destroy objects. C++ destructors are usually invoked in a comparatively predictable order, since they're invoked explicitly by the ...
... can be called from the msvc debugger and will spit out objects that are pointing to the given memory location. Memory Profiler MMgc's memory profiler can display the state of your application's heap, showing the different classes of object in memory, along with object counts, byte counts, and percentage of total memory. It can also display stack traces for where every object was allocated. The re
port can be output to the console or to a file, and can be configured to be displayed pre/post sweep or via API call. The Memory Profiler use sRTTI and stack traces to get information by location and type: class avmplus::GrowableBuffer - 24.9% - 3015 kb 514 items, avg 6007b 98.9% - 2983 kb - 512 items - poolobject.cpp:29 abcparser.cpp:948 ... 0.8% - 24 kb - 1 items - poolobject.cpp:29 abc...
...And 5 more matches
Running Tamarin acceptance tests - Archive of obsolete content
The latest asc.jar can be downloaded from from ftp://ftp.mozilla.org/pub/js/tamarin...latest/asc.jar. Also the source to asc.jar may be downloaded and rebuilt from http://opensource.adobe.com/wiki/dis...exsdk/Flex+SDK. Set the ASC environment variable, as described above. Set the SHELLABC environment variable to the path of the generated/shell_toplevel.abc. ...
...mozilla.org/pub/js/tamarin...latest/asc.jar. Also the source to asc.jar may be downloaded and rebuilt from http://opensource.adobe.com/wiki/dis...exsdk/Flex+SDK. Set the ASC environment variable, as described above. Set the SHELLABC environment variable to the path of the generated/shell_toplevel.abc. ...
...may be downloaded and rebuilt from http://opensource.adobe.com/wiki/dis...exsdk/Flex+SDK. Set the ASC environment variable, as described above. Set the SHELLABC environment variable to the path of the generated/shell_toplevel.abc. ...
...And 5 more matches
URIs and URLs - Archive of obsolete content
ay that existing identifiers are used; and, it allows the identifiers to be reused in many different contexts, thus permitting new applications or protocols to leverage a pre-existing, large, and widely-used set of resource identifiers. Resource A resource can be anything that has identity. Familiar examples include an electronic document, an image, a service (e.g., "today's weather re
port for Los Angeles"), and a collection of other resources. Not all resources are network "retrievable"; e.g., human beings, corporations, and bound books in a library can also be considered resources. The resource is the conceptual mapping to an entity or set of entities, not necessarily the entity which corresponds to that mapping at any particular instance in time. Thus, a resource can remain cons...
... require the use of more than one protocol (e.g., both DNS and HTTP are typically used to access an "http" URL's resource when it can't be found in a local cache). In Necko every URI scheme is represented by a protocol handler. Sometimes a protocol handler represents more than one scheme. The protocol handler provides scheme specific information and methods to create new URIs of the schemes it sup
ports. One of the main Necko goals is to provide a "plug able" protocol sup
port. This means that it should be possible to add new protocols to Necko just by implementing nsIProtocolHandler and nsIChannel. It also might be necessary to implement a new urlparser for a new protocol but that might not be necessary because Necko already provides URI implementations that can deal with a number of schemes, b...
... represents access to typical URLs with schemes like "http", "ftp", ... nsSimpleURI One implementation of nsIURI is nsSimpleURI which is the basis for protocols like "about". nsSimpleURI contains setters and getters for the URI and the components of an URI: scheme and path (non-scheme). There are no pre written urlparsers for simple URIs, because of it's simple structure. nsStandardURL The most im
portant implementation of nsIURL is nsStandardURL which is the basis for protocols like http, ftp, ... These schemes sup
port a hierarchical naming system, where the hierarchy of the name is denoted by a "/" delimiter separating the components in the path. nsStandardURL also contains the facilities to parse these typ of urls, to break the specification of the URL "spec" down into the most basic segment...
...And 5 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
etscape Gecko browsers using XPInstall. A Definition of Terms XPInstall is an installer technology, and the name itself stands for "Cross Platform Install" (hence "XP" -- an abbreviation for "Cross Platform"). An XPInstall package is usually called an XPI package for short (and often pronounced "zippy"). This article is about how you can use XPInstall to install plugins to the browsers that sup
port XPInstall. An XPI Package is in fact a ZIP file with the XPI file extension (e.g. myPluginInstaller.xpi), and can be created on Windows by utilities such as WinZip. XPI Packages, like ZIP files, "contain" other files, typically: The software component to be installed. In our case, this is the plugin software. A JavaScript file called install.js, which is the install logic that drives the insta...
...hat contains the software and the install.js JavaScript file is a cross-platform file (Zip) and since JavaScript is understood by Mozilla browsers on all platforms, often one single XPI package can be deployed on all platforms. This is, in fact, how skins and themes are installed to Mozilla browsers, changing their look and feel. This article focuses on how to install plugins. Which Browsers Sup
port XPInstall? Currently, all Mozilla browsers released by mozilla.org sup
port XPInstall, and a family of browsers based on Mozilla code sup
port XPInstall. In particular, this includes: Recent Netscape browsers such as Netscape 6.2.x and Netscape 7.0, which are both based on Netscape Gecko, which is at the core of the Mozilla browser Recent beta-only versions of the AOL software based on Netscape...
... XPInstall. In particular, this includes: Recent Netscape browsers such as Netscape 6.2.x and Netscape 7.0, which are both based on Netscape Gecko, which is at the core of the Mozilla browser Recent beta-only versions of the AOL software based on Netscape Gecko, the layout engine of the Mozilla project. Caveats: AOL Time Warner's CompuServe browser, also based on Netscape Gecko, does not sup
port XPInstall. Netscape Communicator 4.x does not sup
port XPInstall. What Does a Plugin Consist Of? Plugins can consist of the following types of files, all of which can be installed via an XPI Package: Shared Libraries (i.e. on Windows, these are DLLs, on Unix these are *.so files). These files are native code files made with the Netscape Plugin API. If the plugin is scriptable, then it will ...
...And 5 more matches
Writing Skinnable XUL and CSS - Archive of obsolete content
! Love it! Make it a part of you! Each skin has a master skin file. The skin for a package should always have a master skin file whose name corresponds to the name of the package. For example, the skin for the Navigator package should contain a file called navigator.css that determines the default look of all XUL windows posed from this package. ...
...ys have a master skin file whose name corresponds to the name of the package. For example, the skin for the Navigator package should contain a file called navigator.css that determines the default look of all XUL windows posed from this package. If inheriting the global skin, a skin file must im
port the global skin explicitly. If your skin file wishes to inherit the global skin, then it should im
port the global skin explicitly. This is done using an @im
port directive placed at the top of the file. @im
port url(chrome://global/skin/) ... rest of skin file ... CSS files for a skin fall into two categories: base skin files and derived skin files. CSS files that im
port another skin file are calledderived skin files. CSS files that don't im
port another skin file are calledbase skin files. The...
...ve placed at the top of the file. @im
port url(chrome://global/skin/) ... rest of skin file ... CSS files for a skin fall into two categories: base skin files and derived skin files. CSS files that im
port another skin file are calledderived skin files. CSS files that don't im
port another skin file are calledbase skin files. There is one notable exception to this rule. Skin files that don't im
port any other skin files, but that are only intended to be used in the context of another component's skin are also considered derived skin files, since they are implicitly im
porting information from the other component's skin. These sorts of files are typically used with reusable overlayable widgets (e.g., the sidebar). ...
...And 5 more matches
XUL accessibility guidelines - Archive of obsolete content
m WebAIM. Dive Into Accessibility. Downloadable book on web accessibility with tips and character sketches. Assistive technology compatibility. List of popular assistive technologies and their respective compatibility levels with XUL. #accessibility. Accessibility channel for general discussion around Internet accessibility with logger. Useful at conferences. Apple Accessibility.
Portal to Apple accessibility. LARS (Linux Accessibility Resource Site).
Portal for general Linux accessibility. Microsoft Accessibility.
Portal for Microsoft accessibility. Accessibility - MDC. Accessibility hub on the Mozilla Developer Center. mozilla.sup
port.accessibility. Mozilla accessibility newsgroup. #accessibility. Accessibility channel on Mozilla's IRC server. Guide...
...Many screen reader users and those with physical disabilities rely on the keyboard as their primary input tool. ...
...t, XUL menus, labels, and other widgets get their font, size, and color settings from the user settings specified in the operating system. Respect these defaults unless you have a specific and unavoidable reason to change them. If you must change them, use CSS to size elements relative to the default sizes (for example, use % or em rather than specific point or pixel sizes). Color Color is an im
portant tool. Different colors can give different meanings to objects and text. However, color alone is inadequate for conveying meaning or information to the user. Some users may override the default color scheme of your application. Color should only be used to enhance the meaning of an object or text after that meaning is also communicated another way. Flexible sizing One of the great things abou...
...And 5 more matches
XUL Explorer - Archive of obsolete content
rtup. Option to include a user snippet file. The snippets are merged with the built-in snippets at startup. Double-click or drag-and-drop to insert a snippet File > New allows user to pick any "Template" snippet, as well as blank. Simple XUL Checker can be used to 'validate' the XUL snippet. It checks for legal element and attribute names, including allowed attributes for a given element. ...
...t startup. Double-click or drag-and-drop to insert a snippet File > New allows user to pick any "Template" snippet, as well as blank. Simple XUL Checker can be used to 'validate' the XUL snippet. It checks for legal element and attribute names, including allowed attributes for a given element. ...
...blank. Simple XUL Checker can be used to 'validate' the XUL snippet. It checks for legal element and attribute names, including allowed attributes for a given element. ...
...And 5 more matches
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
ll of the interfaces that you would normally expect to exist in the plugins will still exist when using XEmbed plugins. There are only two key differences: In the NPP_SetWindow call, the window parameter will be the XID of the hosting XEmbed window. As an implementation note, this is really the XID of a GtkSocket window. In your Plugin Instance NPP_GetValue call you need to make sure that you sup
port the new NPPVpluginNeedsXEmbed value. More information is included on this below. Hosting using Gtk2.x Included below are a couple of code snippits that should help you get started as well as some hints on building a successful plugin. Please use the following diagram as a reference: As you can see from the diagram above, it's pretty easy to set up a plugin using Gtk2. The general idea is that y...
...e following diagram as a reference: As you can see from the diagram above, it's pretty easy to set up a plugin using Gtk2. The general idea is that you use the XID that was passed into your NPP_SetWindow() call and create a GtkPlug to host inside of that socket. Since the GtkPlug is just a container, you can add your own widgets at your leisure with the packing you prefer. Telling Mozilla You Sup
port XEmbed As mentioned above, you will need to tell Mozilla that you sup
port the XEmbed protocol for hosting plugins. For backwards compatibility reasons if you don't tell Mozilla that you sup
port it it will try to hand you an Xt widget as a parent. However, before you do so you should make sure that the browser also sup
ports XEmbed when the plugin is first initialized. If you've built your plugin s...
...ed above, you will need to tell Mozilla that you sup
port the XEmbed protocol for hosting plugins. For backwards compatibility reasons if you don't tell Mozilla that you sup
port it it will try to hand you an Xt widget as a parent. However, before you do so you should make sure that the browser also sup
ports XEmbed when the plugin is first initialized. If you've built your plugin so that it will sup
port either Xt or XEmbed you can include a fallback for older style hosting. If you haven't you can return an error and the plugin will be ignored. It's good practice to do this in case people try to install your plugin for older versions of the browser that don't sup
port XEmbed functionality. This is an incomplete example of what a piece of code might look like that tries to check for the proper Mozi...
...And 5 more matches
Tamarin Tracing Build Documentation - Archive of obsolete content
Tamarin Source Versions The following instructions are for obtaining and building the Tamarin Tracing source code. ...
... Tamarin Source Versions The following instructions are for obtaining and building the Tamarin Tracing source code. ...
... Tamarin Source Versions The following instructions are for obtaining and building the Tamarin Tracing source code. ...
...And 5 more matches
Plug-in Development Overview - Gecko Plugin API Reference
ctory for your operating system. See Installing Plug-ins. Test your plug-in and debug as necessary. Create an HTML page and embed the plug-in object. For information about the HTML elements to use, see Using HTML to Display Plug-ins. To see your plug-in in action, simply display the HTML page that calls it in the browser. Registering Plug-ins Gecko identifies a plug-in by the MIME type it sup
ports. When it needs to display data of a particular MIME type, the browser finds and invokes the plug-in object that sup
ports that type. The data can come from either an object element in an HTML file (where the object or embed element either specifies the MIME type directly or references a file of that type), from a separate non-HTML file of that MIME type, or from the server. The server looks for ...
...ooks for the MIME type registered by a plug-in, based on the file extension, and starts sending the file to the browser. The browser looks up the media type, and if it finds a plug-in registered to that type, loads the plug-in software. When it starts up, the browser checks for plug-in modules for the platform and registers them. It determines which plug-ins are installed and which types they sup
port through a combination of user preferences that are private to the browser, the contents of the plug-ins directory, or the registry on Windows. A MIME type is made up of a major type (such as application or image) and a minor type, for example, image/jpeg. If you define a new MIME type for a plug-in, you must register it with IETF (Internet Engineering Task Force). Until your new MIME type is reg...
...ter set to "Windows Multilingual" in your development environment. The resource code for this language and character set combination is 040904E4. Unix On Unix, plug-ins are found according to the section How Gecko Finds Plug-ins. To determine the MIME types and file extensions that the plug-in handles, the browser loads each library and calls into the NP_GetMIMEDescription entry point. This ex
ported C function should return a string containing the type, extension list, and type description separated by colons. Each MIME types should be separated by semicolons. For example: image/xbm:xbm:X Bitmap or for 2 MIME types: image/xbm:xbm:X Bitmap;image/png:png:
Portable Network Graphics. This information will then appear in the navigator.mimeTypes DOM object. NPP_GetValue is called after the plug-...
...And 5 more matches
Sizing items in CSS - Learn web development
Previous Overview: Building blocks Next In the various lessons so far you have come across a number of ways to size items on a web page using CSS. Understanding how big the different features in your design will be is im
portant, and in this lesson we will summarize the various ways elements get a size via CSS and define a few terms around sizing that will help you in the future. Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To understand the different ways we can size things in CSS. The natural or intrinsic size of things HTML Elements have a natural size, set before they are affec...
...to load really large images and then scale them down in the browser. Images should be appropriately sized to be no larger than they need to be for the largest size they are displayed in the design. Downloading overly large images will cause your site to become slow, and it can cost users more money if they are on a metered connection. Note: Find out more about responsive image techniques. ...
... images and then scale them down in the browser. Images should be appropriately sized to be no larger than they need to be for the largest size they are displayed in the design. Downloading overly large images will cause your site to become slow, and it can cost users more money if they are on a metered connection. Note: Find out more about responsive image techniques. ...
...And 5 more matches
From object to iframe — other embedding technologies - Learn web development
content into webpages such as videos and animations, which just weren't available through HTML alone. Embedding these technologies was achieved through elements like <object>, and the lesser-used <embed>, and they were very useful at the time. They have since fallen out of fashion due to many problems, including accessibility, security, file size, and more; these days most mobile devices don't sup
port such plugins anymore, and desktop sup
port is on the way out. Finally, the <iframe> element appeared (along with other ways of embedding content, such as <canvas>, <video>, etc.) This provides a way to embed an entire web document inside another one, as if it were an <img> or other such element, and is used regularly today. With the history lesson out of the way, let's move on and see how to use...
...explore the code in a bit more detail. Say you wanted to include the MDN glossary on one of your web pages -- you could try something like this: <iframe src="https://udn.realityripple.com/docs/Glossary" width="100%" height="500" frameborder="0" allowfullscreen sandbox> <p> <a href="https://udn.realityripple.com/docs/Glossary"> Fallback link for browsers that don't sup
port iframes </a> </p> </iframe> This example includes the basic essentials needed to use an <iframe>: allowfullscreen If set, the <iframe> is able to be placed in fullscreen mode using the Full Screen API (somewhat beyond scope for this article.) frameborder If set to 1, this tells the browser to draw a border between this frame and other frames, which is the default behaviour. 0 removes...
...attribute, as with <video>/<img>, contains a path pointing to the URL of the document to be embedded. width and height These attributes specify the width and height you want the iframe to be. Fallback content In the same way as other similar elements like <video>, you can include fallback content between the opening and closing <iframe></iframe> tags that will appear if the browser doesn't sup
port the <iframe>. In this case, we have included a link to the page instead. It is unlikely that you'll come across any browser that doesn't sup
port <iframe>s these days. sandbox This attribute, which works in slightly more modern browsers than the rest of the <iframe> features (e.g. IE 10 and above) requests heightened security settings; we'll say more about this in the next section. Note: In o...
...And 5 more matches
Looping code - Learn web development
e or more of the following features: A counter, which is initialized with a certain value -- this is the starting point of the loop ("Start: I have no food", above). A condition, which is a true/false test to determine whether the loop continues to run, or stops -- usually when the counter reaches a certain value. This is illustrated by "Have I got enough food?", above. Let's say he needs 10
portions of food to feed his family. An iterator, which generally increments the counter by a small amount on each successive loop, until the condition is no longer true. We haven't explicitly illustrated this above, but we could think about the farmer being able to collect say 2
portions of food per hour. After each hour, the amount of food he has collected is incremented by two, and he checks wheth...
...r, which generally increments the counter by a small amount on each successive loop, until the condition is no longer true. We haven't explicitly illustrated this above, but we could think about the farmer being able to collect say 2
portions of food per hour. After each hour, the amount of food he has collected is incremented by two, and he checks whether he has enough food. If he has reached 10
portions (the point where the condition is no longer true, so the loop exits), he can stop collecting and go home. In pseudocode, this would look something like the following: loop(food = 0; foodNeeded = 10) { if (food >= foodNeeded) { exit loop; // We have enough food; let's go home } else { food += 2; // Spend an hour collecting 2 more food // loop will then run again } } S...
...else { food += 2; // Spend an hour collecting 2 more food // loop will then run again } } So the amount of food needed is set at 10, and the amount the farmer currently has is set at 0. In each iteration of the loop, we check whether the amount of food the farmer has is larger or equal to the amount he needs. If so, we can exit the loop. If not, the farmer spends an hour collecting two
portions of food, and the loop runs again. Why bother? At this point, you probably understand the high-level concepts behind loops, but you are probably thinking "OK, great, but how does this help me write better JavaScript code?" As we said earlier, loops are all to do with doing the same thing over and over again, which is great for rapidly completing repetitive tasks. Often, the code will be sli...
...And 5 more matches
Client-side storage - Learn web development
This lets you persist data for long-term storage, save sites or documents for offline use, retain user-specific settings for your site, and more. This article explains the very basics of how these work. Prerequisites: JavaScript basics (see first steps, building blocks, JavaScript objects), the basics of Client-side APIs Objective: To learn how to use client-side storage APIs to store application data. ...
...me, whether they are logged in, what color to use for the background of the screen, etc. The IndexedDB API provides the browser with a complete database system for storing complex data. This can be used for things from complete sets of customer records to even complex data types like audio or video files. You'll learn more about these APIs below. The future: Cache API Some modern browsers sup
port the new Cache API. This API is designed for storing HTTP responses to specific requests, and is very useful for doing things like storing website assets offline so the site can subsequently be used without a network connection. Cache is usually used in combination with the Service Worker API, although it doesn't have to be. Use of Cache and Service Workers is an advanced topic, and we won't be c...
...diately, they will happen at some point in the future, and you get notified when they're done. To handle this in IndexedDB, you create a request object (which can be called anything you like -- we called it request so it is obvious what it is for). You then use event handlers to run code when the request completes, fails, etc., which you'll see in use below. Note: The version number is im
portant. If you want to upgrade your database (for example, by changing the table structure), you have to run your code again with an increased version number, different schema specified inside the onupgradeneeded handler (see below), etc. We won't cover upgrading databases in this simple tutorial. Now add the following event handlers just below your previous addition -- again inside the wind...
...And 5 more matches
React interactivity: Events and state - Learn web development
actually part of your JavaScript. In the above example, we're adding an onClick attribute to the <button> element. The value of that attribute is a function that triggers a simple alert. The onClick attribute has special meaning here: it tells React to run a given function when the user clicks on the button. There are a couple of other things to note: The camel-cased nature of onClick is im
portant -- JSX will not recognize onclick (again, it is already used in JavaScript for a specific purpose, which is related but different -- standard onclick handler properties). All browser events follow this format in JSX - on, followed by the name of the event. Let's apply this to our app, starting in the Form.js component. Handling form submission At the top of the Form() component function, ...
...an update it later. It's not possible to update the props a component receives; only to read them. React provides a variety of special functions that allow us to provide new capabilities to components, like state. These functions are called hooks, and the useState hook, as its name implies, is precisely the one we need in order to give our component some state. To use a React hook, we need to im
port it from the react module. In Form.js, change your very first line so that it reads like this: im
port React, { useState } from "react"; This allows us to im
port the useState() function by itself, and utilize it anywhere in this file. useState() creates a piece of state for a component, and its only parameter determines the initial value of that state. It returns two things: the state, and a fun...
...practice, you should clear the input after your form submits, so we'll call setName() again with an empty string to do so: function handleSubmit(e) { e.preventDefault(); props.addTask(name); setName(""); } At last, you can type something into the input field in your browser and click Add -- whatever you typed will appear in an alert dialog. ...
...And 5 more matches
Adding a new todo form: Vue events, methods, and models - Learn web development
rm We now have an app that displays a list of to-do items. However, we can't update our list of items without manually changing our code! Let's fix that. Let's create a new component that will allow us to add a new to-do item. In your components folder, create a new file called ToDoForm.vue. Add a blank <template> and a <script> tag like before: <template></template> <script> ex
port default {}; </script> Let's add in an HTML form that lets you enter a new todo item and submit it into the app. We need a <form> with a <label>, an <input>, and a <button>. Update your template as follows: <template> <form> <label for="new-todo-input"> What needs to be done? </label> <input type="text" id="new-todo-input" name="new-todo" autoco...
...put" name="new-todo" autocomplete="off" /> <button type="submit"> Add </button> </form> </template> So we now have a form component into which we can enter the title of a new todo item (which will become a label for the corresponding ToDoItem when it is eventually rendered). Let's load this component into our app. ...
...bmit"> Add </button> </form> </template> So we now have a form component into which we can enter the title of a new todo item (which will become a label for the corresponding ToDoItem when it is eventually rendered). Let's load this component into our app. ...
...And 5 more matches
Setting up your own test automation environment - Learn web development
ramework that will install WebDriver and the bindings required to communicate with WebDriver using this language, for example, Java, C#, Ruby, Python, JavaScript (Node), etc. See Setting Up a Selenium-WebDriver Project for more details of Selenium setups for different languages. Different browsers require different drivers to allow WebDriver to communicate with and control them. See Platforms Sup
ported by Selenium for more information on where to get browser drivers from, etc. We will cover writing and running Selenium tests using Node.js, as it is quick and easy to get started, and a more familiar environment for front end devs. Note: If you want to find out how to use WebDriver with other server-side environments, also check out Platforms Sup
ported by Selenium for some useful links. Se...
...n mistake. To set your PATH variable on Mac OS X/most Linux systems: Open your .bash_profile (or .bashrc) file (if you can't see hidden files, you'll need to display them, see Show/Hide hidden files in Mac OS X or Show hidden folders in Ubuntu). Paste the following into the bottom of your file (updating the path as it actually is on your machine): #Add WebDriver browser drivers to PATH ex
port PATH=$PATH:/Users/bob Save and close this file, then restart your Terminal/command prompt to reapply your Bash configuration. Check that your new paths are in the PATH variable by entering the following into your terminal: echo $PATH You should see it printed out in the terminal. To set your PATH variable on Windows, follow the instructions at How can I add a new folder to my system pa...
...common examples starting at Getting text values on the WebDriver docs. If we wanted to get the text inside our button, we could do this: button.getText().then(function(text) { console.log('Button text is \'' + text + '\''); }); Add this to quick_test.js now. Making sure you are inside your project directory, try running the test: node quick_test.js You should see the button's text label re
ported inside the console. let's do something a bit more useful. delete the previous code entry, then add this line at the bottom instead: button.click(); Try running your test again; the button will be clicked, and the alert() popup should appear. At least we know the button is working! You can interact with the popup too. Add the following to the bottom of the code, and try testing it again: le...
...And 5 more matches
Configuring Build Options
Please read the following directions carefully before building, and follow them in order. ...
...fig" > mozconfig If your mozconfig isn't in your source directory, you can also use the MOZCONFIG environment variable to specify the path to your mozconfig. The path you specify must be an absolute path or else client.mk will not find it. This is useful if you choose to have multiple mozconfig files for different applications or configurations (see below for a full example). Note that in the ex
port example below the filename was not mozconfig. Regardless of the name of the actual file you use, we refer to this file as the mozconfig file in the examples below. Setting the mozconfig path: ex
port MOZCONFIG=$HOME/mozilla/mozconfig-firefox Calling the file .mozconfig (with a leading dot) is also sup
ported, but this is not recommended because it may make the file harder to find. This will al...
... Options prefixed with ac_add_options are passed to configure, and affect the build process. ...
...And 5 more matches
IPDL Tutorial
See IPDL Processes and Threads for more details. Because protocol messages are represented as C++ methods, it's easy to forget that they are in fact asynchronous messages: by default the C++ method will return immediately, before the message has been delivered. The parameters of the Recv* methods (const nsCString& pluginPath in the example) are refer...
...d SendBaz() { /* boilerplate */ } }; You can use the child, parent, and both labels multiple times in a protocol specification. They behave like public, protected, and private labels in C++. Parameters Message declarations allow any number of parameters. Parameters specify data that are sent with the message. Their values are serialized by the sender and deserialized by the receiver. IPDL sup
ports built-in and custom primitive types, as well as unions and arrays. The built-in simple types include the C++ integer types (bool, char, int, double) and XPCOM string types (nsString, nsCString). IPDL im
ports these automatically because they are common, and because the base IPC library knows how to serialize and deserialize these types. See ipc/ipdl/ipdl/builtin.py for the most up-to-date lis...
... Actors may be passed as parameters. The C++ signature will accept a PProtocolParent* on one side and convert it to a PProtocolChild* on the other. ...
...And 5 more matches
Task.jsm
Tasks are built upon generator functions and promises. ...
... Tasks are built upon generator functions and promises. ...
...s. If you specify a function that is not a generator, it is called with no arguments, and its return value is used to fulfill the returned promise. If you specify anything else, you get a promise that is already fulfilled with the specified value. Return value A promise that is fulfills when the task returns or rejects when the task throws an exception. Examples General example Cu.im
port("resource://gre/modules/Task.jsm"); Task.spawn(function* () { // This is our task. It is a generator function because it contains the // "yield" operator at least once. Let's create a promise object, wait on // it and capture its resolution value. let myPromise = getPromiseResolvedOnTimeoutWithValue(1000, "Value"); let result = yield myPromise; // This part is executed only after...
...And 5 more matches
Localization and Plurals
, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, ... ...
...late (Basque), Latin/Greek (Greek), Semitic (Hebrew), Romanic (Italian,
Portuguese, Spanish, Catalan), Vietnamese is 1: 1 everything else: 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, ... Plural rule #2 (2 forms) Families: Romanic (French, Brazilian
Portuguese), Lingala is 0 or 1: 0, 1 everything else: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, ... Plural rule #3 (3 forms) Families: Baltic (Latvian, Latgalian) ends in 0: 0 ends in 1, excluding 11: 1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 13...
.... chrome://mozapps/locale/downloads/do...tes,hours,days chrome://mozapps/locale/downloads/do...dsTitlePercent chrome://browser/locale/browser.prop...ausedDownloads Version history 0.1: Initial version with pluralRule check, properties input loading, table generation, sample output display 0.2: Use PluralForm.numForms() to get the number of forms instead of figuring out locally to better sup
port future rules - Requires build from 2007/01/27 or later 0.3: Generate a list of what numbers fall into which plural form to minimize the sample output to at most 3 of each form Developing with PluralForm The functionality for getting the correct plural forms is provided by a JavaScript Module, PluralForm.jsm. This module provides a couple methods for localizing to the browser's current locale a...
...And 5 more matches
Fonts for Mozilla 2.0's MathML engine
l instead display a box containing the hexadecimal representation of the Unicode code point for the character. Some mathematical operators are also drawn by using glyphs for larger variants of the character (e.g. summation symbol) or by assembling glyphs for a few pieces of the character (e.g braces). These variant or part glyphs do not in general have Unicode assignments, and so font-specific sup
port is required for some characters. Mozilla has general sup
port for the common delimiters and arrows that have the necessary Unicode assignments. For other characters, Mozilla has font-specific sup
port. In general, if the necessary glyphs are not available on the system then Mozilla tries to stretch symbols using scale transforms, but that may result in a less pleasant rendering. To see MathML as in...
...Note that some Web sites may provide the required mathematical fonts as Web fonts. In that case, you will see the correct rendering on these pages if you use Gecko 15.0 (Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12) or greater. ...
...ver all the symbols in MathML and also contains glyphs to stretch mathematical operators. They are available under the SIL Open Font License and should be installed for best MathML rendering. Note that currently, only the fonts in /Fonts/STIX-General/ are used for stretching mathematical operators with STIX fonts. Asana Math is also freely available under the SIL Open Font License and has good sup
port for mathematical characters. Starting in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), Mozilla can also use the glyphs contained in that font for stretchy operators. Starting in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10), MathJax fonts are used as the default fonts for mathematical text and symbol stretching. These fonts are freely available under the Apache Licens...
...And 5 more matches
Mozilla MathML Status
The Top-Level math Element See ? 2.2. Attribute Notes display Implemented. maxwidth, overflow Not implemented. ...
...The Top-Level math Element See ? 2.2. Attribute Notes display Implemented. maxwidth, overflow Not implemented. ...
...The Top-Level math Element See ? 2.2. Attribute Notes display Implemented. maxwidth, overflow Not implemented. ...
...And 5 more matches
L20n Javascript API
ate a special locale called i-default to be used as the default. availableLocales is an array of all locales available to the Context instance. This array (with defaultLocale appended to it if it is not already present) will be used to negotiate the fallback chain for the user. ctx.registerLocaleNegotiator(negotiator: Function) Register a function which will be used to negotiate the locales sup
ported by the Context instance. If you don't call this function, L20n will use the built-in Intl.prioritizeLocales negotiator. ctx.registerLocaleNegotiator(function(available, requested, defLocale) { return Intl.prioritizeLocales(available, requested, defLocale); }); negotiator is a function which takes the following arguments: available - all locales available to the Context instance, requeste...
...eferred locales for the Context instance to negotiate against and freeze the Context instance. When a Context instance is frozen, no more resources can be added or linked. All IO related to fetching the resource files takes place when a Context instance freezes. When all resources have been fetched, parsed and compiled, the Context instance will emit a ready event. The final list of locales sup
ported by the Context instance will be negotiated asynchronously by the negotiator registered by registerLocaleNegotiator. ctx.requestLocales('pl'); ctx.requestLocales('fr-CA', 'fr'); If requestedLocales argument list is empty or undefined, the default locale from registerLocales will be used. ctx.requestLocales('pl'); If registerLocales hasn't been called, the special i-default locale i...
...ns that the following minimal code is valid and will result in a fully operational Context instance. var ctx = L20n.getContext(); ctx.addResource('<hello "Hello, world!">'); ctx.requestLocales(); requestLocales can be called multiple times after the Context instance emitted the ready event, in order to change the current language fallback chain, for instance if requested by the user. ...
...And 5 more matches
About NSPR
These facilities include threads, thread synchronization, normal file and network I/O, interval timing and calendar time, basic memory management (malloc and free) and shared library linking. History A good
portion of the library's purpose, and perhaps the primary purpose in the Gromit environment, was to provide the underpinnings of the Java VM, more or less mapping the sys layer that Sun defined for the
porting of the Java VM to various platforms. NSPR went beyond that requirement in some areas and since it was also the platform independent layer for most of the servers produced by Netscape. ...
...the sys layer that Sun defined for the
porting of the Java VM to various platforms. NSPR went beyond that requirement in some areas and since it was also the platform independent layer for most of the servers produced by Netscape. It was expected and preferred that existing code be restructured and perhaps even rewritten in order to use the NSPR API. It is not a goal to provide a platform for the
porting into Netscape of externally developed code. At the time of writing the current generation of NSPR was known as NSPR20. The first generation of NSPR was originally conceived just to satisfy the requirements of
porting Java to various host environments. NSPR20, an effort started in 1996, built on that original idea, though very little is left of the original code. (The "20" in "NSPR20" does not...
...arious host environments. NSPR20, an effort started in 1996, built on that original idea, though very little is left of the original code. (The "20" in "NSPR20" does not mean "version 2.0" but rather "second generation".) Many of the concepts have been reformed, expanded, and matured. Today NSPR may still be appropriate as the platform dependent layer under Java, but its primary application is sup
porting clients written entirely in C or C++. How It Works NSPR's goal is to provide uniform service over a wide range of operating system environments. It strives to not ex
port the lowest common denominator, but to exploit the best features of each operating system on which it runs, and still provide a uniform service across a wide range of host offerings. Threads Threads are the major feature of...
...And 5 more matches
NSPR Poll Method
PR_Poll uses the poll method behind the scene, but it is also possible to use the poll method directly. We consider a stack of NSPR I/O layers on top of the network trans
port. Each I/O layer is represented by a PRFileDesc structure and the protocol of that layer is implemented by a PRIOMethods table. ...
...RFileDesc. The poll method is not to be confused with the PR_Poll function. The poll method operates on a single NetScape
Portable Runtime (NSPR) file descriptor, whereas PR_Poll operates on a collection of NSPR file descriptors. PR_Poll uses the poll method behind the scene, but it is also possible to use the poll method directly. We consider a stack of NSPR I/O layers on top of the network trans
port. Each I/O layer is represented by a PRFileDesc structure and the protocol of that layer is implemented by a PRIOMethods table. The bottom layer is a wrapper for the underlying network trans
port. The NSPR library provides a reference implementation of the bottom layer using the sockets API, but you can provide your own implementation of the bottom layer using another network trans
port API. The pol...
...The arguments and return value of the poll method are described below. ...
...And 5 more matches
Optimizing Applications For NSPR
This has proven to be quite challenging, a challenge that was met to a large degree, but there is always room for improvement. The casual client may not encounter a need to know the details of the shortcomings to the level described here, but if and when clients become more sophisticated, these issues will certainly surface. This memo is by no way complete. Multiplatform Do not call any blocking system call from a local thread. The only exception to this rule is the <tt>select()</tt> and <tt>poll()</tt> system calls on Unix, both of which NSPR has overridden to make sure they are aware of the NSPR local threads. ...
..., which includes NT, IRIX (sprocs), and pthreads-user, the primordial thread is always a local thread. Therefore, if you call a blocking system call from the primordial thread, it is going to block more than just the primordial thread and the system may not function correctly. ...
...To disable thread preemption call <tt>PR_DisableClockInterrupts()</tt>during initialization. Interrupting threads (via <tt>PR_Interrupt()</tt>) on threads blocked in I/O functions is implemented to various degrees on different platforms. ...
...And 5 more matches
nss tech note7
Your contribution is welcome. Data Types NSS uses the following data types to represent keys: SECKEYPublicKey: a public key, defined in "keythi.h". SECKEYPrivateKey: a private key, defined in "keythi.h". ...
...Your contribution is welcome. Data Types NSS uses the following data types to represent keys: SECKEYPublicKey: a public key, defined in "keythi.h". SECKEYPrivateKey: a private key, defined in "keythi.h". ...
...Your contribution is welcome. Data Types NSS uses the following data types to represent keys: SECKEYPublicKey: a public key, defined in "keythi.h". SECKEYPrivateKey: a private key, defined in "keythi.h". ...
...And 5 more matches
sslintro.html
of the SSL header files provided as part of NSS 2.0 include both public APIs documented in the NSS 2.0 documentation set and private APIs intended for internal use by the NSS implementation of SSL. You should use only the SSL APIs (and related certificate, key, and PKCS #11 APIs) that are described in this document, the SSL Reference. Other APIs that may be exposed in the header files are not sup
ported for application use. Initialization Initialization includes setting up configuration files, setting global defaults, and setting up callback functions. Functions used in the initialization part of an application can include the following: PR_Init. Initializes NSPR. Must be called before any other NSS functions. PK11_SetPasswordFunc. Sets the global callback function to obtain passw...
...vices. NSS_Init is not idempotent, so call it only once. Required. SSL_OptionSetDefault. Changes default values for all subsequently opened sockets as long as the application is running (compare with SSL_SetURL which only configures the socket that is currently open). This function must be called once for each default value that needs to be changed. Optional. NSS_SetDomesticPolicy, NSS_SetEx
portPolicy, NSS_SetFrancePolicy, or SSL_CipherPolicySet. These functions tell the library which cipher suites are permitted by policy (for example, to comply with ex
port restrictions). Cipher suites disabled by policy cannot be enabled by user preference. One of these functions must be called before any cryptographic operations can be performed with NSS. SSL_CipherPrefSetDefault. Enables all cipher...
...preference. One of these functions must be called before any cryptographic operations can be performed with NSS. SSL_CipherPrefSetDefault. Enables all ciphers chosen by user preference. Optional. Initializing Caches SSL peers frequently reconnect after a relatively short time has passed. To avoid the overhead of repeating the full SSL handshake in situations like this, the SSL protocol sup
ports the use of a session cache, which retains information about each connection, such as the master secret generated during the SSL handshake, for a predetermined length of time. If SSL can locate the information about a previous connection in the local session cache, it can reestablish the connection much more quickly than it can without the connection information. By default, SSL allocates one se...
...And 5 more matches
Hacking Tips
pBacktrace prints a backtrace a la gdb for the JS stack. The backtrace contains in the following order, the stack depth, the interpreter frame pointer (see js/src/vm/Stack.h, StackFrame class) or (nil) if compiled with IonMonkey, the file and line number of the call location and under parentheses, the JSScript pointer and the jsbytecode pointer (pc) executed. ...
...pth, the interpreter frame pointer (see js/src/vm/Stack.h, StackFrame class) or (nil) if compiled with IonMonkey, the file and line number of the call location and under parentheses, the JSScript pointer and the jsbytecode pointer (pc) executed. ...
... ...
...And 5 more matches
JSAPI reference
Function JS::CompileFunction Added in SpiderMonkey 17 JS_DecompileFunction JS_DecompileFunctionBody JS_CompileFunction Obsolete since JSAPI 36 JS_CompileFunctionForPrincipals Obsolete since JSAPI 28 JS_CompileUCFunction Obsolete since JSAPI 36 JS_CompileUCFunctionForPrincipals Obsolete since JSAPI 28 Error handling struct JSErrorFormatString Added in SpiderMonkey 17 class JSErrorRe
port class JS::AutoSaveExceptionState Added in SpiderMonkey 31 enum JSExnType Added in SpiderMonkey 17 JS_Re
portError JS_Re
portWarning JS_Re
portErrorNumber JS_Re
portErrorNumberUC JS_Re
portErrorFlagsAndNumber JS_Re
portErrorFlagsAndNumberUC JS_Re
portErrorNumberUCArray Added in SpiderMonkey 24 JS_Re
portOutOfMemory JS_Re
portAllocationOverflow Added in SpiderMonkey 1.8 JS_GetErrorRe
porter JS_S...
...S::AutoSaveExceptionState Added in SpiderMonkey 31 enum JSExnType Added in SpiderMonkey 17 JS_Re
portError JS_Re
portWarning JS_Re
portErrorNumber JS_Re
portErrorNumberUC JS_Re
portErrorFlagsAndNumber JS_Re
portErrorFlagsAndNumberUC JS_Re
portErrorNumberUCArray Added in SpiderMonkey 24 JS_Re
portOutOfMemory JS_Re
portAllocationOverflow Added in SpiderMonkey 1.8 JS_GetErrorRe
porter JS_SetErrorRe
porterObsolete since JSAPI 52 JS_ErrorFromException JS_GetErrorPrototype JSRE
PORT_IS_EXCEPTION JSRE
PORT_IS_STRICT JSRE
PORT_IS_WARNING JSRE
PORT_IS_STRICT_MODE_ERROR The following functions allow C/C++ functions to throw and catch JavaScript exceptions: JS::CreateError Added in SpiderMonkey 38 JS_IsExceptionPending JS_GetPendingException JS_SetPendingException JS_ClearPendingException JS...
...teError Added in SpiderMonkey 38 JS_IsExceptionPending JS_GetPendingException JS_SetPendingException JS_ClearPendingException JS_ThrowStopIteration Added in SpiderMonkey 1.8 JS_IsStopIteration Added in SpiderMonkey 31 typedef JSExceptionState JS_SaveExceptionState JS_RestoreExceptionState JS_DropExceptionState These functions translate errors into exceptions and vice versa: JS_Re
portPendingException JS_ErrorFromException JS_ThrowRe
portedError Obsolete since JSAPI 29 Values and types typedef jsval JS::Value JS::Value constructors: JS::NullValue Added in SpiderMonkey 24 JS::UndefinedValue Added in SpiderMonkey 24 JS::BooleanValue Added in SpiderMonkey 24 JS::TrueValue Added in SpiderMonkey 24 JS::FalseValue Added in SpiderMonkey 24 JS::NumberValue Added i...
...And 5 more matches
SpiderMonkey 24
elow. Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. ...
... this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. ...
...the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. -- Dec 16, 2013 The download url still available, but SpiderMonkey not RELEASE alone! Get it here mozilla-esr24 if the download url is outdate You will find it in "Firefox Extended Sup
port Release 24" package on hg release Platform sup
port SpiderMonkey 24 is sup
ported on all the platforms where Firefox 24 runs. ...
...And 5 more matches
Gecko object attributes
Object attributes are relevant for the entire subtree of the object they are on, unless they are overridden by a descendent with the same object attribute. This is in contrast to text attributes, which apply only to substrings in a text object. Object Attributes List ARIA attributes All ARIA attributes used on DOM element (i.e., any attribute prefixed by 'aria-') are exposed as object attributes; name is preserved except the 'aria-' prefix is cut. Common attributes class The class name for an element from HTML, XUL, SVG, etc. This is useful for retrieving Microformat semantics for an element. display Similar with display CSS style. ...
...o: listitem, option Exposed in ARIA: aria-posinset setsize If this item is in a group, this indicates the number of items in the group. This is useful when combined with the posinset object attribute. Applied to: listitem, option Exposed in ARIA: aria-setsize Live region attribues atomic true when the entire region should be presented as a whole, when changes within it are considered im
portant enough to automatically present. Applied to: any role Exposed via ARIA: aria-atomic live A hint as to whether changes within the current region or subtree should be automatically presented. Possible values are "off" which is the same as not being set -- this means the region is not live. Other possible values are "polite", "assertive", and "rude", which is a suggestion for the policy when ...
...d changes to text and text equivalents should be considered relevant, and that the hiding or removal of items is not. Please see the ARIA States and Properties module for more information. Exposed in ARIA: aria-relevant container-atomic Is this change inside a region that should always be presented at once. If yes, member-of relation will point to the root of the region. ...
...And 5 more matches
Detailed XPCOM hashtable guide
This is the long version of XPCOM hashtable guide. The information you're looking for is probably there. What Is a Hashtable? A hashtable is a data construct that stores a set of items. Each item has a key that identifies the item. Items are found, added, and removed from the hashtable by using the key. Hashtables may seem like arrays, but there are im
portant differences: Array Hashtable Keys: integer: arrays are always keyed on integers, and must be contiguous. any type: almost any datatype can be used as key, including strings, integers, XPCOM interface pointers, IIDs, and almost anything else. Keys can be disjunct (i.e. you can store entries with keys 1, 5, and 3000). Lookup Time: O(1): lookup time is a simple constant O(1): looku...
... usage pattern mapping a simple keytype to a simple datatype; client does not need to declare or manage an entry class; nsDataHashtable datatype is a scalar such as PRUint32; nsInterfaceHashtable datatype is an interface; nsClassHashtable datatype is a class pointer owned by the hashtable. ...
...r owned by the hashtable. ...
...And 5 more matches
Components.Constructor
Summary Creates a JavaScript function which can be used to create or construct new instances of XPCOM components. Syntax var func = [ new ] Components.Constructor(contractID [, interfaceName [, initializer ] ]); Parameters contractID A string containing the contract ID of the component interfaceName If given, nsISup
ports.QueryInterface() will be called on each newly-created instance with the interface named by this string initializer If given, a string containing the name of a function which will be called on the newly-created instance, using the arguments provided to the created function when called Description Components.Constructor() is a handy shortcut for creating instances of XPCOM components. It eliminates the clutter of typing Components.classes, Components.inte...
...ce, using the arguments provided to the created function when called Description Components.Constructor() is a handy shortcut for creating instances of XPCOM components. It eliminates the clutter of typing Components.classes, Components.interfaces, createInstance, and so on every time you wish to create an instance. It also gives creation of XPCOM objects more JavaScript-like syntax. Another im
portant benefit is that it precomputes some of the computation it does, so using a function returned from Components.Constructor() to create XPCOM objects is faster than creating the object from base principles, as demonstrated below. (This benefit is also partly a result of having to travel through the layer between the JavaScript engine and XPCOM fewer times.) The behavior of functions returned by ...
...vel through the layer between the JavaScript engine and XPCOM fewer times.) The behavior of functions returned by Components.Constructor() varies depending upon the arguments given to Components.Constructor() when called. If only one argument is given, that argument is the contract ID of the XPCOM component to create. ...
...And 5 more matches
nsICollection
xpcom/ds/nsICollection.idlScriptable This interface represents a list of nsISup
ports items. It provides basic operations on those items like: getting, setting, appending, removing, and so on. ...
... xpcom/ds/nsICollection.idlScriptable This interface represents a list of nsISup
ports items. It provides basic operations on those items like: getting, setting, appending, removing, and so on. ...
...idlScriptable This interface represents a list of nsISup
ports items. It provides basic operations on those items like: getting, setting, appending, removing, and so on. Inherits from: nsISerializable Last changed in Gecko 1.7 Method overview void AppendElement(in nsISup
ports item); void Clear(); PRUint32 Count(); nsIEnumerator Enumerate(); nsISup
ports GetElementAt(in PRUint32 index); void QueryElementAt(in PRUint32 index, in nsIIDRef uuid, [iid_is(uuid),retval] out nsQIResult result); void RemoveElement(in nsISup
ports item); void SetElementAt(in PRUint32 index, in nsISup
ports item); Methods AppendElement() Appends a new item to the collection. ...
...And 5 more matches
nsIDOMMozNetworkStatsManager
NOTE: Gecko is a fast evolving project. Please check dom/network/interfaces/nsIDOMNetworkStatsManager.idl to make sure this data is accurate. dom/network/interfaces/nsIDOMNetworkStatsManager.idlScriptable Interface that provides access to network usage statistics. Inherits from: nsISup
ports Last changed in Gecko 18.0 (Firefox 18.0 / Thunderbird 18.0 / SeaMonkey 2.15) Implemented by: @mozilla.org/networkStatsManager;1. To create an instance, use: var networkStatsManager = Components.classes["@mozilla.org/networkStatsManager;1"] .createInstance(Components.interfaces.nsIDOMNetworkStatsManager); Furthermore, the NetworkStatsManager is published through a mozNetworkStats child object within the navigator object. If the object exists, you can use the Net...
...er); Furthermore, the NetworkStatsManager is published through a mozNetworkStats child object within the navigator object. If the object exists, you can use the Network Statistics service. ...
...tats child object within the navigator object. If the object exists, you can use the Network Statistics service. ...
...And 5 more matches
nsIDragService
Add-ons should use the standard dataTransfer drag and drop API instead. The only exception is getCurrentSession(), since there's currently no way to check for a drag in progress using standard DOM methods or properties. ...
...dDragSession( in PRBool aDoneDrag ) ; void dragMoved(in long aX, in long aY); Native code only! void fireDragEventAtSource(in unsigned long aMsg); Obsolete since Gecko 43 void fireDragEventAtSource(in mozilla::EventMessage aEventMessage); Native code only! ...
... Obsolete since Gecko 43 void fireDragEventAtSource(in mozilla::EventMessage aEventMessage); Native code only! ...
...And 5 more matches
nsIHttpServer
An example : https://github.com/laurentj/slimerjs/blob/master/src/modules/webserver.jsm var EX
PORTED_SYMBOLS = ["create"]; Components.utils.im
port("resource://gre/modules/Services.jsm"); function create() { var server = Components.classes["@mozilla.org/server/jshttp;1"] .createInstance(Components.interfaces.nsIHttpServer); return { get objectName () { return "WebServer"; }, /** * @param integer|string
port port or "host:
port" * @param object opt optional options. (not sup
ported) * @param function callback optional callback */ listen: function(
port, opt, callback) { if (arguments.length == 2 && "function" == typeof opt) { ...
...orted) * @param function callback optional callback */ listen: function(
port, opt, callback) { if (arguments.length == 2 && "function" == typeof opt) { callback = opt; } if (callback) { this.registerPrefixHandler("/", callback); } let host = "localhost"; if (typeof
port === "string" &&
port.indexOf(':') != -1){ [host,
port] =
port.split(':');
port = parseInt(
port); server.identity.add('http', host,
port); } server.wrappedJSObject._start(
port, host); return true; }, registerFile: function(path, filePath) { var file = Components.classes['@mozilla.org/fi...
...nction(prefix, handlerCallback) { server.registerPrefixHandler(prefix, function (request, response) { var req = createHttpRequest(request); var resp = new HttpResponse(response); handlerCallback(req, resp); }); }, close: function(){ server.stop(function(){}); }, get
port() { return server.identity.primary
Port } } } Reference : mozilla-release/netwerk/test/httpserver/nsIHttpServer.idl [scriptable, uuid(cea8812e-faa6-4013-9396-f9936cbb74ec)] interface nsIHttpServer : nsISup
ports { /** * Starts up this server, listening upon the given
port. * * @param
port * the
port upon which listening should happen, or -1 if ...
...And 5 more matches
nsIIOService
netwerk/base/public/nsIIOService.idlScriptable This interface provides a set of URL parsing utility functions. These are provided as a convenience to the programmer and in some cases to improve performance by eliminating intermediate data structures and interfaces. Inherits from: nsISup
ports Last changed in Gecko 1.2 This interface duplicates many of the nsIProtocolHandler methods in a protocol handler independent way (For example newURI() inspects the scheme in order to delegate creation of the new URI to the appropriate protocol handler). Note: nsIIOService may only be used from the main thread. Implemented by @mozilla.org/network/io-service;1 as a service: var iOService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.inter...
...cts the scheme in order to delegate creation of the new URI to the appropriate protocol handler). Note: nsIIOService may only be used from the main thread. ...
... in order to delegate creation of the new URI to the appropriate protocol handler). Note: nsIIOService may only be used from the main thread. ...
...And 5 more matches
nsIWebProgressListener
uriloader/base/nsIWebProgressListener.idlScriptable This interface is implemented by clients wishing to listen in on the progress associated with the loading of asynchronous requests in the context of a nsIWebProgress instance as well as any child nsIWebProgress instances. Inherits from: nsISup
ports Last changed in Gecko 15 (Firefox 15 / Thunderbird 15 / SeaMonkey 2.12) nsIWebProgress describes the parent-child relationship of nsIWebProgress instances. Method overview void onLocationChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI aLocation, [optional] in unsigned long aFlags); void onProgressChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in lo...
...d to document requests. (See below for a description of document requests.) Other types of requests, such as requests for inline content (for example images and stylesheets) are considered normal requests. STATE_IS_DOCUMENT 0x00020000 This flag indicates that the state transition is for a document request. This flag is set in addition to STATE_IS_REQUEST. A document request sup
ports the nsIChannel interface and its loadFlags attribute includes the nsIChannel::LOAD_DOCUMENT_URI flag. A document request does not complete until all requests associated with the loading of its corresponding document have completed. This includes other document requests (for example corresponding to HTML <iframe> elements). The document corresponding to a document request is available via the...
...This flag indicates that the state transition corresponds to the start or stop of activity for restoring a previously-rendered presentation. As such, there is no actual network activity associated with this request, and any modifications made to the document or presentation when it was originally loaded will still be present. State security flags These flags describe the security state re
ported by a call to the onSecurityChange() method. These flags are mutually exclusive. Constant Value Description STATE_IS_INSECURE 0x00000004 This flag indicates that the data corresponding to the request was received over an insecure channel. STATE_IS_BROKEN 0x00000001 This flag indicates an unknown security state. This may mean that the request is being...
...And 5 more matches
nsIXmlRpcClient
Warning: This interface was removed from Firefox 3 and is no longer available. extensions/xml-rpc/idl/nsIXmlRpcClient.idlScriptable Please add a summary to this article. ...
...nherits from: nsISup
ports Method overview void init(in string serverURL); void setAuthentication(in string username, in string password); void clearAuthentication(in string username, in string password); void setEncoding(in string encoding); void setEncoding(in unsigned long type, out nsIIDRef uuid, out nsQIResult result); void asyncCall (in nsIXmlRpcClientListener listener, in nsISup
ports ctxt, in string methodName, in nsISup
ports arguments, in PRUInt32 count); Attributes Attribute Type Description serverURL readonly nsIURL The URL of the XML-RPC server inProgress readonly boolean Whether or not a call is in progress fault readonly nsIXmlRpcFault The most recent XML-RPC fault from returned from this server. null if the last call didn't return an XML-RPC fault. resul...
...null if the last call didn't return a valid result. responseStatus readonly unsigned long The most recent HTTP status code returned from this server. null if the server was unreachable or not yet contacted. responseString readonly unsigned long The most recent HTTP status code returned from this server. ...
...And 5 more matches
XPCOM Interface Reference
ContentPrefObservernsIContentPrefServicensIContentPrefService2nsIContentSecurityPolicynsIContentSniffernsIContentViewnsIContentViewManagernsIContentViewernsIControllernsIControllersnsIConverterInputStreamnsIConverterOutputStreamnsICookiensICookie2nsICookieAcceptDialognsICookieConsentnsICookieManagernsICookieManager2nsICookiePermissionnsICookiePromptServicensICookieServicensICookieStoragensICrashRe
porternsICryptoHMACnsICryptoHashnsICurrentCharsetListenernsICycleCollectorListenernsIDBChangeListenernsIDBFolderInfonsIDNSListenernsIDNSRecordnsIDNSRequestnsIDNSServicensIDOMCanvasRenderingContext2DnsIDOMChromeWindownsIDOMClientRectnsIDOMDesktopNotificationnsIDOMDesktopNotificationCenternsIDOMElementnsIDOMEventnsIDOMEventGroupnsIDOMEventListenernsIDOMEventTargetnsIDOMFilensIDOMFileErrornsIDOMFileExcep...
...lectControlElementnsIDOMXULSelectControlItemElementnsIDataSignatureVerifiernsIDebugnsIDebug2nsIDeviceMotionnsIDeviceMotionDatansIDeviceMotionListenernsIDialogCreatornsIDialogParamBlocknsIDictionarynsIDirIndexnsIDirIndexListenernsIDirIndexParsernsIDirectoryEnumeratornsIDirectoryIteratornsIDirectoryServicensIDirectoryServiceProvidernsIDirectoryServiceProvider2nsIDiskCacheStreamInternalnsIDispatchSup
portnsIDocShellnsIDocumentLoadernsIDownloadnsIDownloadHistorynsIDownloadManagernsIDownloadManagerUInsIDownloadObservernsIDownloadProgressListenernsIDownloadernsIDragDropHandlernsIDragServicensIDragSessionnsIDroppedLinkHandlernsIDroppedLinkItemnsIDynamicContainernsIEditornsIEditorBoxObjectnsIEditorDocShellnsIEditorIMESup
portnsIEditorLoggingnsIEditorMailSup
portnsIEditorObservernsIEditorSpellChecknsIEffe...
...putStreamCallbacknsIInstallLocationnsIInterfaceRequestornsIJSCIDnsIJSIDnsIJSIIDnsIJSONnsIJetpacknsIJetpackServicensIJumpListBuildernsIJumpListItemnsILivemarkServicensILoadGroupnsILocalFilensILocalFileMacnsILocalensILocaleServicensILoginInfonsILoginManagernsILoginManagerCryptonsILoginManagerIEMigrationHelpernsILoginManagerPrompternsILoginManagerStoragensILoginMetaInfonsIMIMEInputStreamnsIMacDockSup
portnsIMarkupDocumentViewernsIMemorynsIMemoryMultiRe
porternsIMemoryMultiRe
porterCallbacknsIMemoryRe
porternsIMemoryRe
porterManagernsIMenuBoxObjectnsIMessageBroadcasternsIMessageListenernsIMessageListenerManagernsIMessageSendernsIMessageWakeupServicensIMessengernsIMicrosummarynsIMicrosummaryGeneratornsIMicrosummaryObservernsIMicrosummaryServicensIMicrosummarySetnsIMimeConverternsIMimeHeadersnsIModulensI...
...And 5 more matches
Storage
e persistent data or the Session store API (an XPCOM storage utility for use by extensions). Getting started This document covers the Storage API and some peculiarities of SQLite. It does not cover SQL or "regular" SQLite. You can find some very useful links in the See also section however. For Storage API help, you can post to mozilla.dev.apps.platform on the news server news.mozilla.org. To re
port bugs, use Bugzilla. The overall procedure for use is: Get the Storage service - mozIStorageService. Open a connection to the database of your choice - mozIStorageConnection. Create statements to execute on the connection - mozIStorageStatement. Bind parameters to a statement as necessary. Execute the statement. Check for errors. Reset the statement. Opening a connection JavaScript ex...
...ozIStorageService. Open a connection to the database of your choice - mozIStorageConnection. Create statements to execute on the connection - mozIStorageStatement. Bind parameters to a statement as necessary. Execute the statement. Check for errors. Reset the statement. ...
...oice - mozIStorageConnection. Create statements to execute on the connection - mozIStorageStatement. Bind parameters to a statement as necessary. Execute the statement. Check for errors. Reset the statement. ...
...And 5 more matches
Using js-ctypes
Before you can use js-ctypes, you need to im
port the ctypes.jsm code module. This is as simple as including the following line of code in the desired JavaScript scope: Components.utils.im
port("resource://gre/modules/ctypes.jsm") Loading a native library Once you've im
ported the code module, you can call the ctypes.open() method to load each native library you wish to use. On Windows, for example, you might load the system user32 library like this: var lib = ctypes.open("user32.dll"); On Mac OS X, you can load the Core Foundation library from the Core Foundation framework like this: var coreFoundation = ctypes.open("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"); The returned object is a Library object that you use to declare functions and data types for use wit...
...amework/CoreFoundation"); The returned object is a Library object that you use to declare functions and data types for use with the loaded library. Note: js-ctypes only works with C libraries; you can't use C++ methods directly. Instead, you'll need to create a shim library that uses C functions that then call into the C++ library for you. Examples can be found here: Bugzilla :: Bug 505907 - Sup
port C++ calling from JSctypes Library search paths If you specify a full path, that path is used to load the library. Otherwise, the system looks for the library in its standard locations. Windows On Windows, the following locations are searched for the library, in this order: The application's directory. The system directory. The 16-bit system directory. The Windows directory. The current...
...ake use of them. Instantiating C data objects and referencing them is covered in the article Working with data. Memory management moved to Memory Management page. Examples These examples offer a quick look at how js-ctypes is used. See js-ctypes examples for more intricate examples. Calling Windows routines This example demonstrates how to use ctypes to call a Win32 API. ...
...And 5 more matches
Plug-in Development Overview - Plugins
ctory for your operating system. See Installing Plug-ins. Test your plug-in and debug as necessary. Create an HTML page and embed the plug-in object. For information about the HTML elements to use, see Using HTML to Display Plug-ins. To see your plug-in in action, simply display the HTML page that calls it in the browser. Registering Plug-ins Gecko identifies a plug-in by the MIME type it sup
ports. When it needs to display data of a particular MIME type, the browser finds and invokes the plug-in object that sup
ports that type. The data can come from either an object element in an HTML file (where the object or embed element either specifies the MIME type directly or references a file of that type), from a separate non-HTML file of that MIME type, or from the server. The server looks for ...
...ooks for the MIME type registered by a plug-in, based on the file extension, and starts sending the file to the browser. The browser looks up the media type, and if it finds a plug-in registered to that type, loads the plug-in software. When it starts up, the browser checks for plug-in modules for the platform and registers them. It determines which plug-ins are installed and which types they sup
port through a combination of user preferences that are private to the browser, the contents of the plug-ins directory, or the registry on Windows. A MIME type is made up of a major type (such as application or image) and a minor type, for example, image/jpeg. If you define a new MIME type for a plug-in, you must register it with IETF (Internet Engineering Task Force). Until your new MIME type is reg...
...ter set to "Windows Multilingual" in your development environment. The resource code for this language and character set combination is 040904E4. Unix On Unix, plug-ins are found according to the section How Gecko Finds Plug-ins. To determine the MIME types and file extensions that the plug-in handles, the browser loads each library and calls into the NP_GetMIMEDescription entry point. This ex
ported C function should return a string containing the type, extension list, and type description separated by colons. Each MIME types should be separated by semicolons. For example: image/xbm:xbm:X Bitmap or for 2 MIME types: image/xbm:xbm:X Bitmap;image/png:png:
Portable Network Graphics. This information will then appear in the navigator.mimeTypes DOM object. NPP_GetValue is called after the plug-...
...And 5 more matches
Tutorial: Set a breakpoint - Firefox Developer Tools
ick on the options gear at the upper right of the toolbox, and make sure that both "Enable browser chrome and add-on debugging toolboxes" and "Enable remote debugging" are checked. These are located at the bottom right of the options panel; you may need to scroll to see them. Once they're checked, you can close the developer tools. Save the following text to an HTML file: <div onclick="re
port('the best div');">Click me!</div> <div onclick="re
port('another great div');">Or me!</div> <script> function re
port(what) { console.log('clicked: ' + what); } </script> Visit the HTML file in your browser, and open the Browser Content Toolbox by opening the Firefox menu, choosing "Web Developer", and then "Browser Content Toolbox". If that item doesn't appear in the "Web Developer" menu, ...
...y default. To enable it, click on the options gear at the upper right of the Browser Content Toolbox, and make sure the "Scratchpad" box in the "Default Developer Tools" section the left is checked. The Scratchpad panel should appear at the top of the Toolbox alongside the Console, Debugger, and Memory panels. Click on the Scratchpad panel and enter the following code: Components.utils.im
port("resource://gre/modules/jsdebugger.jsm"); Components.utils.im
port("resource://gre/modules/Console.jsm"); // This simply defines 'Debugger' in this Scratchpad; // it doesn't actually start debugging anything. addDebuggerToGlobal(this); // Create a 'Debugger' instance. var dbg = new Debugger; // Make the tab's top window a debuggee, and get a // Debugger.Object referring to the window. var windo...
...ole.jsm"); // This simply defines 'Debugger' in this Scratchpad; // it doesn't actually start debugging anything. addDebuggerToGlobal(this); // Create a 'Debugger' instance. var dbg = new Debugger; // Make the tab's top window a debuggee, and get a // Debugger.Object referring to the window. ...
...And 5 more matches
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ntribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ll request. ...
...And 5 more matches
BasicCardRequest - Web APIs
The BasicCardRequest dictionary is a JavaScript object-structure that can be used in the Payment Request API. The properties of BasicCardRequest are defined in the Basic Card Payment spec). Properties BasicCardRequest.sup
portedNetworks Optional Secure context An optional array of DOMStrings representing the card networks that the retailer sup
ports (e.g. "amex", "mastercard"); see Card network identifiers for a complete list. If the property is missing, it implies that all networks are sup
ported. ...
... optional array of DOMStrings representing the card networks that the retailer sup
ports (e.g. "amex", "mastercard"); see Card network identifiers for a complete list. If the property is missing, it implies that all networks are sup
ported. Obsolete properties These properties have been removed from the Payment Method: Basic Card specification and should no longer be used. BasicCardRequest.sup
portedTypes Optional Secure context This obsolete property was used to provide an optional array of DOMStrings representing the card types that the retailer sup
ports (e.g. credit, debit, prepaid). If the property is missing, it implies that all the card types are sup
ported. ...
...n and should no longer be used. BasicCardRequest.sup
portedTypes Optional Secure context This obsolete property was used to provide an optional array of DOMStrings representing the card types that the retailer sup
ports (e.g. credit, debit, prepaid). If the property is missing, it implies that all the card types are sup
ported. Instead of using this property, it is up to the server to check sup
port for the card given the information coded into the account number. Card network identifiers The W3C maintains an official list of approved card network identifier strings, which may be used in the sup
portedNetworks list. Those are: amex cartebancaire diners discover jcb mastercard mir unionpay visa Examples In the following example, the PaymentRequest() constructor is used to cr...
...And 5 more matches
BlobEvent.timecode - Web APIs
ibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...end us a pull request. ...
...And 5 more matches
DelayNode() - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...send us a pull request. ...
...And 5 more matches
Document.execCommand() - Web APIs
ble elements. Most commands affect the document's selection (bold, italics, etc.), while others insert new elements (adding a link), or affect an entire line (indenting). When using contentEditable, execCommand() affects the currently active editable element. Syntax document.execCommand(aCommandName, aShowDefaultUI, aValueArgument) Return value A Boolean that is false if the command is unsup
ported or disabled. Note: Only returns true if part of a user interaction. Don't try using the return value to verify browser sup
port before calling a command. Parameters aCommandName A DOMString specifying the name of the command to execute. See Commands for a list of possible commands. aShowDefaultUI A Boolean indicating whether the default user interface should be shown. This is not imple...
...lorer uses this to set the text background color. bold Toggles bold on/off for the selection or at the insertion point. Internet Explorer uses the <strong> tag instead of <b>. ClearAuthenticationCache Clears all authentication credentials from the cache. contentReadOnly Makes the content document either read-only or editable. This requires a boolean true/false as the value argument. (Not sup
ported by Internet Explorer.) copy Copies the current selection to the clipboard. Conditions of having this behavior enabled vary from one browser to another, and have evolved over time. Check the compatibility table to determine if you can use it in your case. createLink Creates an hyperlink from the selection, but only if there is a selection. Requires a URI string as a value argument for the hy...
...racter, which may be whitespace. (Internet Explorer will create a link with a null value.) cut Removes the current selection and copies it to the clipboard. When this behavior is enabled varies between browsers, and its conditions have evolved over time. Check the compatibility table for usage details. decreaseFontSize Adds a <small> tag around the selection or at the insertion point. (Not sup
ported by Internet Explorer.) defaultParagraphSeparator Changes the paragraph separator used when new paragraphs are created in editable text regions. See Differences in markup generation for more details. delete Deletes the current selection. enableAbsolutePositionEditor Enables or disables the grabber that allows absolutely-positioned elements to be moved around. The grabber is disabled by def...
...And 5 more matches
Element.scroll() - Web APIs
ity The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...t https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Element.scrollTo() - Web APIs
y The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
EventTarget.dispatchEvent() - Web APIs
vent is cancelable and at least one of the event handlers which received event called Event.preventDefault(). Otherwise it returns true. The dispatchEvent() method throws UNSPECIFIED_EVENT_TYPE_ERR if the event's type was not specified by initializing the event before the method was called, or if the event's type is null or an empty string. Exceptions Exceptions thrown by event handlers are re
ported as uncaught exceptions. The event handlers run on a nested callstack; they block the caller until they complete, but exceptions do not propagate to the caller. Notes Unlike "native" events, which are fired by the DOM and invoke event handlers asynchronously via the event loop, dispatchEvent() invokes event handlers synchronously. All applicable event handlers will execute and return before th...
...e compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
FetchEvent.navigationPreload - Web APIs
able on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...pull request. ...
...And 5 more matches
FileSystemEntry.copyTo() - Web APIs
s page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ibute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...-compat-data and send us a pull request. ...
...And 5 more matches
FileSystemEntry.getMetadata() - Web APIs
e is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...at-data and send us a pull request. ...
...And 5 more matches
FileSystemEntry.moveTo() - Web APIs
s page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ibute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...-compat-data and send us a pull request. ...
...And 5 more matches
FileSystemEntry.remove() - Web APIs
s page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ibute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...-compat-data and send us a pull request. ...
...And 5 more matches
GainNode() - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d send us a pull request. ...
...And 5 more matches
HTMLImageElement.align - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
HTMLImageElement.border - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
HTMLImageElement.isMap - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
HTMLImageElement.longDesc - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
HTMLImageElement.lowSrc - Web APIs
n modified in some fashion so that it loads significantly more quickly than the primary image. There are a number of ways to achieve this; primary among them: Higher compression levels (for example, a primary image saved as a JPEG using 85% quality might have a lowSrc version saved at 15%. Reduced color depth; a primary image in 32-bit color might have an alternate image in 8-bit color. Im
portant: The lowSrc property is obsolete and should not be used. Instead, you should use an image format which loads progressively (such as progressive JPEG). Or simply make sure your images are all well-optimized and balanced for appearance versus size. Usage notes lowSrc is a strange case. It was never technically part of the HTML specification (it was a Mozilla extension to HTML); however, HTML ...
...ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
HTMLImageElement.srcset - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...f you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetsrcset ExperimentalChrome Full sup
port 34Edge Full sup
port 12Firefox Full sup
port 38 Full sup
port 38 No sup
port 32 -- 52Disabled Disabled From version 32 until version 52 (exclusive): this feature is behind the dom.image.srcset.enabled preference (needs to be set to true). To change preferences in Firefox, visit...
... Full sup
port 38 Full sup
port 38 No sup
port 32 -- 52Disabled Disabled From version 32 until version 52 (exclusive): this feature is behind the dom.image.srcset.enabled preference (needs to be set to true). ...
...And 5 more matches
The HTML DOM API - Web APIs
The HTML DOM API is made up of the interfaces that define the functionality of each of the elements in HTML, as well as any sup
porting types and interfaces they rely upon. The functional areas included in the HTML DOM API include: Access to and control of HTML elements via the DOM. Access to and manipulation of form data. Interacting with the contents of 2D images and the context of an HTML <canvas>, for example to draw on top of them. Management of media connected to the HTML media elements (<audio> and <video>). Dragging and dropping of content on webpages. Access to the browser navigation history Sup
porting and connective interfaces for other APIs such as Web Components, Web Storage, Web Workers, WebSocket, and Server-sent events. HTML DOM concepts and usage In this article, w...
...elements, one of which has two more elements nested inside it: While the Document interface is defined as part of the DOM specification, the HTML specification significantly enhances it to add information specific to using the DOM in the context of a web browser, as well as to using it to represent HTML documents specifically. ...
... Event handlers for document events defined by the HTML standard to allow access to mouse and keyboard events, drag and drop, media control, and more. ...
...And 5 more matches
Drag Operations - Web APIs
operty returns a list of MIME-type like DOMStrings, such as text/plain or image/jpeg. You can also create your own types. The most commonly used types are listed in the article Recommended Drag Types. A drag may include data items of several different types. This allows data to be provided in more specific types, often custom types, yet still provide fallback data for drop targets that do not sup
port more specific types. It is usually the case that the least specific type will be normal text data using the type text/plain. This data will be a simple textual representation. To set a drag data item within the dataTransfer, use the setData() method. It takes two arguments: the type of data and the data value. For example: event.dataTransfer.setData("text/plain", "Text to drag"); In this case...
...ld call it with formats in order from most specific to least specific. const dt = event.dataTransfer; dt.setData("application/x.bookmark", bookmarkString); dt.setData("text/uri-list", "https://www.mozilla.org"); dt.setData("text/plain", "https://www.mozilla.org"); Here, data is added in three different types. The first type, application/x.bookmark, is a custom type. Other applications won't sup
port this type, but you can use a custom type for drags between areas of the same site or application. By providing data in other types as well, we can also sup
port drags to other applications in less specific forms. The application/x.bookmark type can provide data with more details for use within the application whereas the other types can include just a single URL or text version. Note that both t...
...sed vary by platform, typically the Shift and Control keys would be used to switch between copying, moving, and linking. The mouse pointer will change to indicate which operation is desired. For instance, for a copy, the cursor might appear with a plus sign next to it. You can modify the dropEffect property during the dragenter or dragover events, if for example, a particular drop target only sup
ports certain operations. You can modify the dropEffect property to override the user effect, and enforce a specific drop operation to occur. Note that this effect must be one listed within the effectAllowed property. Otherwise, it will be set to an alternate value that is allowed. event.dataTransfer.dropEffect = "copy"; In this example, copy is the effect that is performed. You can use the value ...
...And 5 more matches
IDBTransaction.commit() - Web APIs
rror DOMException. Note: This feature is available in Web Workers. Syntax transaction.commit(); Parameters None. Return value Void. Exceptions Exception Description InvalidStateError The transaction state is not active. Examples // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["myDB"], "readwrite"); // re
port on the success of opening the transaction transaction.oncomplete = function(event) { note.innerHTML += '<li>Transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerHTML += '<li>Transaction not opened due to error. Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = transaction.object...
...ansaction.onerror = function(event) { note.innerHTML += '<li>Transaction not opened due to error. ...
...y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
IIRFilterNode() - Web APIs
y table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ke to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... us a pull request. ...
...And 5 more matches
MediaDeviceInfo.deviceId - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...dgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetdeviceIdChrome Full sup
port 55Notes Full sup
port 55Notes Notes For earlier versions, this interface is available through the adapter.js polyfillEdge Full sup
port 12Firefox Full sup
port 39IE No sup
port NoOpera No sup
port NoNotes No sup
port NoNotes Notes This property can be used in Opera by using the adapter.js polyfill.Safari No supp...
...And 5 more matches
MediaDeviceInfo.kind - Web APIs
lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...omeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetkindChrome Full sup
port 55Notes Full sup
port 55Notes Notes For earlier versions, this interface is available through the adapter.js polyfillEdge Full sup
port 12Firefox Full sup
port 39IE No sup
port NoOpera No sup
port NoNotes No sup
port NoNotes Notes This property can be used in Opera by using the adapter.js polyfill.Safari No supp...
...And 5 more matches
MediaKeyStatusMap.get() - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
MediaKeyStatusMap.has() - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
MediaKeyStatusMap.size - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
MediaRecorder.ignoreMutedMedia - Web APIs
in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...send us a pull request. ...
...And 5 more matches
MediaSession.playbackState - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
MediaStream.id - Web APIs
mpatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Media Capabilities API - Web APIs
The Media Capabilities API allows developers to determine decoding and encoding abilities of the device, exposing information such as whether media is sup
ported and whether playback should be smooth and power efficient, with real time feedback about playback to better enable adaptive streaming, and access to display property information. Examples Detect audio file sup
port and expected performance This example defines a audio configuration then checks to see if the user agent sup
ports decoding that media configuration, and whether it will perform well in terms of smoothness and power efficiency. if ('mediaCapabilities' in navigator) { const audioFileConfiguration = { type : 'file', audio : { contentType: "audio/mp3", channels: 2, bitrate: 132700, ...
...hness and power efficiency. ...
... if ('mediaCapabilities' in navigator) { const audioFileConfiguration = { type : 'file', audio : { contentType: "audio/mp3", channels: 2, bitrate: 132700, samplerate: 5200 } }; navigator.mediaCapabilities.decodingInfo(audioFileConfiguration).then(result => { console.log('This configuration is ' + (result.sup
ported ? ...
...And 5 more matches
OfflineAudioCompletionEvent.OfflineAudioCompletionEvent() - Web APIs
s page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...te to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...quest. ...
...And 5 more matches
PaymentRequest.PaymentRequest() - Web APIs
ll be used to handle the process of generating, validating, and submitting a payment request. Syntax var paymentRequest = new PaymentRequest(methodData, details, [options]); Parameters methodData Contains an array of identifiers for the payment methods the merchant web site accepts and any associated payment method specific data. Each item in the array contains the following fields: sup
portedMethods For early implementations of the spec, this was a sequence of identifiers for payment methods that the merchant website accepts. Starting with more recent browsers, this parameter is more generic than credit cards, it is a single DOMString, and the meaning of the data parameter changes with the sup
portedMethods. For example, the basic card payment method is selected by specifying the s...
...For basic credit card services, this structure should match the BasicCardRequest dictionary. ...
...For basic credit card services, this structure should match the BasicCardRequest dictionary. details Provides information about the requested transaction. This parameter contains the following fields: total The total amount of the payment request. ...
...And 5 more matches
Pointer events - Web APIs
Pointer events address that need. Pointer events are DOM events that are fired for a pointing device. They are designed to create a single DOM event model to handle pointing input devices such as a mouse, pen/stylus or touch (such as one or more fingers). The pointer is a hardware-agnostic device that can target a specific set of screen coordinates. ...
... Event Handler. Event On Event Handler Description pointerover onpointerover Fired when a pointer is moved into an element's hit test boundaries. pointerenter onpointerenter Fired when a pointer is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown event from a device that does not sup
port hover (see pointerdown). pointerdown onpointerdown Fired when a pointer becomes active buttons state. pointermove onpointermove Fired when a pointer changes coordinates. This event is also used if the change in pointer state can not be re
ported by other events. pointerup onpointerup Fired when a pointer is no longer active buttons state. point...
...buttons state. pointercancel onpointercancel A browser fires this event if it concludes the pointer will no longer be able to generate events (for example the related device is deactived). pointerout onpointerout Fired for several reasons including: pointer is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not sup
port hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover range detectable by the digitizer. pointerleave onpointerleave Fired when a pointer is moved out of the hit test boundaries of an element. For pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer. gotpointercaptu...
...And 5 more matches
PushMessageData.arrayBuffer() - Web APIs
lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
PushMessageData.blob() - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
PushMessageData.json() - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
PushMessageData.text() - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
PushSubscription.options - Web APIs
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Selection.extend() - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Selection.toString() - Web APIs
ibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
....com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Slottable: assignedSlot - Web APIs
ity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetassignedSlot ExperimentalChrome Full sup
port 53Edge Full sup
port 79Firefox Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Fir...
... Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config. No sup
port ? -- 59Disabled Disabled Until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true) and the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE No sup
port NoOpera Full sup
port ...
...And 5 more matches
URLUtilsReadOnly.origin - Web APIs
For URL using file: scheme, the value is browser dependant. This version of origin is implemented by WorkerLocation for use on workers. ...
...For URL using file: scheme, the value is browser dependant. This version of origin is implemented by WorkerLocation for use on workers. ...
...mpatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Using the User Timing API - Web APIs
fectively a midpoint between two marks. This document shows how to create mark and measure performance entry types and how to use User Timing methods (which are extensions of the Performance interface) to retrieve and remove entries from the browser's performance timeline. A live version of the examples is available on Github, as is the source code. Pull requests, enhancement requests and bug re
ports are welcome. Performance marks A performance mark is a named performance entry that is created by the application at some location in an application. The mark is a timestamp in the browser's performance timeline. Creating a performance mark The performance.mark() method is used to create a performance mark. The method takes one argument, the name of the mark, as shown in the following exampl...
...t some location in an application. The mark is a timestamp in the browser's performance timeline. Creating a performance mark The performance.mark() method is used to create a performance mark. The method takes one argument, the name of the mark, as shown in the following example. function create_marks(ev) { if (performance.mark === undefined) { log("Create Marks: performance.mark Not sup
ported", 0); return; } else { log("Create marks", 0); // Create several performance marks including two with the same name performance.mark("mark-1"); do_work(50000); performance.mark("mark-2"); do_work(50000); performance.mark("mark-2"); var marks = ["mark-1", "mark-2", "mark-2"]; for (var i=0; i < marks.length; i++) log("... Created mark = " + marks[i], 0); } Retrieving...
...rformance interface has three methods to retrieve marks. The following examples shows how to use each of these methods (performance.getEntries(), performance.getEntriesByType(entryType), and performance.getEntriesByName(name, entryType) ) to retrieve one or more marks. function display_marks(ev) { if (performance.getEntries === undefined) { log("Display Marks: performance.getEntries Not sup
ported", 0); return; } log("Display marks", 0); // Display each mark using getEntries() var entries = performance.getEntries(); var j=0; for (var i=0; i < entries.length; i++) { if (entries[i].entryType == "mark") { if (j == 0) { log("= getEntries()", 0); j++ } log("... [" + i + "] = " + entries[i].name, 0); } } // Display each mark using getEntriesByType() ...
...And 5 more matches
WaveShaperNode.WaveShaperNode() - Web APIs
table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... us a pull request. ...
...And 5 more matches
window.cancelIdleCallback() - Web APIs
ble in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetcancelIdleCallback ExperimentalChrome Full sup
port 47Edge Full sup
port 79Firefox Full sup
port 55 Full sup
port 55 Full sup
port 53Disabled Disabled From version 53: this feature is behind the dom.requestIdleCallback.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:...
...Firefox Full sup
port 55 Full sup
port 55 Full sup
port 53Disabled Disabled From version 53: this feature is behind the dom.requestIdleCallback.enabled preference (needs to be set to true). ...
...And 5 more matches
Window.customElements - Web APIs
compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetcustomElementsChrome Full sup
port 54Edge Full sup
port 79Firefox Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences i...
... Full sup
port 63 Full sup
port 63 No sup
port 59 -- 63Disabled Disabled From version 59 until version 63 (exclusive): this feature is behind the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config. No sup
port ? -- 59Disabled Disabled Until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true) and the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE No sup
port NoOpera Full sup
port ...
...And 5 more matches
Window.scroll() - Web APIs
ity The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
HTML in XMLHttpRequest - Web APIs
This limitation avoids wasting time parsing HTML uselessly when legacy code uses XMLHttpRequest in the default mode to retrieve responseText for text/html resources. ...
...This limitation avoids wasting time parsing HTML uselessly when legacy code uses XMLHttpRequest in the default mode to retrieve responseText for text/html resources. ...
...This limitation avoids wasting time parsing HTML uselessly when legacy code uses XMLHttpRequest in the default mode to retrieve responseText for text/html resources. ...
...And 5 more matches
XRSession.requestAnimationFrame() - Web APIs
r value which serves as a unique, non-zero ID or handle you may pass to cancelAnimationFrame() if you need to remove the pending animation frame request. Example The following example requests XRSession with "inline" mode so that it can be displayed in an HTML element (without the need for a separate AR or VR device). Note: A real application should check that the device and the User Agent sup
port WebXR API at all and then that they both sup
port the desired session type via XR.isSessionSup
ported(). // Obtain XR object const XR = navigator.xr // Request a new XRSession XR.requestSession("inline").then((xrSession) => { xrSession.requestAnimationFrame((time, xrFrame) => { let viewer = xrFrame.getViewerPose(xrReferenceSpace) gl.bindFramebuffer(xrWebGLLayer.framebuffer) for (x...
... } }) }) The following example was taken directly from the spec draft. ...
... } }) }) The following example was taken directly from the spec draft. ...
...And 5 more matches
XRView.transform - Web APIs
ts in your scene to adjust their placement and orientation to simulate the viewer's movement through space. In this example, we see an outline of a code fragment used while rendering an XRFrame, which makes use of the view transform to place objects in the world during rendering. ...
...just their placement and orientation to simulate the viewer's movement through space. In this example, we see an outline of a code fragment used while rendering an XRFrame, which makes use of the view transform to place objects in the world during rendering. ...
...and orientation to simulate the viewer's movement through space. In this example, we see an outline of a code fragment used while rendering an XRFrame, which makes use of the view transform to place objects in the world during rendering. ...
...And 5 more matches
@keyframes - CSS: Cascading Style Sheets
y will be handled in the order they should occur. Valid keyframe lists If a keyframe rule doesn't specify the start or end states of the animation (that is, 0%/from and 100%/to), browsers will use the element's existing styles for the start/end states. This can be used to animate an element from its initial state and back. Properties that can't be animated in keyframe rules are ignored, but sup
ported properties will still be animated. Resolving duplicates If multiple keyframe sets exist for a given name, the last one encountered by the parser is used. @keyframes rules don't cascade, so animations never derive keyframes from more than one rule set. If a given animation time offset is duplicated, all keyframes in the @keyframes rule for that percentage are used for that frame. There is cas...
...mes If a keyframe is defined multiple times but not all affected properties are in each keyframe, all values specified in these keyframes are considered. For example: @keyframes identifier { 0% { top: 0; } 50% { top: 30px; left: 20px; } 50% { top: 10px; } 100% { top: 0; } } In this example, at the 50% keyframe, the values used are top: 10px and left: 20px. ...
...ple times but not all affected properties are in each keyframe, all values specified in these keyframes are considered. For example: @keyframes identifier { 0% { top: 0; } 50% { top: 30px; left: 20px; } 50% { top: 10px; } 100% { top: 0; } } In this example, at the 50% keyframe, the values used are top: 10px and left: 20px. Cascading keyframes are sup
ported starting in Firefox 14. ...
...And 5 more matches
Introducing the CSS Cascade - CSS: Cascading Style Sheets
, don't participate in the cascade. In these cases, only the at-rule as a whole participates in the cascade: here, the @font-face identified by its font-family descriptor. If several @font-face rules with the same descriptor are defined, only the most appropriate @font-face, as a whole, is considered. While the declarations contained in most at-rules -- such as those in @media, @document, or @sup
ports -- participate in the cascade, declarations contained in @keyframes don't. As with @font-face, only the at-rule as a whole is selected via the cascade algorithm. Finally, note that @im
port and @charset obey specific algorithms and aren't affected by the cascade algorithm. Origin of CSS declarations The CSS cascade algorithm's job is to select CSS declarations in order to determine the correct...
...ascading order The cascading algorithm determines how to find the value to apply for each property for each document element. It first filters all the rules from the different sources to keep only the rules that apply to a given element. That means rules whose selector matches the given element and which are part of an appropriate media at-rule. ...
...find the value to apply for each property for each document element. It first filters all the rules from the different sources to keep only the rules that apply to a given element. That means rules whose selector matches the given element and which are part of an appropriate media at-rule. Then it sorts these rules according to their im
portance, that is, whether or not they are followed by !im
portant, and by their origin. ...
...And 5 more matches
border - CSS: Cascading Style Sheets
alues <line-width> Sets the thickness of the border. Defaults to medium if absent. See border-width. <line-style> Sets the style of the border. Defaults to none if absent. See border-style. <color> Sets the color of the border. Defaults to currentcolor if absent. See border-color. Description As with all shorthand properties, any omitted sub-values will be set to their initial value. Im
portantly, border cannot be used to specify a custom value for border-image, but instead sets it to its initial value, i.e., none. The border shorthand is especially useful when you want all four borders to be the same. To make them different from each other, however, you can use the longhand border-width, border-style, and border-color properties, which accept different values for each side. Alterna...
...ine: 0.5rem solid khaki; box-shadow: 0 0 0 2rem skyblue; border-radius: 12px; font: bold 1rem sans-serif; margin: 2rem; padding: 1rem; outline-offset: 0.5rem; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border' in that specification. Candidate Recommendation Removes specific sup
port for transparent, as it is now a valid <color>; this has no practical impact. Though it cannot be set to a custom value using the shorthand, border now resets border-image to its initial value (none). CSS Level 2 (Revision 1)The definition of 'border' in that specification. Recommendation Accepts the inherit keyword. Also accepts transparent as a valid color. CSS Level ...
...ity The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
clear - CSS: Cascading Style Sheets
lity The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
Can I start to use the two-value syntax? As demonst...
...ec to evolve. Can I start to use the two-value syntax? As demonstrated above, there is not a lot of advantage in using the two-value version right now; if you did your page would only work in Firefox! Other browsers do not yet implement the two-value versions. Therefore display: block flex will only get you flex layout in Firefox, and will be ignored as invalid in Chrome. You can see current sup
port in the compat data for the two-value syntax: The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Int...
...ble on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
initial - CSS: Cascading Style Sheets
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...t https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
letter-spacing - CSS: Cascading Style Sheets
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
mix-blend-mode - CSS: Cascading Style Sheets
compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...//github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
page-break-after - CSS: Cascading Style Sheets
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
page-break-before - CSS: Cascading Style Sheets
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Index - Developer guides
ommunity AJAX If you know of useful mailing lists, newsgroups, forums, or other communities related to AJAX, please link to them here. 4 Getting Started AJAX, API, Advanced, JavaScript, WebMechanics, XMLHttpRequest This article guides you through the AJAX basics and gives you some simple hands-on examples to get you started. 5 WAI ARIA Live Regions/API Sup
port AJAX, Accessibility Firefox 3 contains im
portant improvements to the way the Mozilla engine exposes live changes in a document. 6 Audio and Video Delivery Audio, Guide, HTML, HTML5, Media, Video Whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pret...
...You can find compatibility information in the Guide to media types and formats on the web. ...
...Often shortened to just streaming, live streaming is the process of transmitting media 'live' to computers and devices. This is a fairly complex and nascent subject with a lot of variables, so in this article, we'll introduce you to the subject and let you know how you can get started. 11 Media buffering, seek...
...And 5 more matches
<input type="range"> - HTML: Hypertext Markup Language
<input> elements of type range let the user specify a numeric value which must be no less than a given value, and no more than another given value. The precise value, however, is not considered im
portant. This is typically represented using a slider or dial control rather than a text entry box like the number input type. Because this kind of widget is imprecise, it shouldn't typically be used unless the control's exact value isn't im
portant. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If the user's browser doesn't sup
port type range, it will fall back and treat it as a text input. Value A DOMString ...
...ve examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If the user's browser doesn't sup
port type range, it will fall back and treat it as a text input. Value A DOMString containing the string representation of the selected numeric value; use valueAsNumber to get the value as a Number. ...
...of predefined values to suggest to the user for this input. Any values in the list that are not compatible with the type are not included in the suggested options. The values provided are suggestions, not requirements: users can select from this predefined list or provide a different value. See the range control with hash marks below for an example of how the options on a range are denoted in sup
ported browsers max The greatest value in the range of permitted values. If the value entered into the element exceeds this, the element fails constraint validation. If the value of the max attribute isn't a number, then the element has no maximum value. This value must be greater than or equal to the value of the min attribute. See the HTML max attribute. min The lowest value in the range of per...
...And 5 more matches
<listing> - HTML: Hypertext Markup Language
ompatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...s://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 5 more matches
Preloading content with rel="preload" - HTML: Hypertext Markup Language
n. This example is trivial, as the browser probably discovers the <link rel="stylesheet"> and <script> elements in the same chunk of HTML as the preloads, but the benefits can be seen much more clearly the later resources are discovered and the larger they are. For example: Resources that are pointed to from inside CSS, like fonts or images. Resources that JavaScript can request, like JSON, im
ported scripts, or web workers. Larger images and video files. preload has other advantages too. Using as to specify the type of content to be preloaded allows the browser to: Prioritize resource loading more accurately. Store in the cache for future requests, reusing the resource if appropriate. Apply the correct content security policy to the resource. Set the correct Accept request headers...
...ent extensions. Also note that the full list of values the as attribute can take is governed by the Fetch spec -- see request destinations. Including a MIME type <link> elements can accept a type attribute, which contains the MIME type of the resource the element points to. This is especially useful when preloading resources -- the browser will use the type attribute value to work out if it sup
ports that resource, and will only download it if so, ignoring it if not. You can see an example of this in our video example (see the full source code, and also the live version): <head> <meta charset="utf-8"> <title>Video preload example</title> <link rel="preload" href="sintel-short.mp4" as="video" type="video/mp4"> <link rel="preload" href="sintel-short.webm" as="video" type="video/webm...
...This shows how preloading content can be ...
...And 5 more matches
Network Error Logging - HTTP
Network Error Logging is a mechanism that can be configured via the NEL HTTP response header. This experimental header allows web sites and applications to opt-in to receive re
ports about failed (and, if desired, successful) network fetches from sup
porting browsers. Re
ports are sent to a re
porting group defined within a Re
port-To header. Usage Web applications opt in to this behaviour with the NEL header, which is a JSON-encoded object: NEL: { "re
port_to": "nel", "max_age": 31556952 } An origin considered secure by the browser is required. The following object keys can be specified in the NEL header: re
port_to The re
porting API group to send network error re
ports to (see below). max_age Specifies the lifetime of the policy, in seconds (in a similar way to e.g. HSTS p...
...: { "re
port_to": "nel", "max_age": 31556952 } An origin considered secure by the browser is required. The following object keys can be specified in the NEL header: re
port_to The re
porting API group to send network error re
ports to (see below). max_age Specifies the lifetime of the policy, in seconds (in a similar way to e.g. HSTS policies are time-restricted). The referenced re
porting group should have a lifetime at least as long as the NEL policy. include_subdomains If true, the policy applies to all subdomains under the origin that the policy header is set. The re
porting group should also be set to include subdomains, if this option is to be enabled. ...
...re time-restricted). The referenced re
porting group should have a lifetime at least as long as the NEL policy. include_subdomains If true, the policy applies to all subdomains under the origin that the policy header is set. The re
porting group should also be set to include subdomains, if this option is to be enabled. success_fraction Floating point value between 0 and 1 which specifies the pro
portion of successful network requests to re
port. Defaults to 0, so that no successful network requests will be re
ported if the key is not present in the JSON payload. failure_fraction Floating point value between 0 and 1 which specifies the pro
portion of failed network requests to re
port. ...
...And 5 more matches
HTTP Public Key Pinning (HPKP) - HTTP
Note: Public Key Pinning mechanism was deprecated in favor of Certificate Transparency and Expect-CT header. HTTP Public Key Pinning (HPKP) was a security feature that used to tell a web client to associate a specific cryptographic public key with a certain web server to decrease the risk of MITM attacks with forged certificates. It has been removed in modern browsers and is no longer sup
ported. To ensure the authenticity of a server's public key used in TLS sessions, this public key is wrapped into a X.509 certificate which is usually signed by a certificate authority (CA). Web clients such as browsers trust a lot of these CAs, which can all create certificates for arbitrary domain names. If an attacker is able to compromise a single CA, they can perform MITM attacks on various TLS conne...
...ate in the certificate chain to contain a public key whose fingerprint is already known via HPKP. If the server delivers an unknown public key, the client should present a warning to the user. Firefox and Chrome disable pin validation for pinned hosts whose validated certificate chain terminates at a user-defined trust anchor (rather than a built-in trust anchor). ...
...It is possible to specify multiple pins for different public keys. Some browsers might allow other hashing algorithms than SHA-256 in the future. ...
...And 5 more matches
Details of the object model - JavaScript
through the class definitions. In a class definition, you can specify that the new class is a subclass of an already existing class. The subclass inherits all the properties of the superclass and additionally can add new properties or modify the inherited ones. For example, assume the Employee class includes only the name and dept properties, and Manager is a subclass of Employee that adds the re
ports property. In this case, an instance of the Manager class would have all three properties: name, dept, and re
ports. JavaScript implements inheritance by allowing you to associate a prototypical object with any constructor function. So, you can create exactly the Employee -- Manager example, but you use slightly different terminology. First you define the Employee constructor function, specifying...
...nts inheritance by allowing you to associate a prototypical object with any constructor function. So, you can create exactly the Employee -- Manager example, but you use slightly different terminology. First you define the Employee constructor function, specifying the name and dept properties. Next, you define the Manager constructor function, calling the Employee constructor and specifying the re
ports property. Finally, you assign a new object derived from Employee.prototype as the prototype for the Manager constructor function. Then, when you create a new Manager, it inherits the name and dept properties from the Employee object. Adding and removing properties In class-based languages, you typically create a class at compile time and then you instantiate instances of the class either at co...
...ndividual objects or to the entire set of objects. The employee example The remainder of this chapter uses the employee hierarchy shown in the following figure. A simple object hierarchy with the following objects: Employee has the properties name (whose value defaults to the empty string) and dept (whose value defaults to "general"). Manager is based on Employee. It adds the re
ports property (whose value defaults to an empty array, intended to have an array of Employee objects as its value). WorkerBee is also based on Employee. It adds the projects property (whose value defaults to an empty array, intended to have an array of strings as its value). SalesPerson is based on WorkerBee. It adds the quota property (whose value defaults to 100). It also overrides the dept prope...
...And 5 more matches
Strict mode - JavaScript
u'll see the default, non-strict mode referred to as "sloppy mode". This isn't an official term, but be aware of it, just in case. JavaScript's strict mode, introduced in ECMAScript 5, is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode". Strict mode isn't just a subset: it intentionally has different semantics from normal code. Browsers not sup
porting strict mode will run strict mode code with different behavior from browsers that do, so don't rely on strict mode without feature-testing for sup
port for the relevant aspects of strict mode. Strict mode code and non-strict mode code can coexist, so scripts can opt into strict mode incrementally. Strict mode makes several changes to normal JavaScript semantics: Eliminates some JavaScript si...
...so true: non-strict plus strict looks non-strict. Obviously, concatenation of scripts is never ideal, but if you must, consider enabling strict on a function-by-function basis. You can also take the approach of wrapping the entire contents of a script in a function and having that outer function use strict mode. This eliminates the concatenation problem and it means that you have to explicitly ex
port any shared variables out of the function scope. Strict mode for functions Likewise, to invoke strict mode for a function, put the exact statement "use strict"; (or 'use strict';) in the function's body before any other statements. function strict() { // Function-level strict mode syntax 'use strict'; function nested() { return 'And so am I!'; } return "Hi! I'm a strict mode function! ...
...mode function! " + nested(); } function notStrict() { return "I'm not strict."; } Strict mode for modules ECMAScript 2015 introduced JavaScript modules and therefore a 3rd way to enter strict mode. The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it. function strict() { // because this is a module, I'm strict by default } ex
port default strict; Changes in strict mode Strict mode changes both syntax and runtime behavior. Changes generally fall into these categories: changes converting mistakes into errors (as syntax errors or at runtime), changes simplifying how the particular variable for a given use of a name is computed, changes simplifying eval and arguments, changes making it easier to write "secure" JavaScript, a...
...And 5 more matches
Navigation and resource timings - Web Performance
in document's timings whereas the resource timing provides the times for all the assets or resources called in by that main document and the resources' requested resources. The general performance timings below have been deprecated in favor of the Performance Entry API, which provides for marking and measuring times along the navigation and resource loading process. While deprecated, they are sup
ported in all browsers. Performance Timings The performanceTiming API, a JavaScript API for measuring the loading performance of the requested page, is deprecated but sup
ported in all browsers. It has been replaced with the performanceNavigationTiming API. The performance timing API provided read only times, in milliseconds(ms), describing at what time each point in the page loading process was rea...
...entStart, unloadEventEnd, redirectStart, redirectEnd, fetchStart, domainLookupStart, domainLookupEnd, connectStart , connectEnd, secureConnectionStart, requestStart, responseStart, responseEnd, domLoading, domInteractive, domContentLoadedEventStart, domContentLoadedEventEnd, domComplete, loadEventStart, and loadEventEnd. With the metrics above, and a little bit of math, we can calculate many im
portant metrics like time to first byte, page load time, dns lookup, and whether the connection is secure. To help measure the time it takes to complete all the steps, the Performance Timing API provides read only measurements of navigation timings. To view and capture our app's timing we enter: let time = window.performance.timing We can then use the results to measure how well our app is perform...
... or if one of the redirects is not of the same origin, the value returned is 0. redirectEnd When the last HTTP redirect is completed, that is when the last byte of the HTTP response has been received. If there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. connectEnd When the connection is opened network. If the trans
port layer re
ports an error and the connection establishment is started again, the last connection establishment end time is given. If a persistent connection is used, the value will be the same as PerformanceTiming.fetchStart. A connection is considered as opened when all secure connection handshake, or SOCKS authentication, is terminated. connectStart When the request to open a connectio...
...And 5 more matches
Add to Home screen - Progressive web apps (PWAs)
antage of it. Why A2HS? A2HS is thought to be part of the Progressive Web App philosophy -- giving web apps the same user experience advantages as native apps so they can compete in today's ecosystem wars. Part of this is the simple gesture of accessing an app by tapping its icon on your Home screen, and then having it appear neatly in its own window. A2HS makes this possible. What browsers sup
port A2HS? A2HS is sup
ported in all mobile browsers, except iOS webview. It's also sup
ported in some Chromium desktop browsers. Firefox has had mobile sup
port since v58 and is working on desktop sup
port. See caniuse.com for exact details. How do you use it? We've written a very simple example web site (see our demo live, and also see the source code) that doesn't do much, but was developed with t...
...and also see the source code) that doesn't do much, but was developed with the necessary code to allow it to be added to a Home screen, as well as a service worker to enable it to be used offline. The example displays a series of fox pictures. If you have Firefox for Android available, use it to navigate to our demo at https://mdn.github.io/pwa-examples/a2hs/. You'll see fox pictures, but more im
portant, you'll see a "home" icon with a plus (+) icon inside it -- this is the "Add to Home screen" icon displayed for any site that has the necessary features in place. Tapping this will show a confirmation banner -- pressing the big + ADD TO HOME SCREEN button completes the action, adding the app to the Home screen. (Note: In Android 8 and higher, a system-level "Add to Home screen" permission d...
...ld be placed somewhere inside your app directory (in the root is probably best) with the name somefilename.webmanifest (we've chosen manifest.webmanifest). It contains multiple fields that define certain information about the web app and how it should behave. Note: The .webmanifest extension is specified in the Media type registration section of the specification, but generally browsers will sup
port manifests with other appropriate extensions, e.g. .json. The fields needed for A2HS are as follows: background_color: Specifies a background color to be used in some app contexts. The most relevant one to A2HS is the splash screen displayed when the app icon on the Home screen is tapped and it first starts to load (this currently appears only when apps have been added to the Home screen by C...
...And 5 more matches
Mobile first - Progressive web apps (PWAs)
l information is loaded on top of that, whenever appropriate. This means that mobiles (often the target devices with the least available memory, bandwidth or processing power available) can be given an experience suitable for them as quickly as possible, and as free as possible of extraneous information. For example: If you are serving different styling and layout information for different view
port sizes, etc., it makes more sense to include the narrow screen/mobile styling as the default styling before any media queries are encountered, rather than having desktop/wider screen styling first. This way, mobile devices don't have to load assets and other information twice. If you are using mechanisms like feature detection and matchMedia to conditionally load scripting functionality depending...
...etc., it makes more sense to include the narrow screen/mobile styling as the default styling before any media queries are encountered, rather than having desktop/wider screen styling first. This way, mobile devices don't have to load assets and other information twice. If you are using mechanisms like feature detection and matchMedia to conditionally load scripting functionality depending on view
port size, feature sup
port, etc., you should just load the very basics that pretty much all browsers will need first, then progressively enhance browsers higher up the food chain. Note: Starting with very little and working up as the need arises usually makes more sense than starting with everything and then covering up things if they aren't needed! Mobile constraints We have already mentioned t...
...Therefore, as well as splitting content into different views, and simplifying the interface and content on each view of your application for mobile as much as possible, it is also a good idea to not include visual effects such as shadows, animations, and gradients. You should at least consider it as an option, especially if you are experiencing slow or laggy performance when your ...
...And 5 more matches
page-mod - Archive of obsolete content
add-on code sends the desired tag to the content script, and the content script replies by sending the HTML content of all the elements with that tag. ...
...content script, and the content script replies by sending the HTML content of all the elements with that tag. ...
...It adds a listener to the getElements message. The attach event...
...And 4 more matches
page-worker - Archive of obsolete content
A page worker may be destroyed, after which its memory is freed, and you must create a new instance to load another page. You specify the page to load using the contentURL option to the Page() constructor. This can point to a remote file: pageWorker = require("sdk/page-worker").Page({ contentScript: "console.log(document.body.innerHTML);", contentURL: "http://en.wikipedia.org/wiki/Internet" }); It can also point to an HTML file which you've packaged with your add-on. ...
...", contentURL: "./myFile.html" }); You can load a new page by setting the page worker's contentURL property. In this example we fetch the first paragraph of a page from Wikipedia, then the first paragraph of a different page: var getFirstParagraph = "var paras = document.getElementsByTagName('p');" + "console.log(paras[0].textContent);" + "self.
port.emit('loaded');" pageWorker = require("sdk/page-worker").Page({ contentScript: getFirstParagraph, contentURL: "http://en.wikipedia.org/wiki/Chalk" }); pageWorker.
port.on("loaded", function() { pageWorker.contentURL = "http://en.wikipedia.org/wiki/Cheese" }); Scripting page content To access the page's DOM you need to attach a script to it. In the SDK these scripts are called "content sc...
...ccess any of the SDK APIs, so in many cases you'll need to exchange messages between the content script and your main add-on code for a complete solution. For example, the content script might read some content and send it back to the main add-on, which could store it using the simple-storage API. You can communicate with the script using either the postMessage() API or (preferably, usually) the
port API. For example, this add-on loads a page from Wikipedia, and runs a content script in it to send all the headers back to the main add-on code: var pageWorkers = require("sdk/page-worker"); // This content script sends header titles from the page to the add-on: var script = "var elements = document.querySelectorAll('h2 > span'); " + "for (var i = 0; i < elements.length; i++) { " ...
...And 4 more matches
cfx - Archive of obsolete content
cfx is no longer sup
ported as of Firefox 44 and no longer accepted for add-on submission. jpm should now be used instead. For information on how to migrate from cfx to jpm see this guide. Enables you to test, run, and package add-ons. cfx is is no longer sup
ported as of Firefox 44 and no longer accepted for add-on submission, jpm should now be used instead. cfx usage is: cfx [options] command [command-specific options] "Options" are global options applicable to the tool itself or to all commands (for example --help). cfx sup
ports the following global options: -h, --help - show a help message and exit -v, --verbose - enable lots of output "Command-specific options" are documented alongside the commands. ...
... cfx run Launch an instance of Firefox with your add-on installed. ...
... main.md lib main.js package.json README.md tests test-main.js cfx run This command is used to run the add-on. Called with no options it looks for a file called package.json in the current directory, loads the corresponding add-on, and runs it under the version of Firefox it finds in the platform's default install path. Sup
ported Options You can point cfx run at a different package.json file using the --pkgdir option, and pass arguments to your add-on using the --static-args option. You can specify a different version of the host application using the --binary option, passing in the path to the application binary to run. The path may be specified as a full path or may be relative to the current directory. But note tha...
...And 4 more matches
Creating Reusable Modules - Archive of obsolete content
To follow this tutorial you'll need to have learned the basics of jpm. With the SDK you don't have to keep all your add-on in a single "index.js" file. You can split your code into separate modules with clearly defined interfaces between them. You then im
port and use these modules from other parts of your add-on using the require() statement, in exactly that same way that you im
port core SDK modules like page-mod or panel. It can often make sense to structure a larger or more complex add-on as a collection of modules. This makes the design of the add-on easier to understand and provides some encapsulation as each module will ex
port only what it chooses to, so you can change the internals of the module without breaking its users. Once you've done this, you can package the modules and distri...
...cker.filterAll | nsIFilePicker.filterText); var rv = fp.show(); if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) { var file = fp.file; // Get the path as string. Note that you usually won't // need to work with the string paths. var path = fp.file.path; // work with returned nsILocalFile... } return path; } Hash function Firefox has built-in sup
port for hash functions, exposed via the nsICryptoHash XPCOM interface The documentation page for that interface includes an example of calculating an MD5 hash of a file's contents, given its path. We can adapt it like this: var {Cc, Ci} = require("chrome"); // return the two-digit hexadecimal code for a byte function toHexString(charCode) { return ("0" + charCode.toString(16)).slice(-2); } funct...
... { console.log(md5File(promptForFile())); } }); This works , but index.js is now getting longer and its logic is harder to understand. Let's factor the file picker and hashing code into separate modules. Creating separate modules filepicker.js First create a new file in "lib" called "filepicker.js". Copy the file picker code into this new file, and add the following line at the end: ex
ports.promptForFile = promptForFile; This defines the public interface of the new module. So "filepicker.js" should look like this: var {Cc, Ci} = require("chrome"); function promptForFile() { var window = require("sdk/window/utils").getMostRecentBrowserWindow(); const nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); fp...
...And 4 more matches
Unit Testing - Archive of obsolete content
ur main add-on code, atob() and btoa() aren't available either. So we'll create a base64 module to expose these functions from the platform (see Creating Reusable Modules). To begin with, create a new directory, navigate to it, and run jpm init. Now create a new file called "base64.js", and give it the following contents: const { atob, btoa } = require("resource://gre/modules/Services.jsm"); ex
ports.atob = a => atob(a); ex
ports.btoa = b => btoa(b); This code ex
ports two functions, which just call the platform's btoa() and atob() functions. To show the module in use, edit the "index.js" file as follows: var base64 = require("./base64"); var button = require("sdk/ui/button/action").ActionButton({ id: "base64", label: "base64", icon: "./icon-16.png", onClick: function() { encod...
...ActionButton({ id: "base64", label: "base64", icon: "./icon-16.png", onClick: function() { encoded = base64.btoa("hello"); console.log(encoded); decoded = base64.atob(encoded); console.log(decoded); } }); To run this example you'll also have to have an icon file named "icon-16.png" saved in your add-ons "data" directory. You could download this icon: . ...
...e64", icon: "./icon-16.png", onClick: function() { encoded = base64.btoa("hello"); console.log(encoded); decoded = base64.atob(encoded); console.log(decoded); } }); To run this example you'll also have to have an icon file named "icon-16.png" saved in your add-ons "data" directory. You could download this icon: . Now "index.js" im
ports the base64 module and calls its two ex
ported functions. ...
...And 4 more matches
Modules - Archive of obsolete content
Some simple code to turn a JavaScript module into non-Mozilla-specific code (e.g., if
porting to the browser). The use of eval() will probably not be of concern because it is only being used on the EX
PORTED_SYMBOLS array which should not depend on user input. function im
portModule (thatObj) { thatObj = thatObj || window; var EX
PORTED_SYMBOLS = [ // Put the symbols here ]; // Your code here... ...
...e browser). The use of eval() will probably not be of concern because it is only being used on the EX
PORTED_SYMBOLS array which should not depend on user input. function im
portModule (thatObj) { thatObj = thatObj || window; var EX
PORTED_SYMBOLS = [ // Put the symbols here ]; // Your code here... ...
...l probably not be of concern because it is only being used on the EX
PORTED_SYMBOLS array which should not depend on user input. function im
portModule (thatObj) { thatObj = thatObj || window; var EX
PORTED_SYMBOLS = [ // Put the symbols here ]; // Your code here... // At the end of your code: (assuming neither 'i' nor 'thatObj' is being ex
ported!) for (var i=0; i < EX
PORTED_SYMBOLS.length; i++) {thatObj[EX
PORTED_SYMBOLS[i]] = eval(EX
PORTED_SYMBOLS[i]);} } or for one-time-only usage of a module: (function (thatObj) { thatObj = thatObj || window; var EX
PORTED_SYMBOLS = [ // Put the symbols here ]; // Your code here... ...
...And 4 more matches
Install Manifests - Archive of obsolete content
ecify a maxVersion of 3.5.*, so that they are automatically compatible with security and stability updates. For Firefox 3.0, a maxVersion of 3.0.* should be used. Extensions compatible only with Firefox or Thunderbird 2 should specify a maxVersion of 2.0.0.*. The Install Manifest must specify at least one of these objects, and may specify more if the add-on targets multiple applications that sup
port the Add-on Manager (e.g. Firefox and Thunderbird). Examples <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!--Firefox--> <em:minVersion>1.5</em:minVersion> <em:maxVersion>3.0.*</em:maxVersion> </Description> </em:targetApplication> Gecko 1.9 based applications allow you to use the special targetApplication id toolkit@mozilla.org to s...
... 2 Extensions 4 Themes 8 Locale 32 Multiple Item Package 64 Spell check dictionary 128 Telemetry Experiment 256 WebExtension Experiment Examples <em:type>2</em:type> This property was added for Firefox 1.5, and is only required for add-on types other than Extensions and Themes. Firefox 2 and previous sup
ported a value of 16 to represent plug-ins. In Firefox 3 this has been removed. version A version string identifying the version of the add-on being supplied. For Firefox/Thunderbird 1.0, the format must conform to the rules specified in Extension Versioning, Update and Compatibility. For Firefox/Thunderbird 1.5, see Toolkit version format. Examples <em:version>2.0</em:version> <em:version>1.0.2...
...reator homepageURL developer translator contributor More documentation can be found at Localizing extension descriptions. optionsType The type of user-interface used for displaying the options. Accepted values are: 1 Opens optionsURL in a dialog box 2 Options are displayed inside the Add-on Manager 3 Opens optionsURL in a new tab (if the application sup
ports that), or a dialog box optionsType defaults to 1 if there is an optionsURL included in install.rdf or 2 if there is no optionsURL and the file options.xul exists in the root of the add-on. <em:optionsType>2</em:optionsType> Options can be opened in a new tab since Firefox 7.0a1. To do so, set optionsType to 3 and set optionsURL to a the path of a page to open. <em:optionsType>3</em:op...
...And 4 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
designed to restrict user choice will result in stronger action, such as blacklisting of the add-ons in question. The most technically sound method of achieving this, and the only acceptable way of changing preferences such that they are automatically restored on add-on uninstall, is to make such changes in the default preference branch, as explained below. While the technical details below are im
portant to understand, a library which encapsulates the appropriate logic is provided along with the example add-on at the end, and should be used where possible. Changing Default Preference Values There are two common ways of changing default preference values. The simplest, which works only for traditional, non-restartless add-ons, is to add the preference changes to a file in an extension's default...
...n is disabled if they have not been changed in the meantime. While changes to default preference values will not persist across sessions, restartless extensions must nevertheless restore them for the balance of the session after they have been disabled. The following example bootstrap.js file illustrates the method: const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; // Im
port the Services module. Cu.im
port("resource://gre/modules/Services.jsm"); // Keep track of whether this is the first run. var firstRun = false; // Get the root user preference branch. var userPrefs = Services.prefs.getBranch(""); // Get the root default preference branch. var defaultPrefs = Services.prefs.getDefaultBranch(""); // Save the original values. var savedPrefs = {} // Change the defaul...
...ange comes in two parts: 1) installing a new search engine (and removing it when your extension is disabled), and 2) setting it as a default (and restoring the previous default when your extension is uninstalled). Adding a New Search Engine Search engines may be added either directly via an API call, or indirectly via an XML description file. ...
...And 4 more matches
Drag and Drop JavaScript Wrapper - Archive of obsolete content
This section describes how to use the JavaScript wrapper for drag and drop. The JavaScript Drag and Drop Wrapper The JavaScript wrapper to drag and drop simplifies the process by handling all of the XPCOM interfaces for you. It works by providing an object which implements the event handlers. All you have to do is write some simpler functions which work with the data being dragged. This drag and drop interface is stored in the global package, in the file chrome://global/content/nsDragAndDrop.js. You can include this file in your XUL file with the script tag in the same way you would include your own scripts. ...
...ssion) This function should be defined when something should happen on a drag exit. It has two arguments, the event object and the drag session. onDrop(event, dropData, session) This function should be defined when you want something to happen when an object is dropped. The first argument is the event object and the second is the data being dragged. The third argument is the drag session. getSup
portedFlavours() This function should return a list of flavors that the object being dragged over can accept. This function takes no arguments. This function is necessary so that the wrapper can determine the best flavour to pass to the other functions. For an observer that is observing an element that can start a drag, you should define at least the onDragStart function. For elements that can have ...
...ect being dragged over can accept. This function takes no arguments. This function is necessary so that the wrapper can determine the best flavour to pass to the other functions. For an observer that is observing an element that can start a drag, you should define at least the onDragStart function. For elements that can have objects dropped on them, you should define onDragOver, onDrop and getSup
portedFlavours (and, if desired, onDragExit). The type of data being dragged is stored as a set of flavors. Often, a dragged object will be available in a number of flavors. That way, a drop target can accept the flavor it finds most suitable. For example, a file may come in two flavors, the file itself and the text name of the file. If the file is dragged and dropped onto a directory, the file flavor...
...And 4 more matches
Embedding FAQ - Archive of obsolete content
ere. Scroll down to "Initalization and Teardown. How to customize document retrieval One method is to implement your own protocol method. You can find more information on adding new protocols here How to embedding mozilla inside of Java There hasn't been any good code examples found. However, there is a stripped down, uncommented code with eclipse libraries in this thread. ...
...zation and Teardown. How to customize document retrieval One method is to implement your own protocol method. You can find more information on adding new protocols here How to embedding mozilla inside of Java There hasn't been any good code examples found. However, there is a stripped down, uncommented code with eclipse libraries in this thread. ...
... retrieval One method is to implement your own protocol method. You can find more information on adding new protocols here How to embedding mozilla inside of Java There hasn't been any good code examples found. However, there is a stripped down, uncommented code with eclipse libraries in this thread. ...
...And 4 more matches
Repackaging Firefox - Archive of obsolete content
Notice: The article is about repackaging Firefox 2.0 and is obsolete when working on 3.x repackaging. Firefox can be customized for the needs of a particular group of users (for example, your organization's employees or clients). Because Firefox is designed from the ground up for extensibility and customization, this process is simple and easy to maintain. Im
portant legal considerations Before you get started, it is very im
portant to know and abide by the legal requirements for distributing Firefox. You must have written authorization from Mozilla to distribute a modified version of Firefox. To do this, please contact trademarks@mozilla.com. Getting started Now, on to the technical details. The following diagram represents an overview of the process and the pieces involved: You...
...trademarks@mozilla.com. Getting started Now, on to the technical details. The following diagram represents an overview of the process and the pieces involved: You will need the following to get started: A Macintosh computer (even for repackaging Windows or Linux only); it may be either PowerPC or Intel based. The repackager tool. Currently that page mentions only Firefox 1.5.x, but it sup
ports Firefox 2. The pristine Firefox 2 installer files (Windows .exe, Mac .dmg, or Linux .tar.gz) for each of the locales you need. At the time of writing this document, the latest builds are here. A "distro" extension that makes the changes you desire. Once you have all the ingredients, the customization process is quite easy: Download the Firefox installer. Install the repackager tool like ...
... want to bundle an extra extension solely to set a few defaults, you can do everything you need to do in your existing extension. However, it's still recommended that you look through this tutorial, as it contains tips specific for creating extensions of this type, and there are a few options that you will need to set to ensure a smooth upgrade path for users. At the very least, don't skip the "Im
portant Extension Preferences" section below. Sample DEX The best way to get started is probably to look at a simple DEX and modify it for your own purposes. Download the sample. XPI files are specially crafted ZIP files in disguise. You can use any ZIP program (WinZIP on Windows, zip on Mac or Linux, etc) to extract it. This XPI has the following contents chrome.manifest components/PartnerBookma...
...And 4 more matches
Style System Overview - Archive of obsolete content
A rule is a selector and a declaration block. A declaration block is a group of declarations. A declaration is a property and a value. p { color: green; font-size: 12em; } selector { property: value; property: value; } CSS Style Rules What do style rules mean? Selector matches elements in the document. Rule applies to matched elements. "casca...
... "cascaded" value for property + element: if 0 rules matching the element have the property: some properties inherit and some properties use initial value. inherited: 'font-size', 'color', etc. "reset": 'border', 'background', etc. ...
... The declarations (properties & values) are stored in data structs (nsCSS*). The data format of the structs and selectors is mostly clear from the code and not worth going into (although the implementation of :not() is confusing). CSS style rule representation h1, h2 { color: green; text-align: right; text-indent: 0; } CSSStyleRuleImpl ...
...And 4 more matches
JavaScript Client API - Archive of obsolete content
The best, and most up-to-date, reference to Sync's internal APIs is the source code. ...
...lves writing types that extend the Store, Tracker, and Record types as well. It will be very helpful to look at an existing sync engine for guidance. Have a look at one of the following files: services/sync/modules/engines/bookmarks.js services/sync/modules/engines/history.js Setting up a JS Module The code for your custom sync engine should live in a JS module. ...
...l. It will be very helpful to look at an existing sync engine for guidance. Have a look at one of the following files: services/sync/modules/engines/bookmarks.js services/sync/modules/engines/history.js Setting up a JS Module The code for your custom sync engine should live in a JS module. First off we're going to im
port the files mentioned above at the top the file. We're also going to im
port ''util.js'' as it contains many useful helpers. ...
...And 4 more matches
Clipboard Test - Archive of obsolete content
jetpa...
...This is the recommended method of copying data to the clipboard. string contentThe content to be copied to the clipboard. If no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavorData type. ...
...s a standardized way for features to access the clipboard. Features can get and set the clipboard in various flavors of data type. The namespace associated with this API is jetpack.clipboard which provides both read and write access to the clipboard. The API is fairly straightforward; examples can be found here. This API currently lives in the future and must be im
ported for use. jetpack.future.im
port("clipboard"); Methods set(contentstringflavorstring)Writes data from Jetpack to the clipboard. This is the recommended method of copying data to the clipboard. string contentThe content to be copied to the clipboard. If no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavorData type. This is an optional parameter. The only flavors currently implemented ar...
...And 4 more matches
Clipboard - Archive of obsolete content
This is the recommended method of copying data to the clipboard. string contentThe content to be copied to the clipboard. ...
...This is the recommended method of copying data to the clipboard. string contentThe content to be copied to the clipboard. If no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavorData type. ...
...s a standardized way for features to access the clipboard. Features can get and set the clipboard in various flavors of data type. The namespace associated with this API is jetpack.clipboard which provides both read and write access to the clipboard. The API is fairly straightforward; examples can be found here. This API currently lives in the future and must be im
ported for use. jetpack.future.im
port("clipboard"); Methods set(contentstringflavorstring)Writes data from Jetpack to the clipboard. This is the recommended method of copying data to the clipboard. string contentThe content to be copied to the clipboard. If no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavorData type. This is an optional parameter. The only flavors currently implemented are...
...And 4 more matches
Clipboard - Archive of obsolete content
This is the recommended method of copying data to the clipboard. contentThe content to be copied to the clipboard. ...
...This is the recommended method of copying data to the clipboard. contentThe content to be copied to the clipboard. If no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavorData type. ...
...es a standardized way for features to access the clipboard. Features can get and set the clipboard in various flavors of data type. The namespace associated with this API is jetpack.clipboard which provides both read and write access to the clipboard. The API is fairly straightforward; examples can be found here. The API currently lives in the future and must be im
ported for use. jetpack.future.im
port("clipboard"); Methods set(contentstringflavorstring) stringWrites data from Jetpack to the clipboard. This is the recommended method of copying data to the clipboard. contentThe content to be copied to the clipboard. If no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavorData type. This is an optional parameter. The only flavors currently implemented are...
...And 4 more matches
Mozilla Application Framework - Archive of obsolete content
m applications Want to build applications? Use the Mozilla framework and make your life easier. We provide a comprehensive framework that does much of the work for you, tools to help you develop your apps, and a community of people to help. ...
...evelop your apps, and a community of people to help. Framework XUL A comprehensive, cross-platform UI toolkit with an easy-to-learn XML language for defining UI structure, a schema for localization, and sup
port for both native and cross-platform (using CSS) look and feel to make writing UIs quick and painless. Gecko A performant web content rendering/editing engine with world-leading sup
port for standards that you can drop into your application with a single line of XUL. Necko A wicked-fast, extensible networking library with built-in sup
port for many common protocols and a well-defined plug-in interface for custom protocol handling so you can add the protocols you need. XPCOM A simple, cross-platform component model with multiple language bindings and IDL descriptions so y...
...king library with built-in sup
port for many common protocols and a well-defined plug-in interface for custom protocol handling so you can add the protocols you need. XPCOM A simple, cross-platform component model with multiple language bindings and IDL descriptions so you can plug your custom functionality into the framework and connect it with other components. Web Services Built-in sup
port for XMLHttpRequest, XML-RPC, SOAP, and WSDL to enable Mozilla-based application authors to take advantage of the exploding world of web services. XPInstall Our cross-platform installer for trivial packaging and installation of your Mozilla framework applications. and much much more... ...
...And 4 more matches
Actionscript Acceptance Tests - Archive of obsolete content
on) there are a couple of requirements: You must use System.swfVersion when looking up the swfVersion. The test file can not be wrapped in a package or define classes as the file will be wrapped in a function when used in the ATS. If you must use classes, define them in a sub-dir with the same name as the test. You must create a testname.as.avm_args file with the USES_SWFVERSION directive. Sup
port Files: There are a variety of sup
port files available for non-standard actionscript tests. testname.as.asc_args This file specifies additional arguments to pass to asc when compiling the test: # ASC args for file # two modes are available: # override| all command line arguments (except builtin.py) are ignored and replaced by these # merge| merge these args in with the current args # specifiy an a...
...ion 11 -swfversion 12 ... Any additional args on the USES_SWFVERSION line will be passed to each run of the vm. (See Bug 587093 for details.) Specifying multiple .abcs: If you desire to run a test with multiple .abc files (e.g: avmshell a.abc b.abc testname.abc) there is a special avm_args directive called multiabc that is specified surrounded by two pipe (|) symbols: |multiabc| $DIR/testname_sup
port/a.abc $DIR/testname_sup
port/b.abc The extra abc files will usually be placed in a _sup
port dir (see Additional Files below). Any avm arguments can be placed before the |multiabc| directive, or the line can start with the directive. Any test arguments (--) must be placed after the multiabc file listings. Here is a more complicated example that passes both avm args, multiple abcs and test args: ...
...The extra abc files will usually be placed in a _sup
port dir (see Additional Files below). Any avm arguments can be placed before the |multiabc| directive, or the line can start with the directive. Any test arguments (--) must be placed after the multiabc file listings. Here is a more complicated example that passes both avm args, multiple abcs and test args: -Ojit |multiabc| $DIR/testname_sup
port/a.abc -- test_args A dir.avm_args file can also be created with the same contents that will apply to the entire directory. testname.as.avm_args files will take precedence over the dir.avm_args file testname.as.tz If a test is only valid for certain timezones, the timezones can be specified in this sup
port file. Below is a sample file that covers the 4 main US timezones: # Place all timezones th...
...And 4 more matches
The new nsString class implementation (1999) - Archive of obsolete content
ing class is a wide character string class used throughout all of Gecko (and other modules) as the default implementation. However, it suffers from a few implementation details which need to be addressed and that are the subject of this document. ...
...ed throughout all of Gecko (and other modules) as the default implementation. However, it suffers from a few implementation details which need to be addressed and that are the subject of this document. ...
...the default implementation. However, it suffers from a few implementation details which need to be addressed and that are the subject of this document. ...
...And 4 more matches
XUL Questions and Answers - Archive of obsolete content
XUL FAQ (make sure they have a clear answer.) Where can I get more information about creating MozSearch plugins? Creating MozSearch plugins contains more help information about creating MozSearch plugin on Firefox 2. More documentation on Search plugins is available in the Search plugins category. Is localizing remote XUL possible? Loading remote DTDs for XML documents is currenty not sup
ported in XUL. The following bugs were re
ported on this issue: bug 22942, bug 133698. Is there an editor widget in XUL that sup
ports syntax highlighting? Daniel Glazman has been working on this for his projects. He said the code will be open-source, but it is not released yet (as of Oct 2006). Some teasers are on his blog. Overlaying elements without IDs The original developers only tend to pu...
... IDs where they need them. As an extension author, you have at least two options: use DOM methods to dynamically create or rearrange elements file an enhancement request in Bugzilla to have extra IDs added. ...
...s: use DOM methods to dynamically create or rearrange elements file an enhancement request in Bugzilla to have extra IDs added. ...
...And 4 more matches
SSL and TLS - Archive of obsolete content
Both client and server authentication occur over SSL/TLS. SSL/TLS uses a combination of public key and symmetric-key encryption. Symmetric-key encryption is much faster than public-key encryption, but public-key encryption provides better authentication techniques. An SSL/TLS session always begins with an exchange of messages called the SSL handshake, initial communication between the server and client. ...
...ange of messages called the SSL handshake, initial communication between the server and client. The handshake allows the server to authenticate itself to the client using public-key techniques, then allows the client and the server to cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows. Both of these protocols sup
port using a variety of different cryptographic algorithms, or ciphers, for operations such as authenticating the server and client, transmitting certificates, and establishing session keys. Clients and servers may sup
port different cipher suites, or sets of ciphers. Among other functions, the SSL handshake determines how the server and client negotiate which cipher suite they will use to authenticate...
...termines how the server and client negotiate which cipher suite they will use to authenticate each other, to transmit certificates, and to establish session keys. Key-exchange algorithms like RSA and Elliptic Curve Cryptography (ECC) govern the way the server and client determine the symmetric keys to use during an SSL session. The most common SSL cipher suites use RSA key exchange, while TLS sup
ports ECC cipher suites as well as RSA. Note: Longer RSA keys are required to provide security as computing capabilities increase. The recommended RSA key-length is 2048 bits. Though many web servers continue to use 1024-bit keys, web servers should migrate to at least 2048 bits. For 64-bit machines, consider using stronger keys. All CAs should use at least 2048-bit keys, and stronger keys (such as 3...
...And 4 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
enu bar is disabled, Firefox is missing the min/max/restore/close button on the right side of the title bar. Please see the following threads on MozillaZine for solutions to this issue: http://forums.mozillazine.org/viewtopic.php?f=18&t=2131121 http://forums.mozillazine.org/viewtopic.php?f=18&t=1953371&start=60 Windows 7 Aero not going into full screen mode properly On Win7 with Aero Glass sup
port Firefox doesn't always go to full screen mode from a normal window properly. The resolution to this issue is to add the following code to your browser.css file somewhere below where the main-window is made transparent to sup
port Aero glass. @media all and (-moz-windows-compositor) { /* Make transition to Fullscreen mode seamlessly in Firefox 10+ */ #main-window[inFullscreen="true"] { -mo...
...rmal window properly. The resolution to this issue is to add the following code to your browser.css file somewhere below where the main-window is made transparent to sup
port Aero glass. @media all and (-moz-windows-compositor) { /* Make transition to Fullscreen mode seamlessly in Firefox 10+ */ #main-window[inFullscreen="true"] { -moz-appearance: none; background-color: -moz-dialog!im
portant; } } For more information about this issue please see bug 732757 and bug 732757 and this MozillaZine thread. Mac OS X OS X Lion missing toolbar button icons Due to Firefox bug 679708 and bug 702558, some toolbar buttons icons may be missing on Firefox 8 and later running on Mac OS X Lion. In order to work around this issue, you need to either rename any of the following files that are in...
...] > .inspector-breadcrumbs-id { .inspector-breadcrumbs-id, .inspector-breadcrumbs-classes { Style inspector breadcrumb button backgrounds are not consistent between pre-FF14 and FF14+ The use of the styling rule fill in -moz-border-image is incompatible with versions of Firefox older than Firefox14, however, its use is needed for Firefox 14 and later. Themes that use -moz-border-image and sup
port both Firefox 14 and newer as well as older versions of Firefox need to use both the older and newer methodologies like the following example. In most themes this issue specifically affects the breadcrumbs toolbar of the style inspector. .inspector-breadcrumbs-button { -moz-border-image: url("chrome://browser/skin/devtools/breadcrumbs/ltr-middle.png") 2 13 2 13 stretch; /* For FF13- */ -moz-...
...And 4 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
n of HTML 4 as an XML 1.0 application. If you're writing XHTML (as opposed to regular HTML) you should understand the fundamental differences between HTML 4 and XHTML. XHTML is XML, not HTML One of the primary misunderstandings about XHTML is that it is just another version of HTML. This misunderstanding is compounded by the fact that, prior to version 9, Microsoft(R) Internet Explorer only sup
ports XHTML if it is served with MIME media type text/html rather than the recommended application/xhtml+xml. When an XHTML page is served with MIME type text/html it is treated by all browsers as if it were nothing more than HTML. However when an XHTML page is served with MIME type text/xml or application/xhtml+xml, then it should be treated as an XML document which must conform to the strict rules ...
...for backward compatibility. <script type="text/javascript"> //<![CDATA[ var i = 0; while (++i < 10) { // ... } //]]> </script> Examples Using CSS rules in inline style within comments Example 1 - XHTML 1.0 Strict as text/html This example illustrates the behavior of XHTML served as text/html when CSS rules are contained inline and surrounded by comments. ...
...- XmlGuru). Note that Netscape 7.x, Mozilla and Opera all agree that CSS rules contained inline inside of comments are to be ignored. ...
...And 4 more matches
XForms Select1 Element - Archive of obsolete content
Introduction Allows the user to choose a single value from a list of pre-defined values (see the spec). The list of pre-defined items can be specified by either item (see the spec) or itemset (see the spec) elements. You can visually group these pre-defined items by using the choices (see the spec) element to contain them. Note, some representations of the select1 element do not sup
port visual grouping. Attributes UI Common appearance - the value of this attribute gives a hint to the XForms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special selection - this attribute, when set to 'open', allows the user to provide free entry to the list. Possible values a...
...processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special selection - this attribute, when set to 'open', allows the user to provide free entry to the list. Possible values are open and closed, default is closed (see #Representations section to refer if the attribute is sup
ported for every representation). incremental - sup
ported, default value is true Properties selection - see corresponding attribute incremental - see corresponding attribute Type restrictions The select1 element can be bound to a node containing simple content. The data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to...
...dgets for the specified appearance attribute values: combobox - default representation (xhtml/xul) listbox - used when appearance = 'compact' (xhtml/xul) radio group - used when appearance = 'full' (xhtml/xul) combobox Displaying a combobox is the default representation (xhtml/xul). ...
...And 4 more matches
The Business Benefits of Web Standards - Archive of obsolete content
ne go. The blogging community are particularly dynamic in this respect where on many platforms including WordPress, TextPattern and Habari, the site theme is a complete and discrete entity in its own right. Improved User Experience: Less Bandwidth and Fast Loads HTML code is often much more compact (therefore easier to read and maintain) when used in conjunction with CSS. According to various re
ports, case studies, and Andy King, author of Speed Up Your Web Site: Web Site Optimization, CSS has made it possible to transform table-based layouts into CSS-based layouts. Typically this reduces page size by 25 to 50%. This translates into better user experience, according to Usability Guru Jakob Nielsen, who notes that users tend to close a web page when it takes more than 10 seconds to load. The...
... need to plunge into the increasing costs and uncertain quality and integrity of proprietary Pay Per Click campaigns. Increase Website Traffic Maintain Contact With Your User On Multiple Platforms Standards-based code and cross-platform go hand in hand. While some browsers have quirks that cause different behavior by platform, Mozilla-based browsers are designed to behave identically on all sup
ported platforms (Mac, Linux, Unix, Windows...) Web Content is increasingly being accessed by a growing number of user agents other than browsers, or by browsers on different platforms - for example mobile telephones. Feed content such as RSS and Atom simply will not work without being implemented by following the requisite standard. Assumptions about the user and their platform based on erroneous t...
... want to work using outdated methodologies and platforms with uncertain standards, with all the consequent uncertainty in quality. They have adopted Web Standards long ago and now work where these new skills are appreciated. Familiarity with Dreamweaver or any other legacy software is not a good basis for hiring creative development personnel. Eliminate Unwelcome Future Costs A very significant
portion of electronically-stored information is produced for the web and written in HTML format. Most of this information uses invalid HTML which happens to be displayed correctly in permissive older browsers. As the web evolves, web browsers may eventually become either less permissive, or behave differently when given invalid markup (e.g. parse invalid data and render it slightly differently). Using...
...And 4 more matches
Game distribution - Game development
will have to focus on if you truly want to succeed. Mobile devices are where HTML5 technology can truly shine and show its advantages. There's no Flash, and HTML5 is fully multiplatform. Trying to compete with desktop games directly is very difficult. You can put your HTML5 games into the same arena (see Native desktop, later on) and you should because it's good to diversify the platforms you sup
port, but you have to remember that developers creating desktop games have years of experience, great tools and stable distribution channels. Many HTML5 games will target different market segments than native desktop games, e.g. simple time killer games to be played while on the move rather than huge immersive experiences. Such games are often designed to be played with two, or even one finger, so you...
...unes or Steam. If you're working on a side project just for fun, then leaving the source open will benefit those who would like to learn from what you've created. You don't even have to worry about looking for a hosting provider as it's possible to host games on GitHub Pages. You'll get free hosting, version control and possible contributors if your project is interesting enough. Publishers and
portals As the name may suggest, publishers can handle the publishing of your game for you. Whether you should go that way or not depends on what your plan is for having your game distributed: Do you want to send it wherever possible, or do you want to restrict its presence to those who've bought an exclusive license? It's up to you. Consider various options, experiment and conclude. Publishers will ...
...ou. Whether you should go that way or not depends on what your plan is for having your game distributed: Do you want to send it wherever possible, or do you want to restrict its presence to those who've bought an exclusive license? It's up to you. Consider various options, experiment and conclude. Publishers will be explained in more detail in the monetization article. There are also independent
portals collecting interesting games like HTML5Games.com, GameArter.com, MarketJS.com, GameFlare, GameDistribution.com or Poki where you can send your game in and it will get some natural promotion because of the big traffic those sites attract. Some of these take your files and host them on their server, whereas others only link to your website or embed your game on their site. Such exposure may just...
...And 4 more matches
MDN Web Docs Glossary: Definitions of Web-related terms
ization Developer Tools DHTML Digest Digital certificate Distributed Denial of Service DMZ DNS Doctype Document directive document environment DOM (Document Object Model) Domain Domain name Domain sharding Dominator DoS attack DTLS (Datagram Trans
port Layer Security) DTMF (Dual-Tone Multi-Frequency signaling) Dynamic programming language Dynamic typing E ECMA ECMAScript Effective connection type Element Empty element Encapsulation Encryption Endianness Engine Entity Entity header Event ...
... Instance Internationalization Internet Intrinsic Size IP Address IPv4 IPv6 IRC ISO ISP ITU J Jank Java JavaScript JPEG jQuery JSON K Key Keyword L Latency Layout view
port Lazy load LGPL Ligature Local scope Local variable Locale Localization Long task Loop Lossless compression lossy compression LTR (Left To Right) M Main Axis Main thread markup MathML Media Media (Audio-visual presentation...
... P P2P PAC Packet Page load time Page prediction Parameter Parent object Parse Parser PDF Perceived performance Percent-encoding PHP Pixel Placeholder names Plaintext PNG Polyfill Polymorphism POP3
Port Prefetch Preflight request Prerender Presto Primitive Privileged privileged code Progressive Enhancement Progressive web apps Promise Property Property (CSS) Property (JavaScript) Protocol Prototype Prototype-based programming Proxy server ...
...And 4 more matches
Handling different text directions - Learn web development
Previous Overview: Building blocks Next Many of the properties and values that we have encountered so far in our CSS learning have been tied to the physical dimensions of our screen. We create borders on the top, right, bottom, and left of a box, for example. These physical dimensions map very neatly to content that is viewed horizontally, and by default the web tends to sup
port left-to-right languages (e.g. English or French) better than right-to-left languages (such as Arabic). In recent years however, CSS has evolved in order to better sup
port different directionality of content, including right-to-left but also top-to-bottom content (such as Japanese) -- these different directionalities are called writing modes. As you progress in your study and begin to work with layout,...
...your study and begin to work with layout, an understanding of writing modes will be very helpful to you, therefore we will introduce them now. Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To understand the im
portance of writing modes to modern CSS. What are writing modes? A writing mode in CSS refers to whether the text is running horizontally or vertically. The writing-mode property lets us switch from one writing mode to another. You don't need to be working in a language which uses a vertical writing mode to want to do this -- you could also change the writing mode of parts of your layout for c...
...ection blocks are displayed on the page in the writing mode in use. The inline dimension is always the direction a sentence flows. This figure shows the two dimensions when in a horizontal writing mode. This figure shows the two dimensions in a vertical writing mode. ...
...And 4 more matches
What text editors are available? - Learn web development
s as you can and get a feel for what suits your workflow. But we'll give you some pointers for getting started. Here are the primary questions you should consider: Which OS (operating system) do I want to work with? What kind of technologies do I want to manipulate? What kind of basic features do I expect from my text editor? Do I want to add extra features to my text editor? Do I need sup
port/help while using my text editor? Does my text editor's look-and-feel matter to me? Notice we didn't mention price. Obviously, that matters too, but a product's cost has little connection with its quality or capability. There's a big chance you'll find a suitable text editor for free. Here are some popular editors: Editor Licence Price OS Sup
port Doc. Extensible ...
... Dig deeper Choice criteria ...
...setting for your needs Check autosave and session saving settings Configure any available plugins and investigate how to get new ones Change color schemes Adjust view settings and see how you can change the layout of the views Check what programming languages/technologies your editor sup
ports While you're learning the default settings of most text editors should be fine to use, but it is im
portant to become familiar with your chosen tools, so you can select the best one for your usage. You will learn more about customizing your editors and tools as you gain experience, and more im
portantly you will learn what features are more useful to your purposes. Dig deeper Choice criteria So, in more detail, what should you be thinking about when you choose a text editor? Which OS (operating s...
...And 4 more matches
Perceived performance - Learn web development
Perceived performance is user perspective, not a metric. This article provides a brief introduction to perceived performance, looking at user perceptions, and what objective tools can be used to measure that which is subjective. Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. ...
...eries of useful hints and tips (or jokes, or whatever else you think might be appropriate). Such an approach is much better than just showing nothing, which will make it feel like it is taking a lot longer and possibly lead to your users thinking it is broken and giving up. Perceived performance The perception of how fast your site loads and how responsive feels to user interaction is vitally im
portant; even more im
portant that actual download time but difficult to quantify. There are areas of your site that you may not be able to make faster, but you can make it feel faster even if the metrics discussed in the othser sections can't be improved. There is no unicorn metric that can measure what the user feels, but metrics are useful in guaging improvements (and regressions). Relevant measure...
...eel faster even if the metrics discussed in the othser sections can't be improved. There is no unicorn metric that can measure what the user feels, but metrics are useful in guaging improvements (and regressions). Relevant measurements include first meaningful paint (FMP), largest contentful paint (LCP), time to interactive (TTI), render start, DOM interactive, and speed index. ...
...And 4 more matches
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
for all, active, and completed todos. A button to clear the completed todos. Because we need access to our service from the footer component, we need to generate a class for the footer. ...
...tton to clear the completed todos. Because we need access to our service from the footer component, we need to generate a class for the footer. ...
...need access to our service from the footer component, we need to generate a class for the footer. Enter the following terminal command to do so: ember generate component-class footer Next, go and find the newly-created todomvc/app/components/footer.js file and update it to the following: im
port Component from '@glimmer/component'; im
port { inject as service } from '@ember/service'; ex
port default class FooterComponent extends Component { @service('todo-data') todos; } Now we need to go back to our todo-data.js file and add some functionality that will allow us to return the number of incomplete todos (useful for showing how many are left), and clear the completed todos out of the list (which is what the "Clear completed" functionality needs). In todo-data.js, add the fo...
...And 4 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
dos, our Todos component is not very useful. To turn our component into a general purpose To-Do editor we should allow the parent of this component to pass in the list of todos to edit. This would allow us to save them to a web service or local storage and later retrieve them for update. So let's turn the array into a prop. In Todos.svelte, replace the existing let todos = ... ...
...s not very useful. To turn our component into a general purpose To-Do editor we should allow the parent of this component to pass in the list of todos to edit. This would allow us to save them to a web service or local storage and later retrieve them for update. So let's turn the array into a prop. In Todos.svelte, replace the existing let todos = ... block with ex
port let todos = []. ex
port let todos = [] This may feel a little weird at first. That's not how ex
port normally works in JavaScript modules! This is how Svelte 'extends' JavaScript by taking valid syntax and giving it a new purpose. In this case Svelte is using the ex
port keyword to mark a variable declaration as a property or prop, which means it becomes accessible to consumers of the component. You can also specify...
... Have a look at the app, and you'll see the "Nothing to do here!" message. This is because we are currently not passing any value into it from App.svelte, so it's using the default value. ...
...And 4 more matches
Getting started with Vue - Learn web development
ntain any valid HTML, as well as some Vue-specific syntax that we'll cover later. Note: By setting the lang attribute on the <template> tag, you can use Pug template syntax instead of standard HTML -- <template lang="pug">. We'll stick to standard HTML through this tutorial, but it is worth knowing that this is possible. <script> contains all of the non-display logic of your component. ...
...ax that we'll cover later. Note: By setting the lang attribute on the <template> tag, you can use Pug template syntax instead of standard HTML -- <template lang="pug">. We'll stick to standard HTML through this tutorial, but it is worth knowing that this is possible. <script> contains all of the non-display logic of your component. Most im
portantly, your <script> tag needs to have a default ex
ported JS object. ...
...ic of your component. Most im
portantly, your <script> tag needs to have a default ex
ported JS object. This object is where you locally register components, define component inputs (props), handle local state, define methods, and more. Your build step will process this object and transform it (with your template) into a Vue component with a render() function. In the case of App.vue, our default ex
port sets the name of the component to app and registers the HelloWorld component by adding it into the components property. When you register a component in this way, you're registering it locally. Locally registered components can only be used inside the components that register them, so you need to im
port and register them in every component file that uses them. This can be useful for bundle splitt...
...And 4 more matches
HTTP logging
rograms" submenu. On all newer versions of Windows, you can hold down the Windows key and press "R". Type CMD and press enter, a new Command Prompt window with a black background will appear. Copy and paste the following lines one at a time into the Command Prompt window. ...
... paste the following lines one at a time into the Command Prompt window. Press the enter key after each one.: For 64-bit Windows: set MOZ_LOG=timestamp,rotate:200,nsHttp:5,cache2:5,nsSocketTrans
port:5,nsHostResolver:5,cookie:5 set MOZ_LOG_FILE=%TEMP%\log.txt "c:\Program Files\Mozilla Firefox\firefox.exe" For 32-bit Windows: set MOZ_LOG=timestamp,rotate:200,nsHttp:5,cache2:5,nsSocketTrans
port:5,nsHostResolver:5,cookie:5 set MOZ_LOG_FILE=%TEMP%\log.txt "c:\Program Files (x86)\Mozilla Firefox\firefox.exe" (These instructions assume that you installed Firefox to the default location, and that drive C: is your Windows startup disk. Make the appropriate adjustments if those aren't the case.) Reproduce whatever problem it is that you're having. Once you've reproduced the problem, exit F...
..." directly into the Windows Explorer location bar to get there quickly. Linux This section offers information on how to capture HTTP logs for Firefox running on Linux. Quit out of Firefox if it's running. Open a new shell. The commands listed here assume a bash-compatible shell. Copy and paste the following commands into the shell one at a time. Make sure to hit enter after each line. ex
port MOZ_LOG=timestamp,rotate:200,nsHttp:5,cache2:5,nsSocketTrans
port:5,nsHostResolver:5,cookie:5 ex
port MOZ_LOG_FILE=/tmp/log.txt cd /path/to/firefox ./firefox Reproduce the problem you're debugging. When the problem has been reproduced, exit Firefox and look for the generated log files, which you can find at /tmp/log.txt. Mac OS X These instructions show how to log HTTP traffic in Firefox on...
...And 4 more matches
Message manager overview
his operates on all frames, in all content tabs. If you load a frame script using the global frame message manager, the script gets loaded separately into every open tab: three times, in the diagram above. Similarly, if you send a message using the global frame message manager, it's received by all content tabs, and is then delivered to any frame scripts that are listening for it. ...
... There's a window message manager for every browser window: two, in the diagram above. It operates on all content tabs in a given window. If you load a frame script using the window message manager it gets loaded separately into each tab open in that particular window. If you send a message using the window message manager, it gets sent to all content tabs in that window. ...
...tab. Scripts you load using a browser message manager are loaded only into that content tab, and messages you send are delivered only to that content tab. You can mix and match: so for example, you could load a script into every tab using the global message manager, but then send a message to the script instance loaded into a specific tab by using the browser message manager. ...
...And 4 more matches
Overview of Mozilla embedding APIs
At the heart of XPCOM's implementation is the Service Manager and the Component Manager. Together, these two services provide a centralized point for gaining access to all of the public Mozilla interfaces. ...
...wing utility classes are available from the XPCOM DLL. They provide some basic functionality which should be leveraged when building new XPCOM components. nsCOMPtr<interface-type> These are templatized smart pointers which transparently deal with XPCOM reference counting issues. See the nsCOMPtr User's Manual for more information. nsString There are a collection of string classes which sup
port both unicode and ASCII strings. These classes provide a variety of string operations as well as dealing with the memory management issues of storing the underlying data. See the String Guide for more details. nsWeakPtr This is an nsCOMPtr which encapsulates XPCOM weak reference sup
port. See the nsIWeakReference document for more information. Public Return Codes NS_SUCCEEDED NS_ERROR_FAIL...
...This must be the first function call made into Gecko. NS_TermEmbedding This function shuts down Gecko and cleans up any remaining resources... Currently, once Gecko has been shutdown, it cannot be restarted in the same process space... This should change in the future. ...
...And 4 more matches
Promise
not be available yet. A reference to an existing promise may be received by different means, for example as the return value of a call into an asynchronous API. Once you have a reference to a promise, you can call its then() method to execute an action when the value becomes available, or when an error occurs. Promises may also be created using the new Promise() constructor. You don't need to im
port the Promise.jsm module to use a Promise object to which you already have a reference. Internally, a promise can be in one of three states: Pending, when the final value is not available yet. This is the only state that may transition to one of the other two states. Fulfilled, when and if the final value becomes available. A fulfillment value becomes permanently associated with the promise. T...
...alue becomes permanently associated with the promise. This may be any value, including undefined. Rejected, if an error prevented the final value from being determined. A rejection reason becomes permanently associated with the promise. This may be any value, including undefined, though it is generally an Error object, like in exception handling. Note: You should always handle, forward, or re
port errors (rejection reasons). If you see the message "A promise chain failed to handle a rejection", there is likely something to be fixed in the code. See handling errors and common pitfalls below. Documentation conventions In documentation, the type of the fulfillment value is usually specified between angular brackets. For example, the OS.File.exists function returns a promise that will event...
...instant state and value of a promise cannot be inspected synchronously from code, without calling the then() method. To help with debugging, only when inspecting a promise object manually, you can see more information as special properties that are inaccessible from code (this, at present, is implemented by randomizing the property name, for the lack of more sophisticated language or debugger sup
port). These code-inaccessible, inspectable properties are: {{private:status}}: 0 for pending, 1 for fulfilled, or 2 for rejected. {{private:value}}: Fulfillment value or rejection reason, for fulfilled or rejected promises only. {{private:handlers}}: Array of objects holding references to functions registered by the then() method, for pending promises only. Examples See the examples page. ...
...And 4 more matches
Application Translation with Mercurial
ith > .hgrc This file stores your general Mercurial settings (Mercurial is the tool which manages the source code and its history of changes). Now go in the file system to the file and open it in your favorite text editor. Windows users can use e.g. Notepad++. Paste the following content into the file: [ui] username = Firstname Lastname <mynick@example.com> merge = internal:merge [alias] qex
port = ex
port -g -r qtip qex
portall = diff -r qparent [defaults] commit = -v diff = -p -U 8 qdiff = -p -U 8 qnew = -U [diff] git = 1 showfunc = 1 unified = 8 [extensions] hgext.mq = progress = [hooks] Put in your name and email address which later will be public on the internet after your translation patch got accepted and uploaded. Save the file and close it. Enabling Mercurial queues (revert...
...ck with the right mouse button on the page in the sidebar and choose "Properties" from the context menu which gets opened. Rename it something meaningful, e.g. "Firefox <version number> translation". After you saved the dialog, click with the left mouse button on the page in the sidebar to open the locally saved copy. Opening English files and the target locale side-by-side The localization re
port shows the IDs of added or removed texts, but the English text itself is still unknown. We get this by comparing the English version of the file with the one of the locale we are translating in. To do so, Launch WinMerge. From its "File" menu, choose "Save project". For the file path of the left directory, go to the downloaded mozilla-aurora source code and then into its browser/locales/ fold...
....label; has to be left unchanged so it can be replaced with the text of the string id &newPrivateWindow.label; whis is stored elsewhere. Translation time: Translate the text. Afterwars, the line should look somehow like this: <!ENTITY privatebrowsingpage.howToStart4 "Der private Modus kann auch uber den Menu-Eintrag &newPrivateWindow.label; gestartet werden."> Save the file. Ex
porting the changes as patch A patch is a file containing recorded changes to a repository. It can be used to apply these changes to a copy of the repository yet without these changes. Tell Mercurial to store the changes in the Mercurial queue with the qref command. We also create a commit message which will describe the changes in the patch and later get used when the patched gets checked in ('ad...
...And 4 more matches
Creating localizable web applications
Listed below are good practices and recommendations that should be followed in order to make your content easily localizable. Note: Most of the code snippets used in the examples below come from an early version of the getpersonas.com website. In some cases, the code snippets were slightly changed to better illustrate the recommendations or for clarity. Cheatsheet Don't hardcode English text, formats (numbers, dates, addresses, etc.), word order or sentence structure. Don't put text or numbers in images. Don't forget about right-to-left locales. Take advantage of printf() (or equivalents) and use variables in the English strings. ...
... locale correctly Be smart about detecting the user's locale correctly. You can use one or more of the following techniques: HTTP Accept-Language headers, the UA string, IP geolocation. See examples of the addons.mozillaorg code at /addons/trunk/site/app/config/language.php and /addons/trunk/site/app/config/language.inc.php. The LANGUAGE_CONFIG class expects arrays of valid languages & sup
ported languages. Always give the user a possibility to change the locale (e.g. by adding locale dropdown menu at bottom of page) and remember this choice for the future visits. Use the locale code in the URLs Depending on how you detect user's locale, you may want to provide a way of overriding the autodetection. You can achieve this by setting a cookie when the user changes the locale with the la...
...zers' work with repeating content. This is useful for strings occurring in the webapp multiple times, like "return to top", "comments", "click to see larger image" etc. Might be also helpful for headers and footers, if you're not using templates to display them. In most of the cases though, you should use gettext whenever technically possible (i.e. the server's PHP has been built with gettext sup
port). Localize the date format Localizing the date format is as easy as localizing any other string. Just let the localizers localize the format specification string. Snippet 1. Bad: $persona['date'] = date("n/j/Y", strtotime($persona['approve'])); Snippet 2. Good: $persona['date'] = date(_("n/j/Y"), strtotime($persona['approve'])); Localize the number format You can make the number format ...
...And 4 more matches
Introduction to Network Security Services
Network Security Services (NSS) is a set of libraries designed to sup
port cross-platform development of communications applications that sup
port SSL, S/MIME, and other Internet security standards. For a general overview of NSS and the standards it sup
ports, see Overview of NSS. Shared libraries Network Security Services provides both static libraries and shared libraries. Applications that use the shared libraries must use only the APIs that they ex
port. Three shared libraries ex
port public functions: The SSL library sup
ports core SSL operations. The S/MIME library sup
ports core S/MIME operations. The NSS library sup
ports core crypto operations. We guarantee that applications using the ex
ported APIs will remain compatible with future versions of those libraries. For a complete...
... use only the APIs that they ex
port. Three shared libraries ex
port public functions: The SSL library sup
ports core SSL operations. The S/MIME library sup
ports core S/MIME operations. The NSS library sup
ports core crypto operations. We guarantee that applications using the ex
ported APIs will remain compatible with future versions of those libraries. For a complete list of public functions ex
ported by these shared libraries in NSS 3.2, see NSS functions. For information on which static libraries in NSS 3.1.1 are replaced by each of the above shared libraries in NSS 3.2 , see Migration from NSS 3.1.1. ...
...t of public functions ex
ported by these shared libraries in NSS 3.2, see NSS functions. For information on which static libraries in NSS 3.1.1 are replaced by each of the above shared libraries in NSS 3.2 , see Migration from NSS 3.1.1. Figure 1, below, shows a simplified view of the relationships among the three shared libraries listed above and NSPR, which provides low-level cross platform sup
port for operations such as threading and I/O. (Note that NSPR is a separate Mozilla project; see Netscape
Portable Runtime for details.) Figure 1 Relationships among core NSS libraries and NSPR Naming conventions and special libraries Windows and Unix use different naming conventions for static and dynamic libraries: Windows Unix static .lib .a dynami...
...And 4 more matches
NSS Developer Tutorial
action(); although the use of curly braces is more common. Multiple-line comments should be formatted as follows: /* * Line1 * Line2 */ or /* ** Line 1 ** Line 2 */ The following styles are also common, because they conserve vertical space: /* Line1 * Line2 */ or /* Line1 ** Line2 */ or /* Line1 * Line2 */ Naming Public functions are named FOO_DoOneAction. Global, but unex
ported functions, are usually named foo_DoOneAction. Variable, and function parameter names, always start with a lowercase letter. The most common style is fooBarBaz, although foobarbaz and foo_bar_baz are also used. Miscellaneous goto can be used, to simplify resource deallocation, before returning from a function. A data buffer is usually represented as: unsigned char *data; unsigned in...
...t tests, which can use most C++11 features. The Mozilla C++ language features guide, and the Chromium C++ usage guide, list C++ features that are known to be widely available and compatible. You should limit features to those that appear in both guides. Ask on nss-dev@ if you think this is restrictive, or if you wish to prohibit a specific feature. NSS C ABI backward compatibility Functions Ex
ported functions cannot be removed. The function prototype of an ex
ported function, cannot be changed, with these exceptions: A Foo * parameter can be changed to const Foo *. This change is always safe. Sometimes an int parameter can be changed to unsigned int, or an int * parameter can be changed to unsigned int *. Whether such a change is safe needs to be reviewed on a case-by-case basi...
... Opaque structs give us complete freedom to change them, but require applications to call NSS functions, to allocate and free them. Enums The numeric values of public enumerators cannot be changed. ...
...And 4 more matches
Encrypt Decrypt_MAC_Using Token
rv = FileToItem(&filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* Check for headers and trailers and remove them. ...
...iledata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* Check for headers and trailers and remove them. */ if ((body = strstr(nonbody, header)) != NULL) { char *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* Maybe this is a MAC file. ...
...r *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* Maybe this is a MAC file. ...
...And 4 more matches
nss tech note1
the SEC_ASN1_POINTER modifier Here is a description of the various tags and modifiers that apply to the <tt style="color: rgb(0,0,0);">kind field. ASN.1 tags ASN.1 tags are specified in the lower byte of the kind field of the template, as noted above. The following is not an attempt to explain ASN.1 tags or their purposes. Rather, the goal here is to explain what type of tags the decoder sup
ports and which macros should be used when defining tags in decoder templates. It should be noted that we only sup
port an older specification of ASN.1; multibyte tags are not currently sup
ported. The 8-bit ASN.1 tags that we sup
port are made of three parts : The ASN.1 component class type. It is specified in the upper 2 tag bits (number 6 and 7). There are four classes of ASN.1 tags : universal,...
... between the two macros. The sub field of the template points to a callback function of type SEC_ASN1TemplateChooser that returns the subtemplate depending on the component data. SEC_ASN1_SKIP: specifies that the decoder should skip decoding of the component. SEC_ASN1DecodeItem can only skip required components and will assert if you try to skip an OPTIONAL component. SEC_QuickDERDecodeItem sup
ports skipping the decoding of OPTIONAL components if you define the tag of the component in the template SEC_ASN1_INNER: recurse into the component and saves its content, without the surrounding ASN.1 tag and length SEC_ASN1_SAVE: saves the component data, but does not proceed to the next component if within a SEQUENCE template array. This means the next template will reprocess the same compone...
...the surrounding ASN.1 tag and length SEC_ASN1_SAVE: saves the component data, but does not proceed to the next component if within a SEQUENCE template array. This means the next template will reprocess the same component. SEC_ASN1_SKIP_REST: abort the decoding. This is used in a template array within a SEQUENCE, if you don't care about the fields at the end of it. SEC_ASN1DecodeItem only sup
ports this modifier in the top-level template. SEC_QuickDERDecodeItem allows it at any nested sublevel. SEC_ASN1_CHOICE: allows decoding of components that are of variable type. This must be the first template in a NULL-terminated array. The offset parameter specifies where to store the type identifier in the target data . Subsequent templates specify a custom identifier for each possible component...
...And 4 more matches
Network Security Services
For a list of frequently asked questions, see the FAQ. NSS is available under the Mozilla Public License. For information on downloading NSS releases as tar files, see Download PKI Source. ...
...For a list of frequently asked questions, see the FAQ. NSS is available under the Mozilla Public License. For information on downloading NSS releases as tar files, see Download PKI Source. ...
...For a list of frequently asked questions, see the FAQ. NSS is available under the Mozilla Public License. For information on downloading NSS releases as tar files, see Download PKI Source. ...
...And 4 more matches
Multithreading in Necko
Warning: The content of this article may be out of date. It was last updated in 2001. Necko's primary interfaces are NOT thread safe. There has not yet been a need to make Necko entirely thread safe as most of Mozilla (and especially most of Gecko) run only on the main/primordial thread. In the future, Necko may be made thread safe to sup
port changes to Gecko that would put some other processing work on background threads (eg. multithreaded image decoding). However, most Necko protocols utilize background threads. Background threads are used to manage all I/O operations (with the exception of few cases). Most simple protocol handlers (eg. file, finger, datetime) do not worry about threading issues. The internal I/O interfaces default to proxying all callbacks to the main thread. ...
...col handlers (eg. file, finger, datetime) do not worry about threading issues. The internal I/O interfaces default to proxying all callbacks to the main thread. This keeps simple protocol handlers simple :-) More complex protocol handlers (eg. http, ftp) operate partially on the background threads to improve performance. For example, the http protocol handler has code that runs on the socket trans
port thread to kick off pending requests well before the main thread would get around to doing so. Socket Trans
port Thread (1) Socket connections are processed on a single background thread. This thread is controlled by the nsSocketTrans
portService. It sits in a loop, polling a list of sockets. When a socket can be read, the socket's listener is notified either synchronously (on the same thread) or...
...d would get around to doing so. Socket Trans
port Thread (1) Socket connections are processed on a single background thread. This thread is controlled by the nsSocketTrans
portService. It sits in a loop, polling a list of sockets. When a socket can be read, the socket's listener is notified either synchronously (on the same thread) or asynchronously via a nsIStreamListenerProxy impl. File Trans
port Threads (1-4) File I/O is processed via a thread pool that has between 1 and 4 threads. These threads are controlled by the nsFileTrans
portService. Each file trans
port object is given time on one of the file trans
port threads. During which it reads (writes) until its buffers are full (empty). Once at the limit of its buffers, it yields the thread to another pending file trans
port object. As with...
...And 4 more matches
SpiderMonkey 1.8.5
4.0. It is much faster than SpiderMonkey 1.8, implements ES-5 (ECMA 262, 5th Edition), and contains many new language and API features, described in detail below. Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or, file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. --22 March 2011 Platform sup
port SpiderMonkey 1.8.5 is sup
ported on all the platforms where Firefox 4 runs. SpiderMonkey 1.8.5 includes a just-in-time compiler (JIT) (several, actually) that compiles JavaScript to machine code, for a significant speed increase. It is sup
ported only on x86, x86_64 and ARM architectures. On other platforms, the JIT is simply disabled; JavaScript code runs in an interpreter, as in previous versions...
...t compiles JavaScript to machine code, for a significant speed increase. It is sup
ported only on x86, x86_64 and ARM architectures. On other platforms, the JIT is simply disabled; JavaScript code runs in an interpreter, as in previous versions. It's the same language, just not as fast. Migrating to SpiderMonkey 1.8 The following features in earlier versions of SpiderMonkey have been dropped. Sup
port for extended class methods (in particular, JSEqualityOp) has been removed. Multithreaded JS programs that race against the same objects are now explicitly not sup
ported. Multithreaded programs are allowed, but each thread must operate on objects in a separate compartment, isolated from the other threads. The old build system (using Makefile.ref) is no longer sup
ported. SpiderMonkey 1.8.5 includ...
..., functions, and callback signatures have changed, though most of them still have the same names and do the same things. Applications will need significant changes, but most of those changes will be detected by the C/C++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. Here is a list of the most significant changes. Previous versions of SpiderMonkey sup
ported two types of native functions: JSNative and JSFastNative. All sup
port for the slow native function type has been removed, and the fast signature has been renamed to JSNative. Embeddings that defined JSNatives in previous versions must update all those functions to the new signature. Getters and setters of type JSPropertyOp took an id parameter of type jsval. The type of the parameter has been ...
...And 4 more matches
Implementation Details
Introduction This article is a reference how Gecko implements AT APIs. ...
... Introduction This article is a reference how Gecko implements AT APIs. ...
... Introduction This article is a reference how Gecko implements AT APIs. ...
...And 4 more matches
Aggregating the In-Memory Datasource
only reflection". That is, you want to reflect the contents of something as an RDF graph (presumably so that it can be aggregated with other information or displayed as styled content). Technical Details As before, have an nsCOMPtr as your delegate, but this time around,don't derive from nsIRDFDataSource. ...
...aph (presumably so that it can be aggregated with other information or displayed as styled content). Technical Details As before, have an nsCOMPtr as your delegate, but this time around,don't derive from nsIRDFDataSource. Also, instead of keeping an nsCOMPtr<nsIRDFDataSource>, you'll just want an nsCOMPtr<nsISup
ports>: class MyClass : public nsIMyInterface { ... private: nsCOMPtr<nsISup
ports> mInner; }; Construct the datasource delegate when your object is constructed (or, at worst, when somebody QI's for it): rv = nsComponentManager::CreateInstance( kRDFInMemoryDataSourceCID, this, /* the "outer" */ nsCOMTypeInfo<nsISup
ports>::GetIID(), getter_AddRefs(mInner)); Note passing this as the "outer" parameter. Now, if the in-memory datasource's imple...
...This preserves the symmetrical property of QueryInterface(). ...
...And 4 more matches
How to build an XPCOM component in JavaScript
om mozdev mirrors. If an interface exists that meets your needs, then you do not need to write an IDL, or compile a typelib, and may skip to the next section. If you don't find a suitable pre-existing interface, then you must define your own. XPCOM uses a dialect of IDL to define interfaces, called XPIDL. Here's the XPIDL definition for our HelloWorld component: HelloWorld.idl #include "nsISup
ports.idl" [scriptable, uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)] interface nsIHelloWorld : nsISup
ports { string hello(); }; Note that you must generate a new UUID for each XPCOM component that you create. See Generating GUIDs for more information. Compiling the Typelib Your interface definition must be compiled into a binary format (XPT) in order to be registered and used within Mozilla appl...
...Note: it doesn't do the work of creating your interface definition file or the type library for you, so you still have to go through those steps above if they h...
...Note: it doesn't do the work of creating your interface definition file or the type library for you, so you still have to go through those steps above if they haven't been done. The library provides a simp...
...And 4 more matches
XPCOM Stream Guide
s a source of water. If we think of the water as data, then the spout represents an input stream: a controller for data coming out of something. At the same time, there may be some way to put water into the tank - say, a main water line. That water line represents an output stream: a controller for data going into something. The actual data going in to and coming out of an object isn't usually im
portant to a stream. Streams simply provide a way to read or write data to some object. In basic C++ programming for a console application, we usually talk about streams to access files, or to interact with the user. Mozilla's use of streams is more complex. On the one hand, we don't interact with the user through streams. On the other hand, we use streams to access files within a ZIP archive, to sto...
... This is also a synchronous (blocking) operation, so if you're in JavaScript, consider using NetUtil.jsm as described below. A note about Unicode strings versus nsIInputStream nsIInputStream and nsIOutputStream work with 8-bit characters. However, JavaScript strings contain 16-bit characters. This can mean if you have characters beyond ASCII code 255,...
...oever invokes the request to the .onStartRequest(), .onDataAvailable(), and .onStopRequest() methods of the listener. As for passing in the stream listener and starting the request: that will vary depending on the use case. Seekable Streams Some streams are "seekable": they let you specify where in the stream you are reading from (instead of requiring it be from the beginning). They can also re
port their current position in the file. Seekable streams implement the nsISeekableStream interface. The following stream types are known to implement nsISeekableStream: nsStorageInputStream nsStringInputStream nsMultiplexInputStream nsPipeInputStream nsFileInputStream nsBufferedInputStream nsFileOutputStream nsBufferedOutputStream Complex stream types Several stream types leverage primi...
...And 4 more matches
IAccessibleText
method it must return S_FALSE. Typically this feature would not be implemented by an application. However, if the application developer was not satisfied with how screen readers have handled the reading of sentences this boundary type could be implemented and screen readers could use the application's version of a sentence rather than the screen reader's. The rest of the boundary types must be sup
ported. This enum is used in textBeforeOffset(), textAtOffset(), and textAfterOffset(). Method overview HRESULT addSelection([in] long startOffset, [in] long endOffset ); [propget] HRESULT attributes([in] long offset, [out] long startOffset, [out] long endOffset, [out] BSTR textAttributes ); [propget] HRESULT caretOffset([out] long offset ); [propget] HRESULT characterExtents([in] long offset...
...gth. endOffset Index of the last character to exclude in the returned string. The valid range is 0..length. text Returns the substring starting with the character at startOffset (inclusive) and up to the character at endOffset (exclusive), if startOffset is less than or equal to endOffset. Return value E_INVALIDARG if bad [in] passed, [out] value is null. S_OK. textAfterOffset() Returns a text()
portion after the given position. Returns the substring of the specified text() type that is located after the given character and does not include it. The result of this method should be same as a result for textAtOffset() with a suitably increased index value. For example, if text() type is ::IA2_TEXT_BOUNDARY_WORD, then the complete word that is closest to and located after offset is returned. If t...
... returned. [propget] HRESULT textAfterOffset( [in] long offset, [in] enum IA2TextBoundaryType boundaryType, [out] long startOffset, [out] long endOffset, [out] BSTR text ); Parameters offset Index of the character for which to return the text() part before it. The index character will not be part of the returned string. The valid range is 0..length. boundaryType The type of the text()
portion to return. See ::IA2TextBoundaryType for the complete list. startOffset 0 based offset of first character. endOffset 0 based offset of one past the last character. text Returns the requested text()
portion. This
portion may be empty or invalid when no appropriate text()
portion is found or text() type is invalid. Return value E_INVALIDARG if bad [in] passed, [out] values are 0s and null respe...
...And 4 more matches
nsICategoryManager
xpcom/components/nsICategoryManager.idlScriptable This interface provides access to a data structure that holds a list of name-value pairs, called categories, where each value is a list of strings. Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Implemented by: @mozilla.org/categorymanager;1. To use this service, use: var categoryManager = Components.classes["@mozilla.org/categorymanager;1"] .getService(Components.interfaces.nsICategoryManager); Method overview string addCategoryEntry(in string aCategory, in string aEntry, in string aValue, in boolean aPersist, in boolean aReplace); void deleteCategory(in string aCategory); void deleteCategoryEntry(in string aCategory, in str...
...reated if they do not exist. string addCategoryEntry( in string aCategory, in string aEntry, in string aValue, in boolean aPersist, in boolean aReplace ); Parameters aCategory The name of the category being modified. ("protocol") aEntry The name of the category entry being modified. ("http") aValue The value for the category entry. ("moz.httprulez.1") aPersist No longer sup
ported. Category entries never persist across application sessions. You must pass false for this parameter. aReplace A flag indicating whether or not to overwrite the value of an existing category entry. Return value The previous value for the given category entry (if any). Exceptions thrown NS_ERROR_INVALID_ARG This error is returned if aReplace is false and the category entry already has a...
...gory being modified. ("protocol") aEntry The name of the category entry being deleted. ("http") aPersist Ignored. Category entries never persist across sessions. You should always pass false for this parameter. enumerateCategories() Enumerate all existing categories. nsISimpleEnumerator enumerateCategories(); Parameters None. Return value A simple enumerator, each result QIs to nsISup
portsCString. enumerateCategory() Enumerate the entries in a category. nsISimpleEnumerator enumerateCategory( in string aCategory ); Parameters aCategory The category to be enumerated. Return value A simple enumerator, each result QIs to nsISup
portsCString. getCategoryEntry() Get the value for the given category's entry. string getCategoryEntry( in string aCategory, in string aEnt...
...And 4 more matches
nsIMsgMessageService
Objects that implements nsIMsgMessageService give the user top level routines related to messages like copying, displaying, attachment's manipulation, printing, streaming the message content to eml format string, etc. ...
...ener, in boolean aMoveMessage, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow, out nsIURI aURL); [noscript] void CopyMessages(in nsMsgKeyArrayPtr keys, in nsIMsgFolder srcFolder, in nsIStreamListener aCopyListener, in boolean aMoveMessage, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow, out nsIURI aURL); void DisplayMessage(in string aMessageURI, in nsISup
ports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, in string aCharsetOverride, out nsIURI aURL); void openAttachment(in string aContentType, in string aFileName, in string aUrl, in string aMessageUri, in nsISup
ports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener); void SaveMessageToDisk(in string aMessageURI, in nsIFileSp...
...istener); void SaveMessageToDisk(in string aMessageURI, in nsIFileSpec aFile, in boolean aGenerateDummyEnvelope, in nsIUrlListener aUrlListener, out nsIURI aURL, in boolean canonicalLineEnding, in nsIMsgWindow aMsgWindow); void GetUrlForUri(in string aMessageURI, out nsIURI aURL, in nsIMsgWindow aMsgWindow); void DisplayMessageForPrinting(in string aMessageURI, in nsISup
ports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, out nsIURI aURL); void Search(in nsIMsgSearchSession aSearchSession, in nsIMsgWindow aMsgWindow, in nsIMsgFolder aMsgFolder, in string aSearchUri); nsIURI streamMessage(in string aMessageURI, in nsISup
ports aConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, in boolean aConvertData,...
...And 4 more matches
Component; nsIPrefBranch
Component: nsIPrefBranch modules/libpref/public/nsIPrefBranch.idlScriptable This interface is used to manipulate the preferences data. This object may be obtained from the preferences service (nsIPrefService) and used to get and set default and/or user preferences across the application. Inherits from: nsISup
ports Last changed in Gecko 58 (Firefox 58 / Thunderbird 58 / SeaMonkey 2.55) This object is created with a "root" value which describes the base point in the preferences "tree" from which this "branch" stems. Preferences are accessed off of this root by using just the final
portion of the preference. For example, if this object is created with the root "browser.startup.", the preferences "browser.startup.page", "browser.startup.homepage", and "browser.startup.homepage_ove...
... Constants Constant Value Description PREF_INVALID 0 long ...
...to foo.bar.baz and foo.bar.bzip. aObserver The object to be notified if the preference changes. The structure of aObserver is any object with an observe function. See nsIObserver and here is a quick snippet: var myObserver = { observe: function(aSubject, aTopic, aData) { //do stuff here } } aHoldWeak true holds a weak reference to aObserver. The object must implement the nsISup
portsWeakReference interface or this will fail. false holds a strong reference to aObserver. clearUserPref() Called to clear a user set value from a specific preference. This will, in effect, reset the value to the default value. If no default value exists the preference will cease to exist. Note: This method does nothing if the prefbranch it is called on is a default branch. void clearUserPref( ...
...And 4 more matches
nsIProtocolHandler
netwerk/base/nsIProtocolHandler.idlScriptable This interface is used to implement protocol handlers. If you wish to create a new protocol handler, you need to implement this interface. Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview boolean allow
Port(in long
port, in string scheme); nsIChannel newChannel(in nsIURI aURI); nsIURI newURI(in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI); Attributes Attribute Type Description default
Port long The default
port is the
port the protocol uses by default. If the protocol doesn't need a
port (for example, the "about" protocol), this attribute is -1. Read only. protocolFlags uns...
... with the Mozilla 2 platform. scheme ACString The scheme for this protocol ("file", "http", and so forth). Read only. Constants Constant Value Description URI_STD 0 A standard full URI with authority component and understanding relative URIs; this includes http and ftp, for example. URI_NORELATIVE 1<<0 The protocol doesn't sup
port relative URIs (for example, about and javascript). URI_NOAUTH 1<<1 The protocol doesn't have an authority component (for example, file). URI_INHERITS_SECURITY_CONTEXT 1<<4 URIs for this protocol have no inherent security context, so documents loaded using this protocol should inherit the security context of the document that loads them. URI_FORBIDS_AUTOMATI...
...es. This could be a local file (URI_IS_LOCAL_FILE), a UI resource (URI_IS_UI_RESOURCE), or something else that would not hit the network. URI_OPENING_EXECUTES_SCRIPT 1<<13 URIs for this protocol execute script when they are opened. ALLOWS_PROXY 1<<2 This protocol handler can be proxied via SOCKS or HTTP (such as IRC, SMTP, and HTTP, for example). If the protocol sup
ports transparent proxying, the handler should implement the nsIProxiedProtocolHandler interface. If the protocol only sup
ports HTTP proxying, it doesn't need to sup
port nsIProxiedProtocolHandler, but should instead set the ALLOWS_PROXY_HTTP flag. ALLOWS_PROXY_HTTP 1<<3 The protocol handler can be proxied using an HTTP proxy (for example, HTTP and FTP). nsIIOService.newChannelFromURI() ...
...And 4 more matches
nsISHEntry
nsDocShellEditorDataPtr forgetEditorData(); Violates the XPCOM interface guidelines nsIContentViewer getAnyContentViewer(out nsISHEntry ownerEntry); void getScrollPosition(out long x, out long y); void getViewerBounds(in nsIntRect bounds); Native cod...
... nsDocShellEditorDataPtr forgetEditorData(); Violates the XPCOM interface guidelines nsIContentViewer getAnyContentViewer(out nsISHEntry ownerEntry); void getScrollPosition(out long x, out long y); void getViewerBounds(in nsIntRect bounds); Native code only! boolean hasDetachedEditor(); Violates t...
... contentType ACString Indicates the content-type of the document that this is a session history entry for. contentViewer nsIContentViewer Content viewer, for fast restoration of presentation. docIdentifier unsigned long long An integer that should be the same for two entries attached to the same docshell if and only if the two entries are entries fo...
...And 4 more matches
nsIServerSocketListener
netwerk/base/public/nsIServerSocket.idlScriptable This interface is notified whenever a server socket accepts a new connection. The trans
port is in the connected state, and read/write streams can be opened using the normal nsITrans
port API. The address of the client can be found by calling the nsISocketTrans
port.GetAddress() method or by inspecting nsISocketTrans
port.GetHost(), which returns a string representation of the client's IP address, which may be either an IPv4 or an IPv6 address. ...
...nection. The trans
port is in the connected state, and read/write streams can be opened using the normal nsITrans
port API. The address of the client can be found by calling the nsISocketTrans
port.GetAddress() method or by inspecting nsISocketTrans
port.GetHost(), which returns a string representation of the client's IP address, which may be either an IPv4 or an IPv6 address. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview void onSocketAccepted(in nsIServerSocket aServ, in nsISocketTrans
port aTrans
port); void onStopListening(in nsIServerSocket aServ, in nsresult aStatus); Methods onSocketAccepted() This method is called when a client connection is accepted. ...
... onStopListening() This method is called when the listening socket stops for some reason. The server socket is effectively dead after this notification. ...
...And 4 more matches
nsIWindowWatcher
Clients may expect this property to be always current, so to properly integrate this component the application will need to keep it current by setting the property as the active window changes. ...
...w); nsIAuthPrompt getNewAuthPrompter(in nsIDOMWindow aParent); nsIPrompt getNewPrompter(in nsIDOMWindow aParent); nsIDOMWindow getWindowByName(in wstring aTargetName, in nsIDOMWindow aCurrentWindow); nsISimpleEnumerator getWindowEnumerator(); nsIDOMWindow openWindow(in nsIDOMWindow aParent, in string aUrl, in string aName, in string aFeatures, in nsISup
ports aArguments); void registerNotification(in nsIObserver aObserver); void setWindowCreator(in nsIWindowCreator creator); void unregisterNotification(in nsIObserver aObserver); Attributes Attribute Type Description activeWindow nsIDOMWindow The Watcher serves as a global storage facility for the current active (front most non-floating-...
... If null, each top level window will be searched. Return value The nsIDOMWindow with the target name. getWindowEnumerator() Get an nsISimpleEnumerator for currently open windows in the order they were opened, guaranteeing that each will be visited exactly once. nsISimpleEnumerator getWindowEnumerator(); Parameters None. Return value An nsISimpleEnumerator which will itself return nsISup
ports objects which can be nsISup
ports.QueryInterface() (QueryInterfaced) to an nsIDOMWindow. openWindow() Creates a new window. It will automatically be added to our list. Note: This method may examine the Javascript context stack for purposes of determining the security context to use for the search for a given window named aName. Note: This method will try to set the default charset for t...
...And 4 more matches
XPCOM Interface Reference by grouping
n contains elements associated with the view pane or the content of the "browser window" proper. It is wrapped by System, but displayed for convenience. Data This section contains Data wrappers and core object definitions. Security This section contains APIs for secure channel communications System This section contains Application level interfaces including calls to external sup
port elements (such as device calls). This is the root element and may contain some functions defined in other groups. User This section contains elements specific to a given user's data storage. Browser Autocomplete nsIAutoCompleteController nsIAutoCompleteInput nsIAutoCompleteSearch Console nsIConsoleListener nsIConsoleMessage nsIConsoleService Doc...
...I nsIURL Util nsIDOMSerializer nsIDOMXPathEvaluator nsIDOMXPathException nsIDOMXPathExpression nsIDOMXPathResult XSLT nsIXSLTException nsIXSLTProcessor Download nsIDownload nsIDownloadManager nsIDownloadProgressListener Element Internal nsIWorker nsIWorkerGlobalScope nsIWorkerMessageEvent nsIWorkerMessage
Port nsIWorkerScope Tree nsITreeBoxObject nsITreeColumn nsITreeColumns nsITreeContentView nsITreeSelection nsITreeView Xform nsIXFormsModelElement nsIXFormsNSInstanceElement nsIXFormsNSModelElement XMLHttpRequest nsIXMLHttpRequestEventTarget FavIcon nsIFaviconDataCallback nsIFaviconService Frame nsIChromeFr...
... nsIFeedProgressListener nsIFeedResult nsIFeedResultListener nsIFeedTextConstruct script mozIJSSubScriptLoader storage mozIStorageVacuumParticipant Util nsIEffectiveTLDService Worker nsIAbstractWorker Data nsIArray nsICategoryManager nsICollection nsIDictionary nsIMutableArray nsISimpleEnumerator nsISup
portsChar nsISup
portsDouble nsISup
portsFloat nsISup
portsID nsISup
portsInterfacePointer nsISup
portsPRBool nsISup
portsPrimitive nsISup
portsPRInt16 nsISup
portsPRInt32 nsISup
portsPRInt64 nsISup
portsPriority nsISup
portsPRTime nsISup
portsPRUint16 nsISup
portsPRUint32 nsISup
portsPRUint64 nsISup
portsPRUint8 nsISup
portsString nsISup
portsVoid ...
...And 4 more matches
Setting HTTP request headers
You can add your own HTTP headers to any request the application makes, whether the request is initiated by your code explicitly opening an HTTP channel, because of XMLHttpRequest activity, an <img> element in content, or even from CSS. HTTP Channels When you deal with HTTP requests and responses, typically you are doing this with an nsIHttpChannel. The nsIHttpChannel interface has a number of properties and methods, but the method that is of interest to us is setRequestHeader. ...
... } }; NOTE: The above code was changed to reflect that in a FireFox Add-On one can not directly access Components.interfaces und Components.classes anymore but must use the require line introduced to the sample code above. So where you see Ci and Cc in this page there used to be Components.interfaces and Components.classes. ...
...Components.interfaces und Components.classes anymore but must use the require line introduced to the sample code above. So where you see Ci and Cc in this page there used to be Components.interfaces and Components.classes. Please also note that the code itself usually is wrapped inside a ex
ports.main = function() { ... } block. Note that the number of parameter that the observe method takes is im
portant. It takes 3 parameters (as we've shown in the example code above). For the "http-on-modify-request" topic, the first parameter (named subject in the code above) will be the nsIHttpChannel. However, it is passed to us as an nsISup
ports. So we need to change the nsISup
ports into a nsIHttpChannel which is what the QueryInterface call does. And yes, converting objects from one kind to another is v...
...And 4 more matches
Mail composition back end
by Richard H. Pizzarro <rhp@netscape.com> Contents Overview Sending Messages nsIMsgSend Sending Listener Interfaces nsIMsgSendListener nsIMsgCopyServiceListener Copy Operations Copy to Sent Folder Drafts Templates "Send Later" Sending Unsent Messages Sending Unsent Messages Listener Quoting Sample Programs Overview I've done considerable work in the past few weeks reorganizing the Mail Composition back end, so I thought it would be helpful to put together a small doc on the new interfaces and how one can use them. ...
... Sending Messages The primary responsibility of the back end is for the creation and sending of RFC822 messages. The interface that accomplishes this task is the nsIMsgSend interface. The feedback mechanism is provided by a nsIMsgSendListener which is implemented by the caller. The caller has the ability to add or remove listener interfaces to the nsIMsgSend object and the interface can sup
port multiple listeners. (For detailed information on the listener interfaces, see the Listener Interfaces section of this document) nsIMsgSend The following describes the methods of the nsIMsgSend interface. All of these methods are asynchronous operations. CreateAndSendMessage The CreateAndSendMessage method will create an RFC822 message and send it all ...
...stener) = 0; NS_IMETHOD RemoveListener(nsIMsgSendListener *aListener) = 0; Sending Listener Interfaces The nsIMsgSendListener interface will let a caller keep track of the progress and any status of a send operation. These are critical for message delivery since message sending is asynchronous. It is the only way to determine if the operation was successful or not. An im
portant item to note is the fact that this interface should also implement the nsIMsgCopyServiceListener interface if it wants to be notified of the progress and completion of the copy operation. nsIMsgSendListener The following describes the methods of the nsIMsgSendListener interface: OnStartSending The OnStartSending interface is called when the sending opera...
...And 4 more matches
Activity Manager examples
his sample to nsIActivityRetryHandler and nsIActivityPauseHandler as well. Showing a user-defined activity with undo capability (C++) ..... #include "nsIActivity.h" #include "nsIActivityManager.h" ..... ...
...h undo capability (C++) ..... #include "nsIActivity.h" #include "nsIActivityManager.h" ..... ...
...event PRUint32 length; nsIVariant **subjectList; rv = event->GetSubjects(&length, &subjectList); if(NS_FAILED(rv)) return rv; // first subject in the list is the source folder in this particular case nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(subjectList[0]); // get the initiator nsIVariant *initiator; event->GetInitiator(&initiator); if (initiator) { nsISup
ports* ptr; rv = object->GetAsISup
ports(&ptr); if(NS_FAILED(rv)) return rv; nsCOMPtr<nsIMsgCopyService> copyService = do_QueryInterface(ptr); if (copyService) copyService->Undo(folder); } return (*result = NS_OK); } ///////////////////////////////////////////////////////////////////////////// //// Creating an undoable copy event nsCOMPtr<nsIActivityUndoHandler> un...
...And 4 more matches
BudgetState.budgetAt - Web APIs
page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...te to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...et ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetbudgetAt ExperimentalDeprecatedNon-standardChrome Full sup
port 60Edge Full sup
port <=79Firefox ? IE ? Opera No sup
port NoSafari ? WebView Android No sup
port NoChrome Android Full sup
port 60Firefox Android ? Opera Android No sup
port NoSafari iOS ? Samsung Internet ...
...And 4 more matches
BudgetState.time - Web APIs
his page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internettime ExperimentalDeprecatedNon-standardChrome Full sup
port 60Edge Full sup
port <=79Firefox ? IE ? Opera No sup
port NoSafari ? WebView Android No sup
port NoChrome Android Full sup
port 60Firefox Android ? Opera Android No sup
port NoSafari iOS ? Samsung Internet ...
...And 4 more matches
Managing screen orientation - Web APIs
o have the ability to control the screen orientation in order to preserve or adapt the interface of a web application. There are several ways to handle screen orientation, both with CSS and JavaScript. The first is the orientation media query. This lets content adjust its layout using CSS, based on whether the browser window is in landscape mode (that is, its width is greater than its height) or
portrait mode (its height is greater than its width). The second way is the JavaScript Screen orientation API that can be used to get the current orientation of the screen itself and eventually lock it. Adjusting layout based on the orientation One of the most common cases for orientation changes is when you want to revise the layout of your content based on the orientation of the device. For examp...
...1em sans-serif; margin : 0; padding: .5em; } ul { list-style: none; font : 1em monospace; margin : 0; padding: .5em; -moz-box-sizing: border-box; box-sizing: border-box; background: black; } li { display: inline-block; margin : 0; padding: 0.5em; background: white; } Once we have some common styles we can start defining a special case for the orientation /* For
portrait, we want the tool bar on top */ @media screen and (orientation:
portrait) { #toolbar { width: 100%; } } /* For landscape, we want the tool bar stick on the left */ @media screen and (orientation: landscape) { #toolbar { position: fixed; width: 2.65em; height: 100%; } p { margin-left: 2em; } li + li { margin-top: .5em; } } And here's the result ...
... Locking the screen orientation Warning: This API is experimental and currently available on Firefox OS and Firefox for Android with a moz prefix, and for Internet Explorer on Windows 8.1 an...
...And 4 more matches
DOMTokenList.forEach() - Web APIs
extContent inside the forEach() inner function. ...
...y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
DocumentFragment.querySelector() - Web APIs
e compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...s://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
FileSystemDirectoryEntry.removeRecursively() - Web APIs
is page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ser-compat-data and send us a pull request. ...
...And 4 more matches
FileSystemEntry.isDirectory - Web APIs
hether or not the FileSystemEntry is a directory. Example This example shows how this property might be used to determine whether to process the entry as a directory or file. If the entry is neither, an error handler is called with an appropriate message. if (entry.isDirectory) { processSubdirectory(entry); } else if (entry.isFile) { processFile(entry); } else { displayErrorMessage("Unsup
ported file system entry specified."); } Specifications Specification Status Comment File and Directory Entries APIThe definition of 'isDirectory' in that specification. Draft Initial specification. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://...
...lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
FileSystemEntry.isFile - Web APIs
ing whether or not the FileSystemEntry is a file. Example This example shows how this property might be used to determine whether to process the entry as a directory or file. If the entry is neither, an error handler is called with an appropriate message. if (entry.isDirectory) { processSubdirectory(entry); } else if (entry.isFile) { processFile(entry); } else { displayErrorMessage("Unsup
ported file system entry specified."); } Specifications Specification Status Comment File and Directory Entries APIThe definition of 'isFile' in that specification. Draft Initial specification. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://githu...
...atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
FileSystemFileEntry.createWriter() - Web APIs
on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../browser-compat-data and send us a pull request. ...
...And 4 more matches
HTMLAnchorElement.referrerPolicy - Web APIs
reflect the HTML referrerpolicy attribute of the <a> element defining which referrer is sent when fetching the resource. Syntax refStr = anchorElt.referrerPolicy; anchorElt.referrerPolicy = refStr; Values "no-referrer" meaning that the Referer: HTTP header will not be sent. "origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the
port. "unsafe-url" meaning that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe as it can leak path information that has been concealed to third-party by using TLS. Examples var elt = document.createElement("a"); var linkText = document.createTextNode("My link"); elt.appendChild(linkText); elt.href = "https://developer.mozil...
... compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
HTMLAreaElement.referrerPolicy - Web APIs
reflect the HTML referrerpolicy attribute of the <area> element defining which referrer is sent when fetching the resource. Syntax refStr = areaElt.referrerPolicy; areaElt.referrerPolicy = refStr; Values "no-referrer" meaning that the Referer: HTTP header will not be sent. "origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the
port. "unsafe-url" meaning that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe as it can leak path information that has been concealed to third-party by using TLS. Examples <img usemap="#mapAround" width="100" height="100" src="/img/logo@2x.png" /> <map id="myMap" name="mapAround" />> var elt = document.createElement("area...
... compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
HTMLImageElement.referrerPolicy - Web APIs
efining which referrer is sent when fetching the resource. Syntax refStr = imgElt.referrerPolicy; imgElt.referrerPolicy = refStr; Values A DOMString representing the referrer policy. Possible values are: "no-referrer" meaning that the Referer: HTTP header will not be sent. "origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the
port. "unsafe-url" meaning that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe as it can leak path information that has been concealed to third-party by using TLS. Examples var img = new Image(); img.src = 'img/logo.png'; img.referrerPolicy = 'origin'; var div = document.getElementById('divAround'); div.appendChild(img); /...
... compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
HTMLInputElement.webkitdirectory - Web APIs
The entry for PIC2343.jpg will have a webkitRelativePath of PhotoAlbums/Birthdays/Don's 40th birthday/PIC2343.jpg. This makes it possible to know the hierarchy even though the FileList is flat. Note: The behavior of webkitRelativePath is different in Chromium < 72. See this bug for further details. Exam...
... table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ike to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
HTMLMediaElement.onwaitingforkey - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
HTMLOrForeignElement.nonce - Web APIs
roperty of the HTMLOrForeignElement interface returns the cryptographic number used once that is used by Content Security Policy to determine whether a given fetch will be allowed to proceed. In later implementations, elements only expose their nonce attribute to scripts (and not to side-channels like CSS attribute selectors). Examples Retrieving a nonce value In the past, not all browsers sup
ported the nonce IDL attribute, so a workaround is to try to use getAttribute as a fallback: let nonce = script['nonce'] || script.getAttribute('nonce'); However, recent browsers version hide nonce values that are accessed this way (an empty string will be returned). The IDL property (script['nonce']) will be the only way to access nonces. Nonce hiding helps preventing that attackers exfiltrate non...
...lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
HTMLScriptElement.referrerPolicy - Web APIs
nd send no header to a less secure destination (e.g. HTTPS->HTTP). unsafe-url Send a full URL when performing a same-origin or cross-origin request. This policy will leak origins and paths from TLS-protected resources to insecure origins. Carefully consider the impact of this setting. Note: An empty string value ("") is both the default value, and a fallback value if referrerpolicy is not sup
ported. If referrerpolicy is not explicitly specified on the <script> element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. If a higher-level policy is not available, the empty string is treated as being equivalent to no-referrer-when-downgrade. Examples var scriptElem = document.createElement("script"); scriptElem.src = "/"; scriptElem.referrerPolicy ...
... compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
Basic concepts - Web APIs
precated it on November 18, 2010. While both IndexedDB and WebSQL are solutions for storage, they do not offer the same functionalities. WebSQL Database is a relational database access system, whereas IndexedDB is an indexed table system. Big concepts If you have assumptions from working with other types of databases, you might get thrown off when working with IndexedDB. So keep the following im
portant concepts in mind: IndexedDB databases store key-value pairs. The values can be complex structured objects, and keys can be properties of those objects. You can create indexes that use any property of the objects for quick searching, as well as sorted enumeration. Keys can be binary objects. IndexedDB is built on a transactional database model. Everything you do in IndexedDB always ...
...it is most commonly set to "success" or "error"). DOM events also have a target property that indicates where the event is headed. In most cases, the target of an event is the IDBRequest object that was generated as a result of doing some database operation. Success events don't bubble up and they can't be canceled. Error events, on the other hand, do bubble, and can be cancelled. This is quite im
portant, as error events abort whatever transactions they're running in, unless they are cancelled. IndexedDB is object-oriented. IndexedDB is not a relational database with tables representing collections of rows and columns. This im
portant and fundamental difference affects the way you design and build your applications. In a traditional relational data store, you would have a table that st...
...ms, read the Wikipedia article on object database. IndexedDB does not use Structured Query Language (SQL). It uses queries on an index that produces a cursor, which you use to iterate across the result set. If you are not familiar with NoSQL systems, read the Wikipedia article on NoSQL. IndexedDB adheres to a same-origin policy. An origin is the domain, application layer protocol, and
port of a URL of the document where the script is being executed. Each origin has its own associated set of databases. Every database has a name that identifies it within an origin. The security boundary imposed on IndexedDB prevents applications from accessing data with a different origin. For example, while an app or a page in http://www.example.com/app/ can retrieve data from http://www.example.
...And 4 more matches
InputEvent.dataTransfer - Web APIs
or plaintext data being added to or removed from editible content. Syntax var dataTransfer = inputEvent.dataTransfer Value A DataTransfer object. Examples In the following simple example we've set up an event listener on the input event so that when any content is pasted into the contenteditable <p> element, its HTML source is retrieved via the InputEvent.dataTransfer.getData() method and re
ported in the paragraph below the input. Try copying and pasting some of the content provided to see the effects. <p><span style="font-weight: bold; color: blue">Whoa, bold blue text!</span></p> <p><span style="font-style: italic; color: red">Exciting: italic red text!</span></p> <p>Boring normal text ;-(</p> <hr> <p contenteditable="true">Go on, try pasting some content into this editable paragra...
...ity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
MediaMetadata.album - Web APIs
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
MediaMetadata.artist - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
MediaMetadata.artwork - Web APIs
tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...thub.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
MediaMetadata.title - Web APIs
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
MediaRecorder.audioBitsPerSecond - Web APIs
ble in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...browser-compat-data and send us a pull request. ...
...And 4 more matches
Using the Media Capabilities API - Web APIs
o determine how well media is being handled, in real time. These features include: The ability to query the browser to determine its ability to encode or decode media given a specified set of encoding parameters. These parameters may include the codecs, resolutions, bit rates, frame rates, and other such details. With the Media Capabilities API, you can determine not just if the browser can sup
port a given format, but whether or not it can do so efficiently and smoothly. In short, this API replaces--and improves upon--the MediaSource method isTypeSup
ported() or the HTMLMediaElement method canPlayType(). More and more finely-detailed information about the display's properties, so that informed decisions can be made when choosing the best format to play on the user's device. For example, you...
...One feature of this is the ability to detect when the device switches GPUs, so you can make appropriate adjustments based on the new GPU's capabilities. ...
...er of the decodingInfo() method to determine if a video matching this configuration would be decodable and if the playback would be smooth and power efficient. var promise = navigator.mediaCapabilities.decodingInfo(videoConfiguration); The decodingInfo() and encodingInfo() methods both return promises. ...
...And 4 more matches
Transcoding assets for Media Source Extensions - Web APIs
Depending on the codec, you might need to fragment the file to comply with the ISO BMFF spec. ...
... Depending on the codec, you might need to fragment the file to comply with the ISO BMFF spec. ...
...se installed successfully before moving to the next step. Sample media should be placed in the Bento4 utils directory and worked here. Note: The prebuilt ffmpeg does not include libfdk_aac due to licensing reasons. Bento4 uses this by default, so you need to compile ffmpeg if necessary. If you don't need it, add --audio-codec=aac to the mp4-dash-encode.py command line. ...
...And 4 more matches
Metadata.size - Web APIs
The read-only size property of the Metadata interface specifies the size, in bytes, of the referenced file or other file system object on disk. Syntax var size = Metadata.size; Value A number indicating the size of the file in bytes. Example This example checks the size of a log file and removes it if it's larger than a megabyte. workingDirectory.getFile("log/im
portant.log", {}, function(fileEntry) { fileEntry.getMetadata(function(metadata) { if (metadata.size > 1048576) { fileEntry.remove(function() { /* log file removed; do something clever here */ }); } }); }, handleError); This API has no official W3C or WHATWG specification. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribut...
...table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ke to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
NodeList.prototype.forEach() - Web APIs
let list = node.childNodes; list.forEach( function(currentValue, currentIndex, listObj) { console.log(currentValue + ', ' + currentIndex + ', ' + this); }, 'myThisArg' ); The above code results in the following: [object HTMLParagraphElement], 0, myThisArg [object Text], 1, myThisArg [object HTMLSpanElement], 2, myThisArg Polyfill This polyfill adds compatibility to all Browsers sup
porting ES5: if (window.NodeList && !NodeList.prototype.forEach) { NodeList.prototype.forEach = function (callback, thisArg) { thisArg = thisArg || window; for (var i = 0; i < this.length; i++) { callback.call(thisArg, this[i], i, this); } }; } OR if (window.NodeList && !NodeList.prototype.forEach) { NodeList.prototype.forEach = Array.prototype.forEach...
...ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
Using the Permissions API - Web APIs
the initial permission request, as we'll see below). The Permissions API provides the tools to allow developers to implement a better user experience as far as permissions are concerned. For example, it can query whether permission to use a particular API is granted or denied, and specifically request permission to use an API. At the moment, implementation of the API is at an early stage, so sup
port in browsers is pretty spotty: It can only be found in Chrome 44 and later and Firefox 43 and later. The only sup
ported method right now is Permissions.query(), which queries permission status. The only two APIs currently recognized by the Permissions API in Chrome are Geolocation and Notification, with Firefox also recognizing Push and WebMIDI. More features will be added as time progresse...
...ed (which makes the "Enable Geolocation" button appear). "denied" The "Enable Geolocation" button is revealed (this code needs to be here too, in case the permission state is already set to denied for this origin when the page is first loaded). ...
...led (this code needs to be here too, in case the permission state is already set to denied for this origin when the page is first loaded). ...
...And 4 more matches
PointerEvent.getCoalescedEvents() - Web APIs
le on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...rowser-compat-data and send us a pull request. ...
...And 4 more matches
PushSubscription.getKey() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
RTCConfiguration.bundlePolicy - Web APIs
) constructor. Syntax let rtcConfiguration = { bundlePolicy: policy }; rtcConfiguration.bundlePolicy = policy; Value A DOMString identifying the SDP bundling policy to use for the RTP streams used by the RTCPeerConnection. This string, which must be a member of the RTCBundlePolicy enumeration, has the following possible values: balanced The ICE agent begins by creating one RTCDtlsTrans
port to handle each type of content added: one for audio, one for video, and one for the RTC data channel, if applicable. If the remote peer isn't BUNDLE-aware, the ICE agent chooses one audio track and one video track and those two tracks are each assigned to the corresponding RTCDtlsTrans
port. All other tracks are ignored by the connection. This is the default, and most compatible, policy. max-comp...
...o, one for video, and one for the RTC data channel, if applicable. If the remote peer isn't BUNDLE-aware, the ICE agent chooses one audio track and one video track and those two tracks are each assigned to the corresponding RTCDtlsTrans
port. All other tracks are ignored by the connection. This is the default, and most compatible, policy. max-compat The ICE agent intially creates one RTCDtlsTrans
port for each media track and a separate one for the RTCDataChannel, if one is created. ...
...If the remote peer isn't bundle-compatible, only one media track is negotiated and the rest are ignored. ...
...And 4 more matches
RTCRtpContributingSource.source - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetsourceChrome Full sup
port 59Edge Full sup
port <=79Firefox Full sup
port 59Disabled Full sup
port 59Disabled Disabled From version 59: this feature is behind the media.peerconnection.rtpsourcesapi.enable preference (needs to be set to true). To change preferences...
... sup
port <=79Firefox Full sup
port 59Disabled Full sup
port 59Disabled Disabled From version 59: this feature is behind the media.peerconnection.rtpsourcesapi.enable preference (needs to be set to true). ...
... Full sup
port 59Disabled Full sup
port 59Disabled Disabled From version 59: this feature is behind the media.peerconnection.rtpsourcesapi.enable preference (needs to be set to true). ...
...And 4 more matches
SVGAElement.target - Web APIs
This property is used when there are multiple possible targets for the ending resource, like when the parent document is a mlti-frame HTML or XHTML document. Syntax myLink.target = 'value'; Value An SVGAnimatedString indicating the ending resource target that opens the document when the link is activated. Sample values can be found here Example The code is taken from the "SVGAElement example code" ... ...
...ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
SVGAnimatedPoints - Web APIs
Additionally, the points attribute on the original element accessed via the XML DOM (e.g., using the getAttribute() method call) will reflect any changes made to the SVGAnimatedPoints.points attribut. ...
...erated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...viewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetSVGAnimatedPointsChrome ? Edge Full sup
port <=18Firefox ? IE ? Opera ? Safari ? WebView Android No sup
port NoChrome Android ? Firefox Android ? Opera Android ? Safari iOS ? ...
...And 4 more matches
SVGAnimatedString.animVal - Web APIs
AnimVal attribute or animVal property contains the same value as the baseVal property.If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, then it contains the same value as baseVal The animVal property is a read only property. Internet Explorer 9 sup
ports script-based SVG animation but it does not sup
port declarative-based SVG animation. As a result, the animVal property contains the same value as the baseVal property. Syntax var = object.animVal Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition) Recommendation Scalable Vector Graphics (SVG) 2 Candidate Recommendat...
...ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
Screen.lockOrientation() - Web APIs
for Web pages in full-screen mode. Syntax lockAllowed = window.screen.lockOrientation(orientation); Parameters orientation The orientation into which to lock the screen. This is either a string or an array of strings. Passing several strings lets the screen rotate only in the selected orientations. ...
...(orientation); Parameters orientation The orientation into which to lock the screen. This is either a string or an array of strings. Passing several strings lets the screen rotate only in the selected orientations. The following strings represent the possible orientation requirements you may specify:
portrait-primary It represents the orientation of the screen when it is in its primary
portrait mode. A screen is considered in its primary
portrait mode if the device is held in its normal position and that position is in
portrait, or if the normal position of the device is in landscape and the device held turned by 90? clockwise. The normal position is device dependant.
portrait-secondary It represents the orientation of the screen when it is in its secondary
portrait mode. A screen...
...The normal position is device dependant. landscape-primary It represents the orientation of the screen when it is in its primary landscape mode. ...
...And 4 more matches
ScreenOrientation.lock() - Web APIs
The lock() property of the ScreenOrientation interface locks the orientation of the containing document to its default orientation. Syntax ScreenOrientation.lock(orientation) Parameters orientation An orientation lock type. One of the following: "any" "natural" "landscape" "
portrait" "
portrait-primary" "
portrait-secondary" "landscape-primary" "landscape-secondary" Return value A Promise. Specifications Specification Status Comment Screen Orientation APIThe definition of 'lock()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and...
...lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
ScreenOrientation.type - Web APIs
Syntax type = ScreenOrientation.type Value A String. Specifications Specification Status Comment Screen Orientation APIThe definition of 'type' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...lity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
ServiceWorkerMessageEvent.ServiceWorkerMessageEvent() - Web APIs
Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features. The ServiceWorkerMessageEvent() constructor creates a new ServiceWorkerMessageEvent object instance. Syntax var mySWME = new ServiceWorkerMessageEvent(type, init); Parameters type A DOMString that defines the type of the message event being created. init Optional An initialisation object, which should contain the following parameters: data: The event's data -- this can be any type. origin: A DOMString that defines the origin of the corresponding service worker's environment settings object. lastEventId: A DOMString that defines the last event ID of the event source. ...
...message event being created. init Optional An initialisation object, which should contain the following parameters: data: The event's data -- this can be any type. origin: A DOMString that defines the origin of the corresponding service worker's environment settings object. ...
...init Optional An initialisation object, which should contain the following parameters: data: The event's data -- this can be any type. origin: A DOMString that defines the origin of the corresponding service worker's environment settings object. ...
...And 4 more matches
ServiceWorkerRegistration.navigationPreload - Web APIs
able in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
Using Service Workers - Web APIs
idea because it allowed you to specify assets to cache really easily. However, it made many assumptions about what you were trying to do and then broke horribly when your app didn't follow those assumptions exactly. Read Jake Archibald's (unfortunately-titled but well-written) Application Cache is a Douchebag for more details. Note: As of Firefox 44, when AppCache is used to provide offline sup
port for a page a warning message is now displayed in the console advising developers to use Service workers instead (bug 1204581.) Service workers should finally fix these issues. Service worker syntax is more complex than that of AppCache, but the trade off is that you can use JavaScript to control your AppCache-implied behaviors with a fine degree of granularity, allowing you to handle this probl...
...ched assets first, thus providing a default experience even when offline, before then getting more data from the network (commonly known as Offline First). This is already available with native apps, which is one of the main reasons native apps are often chosen over web apps. Setting up to play with service workers Many service workers features are now enabled by default in newer versions of sup
porting browsers. If however you find that demo code is not working in your installed versions, you might need to enable a pref: Firefox Nightly: Go to about:config and set dom.serviceWorkers.enabled to true; restart browser. Chrome Canary: Go to chrome://flags and turn on experimental-web-platform-features; restart browser (note that some features are now enabled by default in Chrome.) Opera: Go...
...d that demo code is not working in your installed versions, you might need to enable a pref: Firefox Nightly: Go to about:config and set dom.serviceWorkers.enabled to true; restart browser. Chrome Canary: Go to chrome://flags and turn on experimental-web-platform-features; restart browser (note that some features are now enabled by default in Chrome.) Opera: Go to opera://flags and enable Sup
port for ServiceWorker; restart browser. Microsoft Edge: Go to about:flags and tick Enable service workers; restart browser. You'll also need to serve your code via HTTPS -- Service workers are restricted to running across HTTPS for security reasons. GitHub is therefore a good place to host experiments, as it sup
ports HTTPS. In order to facilitate local development, localhost is considered a secure...
...And 4 more matches
SubtleCrypto.deriveKey() - Web APIs
key. It takes as arguments some initial key material, the derivation algorithm to use, and the desired properties for the key to derive. It returns a Promise which will be fulfilled with a CryptoKey object representing the new key. It's worth noting that the three key derivation algorithms you can use have quite different characteristics and are appropriate in quite different situations. See Sup
ported algorithms for some more detail on this. Syntax const result = crypto.subtle.deriveKey( algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages ); Parameters algorithm is an object defining the derivation algorithm to use. To use ECDH, pass an EcdhKeyDeriveParams object. To use HKDF, pass an HkdfParams object. To use PBKDF2, pass a Pbkdf2Params ob...
... ECDH, pass an EcdhKeyDeriveParams object. To use HKDF, pass an HkdfParams object. To use PBKDF2, pass a Pbkdf2Params object. baseKey is a CryptoKey representing the input to the derivation algorithm. If algorithm is ECDH, then this will be the ECDH private key. ...
... To use HKDF, pass an HkdfParams object. To use PBKDF2, pass a Pbkdf2Params object. baseKey is a CryptoKey representing the input to the derivation algorithm. If algorithm is ECDH, then this will be the ECDH private key. Otherwise it will be the initial key material for the derivation function: for example, for PBKDF2 it might be a password, im
ported as a CryptoKey using SubtleCrypto.im
portKey(). derivedKeyAlgorithm is an object defining the algorithm the derived key will be used for. For HMAC: pass an HmacKeyGenParams object. For AES-CTR, AES-CBC, AES-GCM, or AES-KW: pass an AesKeyGenParams object. extractable is a Boolean indicating whether it will be possible to ex
port the key using SubtleCrypto.ex
portKey() or SubtleCrypto.wrapKey(). keyUsages is an Array indic...
...And 4 more matches
URLUtilsReadOnly.host - Web APIs
Syntax string = object.host; Examples // In a Web worker, on the page https://developer.mozilla.org/URLUtilsReadOnly.host var result = window.self.host; // Returns:'developer.mozilla.org:80' Specifications Specification Status Comment URLThe definition of 'URLUtilsReadOnly.host' in that specification. Living Standard Initial definition. Browser compatibility The compatibility table in this page is generated from structured data. ...
...compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
WebXR Device API - Web APIs
The WebXR Device API implements the core of the WebXR feature set, managing the selection of output devices, render the 3D scene to the chosen device at the appropriate frame rate, and manage motion vectors created using input controllers. ...
...the right eye's viewpoint rendered into the right half of the buffer. Once both eyes' perspectives on the scene have been rendered, the resulting framebuffer is delivered to the WebXR device to be presented to the user through their headset or other appropriate display device. WebXR Device API concepts and usage Example WebXR hardware setup While the older WebVR API was designed solely to sup
port Virtual Reality (VR), WebXR provides sup
port for both VR and Augmented Reality (AR) on the web. Sup
port for AR functionality is added by the WebXR Augmented Reality Module. A typical XR device can have either 3 or 6 degrees of freedom and might or might not have an external positional sensor. The equipment may also include an accelerometer, barometer, or other sensors which are used to sense wh...
...ace which is used to identify a spatial relationship in relation to the user's physical environment. The XRReferenceSpace coordinate system is expected to remain unchanged through the lifespan of the XRSession.The world has no boundaries and extends infinitely in every direction. XRBoundedReferenceSpace XRBoundedReferenceSpace extends the XRReferenceSpace coordinate system to further include sup
port for a finite world with set boundaries. Unlike XRReferenceSpace, the origin must be located on the floor (that is, y = 0 at the floor). The x and z components of the origin are typically presumed to be located at or near the center of the room or surface. XRView Represents a single view into the XR scene for a particular frame. Each XRView corresponds to the video display surface used to presen...
...And 4 more matches
Window.innerWidth - Web APIs
This property is read-only, and has no default value. ...
...This property is read-only, and has no default value. ...
...This property is read-only, and has no default value. ...
...And 4 more matches
Window.requestFileSystem() - Web APIs
page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...o the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...irefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetrequestFileSystem ExperimentalNon-standardChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port <=18Prefixed Full sup
port <=18Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox No sup
port NoIE No sup
port NoOpera No sup
port NoSafari No sup
port ...
...And 4 more matches
Window.restore() - Web APIs
lity The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ck out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
ada condimentum magna. Quisque in ante tellus, in placerat est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec a mi magna, quis mattis dolor. Etiam sit amet ligula quis urna auctor imperdiet nec faucibus ante. Mauris vel consectetur dolor. Nunc eget elit eget velit pulvinar fringilla consectetur aliquam purus. Curabitur convallis, justo posuere
porta egestas, velit erat ornare tortor, non viverra justo diam eget arcu. Phasellus adipiscing fermentum nibh ac commodo. Nam turpis nunc, suscipit a hendrerit vitae, volutpat non ipsum.</p> <form> <p>Phasellus ac nisl lorem: <input type="text" /><br /> <textarea style="width: 400px; height: 200px;">Nullam commodo suscipit lacus non aliquet. Phasellus ac nisl lorem, sed facilisis ligula. Nam cursus l...
...a. Nam cursus lobortis placerat. Sed dui nisi, elementum eu sodales ac, placerat sit amet mauris. Pellentesque dapibus tellus ut ipsum aliquam eu auctor dui vehicula. Quisque ultrices laoreet erat, at ultrices tortor sodales non. Sed venenatis luctus magna, ultricies ultricies nunc fringilla eget. Praesent scelerisque urna vitae nibh tristique varius consequat neque luctus. Integer ornare, erat a
porta tempus, velit justo fermentum elit, a fermentum metus nisi eu ipsum. Vivamus eget augue vel dui viverra adipiscing congue ut massa. Praesent vitae eros erat, pulvinar laoreet magna. Maecenas vestibulum mollis nunc in posuere. Pellentesque sit amet metus a turpis lobortis tempor eu vel tortor. Cras sodales eleifend interdum.</textarea></p> <input type="submit" value="Send" /> </form> <p>Duis lobo...
...um elit, a fermentum metus nisi eu ipsum. Vivamus eget augue vel dui viverra adipiscing congue ut massa. Praesent vitae eros erat, pulvinar laoreet magna. Maecenas vestibulum mollis nunc in posuere. Pellentesque sit amet metus a turpis lobortis tempor eu vel tortor. Cras sodales eleifend interdum.</textarea></p> <input type="submit" value="Send" /> </form> <p>Duis lobortis sapien quis nisl luctus
porttitor. In tempor semper libero, eu tincidunt dolor eleifend sit amet. Ut nec velit in dolor tincidunt rhoncus non non diam. Morbi auctor ornare orci, non euismod felis gravida nec. Curabitur elementum nisi a eros rutrum nec blandit diam placerat. Aenean tincidunt risus ut nisi consectetur cursus. Ut vitae quam elit. Donec dignissim est in quam tempor consequat. Aliquam aliquam diam non felis conva...
...And 4 more matches
:read-only - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ed data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ttps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
:read-write - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
Border-image generator - CSS: Cascading Style Sheets
r: 3px solid #3490D2; border-color: #208B20; background: #666; background-color: #EEF1F5; color: #000; position: absolute; top: 2em; left: 0; z-index: 100; overflow: hidden; transition: all 0.3s; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-dropdown-list:hover { overflow: auto; } .ui-dropdown-list[data-hidden='true'] { height: 0 !im
portant; opacity: 0; visibility: hidden; } .ui-dropdown[data-position='left'] .ui-dropdown-list { left: -100%; top: 0; } .ui-dropdown[data-position='right'] .ui-dropdown-list { left: 100%; top: 0; } .ui-dropdown-list > div { width: 100%; height: 1.6em; margin: 0.3em 0; padding: 0.3em; line-height: 1em; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-bo...
... 20px 0; font-family: "Segoe UI", Arial, Helvetica, sans-serif; /*background: url("https://mdn.mozillademos.org/files/6025/grain.png");*/ border: 1px solid #EEE; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } body[data-move='X'] { cursor: w-resize !im
portant; } body[data-move='Y'] { cursor: s-resize !im
portant; } #container { width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } [data-draggable='true']:hover { cursor: move; } [data-draggable='true']:hover > * { cursor: default; } /******************************************************************************/ /***************************...
...CE5; opacity: 1; } #image-gallery[data-collapsed='true'] { margin-top: -100px; } /* Load Menu */ #load-actions { margin: 10px 0; } #toggle-gallery { width: 30px; height: 25px; margin: 10px; color: #FFF; background-image: url('https://mdn.mozillademos.org/files/6005/arrow-up-white.png'); background-repeat: no-repeat; background-position: top 4px center; background-color: #888888 !im
portant; border-radius: 2px; float: left; } #toggle-gallery:hover { cursor: pointer; } #toggle-gallery[data-action='show'] { background-image: url('https://mdn.mozillademos.org/files/6001/arrow-down-white.png'); background-color: #888888 !im
portant; } #toggle-gallery[data-action='hide'] { background-image: url('https://mdn.mozillademos.org/files/6005/arrow-up-white.png'); } .button { width...
...And 4 more matches
Variable fonts guide - CSS: Cascading Style Sheets
cess all the variations contained in a given font file via CSS and a single @font-face reference. This article will give you all you need to know to get you started using variable fonts. Warning: In order to use variable fonts on your operating system, you need to make sure that it is up to date. For example Linux OSes need the latest Linux Freetype version, and macOS prior to 10.13 does not sup
port variable fonts. If your operating system is not up to date, you will not be able to use variable fonts in web pages or the Firefox Developer Tools. Variable Fonts: what they are, and how they differ To better understand what's different about variable fonts, it is worth reviewing what non-variable ones are like and how they compare. Standard (or Static) fonts In the past, a typeface would be...
...he code examples below. Registered axes and existing CSS attributes In this section we'll demonstrate the five registered axes defined with examples and the corresponding CSS. Where possible, both the standard and lower-level syntax are included. The lower-level syntax (font-variation-settings) was the first mechanism implemented in order to test the early implementations of variable font sup
port, and is necessary to utilize new or custom axes beyond the five registered ones. However, the W3C's intent was for this syntax not to be used when other attributes are available. Therefore wherever possible, the appropriate property should be used, with the lower-level syntax of font-variation-settings only being used to set values or axes not available otherwise. Notes When using font-var...
...ilize new or custom axes beyond the five registered ones. However, the W3C's intent was for this syntax not to be used when other attributes are available. Therefore wherever possible, the appropriate property should be used, with the lower-level syntax of font-variation-settings only being used to set values or axes not available otherwise. Notes When using font-variation-settings it is im
portant to note that axis names are case-sensitive. The registered axis names must be in lower case, and custom axes must be in upper case. For example: font-variation-settings: 'wght' 375, 'GRAD' 88; wght (weight) is a registered axis, and GRAD (grade) is a custom one. If you have set values using font-variation-settings and want to change one of those values, you must redeclare all of th...
...And 4 more matches
background-position-x - CSS: Cascading Style Sheets
ibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
background-position-y - CSS: Cascading Style Sheets
ibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
env() - CSS: Cascading Style Sheets
function and custom properties. The difference is that, as well as being user-agent defined rather than user-defined, environment variables are globally scoped to a document, whereas custom properties are scoped to the element(s) on which they are declared. ...
...e difference is that, as well as being user-agent defined rather than user-defined, environment variables are globally scoped to a document, whereas custom properties are scoped to the element(s) on which they are declared. To tell the browser to use the whole available space on the screen, and so enabling us to use the env() variables, we need to add a new view
port meta value: <meta name="view
port" content="view
port-fit=cover" /> body { padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px); } In addition, unlike custom properties, which cannot be used outside of declarations, the env() function can be used in place of any part of a property value, or any part of a descriptor (e.g. in Me...
... addition, unlike custom properties, which cannot be used outside of declarations, the env() function can be used in place of any part of a property value, or any part of a descriptor (e.g. in Media query rules). As the spec evolves, it may also be usable in other places such as selectors. Originally provided by the iOS browser to allow developers to place their content in a safe area of the view
port, the safe-area-inset-* values defined in the specification can be used to help ensure content is visible even to viewers using non-rectangular displays. Syntax /* Using the four safe area inset values with no fallback values */ env(safe-area-inset-top); env(safe-area-inset-right); env(safe-area-inset-bottom); env(safe-area-inset-left); /* Using them with fallback values */ env(safe-area-inset-...
...And 4 more matches
image() - CSS: Cascading Style Sheets
Disambiguation: Image(), the HTMLImageElement constructor. ...
...r> | <percentage><hue> = <number> | <angle> where: image-tagsOptional The directionality of the image, either ltr for left-to-right or rtl for right-to-left. image-src Optional Zero or more <url>s or <string>s specifying the image sources, with optional image fragment identifiers. colorOptional A color, specifying a solid background color to use as a fallback if no image-src is found, sup
ported, or declared. Bi-directional awareness The first, optional parameter of the image() notation is the directionality of the image. If included, and the image is used on an element with opposite directionality, the image will be flipped horizontally in horizontal writing modes. If the directionality is omitted, the image won't be flipped if the language direction is changed. Image fragments O...
...ability to add a media fragment identifier -- a starting point along the x and y axis, along with a width and height -- onto the image source to display only a section of the source image. The section of the image defined in the parameter becomes a standalone image. The syntax looks like so: background-image: image('myimage.webp#xywh=0,20,40,60'); The background image of the element will be the
portion of the image myImage.webp that starts at the coordinate 0px, 20px (the top left hand corner) and is 40px wide and 60px tall. The #xywh=#,#,#,# media fragment syntax takes four comma separated numeric values. The first two represent the X and Y coordates for the starting point of the box that will be created. The third value is the width of the box, and the last value is the height. By default...
...And 4 more matches
<integer> - CSS: Cascading Style Sheets
r negative. Integers can be used in numerous CSS properties, such as column-count, counter-increment, grid-column, grid-row, and z-index. Syntax The <integer> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. There is no unit associated with integers. Note: There is no official range of valid <integer> values. Opera 12.1 sup
ports values up to 215-1, IE up to 220-1, and other browsers even higher. During the CSS3 Values cycle there was a lot of discussion about setting a minimum range to sup
port: the latest decision, in April 2012 during the LC phase, was [-227-1; 227-1], but other values like 224-1 and 230-1 were also proposed. However, the latest spec doesn't specify a range anymore. Interpolation When animated, value...
... The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
mask-size - CSS: Cascading Style Sheets
determined by the value of mask-origin. The mask positioning area is, by default, the area containing the content of the box and its padding; the area may also be changed to just the content or to the area containing borders, padding and content. Negative percentages are not allowed. auto A keyword that scales the mask image in the corresponding directions in order to maintain its intrinsic pro
portion. contain A keyword that scales the image as large as possible and maintains image aspect ratio (image doesn't get squished). The image is letterboxed within the container. The image is automatically centered unless over-ridden by another property such as mask-position. cover A keyword that is the inverse of contain. Scales the image as large as possible and maintains image aspect ratio (im...
...cales the image as large as possible and maintains image aspect ratio (image doesn't get squished). The image "covers" the entire width or height of the container. When the image and container have different dimensions, the image is clipped either on left/right or at top/bottom. The interpretation of possible values depends on the image's intrinsic dimensions (width and height) and intrinsic pro
portion (ratio of width and height). A bitmap image always has intrinsic dimensions and an intrinsic pro
portion. A vector image may have both intrinsic dimensions and thus it has an intrinsic pro
portion too. It also may have one or no intrinsic dimensions and in either case it might or might not have an intrinsic pro
portion. Gradients are treated as images with no intrinsic dimensions or intrinsic pro...
...ion (ratio of width and height). A bitmap image always has intrinsic dimensions and an intrinsic pro
portion. A vector image may have both intrinsic dimensions and thus it has an intrinsic pro
portion too. It also may have one or no intrinsic dimensions and in either case it might or might not have an intrinsic pro
portion. Gradients are treated as images with no intrinsic dimensions or intrinsic pro
portion. The rendered size of the mask image is then computed as follows: If both components of mask-size are specified and are not auto: The mask image renders at the specified size. ...
...And 4 more matches
Content categories - Developer guides
Form-related content categories, which describe rules common to form-related elements. Specific content categories, which describe rare categories shared only by a few elements, sometimes only in a specific context. Note: A more detailed discussion of these content categories and their comparative functionalities is beyond the scope of this article; for that, you may wish to read the relevant
portions of the HTML specification. Main content categories Metadata content Elements belonging to the metadata content category modify the presentation or the behavior of the rest of the document, set up links to other documents, or convey other out of band information. Elements belonging to this category are <base>, <command>, <link>, <meta>, <noscript>, <script>, <style> and <title>. Flow ...
... defined by the heading content itself. Elements belonging to this category are <h1>, <h2>, <h3>, <h4>, <h5>, <h6> and <hgroup>. Though likely to contain heading content, the <header> is not heading content itself. Note: The <hgroup> element was removed from the W3C HTML specification prior to HTML 5 being finalized, but is still part of the WHATWG specification and is at least partially sup
ported by most browsers. Phrasing content Phrasing content defines the text and the mark-up it contains. Runs of phrasing content make up paragraphs. Elements belonging to this category are <abbr>, <audio>, <b>, <bdo>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <dfn>, <em>, <embed>, <i>, <iframe>, <img>, <input>, <kbd>, <keygen>, <label>, <mark>, <math>, <meter>, <n...
...Elements that belong to this category include: <audio>, <canvas>, <embed>, <iframe>, <img>, <math>, <object>, <picture>, <svg>, <video>. Interactive content Interactive content includes elements that are specifically designed for user interaction. Elements that belong to this category include: <a>...
...And 4 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
y depending on the writing-mode, direction, and text-orientation properties, which are typically (but not always) used to adjust text directionality based on the language being displayed. For example, if the box's text is being rendered right-to-left, then the border-inline-start-color is applied to the right side of the border. Other ways to use color CSS isn't the only web technology that sup
ports color. There are graphics technologies that are available on the web which also sup
port color. The HTML Canvas API Lets you draw 2D bitmapped graphics in a <canvas> element. See our Canvas tutorial to learn more. SVG (Scalable Vector Graphics) Lets you draw images using commands that draw specific shapes, patterns, and lines to produce an image. SVG commands are formatted as XML, and can b...
...sible to the brightest possible (from black to white). Image courtesy of user SharkD on Wikipedia, distributed under the CC BY-SA 3.0 license. The value of the hue (H) component of an HSL color is an angle from red around through yellow, green, cyan, blue, and magenta (ending up back at red again at 360?) that identifies what the base color is. The value can be specified in any <angle> unit sup
ported by CSS, including degrees (deg), radians (rad), gradians (grad), or turns (turn). But this doesn't control how vivid or dull, or how bright or dark the color is. The saturation (S) component of the color specifies what percentage of the final color is comprised of the specified hue. The rest is defined by the grey level provided by the luminance (L) component. Think of it like creating the pe...
...tions in which your website may need to let the user select a color. Perhaps you have a customizable user interface, or you're implementing a drawing app. Maybe you have editable text and need to let the user choose the text color. Or perhaps your app lets the user assign colors to folders or items. Although historically it's been necessary to implement your own color picker, HTML now provides sup
port for browsers to provide one for your use through the <input> element, by using "color" as the value of its type attribute. The <input> element represents a color only in the hexadecimal string notation covered above. Example: Picking a color Let's look at a simple example, in which the user can choose a color. As the user adjusts the color, the border around the example changes to reflect the ...
...And 4 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
The type of relationships is given by the value of the rel attribute, which, if present, must have a value that is an unordered set of unique space-separated keywords, which are listed in the following table. Every keyword within a space seperated value should be unique within that value. ...
.... External Resource Not allowed Not allowed prev Indicates that the current document is a part of a series, and that the previous document in the series is the referenced document. Link Link Link search Gives a link to a resource that can be used to search through the current document and its related pages. Link Link Link stylesheet Im
ports a style sheet. External Resource Not allowed Not allowed tag Gives a tag (identified by the given address) that applies to the current document. Not allowed Link Not allowed The rel attribute is relevant to the <link>, <a>, <area>, and <form> elements, but some values only relevant to a subset of those elements. Like all HTML keyword attribute values, these v...
... the current document. Not allowed Link Not allowed The rel attribute is relevant to the <link>, <a>, <area>, and <form> elements, but some values only relevant to a subset of those elements. Like all HTML keyword attribute values, these values are case-insenstive. The rel attribute has no default value. If the attribute is omitted or if none of the values in the attribute are sup
ported, then the document has no particular relationship with the destination resource other than there being a hyperlink between the two. In this case, on <link> and <form>, if the rel attribute is absent, has no keywords, or if not one or more of the space-separated keywords above, then the element does not create any links. <a> and <area> will still created links, but without a defined relationship...
...And 4 more matches
<input type="checkbox"> - HTML: Hypertext Markup Language
t may have rounded corners. A checkbox allows you to select single values for submission in a form (or not). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: Radio buttons are similar to checkboxes, but with an im
portant distinction -- radio buttons are grouped into a set in which only one radio button can be selected at a time, whereas checkboxes allow you to turn single values on and off. Where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected. Value A DOMString representing the value of the checkbox. ...
...ped into a set in which only one radio button can be selected at a time, whereas checkboxes allow you to turn single values on and off. Where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected. Value A DOMString representing the value of the checkbox. Events change and input Sup
ported common attributes checked IDL attributes checked, indeterminate and value Methods select() Value A DOMString representing the value of the checkbox. This is never seen on the client-side, but on the server this is the value given to the data submitted with the checkbox's name. Take the following example: <form> <div> <input type="checkbox" id="subscribe...
...cked state (e.g. value=unchecked); the value is not submitted to the server at all. If you wanted to submit a default value for the checkbox when it is unchecked, you could include an <input type="hidden"> inside the form with the same name and value, generated by JavaScript perhaps. ...
...And 4 more matches
<input type="email"> - HTML: Hypertext Markup Language
send us a pull request. The input value is automatically validated to ensure that it's either empty or a properly-formatted e-mail address (or list of addresses) before the form can be submitted. The :valid and :invalid CSS pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid e-mail address or not. ...
...lid and :invalid CSS pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid e-mail address or not. On browsers that don't sup
port inputs of type email, a email input falls back to being a standard text input. Value A DOMString representing an e-mail address, or empty Events change and input Sup
ported Common Attributes autocomplete, list, maxlength, minlength, multiple, name,pattern, placeholder, readonly, required, size, and type IDL attributes list and value Methods select() Value The <input> element's value attribute contains a DOMString which is automatically validated as conforming to e-mail syntax. More specifically, there are three possible value for...
..., the value can be a list of properly-formed comma-separated e-mail addresses. Any trailing and leading whitespace is removed from each address in the list. See Validation for details on how e-mail addresses are validated to ensure that they're formatted properly. ...
...And 4 more matches
<input type="radio"> - HTML: Hypertext Markup Language
red in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. They are called radio buttons because they look and operate in a similar manner to the push buttons on old-fashioned radios, such as the one shown below. Note: Checkboxes are similar to radio buttons, but with an im
portant distinction: radio buttons are designed for selecting one value out of a set, whereas checkboxes let you turn individual values on and off. Where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected. Value A DOMString representing the value of the radio button. Events change and input ...
...ion: radio buttons are designed for selecting one value out of a set, whereas checkboxes let you turn individual values on and off. Where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected. Value A DOMString representing the value of the radio button. Events change and input Sup
ported common attributes checked and value IDL attributes checked and value Methods select() Value The value attribute is a DOMString containing the radio button's value. The value is never shown to the user by their user agent. Instead, it's used to identify which radio button in a group is selected. Defining a radio group A radio group is defined by giving each o...
... data assigns the value on to the group. In this scenario, if the user clicked on the "Phone" option and submitted the form, the resulting form data would be contact=on, which isn't helpful. So don't forget to set your value attributes! Note: If no radio button is selected when the form is submitted, the radio group is not included in the submitted form data at all, since there is no value to re
port. It's fairly uncommon to actually want to allow the form to be submitted without any of the radio buttons in a group selected, so it is usually wise to have one default to the checked state. See Selecting a radio button by default below. Let's add a little bit of code to our example so we can examine the data generated by this form. The HTML is revised to add a <pre> block to output the form d...
...And 4 more matches
<input type="tel"> - HTML: Hypertext Markup Language
lly identical to standard text inputs, they do serve useful purposes; the most quickly apparent of these is that mobile browsers -- especially on mobile phones -- may opt to present a custom keypad optimized for entering phone numbers. Using a specific input type for telephone numbers also makes adding custom validation and handling of phone numbers more convenient. ...
...ent a custom keypad optimized for entering phone numbers. Using a specific input type for telephone numbers also makes adding custom validation and handling of phone numbers more convenient. Note: Browsers that don't sup
port type tel fall back to being a standard text input. ...
...t, selectionEnd, selectionDirection, and value Methods select(), setRangeText(), setSelectionRange() Value The <input> element's value attribute contains a DOMString that either represents a telephone number or is an empty string (""). ...
...And 4 more matches
<script>: The Script element - HTML: Hypertext Markup Language
llows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. defer has a similar effect in this case. This is a boolean attribute: the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. See Browser compatibility for notes on browser sup
port. See also Async scripts for asm.js. crossorigin Normal script elements pass minimal information to the window.onerror for scripts which do not pass the standard CORS checks. To allow error logging for sites which use a separate domain for static media, use this attribute. See CORS settings attributes for a more descriptive explanation of its valid arguments. defer This Boolean attribute i...
...load and evaluate scripts before continuing to parse. async has a similar effect in this case. integrity This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation. See Subresource Integrity. nomodule This Boolean attribute is set to indicate that the script should not be executed in browsers that sup
port ES2015 modules -- in effect, this can be used to serve fallback scripts to older browsers that do not sup
port modular JavaScript code. nonce A cryptographic nonce (number used once) to whitelist scripts in a script-src Content-Security-Policy. The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a re...
... is otherwise trivial. referrerpolicy Indicates which referrer to send when fetching the script, or resources fetched by the script: no-referrer: The Referer header will not be sent. no-referrer-when-downgrade (default): The Referer header will not be sent to origins without TLS (HTTPS). origin: The sent referrer will be limited to the origin of the referring page: its scheme, host, and
port. origin-when-cross-origin: The referrer sent to other origins will be limited to the scheme, the host, and the
port. Navigations on the same origin will still include the path. same-origin: A referrer will be sent for same origin, but cross-origin requests will contain no referrer information. strict-origin: Only send the origin of the document as the referrer when the protocol security lev...
...And 4 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or
port) from its own. An example of a cross-origin request: the front-end JavaScript code served from https://domain-a.com uses XMLHttpRequest to make a request for https://domain-b.com/data.json. For security reasons, browsers restrict cross-origin HTTP requests initiated from scripts. For example, XMLHttpRequest and the Fetch API follow the same-origin policy. This means that a web application using those APIs can only request resources from the same origin ...
...n. For security reasons, browsers restrict cross-origin HTTP requests initiated from scripts. For example, XMLHttpRequest and the Fetch API follow the same-origin policy. This means that a web application using those APIs can only request resources from the same origin the application was loaded from unless the response from other origins includes the right CORS headers. The CORS mechanism sup
ports secure cross-origin requests and data transfers between browsers and servers. Modern browsers use CORS in APIs such as XMLHttpRequest or Fetch to mitigate the risks of cross-origin HTTP requests. Who should read this article? Everyone, really. More specifically, this article is for web administrators, server developers, and front-end developers. Modern browsers handle the client side of cross...
... Resource Sharing standard works by adding new HTTP headers that let servers describe which origins are permitted to read that information from a web browser. Additionally, for HTTP request methods that can cause side-effects on server data (in particular, HTTP methods other than GET, or POST with certain MIME types), the specification mandates that browsers "preflight" the request, soliciting sup
ported methods from the server with the HTTP OPTIONS request method, and then, upon "approval" from the server, sending the actual request. Servers can also inform clients whether "credentials" (such as Cookies and HTTP Authentication) should be sent with requests. CORS failures result in errors, but for security reasons, specifics about the error are not available to JavaScript. All the code knows i...
...And 4 more matches
CSP: script-src - HTTP
ective is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the script-src policy: Content-Security-Policy: script-src <source>; Content-Security-Policy: script-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 4 more matches
An overview of HTTP - HTTP
ages (as opposed to a stream of data). The messages sent by the client, usually a Web browser, are called requests and the messages sent by the server as an answer are called responses. Designed in the early 1990s, HTTP is an extensible protocol which has evolved over time. It is an application layer protocol that is sent over TCP, or over a TLS-encrypted TCP connection, though any reliable trans
port protocol could theoretically be used. Due to its extensibility, it is used to not only fetch hypertext documents, but also images and videos or to post content to servers, like with HTML form results. HTTP can also be used to fetch parts of documents to update Web pages on demand. Components of HTTP-based systems HTTP is a client-server protocol: requests are sent by one entity, the user-agent ...
... the response. Between the client and the server there are numerous entities, collectively called proxies, which perform different operations and act as gateways or caches, for example. In reality, there are more computers between a browser and the server handling the request: there are routers, modems, and more. Thanks to the layered design of the Web, these are hidden in the network and trans
port layers. HTTP is on top, at the application layer. Although im
portant to diagnose network problems, the underlying layers are mostly irrelevant to the description of HTTP. Client: the user-agent The user-agent is any tool that acts on the behalf of the user. This role is primarily performed by the Web browser; other possibilities are programs used by engineers and Web developers to debug their a...
...ment on demand. A server is not necessarily a single machine, but several server software instances can be hosted on the same machine. With HTTP/1.1 and the Host header, they may even share the same IP address. Proxies Between the Web browser and the server, numerous computers and machines relay the HTTP messages. Due to the layered structure of the Web stack, most of these operate at the trans
port, network or physical levels, becoming transparent at the HTTP layer and potentially making a significant impact on performance. Those operating at the application layers are generally called proxies. These can be transparent, forwarding on the requests they receive without altering them in any way, or non-transparent, in which case they will change the request in some way before passing it along ...
...And 4 more matches
Inheritance and the prototype chain - JavaScript
One misfeature that is often used is to extend Object.prototype or one of the other built-in prototypes. This technique is called monkey patching and breaks encapsulation. While used by popular frameworks such as Prototype.js, there is still no good reason for cluttering built-in types with additional non-standard functionality. The only good reason for extending a built-in prototype is to back
port the features of newer JavaScript engines, like Array.forEach. Summary of methods for extending the prototype chain Here are all 4 ways and their pros/cons. All of the examples listed below create exactly the same resulting inst object (thus logging the same results to the console), except in different ways for the purpose of illustration. Name Example(s) Pro(s) Con(s) ...
...lts to the console), except in different ways for the purpose of illustration. Name Example(s) Pro(s) Con(s) New-initialization function foo(){} foo.prototype = { foo_prop: "foo val" }; function bar(){} var proto = new foo; proto.bar_prop = "bar val"; bar.prototype = proto; var inst = new bar; console.log(inst.foo_prop); console.log(inst.bar_prop); Sup
ported in every browser imaginable (sup
port goes all the way back to IE 5.5!). Also, it is very fast, very standard, and very JIST-optimizable. In order to use this method, the function in question must be initialized. During this initialization, the constructor may store unique information that must be generated per-object. However, this unique information would only be generated once, potentially...
...bar val"; bar.prototype = proto; var inst = new bar; console.log(inst.foo_prop); console.log(inst.bar_prop); function foo(){} foo.prototype = { foo_prop: "foo val" }; function bar(){} var proto = Object.create( foo.prototype, { bar_prop: { value: "bar val" } } ); bar.prototype = proto; var inst = new bar; console.log(inst.foo_prop); console.log(inst.bar_prop) Sup
port in all in-use-today browsers which are all non-microsoft browsers plus IE9 and up. Allows the direct setting of __proto__ in a way that is one-time-only so that the browser can better optimize the object. Also allows the creation of objects without a prototype via Object.create(null). Not sup
ported in IE8 and below. However, as Microsoft has discontinued extended sup
port for systems running th...
...And 4 more matches
TypeError: "x" is not a function - JavaScript
Some code expects you to provide a function, but that didn't happen. ...
...sing brackets for multiplication In math, you can write 2 x (3 + 5) as 2*(3 + 5) or just 2(3 + 5). ...
...ts for multiplication In math, you can write 2 x (3 + 5) as 2*(3 + 5) or just 2(3 + 5). ...
...And 4 more matches
Number.prototype.toLocaleString() - JavaScript
numbers, it is better to create a NumberFormat object and use the function provided by its NumberFormat.format property. Examples Using toLocaleString In basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var number = 3500; console.log(number.toLocaleString()); // Displays "3,500" if in U.S. ...
...y its NumberFormat.format property. Examples Using toLocaleString In basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var number = 3500; console.log(number.toLocaleString()); // Displays "3,500" if in U.S. English locale Checking for sup
port for locales and options arguments The locales and options arguments are not sup
ported in all browsers yet. ...
...les Using toLocaleString In basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var number = 3500; console.log(number.toLocaleString()); // Displays "3,500" if in U.S. English locale Checking for sup
port for locales and options arguments The locales and options arguments are not sup
ported in all browsers yet. ...
...And 4 more matches
WebAssembly.compileStreaming() - JavaScript
(see our compile-streaming.html demo on GitHub, and view it live also) directly streams a .wasm module from an underlying source then compiles it to a WebAssembly.Module object. Because the compileStreaming() function accepts a promise for a Response object, you can directly pass it a WindowOrWorkerGlobalScope.fetch() call, and it will pass the response into the function when it fulfills. var im
portObject = { im
ports: { im
ported_func: arg => console.log(arg) } }; WebAssembly.compileStreaming(fetch('simple.wasm')) .then(module => WebAssembly.instantiate(module, im
portObject)) .then(instance => instance.ex
ports.ex
ported_func()); The resulting module instance is then instantiated using WebAssembly.instantiate(), and the ex
ported function invoked. Specifications Specification ...
...table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ke to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 4 more matches
Media - Progressive web apps (PWAs)
cted display all All media (the default) More details There are other ways to specify the media type for a set of rules. The document's markup language might allow the media type to be specified when the stylesheet is linked to the document. For example, in HTML, you have the option to specify the media type with a media attribute in the LINK element. ...
...(the default) More details There are other ways to specify the media type for a set of rules. The document's markup language might allow the media type to be specified when the stylesheet is linked to the document. For example, in HTML, you have the option to specify the media type with a media attribute in the LINK element. ...
... A @page rule can set the page margins. For double-sided printing, you can specify the margins separately for @page:left and @page:right. For print media, you normally use appropriate length units like inches (in) and points (pt = 1/72 inch), or centimeters (cm) and millimeters (mm). ...
...And 4 more matches
Structural overview of progressive web apps - Progressive web apps (PWAs)
ts of the app shell pattern This architecture allows a web site to benefit the most from all the PWA features -- it caches the app shell and manages the dynamic content in a way that greatly improves the performance. In addition to the basic shell, you can add other features such as add to home screen or push notifications, safe in the knowledge that the app will still work OK if they are not sup
ported by the user's browser -- this is the beauty of progressive enhancement. The website feels like a native app with instant interaction and solid performance while keeping all the benefits of the web. Being linkable, progressive, and responsive by design It's im
portant to remember the PWA advantages and keep them in mind when designing the application. The app shell approach allows websites to ...
...ws websites to be: Linkable: Even though it behaves like a native app, it is still a website -- you can click on the links within the page and send a URL to someone if you want to share it. ...
... Another approach: Streams An entirely different approach to server- or client-side rendering can be achieved with the Streams API. ...
...And 4 more matches
Interacting with page scripts - Archive of obsolete content
Mod({ include: pageUrl, contentScript: "console.log(unsafeWindow.foo);" }) tabs.open(pageUrl); Be careful using unsafeWindow: you can't rely on any of its properties or functions being, or doing, what you expect. Any of them, even setters and getters, could have been redefined by a page script. Don't use it unless you trust the page, and even then be careful. Also, unsafeWindow isn't a sup
ported API, so it could be removed or changed in a future version of the SDK. Expose objects to page scripts Until Firefox 30, you could use unsafeWindow to perform the reverse procedure, and make objects defined in content scripts available to page scripts: // content-script.js unsafeWindow.contentScriptObject = {"greeting" : "hello from add-on"}; // page-script.js var button = document.getEl...
...a bit more powerful than simple JSON serialization, but not much: in particular, functions aren't cloned. This means that you can't expose a function to a page script using cloneInto(), and if you clone an object into the page script scope, its methods will not be available to the page script. To expose a function defined in a content script to a page script so the page script can call it, use ex
portFunction(). Here's an example. The "main.js" opens the local file "page.html" and attaches a content script to it: // main.js var tabs = require("sdk/tabs"); var self = require("sdk/self"); tabs.open({ url: self.data.url("page.html"), onReady: attachScript }); function attachScript(tab) { tab.attach({ contentScriptFile: self.data.url("content-script.js") }); } The content script...
..."main.js" opens the local file "page.html" and attaches a content script to it: // main.js var tabs = require("sdk/tabs"); var self = require("sdk/self"); tabs.open({ url: self.data.url("page.html"), onReady: attachScript }); function attachScript(tab) { tab.attach({ contentScriptFile: self.data.url("content-script.js") }); } The content script defines a function greetme() and ex
ports it to the page script context. Note that the function's closure will be ex
ported, too: // content-script.js var salutation = "hello, "; function greetme(user) { return salutation + user; } ex
portFunction(greetme, unsafeWindow, {defineAs: "greetme"}); Finally, the "page.html" file adds a button and a page script that calls the ex
ported function when the user pushes the button: <html> <h...
...And 3 more matches
test/assert - Archive of obsolete content
Implements the assert interface defined in the CommonJS Unit Testing specification version 1.1. Usage To use the assert module, write a set of unit tests following the instructions in the unit testing tutorial. Each test will be passed an Assert object when you run the tests using jpm test. You can use this object to make assertions about your program's state. For example: var a = 1; ex
ports["test value of a"] = function(assert) { assert.ok(a == 1, "test that a is 1"); } require("sdk/test").run(ex
ports); Globals Constructors Assert(logger) Create a new Assert object. This function is only called by the unit test framework, and not by unit tests themselves. Parameters logger : object Object used to log the results of assertions. Assert An object used to make assertions about...
... inherit from different prototypes"); Parameters actual : object The actual result. expected : object The expected result. message : string Optional message to log, providing extra information about the test. strictEqual(actual, expected, message) Tests that two objects are equal, using the strict equality operator ===: // This test will pass, because "==" will perform type conversion ex
ports["test coercive equality"] = function(assert) { assert.equal(1, "1", "test coercive equality between 1 and '1'"); } // This test will fail, because the types are different ex
ports["test strict equality"] = function(assert) { assert.strictEqual(1, "1", "test strict equality between 1 and '1'"); } Parameters actual : object The actual result. expected : object The expected result. messag...
...1 and '1'"); } Parameters actual : object The actual result. expected : object The expected result. message : string Optional message to log, providing extra information about the test. notStrictEqual(actual, expected, message) Tests that two objects are not equal, using the negation of the strict equality operator ===: // This test will fail, because "==" will perform type conversion ex
ports["test coercive equality"] = function(assert) { assert.notEqual(1, "1", "test coercive equality between 1 and '1'"); } // This test will pass, because the types are different ex
ports["test strict equality"] = function(assert) { assert.notStrictEqual(1, "1", "test strict equality between 1 and '1'"); } Parameters actual : object The actual result. expected : object The expected result. ...
...And 3 more matches
ui/frame - Archive of obsolete content
Right now it can be used in conjunction with a Toolbar: you create a Frame, then supply it to the Toolbar's constructor, and the content is then displayed inside the toolbar. ...
...unction Assign a listener to the frame's load event. onReady function Assign a listener to the frame's ready event. onMessage function Assign a listener to the frame's message event. Frame Methods postMessage(message, targetOrigin) Send a message to scripts loaded into the frame. ...
... a listener to a frame event: var { Frame } = require("sdk/ui/frame"); var frame = new Frame({ url: "./frame.html" }); frame.on("message", pong) function pong(e) { if (e.data == "ping") { // message only the sender, and not any frames attached to other browser windows e.source.postMessage("pong", "*"); } } Parameters event : string The name of the event to listen to. Frame sup
ports the following events: attach, detach, load, ready, and message. listener : function The listener function. This is passed an event object which always contains a source property, which has a postMessage() function modeled after window.postMessage(). You can use this to communicate only with the specific frame instance that generated the event, and not to any frame instance attached to other b...
...And 3 more matches
package.json - Archive of obsolete content
package.json may contain the following keys: author The name of the package's original author; this could be the name of a person or a company. Defaults to an empty string. It may include a optional URL in parentheses and an email address in angle brackets. This value will be used as the add-on's em:creator element in the install.rdf file generated by cfx. Note: jpm sup
ports NodeJS people fields. contributors An array of additional author strings, identifying other contributors to the add-on. These values will be used as the add-on's em:contributor elements in its install.rdf. Note: This is deprecated along with cfx; it's not available when using jpm. dependencies A string or an array of strings specifying the name...
... strings specifying the names of packages that this add-on requires in order to function properly. description The add-on's description; this is a human-readable message describing what the add-on does. This defaults to the text "a basic add-on". This value will be used as the add-on's em:description element in its install.rdf. engines Object with sup
ported applications (key) and required version numbers (value). The version number can both specify a minimum and maximum version separated by a space. firefox: Firefox Desktop fennec: Firefox for Android thunderbird: Thunderbird seamonkey: SeaMonkey Any application UUID Example: "engines": { "firefox": ">= 38.0a1", "fennec": ">= 38.0a1" } ...
...ts install.rdf. packages Note: This is deprecated along with cfx and is not available when using jpm. A string pointing to a directory containing additional packages. Defaults to "packages". permissions An object describing the set of permissions that the add-on needs. private-browsing: a boolean indicating whether or not the add-on sup
ports private browsing. If this value is not true or is omitted, then the add-on will not see any private windows or objects, such as tabs, that are associated with private windows. See the documentation for the private-browsing module. cross-domain-content: a list of domains for which content scripts are given cross-domain privileges to access content in iframes or to make XMLHTTPRequests. See t...
...And 3 more matches
Drag & Drop - Archive of obsolete content
m.addEventListener("dragdrop", _dragDrop, true); Here, elem could be a window or an XUL element. ...
...Drop, true); Here, elem could be a window or an XUL element. ...
...indow or an XUL element. ...
...And 3 more matches
JavaScript Daemons Management - Archive of obsolete content
en to create a constructor for such a class of objects (Daemon) in order to standardize and simplify the instantiation of them. Note: A minimalistic version of it (MiniDaemon) is published here. This more complex version of it is nothing but a big and scalable collection of methods for the Daemon constructor. But the Daemon constructor itself is nothing but a clone of MiniDaemon with an added sup
port for init and onstart functions declarable during the instantiation of the daemon. So the MiniDaemon framework will remain the recommended way for simple animations, because Daemon without its collection of methods is essentially a clone of it. The architecture of the Daemon constructor explicitly avoids the use of closures. It also offers an alternative way to pass the this object to the callbac...
...odule is daemon.js: both the daemon-safe.js module and the daemon-methods.js module require daemon.js to work. For a fast overview on the code proposed here you can git clone https://github.com/madmurphy/daemon.js.git. or, at your choice, directly download this .zip file. About the "callback arguments" polyfill In order to make this framework compatible with Internet Explorer (which doesn't sup
port sending additional parameters to timers' callback function, neither with setTimeout() or setInterval()) we included the IE-specific compatibility code (commented code), which enables the HTML5 standard parameters' passage functionality in that browser for both timers (polyfill), at the end of the daemon.js module. daemon.js What follows is the module that declares the Daemon constructor (the co...
...pecific compatibility code (commented code), which enables the HTML5 standard parameters' passage functionality in that browser for both timers (polyfill), at the end of the daemon.js module. daemon.js What follows is the module that declares the Daemon constructor (the core of this framework). The Daemon constructor itself is nothing but a clone of the little framework MiniDaemon with added sup
port for init and onstart functions (declarable during the instantiation of the daemon). So the MiniDaemon framework will remain the recommended way for simple animations, because Daemon without its collection of methods is essentially a clone of it. /*\ |*| |*| ******************************* |*| * daemon.js * |*| ******************************* |*| |*| ver. 1.0 re...
...And 3 more matches
Appendix F: Monitoring DOM changes - Archive of obsolete content
document lays out some alternatives which do not have such severe performance impacts. Mutation observers Mutation observers are the more efficient, W3C speced replacement for the highly inefficient mutation events. Their major advantage is in their performance and their ease of use, especially when combined with simple libraries. Their main disadvantage is that, due to their recent advent, sup
port is currently limited to Firefox 14+ and Chrome 18. While they are still viable for add-ons targeting only the latest Firefox, those wishing to sup
port older browsers will need to provide fallbacks. For more information, see this blog post on the issues at hand. Non-mutation triggers It is usually possible to tell when a mutation has occurred or is about to occur without resorting to mutation e...
...ements and check for matching elements when the event fires. For instance, rather than watching for the creation of <a> elements and adding event listeners to them as they are created, an event listener can be added to the root <html> element, and when the event fires, the event.target and its parents can be searched for a matching element. You can read more about event delegation here. It is im
portant to note, however, that this method can have severe performance implications for certain events, namely mouseover, mouseout, and friends, which are fired very often while the mouse is moving. Monkey patching In many instances, especially when dealing with chrome code, the best way to modify actions which result in DOM mutations is by wrapping the functions that trigger those changes. For inst...
...cient fallback implementation for older browsers. It is worth noting, however, that while the animation-based implementation will fire any time an element which previously did not match the given selector is changed so that it does (when a class is added, for instance), the fallback will only match nodes when they are inserted into the DOM tree. Minor changes are also required if one wishes to sup
port other browsers, or to run in non-chrome-privileged scopes. /** * Watches for nodes matching the given CSS selector to become * available. * * @param {string} selector The CSS selector of nodes about which you * want to be notified. * @param {function(Event)} callback The function which is to be called * when matching nodes become available. * @param {Document} doc The document in...
...And 3 more matches
Connecting to Remote Content - Archive of obsolete content
Besides XML, it can be used to retrieve data in other formats, for example JSON, HTML and plain text. In this section we'll look into the XML and JSON communication mechanisms. ...
...ther the request should be handled asynchronously or not. In asynchronous mode code execution continues immediately after the send call. In synchronous mode the code and user interface are blocked while waiting for a response to come back. Note: Requests can take a long time to process and you don't want users to be stuck waiting while a request is obtained and processed. Therefore, it is very im
portant that XMLHttpRequest calls are always done asynchronously. Now let's look at the most common types of content you can use to communicate with remote servers. JSON content JSON is a very lightweight and simple data representation format, similar to the object representation used in JavaScript. Unlike JavaScript, the JSON format doesn't allow any kind of code that can be run, only data. JSON ...
.../xul:label> </xul:hbox> </xsl:for-each> <xul:hbox> <xul:label value="Total:" /> <xul:label> <xsl:value-of select="total" /> </xul:label> </xul:hbox> </xul:vbox> </xsl:template> </xsl:stylesheet> Next you need to read the XSLT stylesheet as a file stream and parse it into a document object. After that, the XSLT stylesheet can be im
ported into an XSLT processor as shown below. Now, the processor is ready to perform the transformation. let domParser = Components.classes["@mozilla.org/xmlextras/domparser;1"] .createInstance(Components.interfaces.nsIDOMParser); let fileStream = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); l...
...And 3 more matches
Observer Notifications - Archive of obsolete content
e. Let's see the following example code on how to send out a notification from non-chrome code. /** * Notifies all the registered observers with the test notification topic. */ notifyTest : function() { let observerService = Components.classes["@mozilla.org/observer-service;1"]. ...
...ication from non-chrome code. /** * Notifies all the registered observers with the test notification topic. */ notifyTest : function() { let observerService = Components.classes["@mozilla.org/observer-service;1"]. getService(Components.interfaces.nsIObserverService); let subject = Components.classes["@mozilla.org/sup
ports-string;1"]. createInstance(Components.interfaces.nsISup
portsString); // assign some text to data attribute subject.data = "This is a test."; // notify all registered observers observerService.notifyObservers( subject, "xulschoolhello-test-topic", "hello"); } In the notifyTest method, the notifyObservers call is used to notify all registered observers about the notification topic "xulschoolhello-test-topic". The input parameter is an insta...
...// assign some text to data attribute subject.data = "This is a test."; // notify all registered observers observerService.notifyObservers( subject, "xulschoolhello-test-topic", "hello"); } In the notifyTest method, the notifyObservers call is used to notify all registered observers about the notification topic "xulschoolhello-test-topic". The input parameter is an instance of nsISup
portsString with some text and the last input parameter is a string "Hello". In a chrome browser overlay file, we register an observer to listen to the notification topic "xulschoolhello-test-topic" when the window loads. Keep in mind that you have to remove observers that are not longer needed. Not doing so will result in memory leaks. Therefore, the registered observer is unregistered when the brow...
...And 3 more matches
Setting Up a Development Environment - Archive of obsolete content
ons use the same (or similar) languages that are used for web development, so most text editors and IDEs are up to the task. Most XUL tools and plugins you'll find online are merely templates that generate the folder structure for the project, and that's not much help. We recommend Komodo Edit. It's free, open source, and cross-platform. It's based on the Mozilla XULRunner platform, so it has sup
port for some of the particularities in Firefox extension development. Komodo Edit has automatic completion for XUL tags and attributes, and it sup
ports Mozilla's CSS extensions (CSS values and properties beginning with "-moz"). It has an add-on system similar to the one in Firefox, and there are some Komodo extensions that provide additional help in extension development. That is more than what you c...
...ation to locate the installation path of the extension and overwrite the installed files. If Firefox is open at the time you run "make install", you'll have to restart it in order to see the changes. It's still better than installing the XPI all over again. You may need to alter the profile location in your Makefile. ...
... extension and overwrite the installed files. If Firefox is open at the time you run "make install", you'll have to restart it in order to see the changes. It's still better than installing the XPI all over again. You may need to alter the profile location in your Makefile. In order to set the profile location to the right value, you should read the sup
port article on profiles, at the Mozilla Sup
port site. ...
...And 3 more matches
The Essentials of an Extension - Archive of obsolete content
sion. Now we'll look into its files and code, starting with the install.rdf file. You can open it with any text editor. The file is formatted in a special flavor of XML called RDF. RDF used to be the central storage mechanism for Firefox, but it is now being replaced for a simpler database system. We'll discuss both of these storage systems further ahead in the tutorial. Now let's look at the im
portant parts of the file. <em:id>helloworld@xulschool.com</em:id> This is the unique identifier for the extension. Firefox needs this to distinguish your extension from other extensions, so it is required that you have an ID that is unique. There are two accepted standards for add-on ids. One is the email-like format in the Hello World example, which should be something like <project-name>@<yo...
...t application and target versions for the extension, specifically Firefox, from version 4 up to version 10. The UUID is Firefox's unique ID. Other Mozilla and Mozilla-based applications such as Thunderbird and Seamonkey have their own. You can have an extension that works on multiple applications and versions. For example, if you create a Firefox extension, it would normally take little effort to
port it to SeaMonkey, which has very similar features and UI. The min and max version specify the version range in which the extension can be installed. Here's more about the version format. If the application or version range don't match, you won't be allowed to install the extension, or the extension will be installed in a disabled state. Users can disable version checks through preferences or inst...
...es and UI. The min and max version specify the version range in which the extension can be installed. Here's more about the version format. If the application or version range don't match, you won't be allowed to install the extension, or the extension will be installed in a disabled state. Users can disable version checks through preferences or installing add-ons like the Add-on Compatibility Re
porter. Beginning with Firefox 11, add-ons will default to compatible and Firefox will mostly ignore the version range. Testing your add-ons with every Firefox version is always recommended, though. This is the information Firefox and other Mozilla applications need to install an add-on. Any errors or missing information will cause the installation process to fail, or the extension to be installed in...
...And 3 more matches
XPCOM Objects - Archive of obsolete content
s and interfaces, but it's more of a source browser than a documentation reference. Stepping into the time machine, we see the Preferences Service component page. Right at the top you can see a list of the interfaces it implements, with a link to a documentation page for each one of them. Then you'll see a list of all members of this object, with some documentation about it. It is particularly im
portant to note that, for every member in the component, you'll see in what interface this member is defined. Clicking on the link for the getBranch method takes you to the nsIPrefService documentation page, where you can see more details on the interface and the method. You can also see a list of what components implement this interface. All of this documentation is generated from the one present in ...
... to transform values to the correct type, but it's usually best to pass the right type in the first place. This section is a quick guide on how to read XPCOM documentation, which basically amounts to understanding the syntax of XPIDL, the language used to specify XPCOM interfaces. At MDC, you'll see stuff like this: void setCharPref(in string aPrefName, in string aValue); One of the most im
portant details to notice is that both paratemers have the in keyword. This specifies that these are input parameters, values that the method will use to perform its actions. When is a parameter not an in parameter? In some methods the out keyword is used for parameters that are return values in reality. This is done for certain value types that are not valid as return values in IDL, such as typed arr...
.... In this case you may also find it easier to implement your component using JSM and the XPCOMUtils module. Download this version of the Hello World project with XPCOM to see how XPCOM files are structured in the project and built. (Your build will probably break, we'll cover this later on.) In the components directory, the file xsIHelloCounter.idl has the following contents: #include "nsISup
ports.idl" /** * Counter for the Hello World extension. Keeps track of how many times the * hello world message has been shown. */ [scriptable, uuid(BD46F689-6C1D-47D0-BC07-BB52B546B8B5)] interface xsIHelloCounter : nsISup
ports { /* The maximum allowed count. */ const short MAX_COUNT = 100; /* The current count. */ readonly attribute short count; /** * Increments the display count a...
...And 3 more matches
Plug-n-Hack - Archive of obsolete content
people with less experience from using such tools. This can include application developers and testers, exactly the sort of people we would like to use these tools more! For example, to configure a browser to use an intercepting proxy that can handle HTTPS traffic, the user must typically: Configure their browser to proxy via the tool Configure the tool to proxy via their corporate proxy Im
port the tool's SSL certificate into their browser If any of these steps are carried out incorrectly then the browser will typically fail to connect to any website - debugging such problems can be frustrating and time-consuming. Without integration between security tools and browsers, a user must often switch between the tool and their browser several times to perform a simple task, such as intercept...
...ectly then the browser will typically fail to connect to any website - debugging such problems can be frustrating and time-consuming. Without integration between security tools and browsers, a user must often switch between the tool and their browser several times to perform a simple task, such as intercepting an HTTP(S) request. PnH allows security tools to declare the functionality that they sup
port which is suitable for invoking directly from the browser. A browser that sup
ports PnH can then allow the user to invoke such functionality without having to switch to and from the tool. While some of the PnH capabilities do have a fixed meaning, particularly around proxy configuration, most of the capabilities are completely generic, allowing tools to expose whatever functionality they want. Impl...
...As a result we have designed and developed the PnH protocol to be both browser and tool independent. ...
...And 3 more matches
Running Tamarin performance tests - Archive of obsolete content
avm sunspider/access-binary-trees.as 82.0 sunspider/access-fannkuch.as 152.0 sunspider/access-nbody.as 173.0 sunspider/access-nsieve.as 65.0 sunspider/bitops-3bit-bits-in-byte.as 13.0 sunspider/bitops-bits-in-byte.as 36.0 $ ex
port AVM2=c:/dev/tamarin-tracing2/bld/shell/avmshell.exe $ python ./runtests.py Executing tests at 2008-07-22 14:03:51.957381 avm: c:/dev/tamarin-tracing/bld/shell/avmshell.exe avm2: c:/dev/tamarin-tracing2/bld/shell/avmshell.exe test avm avm2 %sp sunspider/access-binary-trees.as 82.0 80.0 2.5 sunspider/access-fann...
...rint geometric mean of scores --index= index file to use (must end with .py) --saveindex= save results to given index file name Option Details indexing: There are two command line flags that control indexing: --index and --saveindex both require an index filename to be specified after the flag. "--index index.py" will load index.py and run all of the tests in that index and re
port results normalized to the index values. A subset of the tests in the index can be run by passing what tests you want to run after specifying the index file. "--saveindex indexname.py" will run the specified tests and save the values to the give index file. Specifying both --index and --saveindex will merge the values specified in --index to the new saved indexfile. cumulative score: new opt...
...e: new option of --score will display a cumulative score for every metric. Really most useful with an index file (or v8 tests), since running with raw time values will skew the results towards longer running tests csv output: "--csv filename" will save run results to a csv file that can be analyzed using excel pivottables. Use --csvappend if you want to append the results to the csv file Sup
port Files testconfig.txt This file contains instructions for how the harness should handle performance tests. metricinfo.py This file contains a list of metrics that the harness will look for and record. See the file header for details Testing the Android Shell The instructions above apply to running tests on an android device as well, but with a few differences. You should set environment variable...
...And 3 more matches
Elements - Archive of obsolete content
Note: The normal same-origin policy is used for web sites; they can only link to XBL files on the ...
... Note: The normal same-origin policy is used for web sites; they can only link to XBL files on the same domain, or within the chrome. ...
... the name of the corresponding class that is constructed for the implementation. If no name attribute is specified then the binding's document URI and id are used to uniquely reference the binding's implementation. implements - The implements attribute can be used to describe the set of interfaces that are implemented by the binding. Its value is a comma-separated list of named interfaces. If sup
ported, in strongly typed languages the bound element can be referenced not only as any of the interfaces that the element might already sup
port (e.g., HTMLElement) but also as any of the interfaces described by this attribute. Sup
port of this capability is optional. constructor The code inside the constructor is called when a binding has just been attached to an element. So full access to anonymou...
...And 3 more matches
Building accessible custom components in XUL - Archive of obsolete content
the control; they had no way of knowing that a particular collection of div and span elements should be treated as a single cohesive control (such as a tab bar or a treeview). By implementing DHTML Accessibility techniques, web developers can declare that generic HTML elements are really acting as specific GUI controls (such as a treeitem within a treeview). Firefox 1.5 is the first browser to sup
port DHTML Accessibility; it maps the declarations within the HTML page to the underlying accessibility architecture so that assistive technologies can "read" a web page and know how to present these complex controls to the end user. This has all been well-documented for some time. However, it is less well-known that the same DHTML Accessibility techniques can be applied to XUL, Mozilla's XML markup l...
...L Accessibility Download stage-2.zip install stage-2.xpi Using the new DHTML Accessibility techniques in Firefox 1.5, we can declare the role of each element in our spreadsheet. The grid element is really a spreadsheet. Each label element is really a cell within the spreadsheet. Each description element is really a row or column header within the spreadsheet. You can find a list of all the sup
ported roles in Firefox 1.5 on mozilla.org. Role declarations are a little confusing at first glance, but they all follow the same pattern. The role attribute itself is in the XHTML 2 namespace. We will need to declare the namespace (xmlns:x2="http://www.w3.org/TR/xhtml2") so we can add an xhtml2:role attribute to each XUL element. The role attribute value is also in a namespace. We will need to decla...
...t's it! Well, not quite. We still have no way to focus individual cells, nor do we have a way to navigate the spreadsheet with the keyboard. But that's it as far as DHTML Accessibility goes. All you need to do is declare two namespaces and assign the appropriate role attributes, and Firefox handles exposing the elements properly to the underlying assistive technology. Further reading Table of sup
ported roles and states in Firefox Focus Issues Download stage-3.zip install stage-3.xpi The next step on the road to an accessible spreadsheet is the focus problem. In HTML documents, you can make any element focusable with the tabindex attribute. In XUL, there is no tabindex attribute; to make a XUL element focusable, you need to use a Mozilla-specific CSS property, -moz-user-focus: normal. <code...
...And 3 more matches
Introduction to XUL - Archive of obsolete content
need to change the the mime type to something like "text/x-xul".) These files are processed using the same parser as "text/xml" files (and therefore subject to XML syntax rules, as they should be). It's possible to load a XUL document from an XML file (one named *.xml). The resulting UI will be created using an XML content model. A XUL content model is generated from *.xul files. XML documents sup
port the basic DOM Level 1 Core APIs. XUL documents sup
port an extended set, much as HTML documents sup
port DOM Level 1 HTML APIs. Mozilla's XUL content models also sup
port nifty features like local/remote merging; see the XUL and RDF document for details. In general, you will want to store XUL in *.xul files. A XUL file can contain XML elements and HTML elements, as well as special elements unique t...
...egated to the contents of a CDATA section, to prevent the XML parser from choking on JavaScript which may look like XML content (a < character, for instance.) <html:script type="application/javascript"> <![CDATA[ function lesser(a,b) { return a < b ? ...
...At this time these additional DOM methods are available, though the code is of course the most accurate place to look for this information. ...
...And 3 more matches
Commands - Archive of obsolete content
ment had selected text or not, and for paste operations, whether there is something suitable on the clipboard to paste. As you can see, this becomes complicated. By using commands, much of the work is handled for you. You can use a command for any operation. Mozilla uses them for almost every menu command. In addition, text fields and other widgets have a number of commands which they already sup
port that you can invoke. You should use them when the operation depends on which element is focused. A command is identified by its id attribute. Mozilla uses the convention that command id's start with 'cmd_'. You will probably want to use the same id if a command is already being used, however, for your own commands, you can use any command id you wish. To avoid conflicts, you may wish to include ...
...a window. The command dispatcher contains methods for retrieving controllers for commands and for retrieving and modifying the focus. Adding Controllers You can implement your own controllers to respond to commands. You could even override the default handling of a command with careful placement of the controller. A controller is expected to implement four methods, which are listed below: sup
portsCommand (command) this method should return true if the controller sup
ports a command. If you return false, the command is not handled and command dispatcher will look for another controller. A single controller may sup
port multiple commands. isCommandEnabled (command) this method should return true if the command is enabled, or false if it is disabled. Corresponding buttons will be disabled a...
...le below isn't completely polished. Really, we should ensure that the selection and focus is adjusted appropriately after a deletion. ...
...And 3 more matches
Skinning XUL Files by Hand - Archive of obsolete content
lla's current global skin defines this basic behavior for several classes of button. A button is styled by the global skin when its class attribute is set to a class which is defined in the global skin. For example, when a button is defined as follows: <button class="plain" label="Push Me" /> Then the following very simple style definition applies to that button. button.plain { border: 0px !im
portant; } The global skin, in which styles for these several button classes and dozens of other elements are defined, is described in the following section. If you want to use the classes already defined in Mozilla's global skin to style your elements, you may do so. But you may also want to define new classes of buttons particular to your XUL file, in which case the style information will be wholl...
...d dozens of other elements are defined, is described in the following section. If you want to use the classes already defined in Mozilla's global skin to style your elements, you may do so. But you may also want to define new classes of buttons particular to your XUL file, in which case the style information will be wholly defined within your custom CSS file. Reading the Global Skin It's very im
portant to familiarize yourself with the basic style definitions in the global skin before you set out creating your own stylesheet. CSS can quickly become complicated. The ability to apply styles to elements of a type, to specifically identified elements, and to classes of elements creates the potential for redundancies or conflicts in the style information. To avoid this, the makers of the CSS speci...
...o be a part of a larger application that can be skinned, like Mozilla, you probably want your XUL file to pick up the global changes when the application is dynamically reskinned. To keep your XUL looking consistent and to avoid breaking skins altogether (when your styles have some dependency on a part of the global skin that changes, such as an image), use the style rules in the global skin by im
porting it into your stylesheet with the following instruction: @im
port url("chrome://global/skin/"); Refer to the document Writing Skinnable XUL and CSS for guidelines on how to make your skins friendly to the global skin, to XUL, and to Mozilla. Stylesheet Syntax To familiarize yourself with the global skin, open up the text file called global.css in the chrome/classic.jar!/skin/classic/global ...
...And 3 more matches
Using the standard theme - Archive of obsolete content
me (the theme currently chosen by the user in the Theme Selector), or even the default theme delivered with your the base application. Applying the standard theme In order to use the theme currently chosen by the user of the base application (the so called "Global Skin"), you have to add the following line to your XUL file: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> This im
ports the styles found in the <tt>global/skin</tt> chrome directory and will make the standard XUL widgets of your application use the selected chosen theme. You do not have to specify a specific file; Mozilla will determine by its own which files in the directory it needs to use. If you are only going to use these global style sheets, you of course do not need a <tt>skin</tt> directory in your extens...
...eed a <tt>skin</tt> directory in your extension package, and also do not have to register a style in the <tt>chrome.manifest</tt>. Adding custom styles In order to provide custom styling for some of your widgets (apart from the standard global skin) you can take two different routes. You can either add multiple <tt>xml-stylesheet</tt> processing instructions to your XUL file, or create an <tt>@im
port</tt> chain. No matter which approach you choose, do not forget to register your custom skin in the <tt>chrome.manifest</tt>. Note that you can also mix these two approaches, although it makes your code more readable when sticking to only one way. Multiple <tt>xml-stylesheet</tt> processing instructions Simply add one <tt>xml-stylesheet</tt> processing instruction for every style sheet you want t...
...it makes your code more readable when sticking to only one way. ...
...And 3 more matches
What XULRunner Provides - Archive of obsolete content
The goal of XULRunner is to provide a solution for deploying XUL applications (primarily Firefox and Thunderbird), as well as providing an embedding mechanism. ...
...ns (primarily Firefox and Thunderbird), as well as providing an embedding mechanism. ...
...See the wikimo:XUL:Installation Story. Extension Manager ...
...And 3 more matches
LiveConnect Overview - Archive of obsolete content
ber or method and fails, the Java exception is passed on to JavaScript for you to handle. Beginning with JavaScript 1.4, you can catch this exception in a try...catch statement. (Although this functionality (along with some others) had been broken in Gecko 1.9 (see bug 391642) as the Mozilla-specific LiveConnect code had not been maintained inside Mozilla, with Java 6 update 11 and 12 building sup
port for reliance on Mozilla's implementation of the generic (and cross-browser) NPAPI plugin code, this has again been fixed.) For example, suppose you are using the Java forName method to assign the name of a Java class to a variable called theClass. The forName method throws an exception if the value you pass it does not evaluate to the name of a Java class. Place the forName assignment statement i...
...ing For specialized handling based on the exception type, use the instanceof operator: try { // ... } catch (e) { if (e instanceof java.io.FileNotFound) { // handling for FileNotFound } else { throw e; } } See Exception Handling Statements for more information about JavaScript exceptions. Java to JavaScript Communication If you want to use JavaScript objects in Java, you must im
port the netscape.javascript package into your Java file. This package defines the following classes: netscape.javascript.JSObject allows Java code to access JavaScript methods and properties. netscape.javascript.JSException allows Java code to handle JavaScript errors. See the JavaScript Reference for more information about these classes. Locating the LiveConnect classes In older versions of the ...
...cript.JSException. This allows your Java code to handle errors in JavaScript code execution which appear in Java as exceptions of type JSException. Accessing JavaScript with JSObject For example, suppose you are working with the Java class called JavaDog. ...
...And 3 more matches
Archive of obsolete content
n a living product, it may not be appropriate to move it here. In general, it may be best to discuss it in the MDN Web Docs room on Matrix before moving content here. .htaccess ( hypertext access ) File Accessing : htaccess files can be opened using any text editor, like Windows Notepad, Vin, Sublime text editor or any other. Syntax highliting sup
port for .htaccess files less. 2015 MDN Fellowship Program Add-ons Archived add-ons documentation. Adding preferences to an extension This article takes the Creating a dynamic status bar extension sample to the next level, adding a popup menu that lets you quickly switch between multiple stocks to watch. It also adds a preference dial...
...kely to be incomplete since we think there are many dark matter projects that we don't know about. If you have information about a new project or extra information about an existing project, please feel free to update this page. Localizing an extension This article expands upon the previous samples on extension writing by adding localization sup
port to our stock watcher extension. Performing a few simple steps makes your extension much easier to localize into various languages without having to edit the XUL or JavaScript files themselves. Makefile - .mk files Misc top level These pages were moved from the top level of MDN in a spate of furious reorganization. MMgc M...
...ollowing instructions are for obtaining and building the Tamarin Tracing source code. For instructions on Tamarin Central, please see The Basics of Web Services Summary: A current hot topic on the web right now are Web Services. This short guide will allow you to learn more about web services. Themes Archived theme documentation. Updating an extension to sup
port multiple Mozilla applications This article shows how to take an existing extension and update it so that it can be used in additional Mozilla applications. We'll build upon the stock watcher extension created in earlier articles in this series, updating it so it can also be used in Thunderbird and Sunbird (previous versions worked only in Firefox). Usin...
...And 3 more matches
Game monetization - Game development
ey cost to make, and you still need a lot of luck for that. How much you charge for your game depends on the market, quality of your game and a lot of other small factors. An arcade iOS title can be sold for 0.99 USD, but a longer RPG-style desktop game on Steam can cost 20 USD; both prices are ok. You have to follow the market and do your own research -- learning from your mistakes quickly is im
portant. In-app purchases Instead of having people pay for your game up front, you can offer a free game with in-app purchases (IAPs.) In this case the game can be acquired without spending a dime -- give the game to the players, but offer in-game currency, bonuses or benefits for real money. Specific examples can include bonus levels, better weapons or spells, or refilling the energy needed to play...
... There are many companies offering advert systems -- you sign up and allow them to show adverts in exchange for a percentage of the earnings. Google AdSense is said to be the most effective one, but it's not designed for games and it's a pretty bad practice to use it for that purpose. Instead of risking of having your account closed and all the money blocked try to use the usual, gamedev targeted
portals like LeadBolt. They offer easy to implement systems to show the adverts in your games and split the earnings with you. Video ads are getting more and more popular, especially in the form of a pre-roll -- they are shown at the beginning of your game while it's still loading. And on the topic of where to put the advertisements in your game it really depends on you. It should be as subtle as pos...
...ds on you. It should be as subtle as possible so as to not annoy the players too much, but visible enough to make them click it or at least take notice. Adding adverts between game sessions on game over screens is a popular approach. Licensing There's an approach that can work as a monetization model on it's own, and that's selling licenses for distribution of your game. There are more and more
portals interested in showing your games on their websites. They follow various strategies to earn money via your games, but you don't have to worry about all that as selling the license is usually a one-time deal. You get the money and they can get creative with using your game to make money. Finding publishers might be hard at first -- try to look for them at the HTML5 Gamedevs forums. If you're we...
...And 3 more matches
CSS and JavaScript accessibility best practices - Learn web development
Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, and understanding of what accessibility is. Objective: To gain familiarity with using CSS and JavaScript appropriately in your web documents to maximise accessibility and not detract from it. CSS and JavaScript are accessible? CSS and JavaScript don't have the same immediate im
portance for accessibility as HTML, but they are still able to help or damage accessibility, depending on how they are used. To put it another way, it is im
portant that you consider some best practice advice to make sure that your use of CSS and JavaScript doesn't ruin the accessibility of your documents. CSS Let's start off by looking at CSS. Correct semantics and user expectation It is possible ...
...g on surfaces is called <strong>condensation</strong>.</p> You might want to add some simple coloring to your emphasised text: strong, em { color: #a60000; } You will however rarely need to style emphasis elements in any significant way. The standard conventions of bold and italic text are very recognisable, and changing the style can cause confusion. For more on emphasis, see Emphasis and im
portance. Abbreviations An element that allows an abbreviation, acronym, or initialization to be associated with its expansion: <p>Web content is marked up using <abbr title="Hypertext Markup Language">HTML</abbr>.</p> Again, you might want to style it in some simple way: abbr { color: #a60000; } The recognised styling convention for abbreviations is a dotted underline, and it is unwise to sig...
...cused (e.g. via tabbing) or activated. The following image shows the highlight in both Firefox (a dotted outline) and Chrome (a blue outline): You can be creative with link styles, as long as you keep giving users feedback when they interact with the links. Something should definitely happen when states change, and you shouldn't get rid of the pointer cursor or the outline -- both are very im
portant accessibility aids for those using keyboard controls. Form elements Elements to allow users to input data into websites: <div> <label for="name">Enter your name</label> <input type="text" id="name" name="name"> </div> You can see some good example CSS in our form-css.html example (see it live also). Most of the CSS you'll write for forms will be for sizing the elements, lining up labe...
...And 3 more matches
Mobile accessibility - Learn web development
Previous Overview: Accessibility Next With web access on mobile devices being so popular and renowned platforms such as iOS and Android having full-fledged accessibility tools, it is im
portant to consider the accessibility of your web content on these platforms. This article looks at mobile-specific accessibility considerations. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, and an understanding of the previous articles in the course. Objective: To understand what problems exist with accessibility on mobile devices, and how to overcome them. Accessibility on mobile devices The state of accessibility -- and sup
port for web standards in general -- is good in modern mobile devices. Long gone are the days when ...
...rowser sniffing and serve them completely separate sites (although quite a few companies still detect usage of mobile devices and serve them a separate mobile domain). These days, mobile devices can usually handle fully-featured websites, and the main platforms even have screenreaders built in to enable visually impaired users to use them successfully. Modern mobile browsers tend to have good sup
port for WAI-ARIA, too. To make a website accessible and usable on mobile, you just need to follow general good web design and accessibility best practices. There are some exceptions that need special consideration for mobile; the main ones are: Control mechanisms -- Make sure interface controls such as buttons are accessible on mobiles (i.e., mainly touchscreen), as well as desktops/laptops (mai...
...sers of different device types. In particular, the most common problems that need to be addressed for mobile are: Suitability of layouts for mobile devices. A multi-column layout won't work as well on a narrow screen, for example, and the text size may need to be increased so it is legible. Such issues can be solved by creating a responsive layout using technologies such as media queries, view
port, and flexbox. Conserving image sizes downloaded. In general, small screen devices won't need images that are as large as their desktop counterparts, and they are more likely to be on slow network connections. Therefore, it is wise to serve smaller images to narrow screen devices as appropriate. You can handle this using responsive image techniques. Thinking about high resolutions. Many mobile d...
...And 3 more matches
What is accessibility? - Learn web development
sibility is the practice of making your websites usable by as many people as possible. We traditionally think of this as being about people with disabilities, but the practice of making sites accessible also benefits other groups such as those using mobile devices, or those with slow network connections. You might also think of accessibility as treating everyone the same, and giving them equal op
portunities, no matter what their ability or circumstances. Just as it is wrong to exclude someone from a physical building because they are in a wheelchair (modern public buildings generally have wheelchair ramps or elevators), it is also not right to exclude someone from a website because they have a visual impairment. We are all different, but we are all human, and therefore have the same human rig...
...move between the different controls of a web form, for example? You can find more details about keyboard controls in our Cross browser testing Using native keyboard accessibility section. In terms of statistics, a significant number of people have mobility impairments. The U.S. Centers for Disease Control and Prevention Disability and Functioning (Noninstitutionalized Adults 18 Years and Over) re
ports the USA "Percent of adults with any physical functioning difficulty: 16.1%". People with cognitive impairments Cognitive impairment refers to a broad range of disabilities, from people with intellectual disabilities who have the most-limited capabilities, to all of us as we age and have difficulty thinking and remembering. The range includes people with mental illnesses, such as depression and...
...nt refers to a broad range of disabilities, from people with intellectual disabilities who have the most-limited capabilities, to all of us as we age and have difficulty thinking and remembering. The range includes people with mental illnesses, such as depression and schizophrenia. It also includes people with learning disabilities, such as dyslexia and attention deficit hyperactivity disorder. Im
portantly, though there is a lot of diversity within clinical definitions of cognitive impairments, people with them experience a common set of functional problems. These include difficulty with understanding content, remembering how to complete tasks, and confusion caused by inconsistent webpage layouts. A good foundation of accessibility for people with cognitive impairments includes: delivering...
...And 3 more matches
Debugging CSS - Learn web development
e mistakes in your code the browser needs to make a guess at what you meant, and it might make a different decision to what you had in mind. In addition, two different browsers might cope with the problem in two different ways. A good first step therefore is to run your HTML and CSS through a validator, to pick up and fix any errors. ...
...n addition, two different browsers might cope with the problem in two different ways. A good first step therefore is to run your HTML and CSS through a validator, to pick up and fix any errors. CSS Validator HTML validator Is the property and value sup
ported by the browser you are testing in? Browsers simply ignore CSS they don't understand. If the property or value you are using is not sup
ported by the browser you are testing in then nothing will break, but that CSS won't be applied. DevTools will generally highlight unsup
ported properties and values in some way. In the screenshot below the browser does not sup
port the subgrid value of grid-template-columns. You can also take a look at the Browser compatibility tables at the bottom of each property page on MDN. These show you browse...
...The below table shows the compat data for the shape-outside property. No compatibility data found. ...
...And 3 more matches
Grids - Learn web development
ercentages, we can use the fr unit to flexibly size grid rows and columns. This unit represents one fraction of the available space in the grid container. Change your track listing to the following definition, creating three 1fr tracks. .container { display: grid; grid-template-columns: 1fr 1fr 1fr; } You should now see that you have flexible tracks. The fr unit distributes space in pro
portion, therefore you can give different positive values to your tracks, for example if you change the definition like so: .container { display: grid; grid-template-columns: 2fr 1fr 1fr; } The first track now gets 2fr of the available space and the other two tracks get 1fr, making the first track larger. You can mix fr units and fixed length tracks -- in such a case the space needed for the...
...er { grid-column: 1 / 3; grid-row: 3; } header, footer { border-radius: 5px; padding: 10px; background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); } aside { border-right: 1px solid #999; } <div class="container"> <header>This is my lovely blog</header> <article> <h1>My article</h1> <p>Duis felis orci, pulvinar id metus ut, rutrum luctus orci. Cras
porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. Sed auctor cursus massa at
porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula. Curabitur vehicula tellus neque, ac ornare ex malesuada et. In vitae convallis lacus. Aliquam erat volutpat. Suspendisse ac imperdiet turpis. Aenean finibus sollicitudin eros pharetra congue. Duis ornare egestas augue ut luctus. Pr...
..." "footer footer"; grid-template-columns: 1fr 3fr; grid-gap: 20px; } header { grid-area: header; } article { grid-area: content; } aside { grid-area: sidebar; } footer { grid-area: footer; } <div class="container"> <header>This is my lovely blog</header> <article> <h1>My article</h1> <p>Duis felis orci, pulvinar id metus ut, rutrum luctus orci. Cras
porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. Sed auctor cursus massa at
porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula. Curabitur vehicula tellus neque, ac ornare ex malesuada et. In vitae convallis lacus. Aliquam erat volutpat. Suspendisse ac imperdiet turpis. Aenean finibus sollicitudin eros pharetra congue. Duis ornare egestas augue ut luctus. Pr...
...And 3 more matches
How CSS is structured - Learn web development
ired with selectors to produce CSS rulesets (or CSS rules). The example below contains two rules: one for the h1 selector and one for the p selector. The colored highlighting identifies the h1 rule. Setting CSS properties to specific values is the primary way of defining layout and styling for a document. The CSS engine calculates which declarations apply to every single element of a page. ...
... a document. The CSS engine calculates which declarations apply to every single element of a page. Im
portant: CSS properties and values are case-sensitive. The property and value in each pair is separated by a colon. (:) Look up different values of properties listed below. Write CSS rules that apply styling to different HTML elements: font-size width background-color color border Im
portant: If a property is unknown, or if a value is not valid for a given property, the declaration is processed as invalid. It is completely ignored by the browser's CSS engine. Im
portant: In CSS (and other web standards), it has been agreed that US spelling is the standard where there is language variation or uncertainty. For example, color should be spelled color, as colour will not work. Func...
... values of properties listed below. Write CSS rules that apply styling to different HTML elements: transform background-image, in particular gradient values color, in particular rgb/rgba/hsl/hsla values @rules CSS @rules (pronounced "at-rules") provide instruction for what CSS should perform or how it should behave. Some @rules are simple with just a keyword and a value. For example, @im
port im
ports a stylesheet into another CSS stylesheet: @im
port 'styles2.css'; One common @rule that you are likely to encounter is @media, which is used to create media queries. Media queries use conditional logic for applying CSS styling. In the example below, the stylesheet defines a default pink background for the <body> element. However, a media query follows that defines a blue background if t...
...And 3 more matches
Advanced form styling - Learn web development
property was created as a way to control what OS- or system-level styling was applied to web form controls. Unfortunately, the behavior of this property's original implementations was very different across browsers, making it not very usable. Newer implementations are more consistent in behavior; interestingly enough, both Chromium-based browsers (Chrome, Opera, Edge), Safari, and Firefox all sup
port the -webkit- prefixed version (-webkit-appearance). Firefox settled on this because web developers mostly seemed to be using the -webkit- prefixed version, so it was better for compatibility. If you look at the reference page you'll see a lot of different possible values listed for -webkit-appearance, however by far the most helpful value, and probably the only one you'll use, is none. This sto...
...ated it. :disabled -- the checkbox (or radio button) is in a disabled state -- it cannot be interacted with. You can see the live result: We've also created a couple of other examples to give you more ideas: Styled radio buttons: Custom radio button styling. Toggle switch example: A checkbox styled to look like a toggle switch. If you view these checkboxes in a browser that doesn't sup
port appearance, your custom design will be lost, but they will still look like checkboxes and be usable. Note: While Internet Explorer doesn't sup
port any version of appearance, the input[type=checkbox]::-ms-check enables the targeting of checkboxes in IE only. This technique works for radio buttons too, despite the name -ms-check. What can be done about the "ugly" elements? Now let's turn our a...
...he style of the range control's drag handle -- to get full control over range styling you'll need to use a whole bunch of complex CSS code, including multiple non-standard, browser-specific pseudo-elements. Check out Styling Cross-Browser Compatible Range Inputs with CSS on CSS tricks for a detailed write up of what's needed. Color input types Input controls of type color are not too bad. In sup
porting browsers, they tend to just give you a block of solid color with a small border. You can remove the border, just leaving the block of color, using something like this: input[type="color"] { border: 0; padding: 0; } However, a custom solution is the only way to get anything significantly different. File input types Inputs of type file are generally OK -- as you saw in our example, it i...
...And 3 more matches
Styling web forms - Learn web development
rerequisites: Basic computer literacy, and a basic understanding of HTML and CSS. Objective: To understand the issues behind styling forms, and learn some of the basic styling techniques that will be useful to you. Why is styling form widgets challenging? Form controls were added to HTML in the HTML 2 specification in 1995; CSS wasn't released until late 1996, and wasn't sup
ported very well by browsers for a few years after that. Browsers relied on the underlying operating system to manage and render form controls. And even with CSS available to style HTML, browser vendors have historically been reluctant to make form controls stylable because users were so accustomed to the visual appearance of their respective platforms. But this has changed. Website owners want form ...
.... Rather, it uses the font-family: system-ui. This is another reason to use <button> elements over their equivalent input types! There's a lot of debate as to whether forms look better using the system default styles, or customized styles designed to match your content. This decision is yours to make, as the designer of your site, or web application. Box sizing All text fields have complete sup
port for every property related to the CSS box model, such as width, height, padding, margin, and border. As before, however, browsers rely on the system default styles when displaying these widgets. It's up to you to define how you wish to blend them into your content. If you want to keep the native look and feel of the widgets, you'll face a little difficulty if you want to give them a consistent si...
...The legend contents will still be spoken in the same way; it is just the visual position that has changed. Note: You could also use the transform property to help you with positioning your <legend>. However, when y...
...And 3 more matches
HTML Cheatsheet - Learn web development
to differentiate a part of the content that we will work on differently Emphasize some text <em>I'm posh</em> I'm posh Italic textt You can mark a phrase in the text in <i>italics</i> You can mark a phrase in the text in italics Bold some text <b>Bold a word or phrase</b>within the text Bold a word or phrase within the text Mark text as im
portant <strong>I'm im
portant</strong> I'm im
portant Highlight some text <mark>Notice me</mark> Notice me Draw a line through irrelevant text <s>I'm irrelevant</s> I'm irrelevant Underline a non-textual annotation This is <u>mispelled</u> This is mispelled Text displayed lower than normal text H<sub>2</sub>O H2O Small t...
... <p>This text is in normal format.</p> <code>This text is in code format.</code> <pre>This text is in predefined format.</pre> This text is in normal format. This text is in code format. This text is in predefined format. Embedded Audio <audio controls="controls" src="https://udn.realityripple.com/samples/b7/193cb038d0.mp3">Your browser does not sup
port the HTML5 Audio element.</audio> Your browser does not sup
port the HTML5 Audio element. Embedded Audio with alternative sources <audio controls="controls"><source src="https://udn.realityripple.com/samples/b7/193cb038d0.mp3" type="audio/mpeg"><source src="https://udn.realityripple.com/samples/f7/14a4179ee6.ogg" type="audio/ogg"> Your browser does not sup
port Audio. </audio...
... Block elements "Block elements," on the other hand, take up the entire width of a webpage. ...
...And 3 more matches
Creating hyperlinks - Learn web development
This article shows the syntax required to make a link, and discusses link best practices. Prerequisites: Basic HTML familiarity, as covered in Getting started with HTML. HTML text formatting, as covered in HTML text fundamentals. Objective: To learn how to implement a hyperlink effectively, and link multiple files together. What is a hyperlink? Hyperlinks are one of the most exciting innovations the Web has to offer. They've been a feature of the Web since the beginning, and are what makes the Web a web. ...
...sic link is created by wrapping the text or other content, see Block level links, inside an <a> element and using the href attribute, also known as a Hypertext Reference, or target, that contains the web address. <p>I'm creating a link to <a href="https://www.mozilla.org/">the Mozilla homepage</a>. </p> This gives us the following result: I'm creating a link to the Mozilla homepage. Adding sup
porting information with the title attribute Another attribute you may want to add to your links is title. The title contains additional information about the link, such as which kind of information the page contains, or things to be aware of on the web site. <p>I'm creating a link to <a href="https://www.mozilla.org/" title="The best place to find more information about Mozilla's missi...
...Mozilla homepage</a>. </p> This gives us the following result and hovering over the link displays the title as a tooltip. I'm creating a link to the Mozilla homepage. Note: A link title is only revealed on mouse hover, which means that people relying on keyboard controls or touchscreens to navigate web pages will have difficulty accessing title information. If a title's information is truly im
portant to the usability of page, then you should present it in a manner that will be accessible to all users, for example by putting it in the regular text. Active learning: creating your own example link Create an HTML document using your local code editor and our getting started template. Inside the HTML body, add one or more paragraphs or other types of content you already know about. Chang...
...And 3 more matches
Adding vector graphics to the Web - Learn web development
CSS or scripted via JavaScript. So why would anyone want to use raster graphics over SVG? Well, SVG does have some disadvantages: SVG can get complicated very quickly, meaning that file sizes can grow; complex SVGs can also take significant processing time in the browser. SVG can be harder to create than raster images, depending on what kind of image you are trying to create. SVG is not sup
ported in older browsers, so may not be suitable if you need to sup
port older versions of Internet Explorer with your web site (SVG started being sup
ported as of IE9.) Raster graphics are arguably better for complex precision images such as photos, for the reasons described above. Note: In Inkscape, save your files as Plain SVG to save space. Also, please refer to this article describing how to pr...
...ding times for any page that uses the image loaded in the future. Cons You cannot manipulate the image with JavaScript. If you want to control the SVG content with CSS, you must include inline CSS styles in your SVG code. (External stylesheets invoked from the SVG file take no effect.) You cannot restyle the image with CSS pseudoclasses (like :focus). ...
... the image loaded in the future. Cons You cannot manipulate the image with JavaScript. If you want to control the SVG content with CSS, you must include inline CSS styles in your SVG code. (External stylesheets invoked from the SVG file take no effect.) You cannot restyle the image with CSS pseudoclasses (like :focus). ...
...And 3 more matches
Images in HTML - Learn web development
would display the alt text instead: So, why would you ever see or need alt text? It can come in handy for a number of reasons: The user is visually impaired, and is using a screen reader to read the web out to them. In fact, having alt text available to describe images is useful to most users. As described above, the spelling of the file or path name might be wrong. The browser doesn't sup
port the image type. Some people still use text-only browsers, such as Lynx, which displays the alt text of images. You may want to provide text for search engines to utilize; for example, search engines can match alt text with search queries. Users have turned off images to reduce data transfer volume and distractions. This is especially common on mobile phones, and in countries where bandwidth is ...
...t fitting the user's needs. The image may also end up looking distorted, if you don't maintain the correct aspect ratio. You should use an image editor to put your image at the correct size before putting it on your webpage. Note: If you do need to alter an image's size, you should use CSS instead. Image titles As with links, you can also add title attributes to images, to provide further sup
porting information if needed. In our example, we could do this: <img src="images/dinosaur.jpg" alt="The head and torso of a dinosaur skeleton; it has a large head with long sharp teeth" width="400" height="341" title="A T-Rex on display in the Manchester University Museum"> This gives us a tooltip on mouse hover, just like link titles: However, this is not recommend...
... Active learning: embedding ...
...And 3 more matches
Aprender y obtener ayuda - Learn web development
t things. This is more the kind of thinking you do while you are in the shower, or during a coffee break. From the studies that neuroscientists have done on brain activity, we have found out that you can't really engage in both ways of learning -- or thinking -- at once. So which one should you choose? You might think that focused learning is better for studying, but in reality, both are very im
portant. Focused thinking is great for concentrating hard on specific subjects, getting into deep problem solving, and improving your mastery of the techniques required -- strengthening the neural pathways in your brain where that information is stored. It isn't however very good at getting an understanding of "the big picture", and unlocking new neural pathways when you are trying to understand new ...
... while and get frustrated because you can't think how to solve it. But then after going on a walk to get some fresh air, you may well find that as your mind wanders, you suddenly make a connection between tool A and tool B, and realize that you can use them together to fix problem C! It isn't always this simple, but it is also surprising how many times this does happen. This also highlights the im
portance of taking regular breaks when you are studying in front of the computer. Different learning materials It is also worth looking at the different types of learning materials that are available, to see which ones are most effective for you to learn with. Textual articles You'll find a lot of written articles on the web to teach you about web design. Like most of this course, for example. Som...
...r. Different learning materials It is also worth looking at the different types of learning materials that are available, to see which ones are most effective for you to learn with. Textual articles You'll find a lot of written articles on the web to teach you about web design. Like most of this course, for example. ...
...And 3 more matches
Web performance - Learn web development
er teachings in our main MDN Web performance section, including overviews of performance APIs, testing and analysis tools, and performance bottleneck gotchas. Guides This topic contains the following guides. The following is a suggested order for working through them; you should definitely start with the first one. ...
...d performance bottleneck gotchas. Guides This topic contains the following guides. The following is a suggested order for working through them; you should definitely start with the first one. The "why" of web performance This article discusses why web performance is im
portant for accessibility, user experience and your business goals. ...
...These perceptions are impacted by actual page load time, idling, responsiveness to user interaction, and the smoothness of scrolling and other animations. ...
...And 3 more matches
Properly configuring server MIME types - Learn web development
This article may contain out of date information, as it has not been significantly updated in many years. Background By default, many web servers are configured to re
port a MIME type of text/plain or application/octet-stream for unknown content types. As new content types are invented or added to web servers, web administrators may fail to add the new MIME types to their web server's configuration. This is a major source of problems for users of Gecko-based browsers, which respect the MIME types as re
ported by web servers and web applications. What are MIME types? MIME types describe the media type of content either in email or served by web servers or web applications and are intended to help guide a web browser in how the content is to be processed and displayed. Examples of MI...
...text/javascript for scripts application/octet-stream meaning "download this file" application/x-java-applet for Java applets application/pdf for PDF documents Technical Background Registered values for MIME types are available in IANA | MIME Media Types. The HTTP specification defines a superset of MIME which is used to describe the media types used on the web. Why are correct MIME types im
portant? If the web server or application re
ports an incorrect MIME type for content, a web browser has no way, according to the HTTP specification, of knowing that the author actually intended the content to be processed and displayed in a way different from that implied by the re
ported MIME type. Some other web browsers, such as Microsoft(R) Internet Explorer, try to allow for misconfigured web s...
...IME type. Some other web browsers, such as Microsoft(R) Internet Explorer, try to allow for misconfigured web servers and applications by guessing what the correct MIME type should be. This has sheltered many web administrators from their own errors, since Internet Explorer will continue to process content as expected even though the web server is misconfigured, e.g. displays an image which is re
ported to be plain text. Serving content using the correct MIME type can also be im
portant for security reasons; it's possible for malicious content to affect the user's computer by pretending to be a safe type of document when it is in fact not. Note: Historically, Firefox has loaded CSS files even if they had the wrong MIME type, as long as the HTML document that requested them was being processe...
...And 3 more matches
Starting our Svelte Todo list app - Learn web development
zed convention to follow, allowing you to find your components easily. Create a file named src/components/Todos.svelte with the following content: <h1>Svelte To-Do list</h1> Change the title element in public/index.html to contain the text Svelte To-do list: <title>Svelte To-Do list</title> Open src/App.svelte and replace its contents with the following: <script> im
port Todos from './components/Todos.svelte' </script> <Todos /> In development mode, Svelte will issue a warning in the browser console when specifying a prop that doesn't exist in the component; in this case we have a name prop being specified when we instantiate the App component inside src/main.js, which isn't used inside App. The console should currently give you a message along the lines o...
...hen specifying a prop that doesn't exist in the component; in this case we have a name prop being specified when we instantiate the App component inside src/main.js, which isn't used inside App. The console should currently give you a message along the lines of "<App> was created with unknown prop 'name'". To get rid of this, remove the name prop from src/main.js; it should now look like so: im
port App from './App.svelte' const app = new App({ target: document.body }) ex
port default app Now if you check your testing server URL you'll see our Todos.svelte component being rendered: Adding static markup For the moment we will start with a static markup representation of our app, so you can see what it will look like. Copy and paste the following into our Todos.svelte component file...
...e technologies that we're treating our <h2> with an id of list-heading as the label that describes the purpose of the list beneath it. Making this association gives the list a more informative context, which could help screen reader users better understand the purpose of it. This seems like a good time to talk about how Svelte deals with accessibility; let's do that now. Svelte accessibility sup
port Svelte has a special emphasis on accessibility. The intention is to encourage developers to write more accessible code "by default". Being a compiler, Svelte can statically analyze our HTML templates to provide accessibility warnings when components are being compiled. Accessibility (shortened to a11y) isn't always easy to get right, but Svelte will help by warning you if you write inaccessible...
...And 3 more matches
Links and Resources
y checklist - guidelines to making Java accessibility. Accessibility Information Resource Center For Developers at Adobe - Flash MX accessibility, PDF document accessibility and ActionScript accessibility. ...
...re are now a few available and excellent online accessibility validators which check single webpages according to checkpoints of WCAG guidelines and then re
ports errors or warnings. WebXACT(TM) from Watchfire(R) Corporation WebXACT(TM) is a free and complete online accessibility validation service that can test single pages for quality, accessibility and privacy issues. The accessibility re
port will contain errors and warnings for "Automatic Checkpoints" and "Manual Checkpoints"; detailed and useful information (line numbers, instances/occurences, textual references to guidelines) will be included for web authors. Cynthia says(TM) from HiSoftware(R) Company "Cynthia says(TM)" is a free online webpage accessibility validation service that identifies accessibility errors in webpa...
...ility, metadata and even alt text attribute quality. Accessibility Valet from WebThing Description and summary to be written. ...
...And 3 more matches
Chrome registration
/to/files Note: The characters @ # ; : ? / are not allowed in the packagename. Firefox 2, Thunderbird 2, and SeaMonkey 1.1 will not find the chrome when packagename is mixed case. If the above example had a packagename of CamelCasePackage, you would get an error message similar to "No chrome registered for chrome://camelcasepackage/path/to/files". Firefox 3, Thunderbird 3, and SeaMonkey 2 sup
port mixed case. Bug resolved in Mozilla 1.9; see bug 132183. Manifest instructions comments # this line is a comment - you can put here whatever you want A line is a comment if it begins with the character '#'. Any following character in the same line is ignored. manifest manifest subdirectory/foo.manifest [flags] This will load a secondary manifest file. This can be useful for separating ...
... flags match. The version string must conform to the Toolkit version format. Note: Versions of Gecko before Gecko 1.8.0.13 and Gecko 1.8.1.5 contained a bug where if you use the comparisons <, > or =, the version string had be two or more characters long. If not, you would get a message in the error console that the appversion flag was not recognized. See bug 380398. platformversion When sup
porting more then one application, it is often more convenient for an extension to specify which Gecko version it is compatible with. This is particularly true for binary components. If there are chrome registration lines which only apply to a particular Gecko version, the flag platformversion=version platformversion<version platformversion<=version platformversion>version platformversion>=version ...
...nt xpcnativewrappers Chrome packages can decide whether to use the XPCNativeWrapper security mechanism to automatically protect their code against malicious content that they might access. See Safely accessing content DOM from chrome for details. This flag is enabled by default since Firefox 1.5. Disabling it manually was possible by specifying xpcnativewrappers=no until Firefox 4. Note: Sup
port for this flag has been removed in Gecko 2.0. You can no longer disable XPCNativeWrappers. To update your add-on to work without this flag: If your add-on depends upon XBL bindings attached to content objects (that is, it needs to be able to call functions or get and set properties created by the XBL binding), you'll need to use the object's wrappedJSObject property to obtain a wrapped object. ...
...And 3 more matches
Eclipse CDT
definition. The results for "Quick Type Hierarchy" will only show those classes in the inheritance tree that override the method. Double click on a class to go straight to its override's definition. Building from Eclipse In short, don't do this. Eclipse doesn't have good facilities for building incrementally in individual directories in the way that Mozilla developers generally require. More im
portantly, unless you're willing to screw up Eclipse's code assistance (in which case why bother using Eclipse) you're going to have to set Eclipse's "Build" step to do a very slow, non-parallel, full rebuild. (See the "Code assistance" section above for why.) Nevertheless, if you understand the above warning and you still want to configure Eclipse's "Build" button to invoke a real build, then read o...
...ll take you straight to the source file and line where the problem occurred. For this to work reliably though, you still need to build using slow -j1 -w builds, so that make outputs non-interleaved "Entering"/"Leaving" lines. It also used to be necessary to add the following two lines to your mozconfig to make the compiler output errors all on a single line, but that may not be needed anymore: ex
port CFLAGS="-fmessage-length=0" ex
port CPPFLAGS="-fmessage-length=0" Debugging To create a debug configuration, open the project properties window, and select "Run/Debug Settings" on the left. Click "New", then select "C/C++ Application". In the window that opens enter the path to your firefox binary (something like {your-obj-dir}/dist/NightlyDebug.app/Contents/MacOS/firefox) and select "Disable a...
...Open Perspective > C/C++". Upgrading GDB on Mac The ancient, barely maintained Apple fork of GDB that comes with Xcode on Mac is really horrible. If you use Mac, you may want to build the latest FSF version of GDB and set Eclipse to use that GDB for debugging. One suggested configuration for building GDB is '--prefix="$HOME" --disable-debug --with-python=/usr' (create an optimized build with sup
port for Python (so that you can use python to much better control when you break etc.), and install it in $HOME/bin). That done, open the workspace preferences, select "C/C++ > Debug > GDB", and set "GDB Debugger" to the full path of your new gdb executable. GDB unexpectedly detaching If GDB starts ignoring your breakpoints, or unexpectedly terminates or detaches from the Firefox process, this may ...
...And 3 more matches
Eclipse CDT Manual Setup
, then get your build going now so that it can be running while you continue with the instructions below. FAQ: Wait, why does Eclipse need an object directory?) Code assistance Out of the box, Eclipse can provide some code assistance for the Mozilla source, but it will be incomplete and often just plain broken. If you set up Eclipse as detailed below, you will experience much better results. Im
portant background To help you make sense of the instructions that follow (and so that you can modify them to meet your own needs if necessary), this section provides some background on what IDEs need in order to provide advanced code assistance, and what Eclipse CDT needs in particular. To be able to provide really good code assistance for a project's source code, IDEs like Eclipse need to carry ou...
...lly update the index" Turning off automatic indexing prevents the CPU intensive indexer from running at various stages during the steps below before we're ready. Select "General > Content Types", expand "Text > C Source File > C++ Source File", click "Add" and add "*.mm". Eclipse CDT doesn't currently understand Objective-C files (although there is a project that promises to add Objective-C sup
port), so for now, this is the best we can do to give Eclipse a chance of expanding its understanding of the source into the Objective-C files. Select "General > Editors > Text Editors". If you want line numbers, tick "Show line numbers". If you want a column marker to mark the 80th column to help with formatting code to Mozilla's 80 character line limit, tick "Show print margin" and set the value to...
...es)" to something large, like "1000000". Eclipse CDT will try to format C/C++ code that you add as you type. However, its default formats are not a good match to Mozilla's style rules. Download this first pass at an Eclipse formatter configuration for Mozilla C/C++ coding style, and install it by opening the workspace preferences, selecting "C/C++ > Code Style > Formatter", and then using the "Im
port" button to im
port that file. The "Active profile" field should then automatically change to "Mozilla". Depending on the area of the code that you work on, you may need to tweak this configuration using the "Edit" button. (Note that the format settings under "General > Editors > Text Editors" have no effect in C/C++ views, since the C/C++ settings are more specific and override those settings. How...
...And 3 more matches
Obsolete Build Caveats and Tips
of deleting all these nuggets of information, it's best to collect them all here and remove them from the majority happy path documentation. Each piece of information should mention the page and the section it originally came from. You can copy in the original text and bold out what has been removed. ...
...ons Visual C++ 9 (VS2008) Professional/Express Download and install the Windows 7 SDK. Note that you need Service Pack 1--for the Express edition it is a separate download. Visual C++ 8 (VS2005) Professional Download and install the Windows 7 SDK. Install this Microsoft hotfix to allow linking to work correctly. Visual C++ 7.1 or Visual C++ 8 (VS2005) Express These versions are not sup
ported and the Windows 7 SDK will not work with them. You need to upgrade to one of the newer Visual C++ versions above. For Gecko 11 or below: you could also download the Windows Vista SDK and follow the instructions there to allow you to build against it. Starting with Gecko 12.0, this SDK is necessary. Note: While this configuration will probably build on mozilla-1.9.1 and mozilla-1.9.0,...
...dows 7 SDK will not work with them. You need to upgrade to one of the newer Visual C++ versions above. For Gecko 11 or below: you could also download the Windows Vista SDK and follow the instructions there to allow you to build against it. Starting with Gecko 12.0, this SDK is necessary. Note: While this configuration will probably build on mozilla-1.9.1 and mozilla-1.9.0, it is not sup
ported. Warning: Due to a bug in old versions of MozillaBuild (prior to 1.6), if you download version 7.1 of the Windows 7 SDK (which is the current version available), your build will fail, often while building cairo with "ocidl.h" errors. In order to fix this issue, you need to use the latest version of MozillaBuild. Windows Vista SDK Obsolete since Gecko 12.0 (Firefox 12.0 / Thunderbird 1...
...And 3 more matches
HTTP Cache
This document describes the New HTTP cache version 2. The code resides in /network/cache2. API Here is a detailed description of the HTTP cache v2 API, examples included. This document only contains what cannot be found or may not be clear directly from the IDL files comments. The cache API is completely thread-safe and non-blocking. There is no IPC sup
port. It's only accessible on the default chrome process. When there is no profile the new HTTP cache works, but everything is stored only in memory not obeying any particular limits. It is strongly encoraged to NOT USE the OLD cache API any more - nsICacheService et al. It will soon be completely obsoleted and removed (bug 913828). nsICacheStorageService The HTTP cache entry-point. Accessible as a service o...
... Two storage objects created with in any way different nsILoadContextInfo arguments are strictly and completely distinct and cache entries in them do not ove...
...ionality: asyncEvictStorage (bug 977766), asyncVisitStorage (bug 916052) nsICacheEntryOpenCallback //github.com/RealityRipple/UXP/blob/master/netwerk/cache2/nsICacheEntryOpenCallback.idl The result of nsICacheStorage.asyncOpenURI is always and only sent to callbacks on this interface. These callbacks are ensured to be invoked when asyncOpenURI returns NS_OK. Im
portant difference in behavior from the old cache: when the cache entry object is already present in memory or open as "force-new" (a.k.a "open-truncate") this callback is invoked sooner then the asyncOpenURI method returns (i.e. immediately); there is currently no way to opt out of this feature (watch bug 938186). nsICacheEntry //github.com/RealityRipple/UXP/blob/master/netwerk/cache2/ns...
...And 3 more matches
How to implement a custom autocomplete search component
The XUL textbox element sup
ports an autocomplete mechanism that is used to create a textbox with a popup containing a list of possible completions for what the user has started to type. There are actually two autocomplete mechanisms: An older mechanism that is part of the "xpfe" codebase and is used in older applications such as Thunderbird and SeaMonkey. A newer and slightly simplified mechanism that is used in "toolkit" applications such as Firefox and XULRunner. Thunderbird 2.x and SeaMonkey 1.1.x sup
port the toolkit interfaces, although they do not use the same autocomplete widget. To use autocomplete with a XUL textbox, all you need to do is set some attributes: <textbox type="autocomplete" autocompletesearch="history"/> The type="autocomplete" turns on the autocomplete mech...
...complete with a XUL textbox, all you need to do is set some attributes: <textbox type="autocomplete" autocompletesearch="history"/> The type="autocomplete" turns on the autocomplete mechanism and the autocompletesearch="history" sets the source for the autocomplete. There are more options and features, see XUL:textbox_(Firefox_autocomplete) for more details. The toolkit mechanism has built-in sup
port for several autocomplete sources, including: history: Search the browser's URL history (Firefox: 1.0+; SeaMonkey: 1.1+) form-history: Search the values that the user has entered into form fields. (Firefox: 1.0+; SeaMonkey: 2.0+) file: Search file names (Firefox: 2.0+; Thunderbird: 2.0+; SeaMonkey: 1.1+; GTK builds only). The component uses the autocompletesearchparam attribute or searchParam ...
...care about compatibility with older Gecko versions First copy the following JavaScript code into a file named basic_autocomplete.js into the components directory (or whatever components folder is appropriate in your case): Warning: The UUID used below in chrome.manifest and assigned to CLASS_ID must be changed before use. ...
...And 3 more matches
CustomizableUI.jsm
This module is only available from Firefox 29 onwards. The CustomizableUI.jsm JavaScript code module allows you to interact with customizable buttons and items in Firefox's main window UI. It is available in the Firefox window as the CustomizableUI property on the window. If you want to use it from a JSM or another context without a window reference, you need to im
port it yourself: Components.utils.im
port("resource:///modules/CustomizableUI.jsm"); Introduction The module is intended for two primary purposes: Allow adding, moving and removing customizable widgets. Manage the areas in which these widgets are shown. Note that it is expressly not really aware about the specific UI used by users to make customizations. This is handled by CustomizeMode.jsm, which interacts with C...
...ation of the user interface. In order to use this facility, you should create a plain JS object which defines some of the event handlers defined below. Not all event handler methods need to be defined. CustomizableUI will catch exceptions. Events are dispatched synchronously on the UI thread, so if you can delay any/some of your processing, that is advisable. The following event handlers are sup
ported: onWidgetAdded(aWidgetId, aArea, aPosition) Fired when a widget is added to an area. aWidgetId is the widget that was added, aArea the area it was added to, and aPosition the position in which it was added. onWidgetMoved(aWidgetId, aArea, aOldPosition, aNewPosition) Fired when a widget is moved within its area. aWidgetId is the widget that was moved, aArea the area it was moved in, aOldPo...
...re has been 1 endBatchUpdate call for each beginBatchUpdate call). If any of the endBatchUpdate calls pass aForceDirty=true, we will flush to the prefs file. Parameters aForceDirty force CustomizableUI to flush to the prefs file when all batch updates have finished. createWidget() Create a widget. To create a widget, you should pass an object with its desired properties. For a list of sup
ported properties, see API-provided widgets. Parameters aProperties the specification for the widget Return value A wrapper around the created widget. Note: if your extension is compatible with versions of Firefox below 29, i.e. before CustomizableUI was introduced, then you have to make sure that in case of running on newer browsers, XUL overlay does not contain description of the button tha...
...And 3 more matches
JNI.jsm
The most common use for this module is in add-ons and other works on Firefox for Android (Fennec). ...
...The most common use for this module is in add-ons and other works on Firefox for Android (Fennec). ...
...The most common use for this module is in add-ons and other works on Firefox for Android (Fennec). ...
...And 3 more matches
Index
like Firefox and Thunderbird from Build Instructions. This is only necessary once. 3 Bootstrapping a new locale Localization, Mercurial, Translate, bit bucket (see also https://developer.mozilla.org/en/Create_a_new_localization) 4 Encodings for localization files Internationalization, Localization When creating a localization for Mozilla products, it's im
portant to be aware of the encoding of the files that you generate. 5 Index Localization Found 42 pages: 6 L10n Checks Internationalization, Localization, Localization:Tools, Tools L10n Checks is a Python script and library similar to compare-locales. It allows Mozilla localizers to easily check their work. 7 L10n testing with xcode Firefox for ...
...illa, l10n, l12y This document provides best practices for developers to create localizable code, and describes how to avoid some localizability (l12y) common mistakes. 10 Localization notes Guide, Internationalization, Localization, Mozilla Localizers usually work on the localizable files without the context of the source files including the localized strings; it is im
portant to add comments to the localizable files themselves, too. These comments are generally referred to as localization notes. There is an established format for those, which is described in this document. 11 Localization prerequisites Internationalization, Localization, delete To work on localization, you need a subset of the Mozilla Build Prerequisites. On Mac and Linux, you ...
...irefox for iOS uses the XLIFF XML-based file format to hold and transfer localization data. XLIFF (eXtensible Localisation Interchange File Format) is a localization standard governed by the OASIS standards body. The goal of the standard is to have an XML-based format to use when exchanging localization data between tools without the potential of data loss or corruption. Most translation tools sup
port the XLIFF standard, making localizing the XLIFF files for Firefox for iOS easy to do using translation tools. Editing the raw XLIFF file is also rather easy, especially if you're already familiar with XML. This tutorial will walk you through the steps you need to take to translation strings within an XLIFF file. 21 Localizing extension descriptions Add-ons, Extensions, Guide, Inter...
...And 3 more matches
Performance
A development environment is not required. Benchmarking Tips on generating valid performance metrics. Performance best practices in extensions A performance "best practices" guide for extension developers. Measuring Add-on Startup Performance A guide for add-on developers on how to set up a performance testing environment. ...
...tion techniques. Automated Performance Testing and Sheriffing Information on automated performance testing and sheriffing at Mozilla. Best practices for Front-end Engineers Tips for reducing impacts on browser performance in front-end code. Memory profiling and leak detection tools The Developer Tools "Memory" panel The memory panel in the devtools sup
ports taking heap snapshots, diffing them, computing dominator trees to surface "heavy retainers", and recording allocation stacks. about:memory about:memory is the easiest-to-use tool for measuring memory usage in Mozilla code, and is the best place to start. It also lets you do other memory-related operations like trigger GC and CC, dump GC & CC logs, and dump DMD re
ports. about...
...ng dominator trees to surface "heavy retainers", and recording allocation stacks. about:memory about:memory is the easiest-to-use tool for measuring memory usage in Mozilla code, and is the best place to start. It also lets you do other memory-related operations like trigger GC and CC, dump GC & CC logs, and dump DMD re
ports. about:memory is built on top of Firefox's memory re
porting infrastructure. DMD DMD is a tool that identifies shortcomings in about:memory's measurements, and can also do multiple kinds of general heap profiling. Are We Slim Yet areweslimyet.com (a.k.a. AWSY) is a memory usage and regression tracker. BloatView BloatView prints per-class statistics on allocations and refcounts, and provides gross numbers on the amount of me...
...And 3 more matches
McCoy
McCoy uses XULrunner which is bound to break, for details see this post. Mozilla calls McCoy a "simple system" which is a clear sign that something probably is not working, and indeed, is not. McCoy is an application that allows add-on authors to provide secure updates to their users. Applications periodically look for and install updates to their add-ons. It's im
portant that the update information retrieved has not been tampered with since being written by the add-on author. Specifically, it focuses on the process of digitally signing update manifests so the applications can verify the integrity of a manifest retrieved over normally insecure channels. If you want to learn about the technical details of McCoy then visit the project wiki. Installing McCoy To use McCoy you need to ...
...eys and other McCoy data are kept in a profile folder separate from the application so you can uninstall and reinstall without losing your precious keys. Backing up data If you need to backup your data or move it from one machine to another you need to take a copy of the profile folder. This is located in: %APPDATA%\Mozilla\McCoy (Windows) ~/.mozilla/mccoy (Linux) ~/Library/Application Sup
port/McCoy (Mac OS X) It is highly recommended that you back up your profile folder and store it in a safe location whenever you create a new key; without a backup, there is no way to recover your private keys if they are lost! Running McCoy To run McCoy simply run the mccoy executable (or the McCoy application on OS X). The first time it runs it will ask you to create a master password. It is str...
... run McCoy simply run the mccoy executable (or the McCoy application on OS X). The first time it runs it will ask you to create a master password. It is strongly recommended that you use a password to protect your McCoy data. Once you have a password set you can change it from the Keys menu and you will have to enter it each time you run McCoy. ...
...And 3 more matches
NSPR Contributor Guide
We (the NSPR module owners) sometimes disappoint our contributors when we must reject their contributions. We reject contributions for a variety of reasons. Some of these reasons are not obvious to an outside observer. NSPR wishes to document some guidelines for those who would contribute to NSPR. These guidelines should help the contributor in crafting his contribution, increasing its likelihood for acceptance. ...
...lse; pay close attention to the rights of your "Day-Job" employer. If you snatched it from somewhere else, tell us where; show us where the right to incorporate it into NSPR exists. License under MPL or GPL When you contribute material to NSPR, you agree to allow your contribution to be licensed under the MPL or GPL. BugFixes Use Bugzilla to track bugs. Document the bug or use an existing re
port. Be verbose in describing what you are doing and why. Include your changes as diffs in an attachment to the BugZilla re
port. Use a coding style consistent with the source file you are changing. New Features For purposes of this paper, a "new feature" is defined as some API addition that goes into the core NSPR library, for example: libnspr4.dll NSPR is mostly complete. New APIs are driven most...
...ry, for example: libnspr4.dll NSPR is mostly complete. New APIs are driven mostly by the OS vendors as they add new features. Should you decide that there's something that NSPR does not cover that should be covered, let's talk. Your proposed API should encapsulate a relatively low level capability as would be found in a system call or libc. Your new feature must be implemented on all platforms sup
ported by NSPR. When you consider a new API for NSPR ask yourself if your proposed feature can implement it across all platforms sup
ported by NSPR. If several platforms cannot be made to implement your API, then it is not a good candidate for inclusion in NSPR. Before you begin what may be a substantial effort in making a candidate feature for NSPR, talk to us. We may tell you that you have a good ide...
...And 3 more matches
4.3 Release Notes
Release Date: 01 April 2009 Introduction Network Security Services for Java (JSS) 4.3 is a minor release with the following new features: SQLite-Based Shareable Certificate and Key Databases libpkix: an RFC 3280 Compliant Certificate Path Validation Library PKCS11 needsLogin method sup
port HmacSHA256, HmacSHA384, and HmacSHA512 sup
port for all NSS 3.12 initialization options JSS 4.3 is tri-licensed under MPL 1.1/GPL 2.0/LGPL 2.1. New in JSS 4.3 A list of bug fixes and enhancement requests were implemented in this release can be obtained by running this bugzilla query JSS 4.3 requires NSS 3.12 or higher. New SQLite-Based Shareable Certificate and Key Databases by prepending the string "sql:" to the directory path passed to configdir parameter for Crypomanager.initiali...
...uires NSS 3.12 or higher. New SQLite-Based Shareable Certificate and Key Databases by prepending the string "sql:" to the directory path passed to configdir parameter for Crypomanager.initialize method or using the NSS environment variable NSS_DEFAULT_DB_TYPE. ...
... and Key Databases by prepending the string "sql:" to the directory path passed to configdir parameter for Crypomanager.initialize method or using the NSS environment variable NSS_DEFAULT_DB_TYPE. ...
...And 3 more matches
NSS_3.12.1_release_notes.html
istributions to get the NSPR 4.7.1 header files and shared libraries, which NSS 3.12.1 requires. NSPR 4.7.1 binary distributions are in https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.7.1/. New in NSS 3.12.1 New functions in the nss shared library: CERT_NameToAsciiInvertible (see cert.h) Convert an CERTName into its RFC1485 encoded equivalent. Returns a string that must be freed with
PORT_Free(). Caller chooses encoding rules. CERT_EncodeSubjectKeyID (see cert.h) Encode Certificate SKID (Subject Key ID) extension. PK11_GetAllSlotsForCert (see pk11pub.h) PK11_GetAllSlotsForCert returns all the slots that a given certificate exists on, since it's possible for a cert to exist on more than one PKCS#11 token. Levels of standards conformance strictness for CERT_NameToAsciiInvertible...
... test Bug 330622: certutil's usage messages incorrectly document certain options Bug 330628: coreconf/Linux.mk should _not_ default to x86 but result in an error if host is not recognized Bug 359302: Remove the sslsample code from NSS source tree Bug 372241: Need more versatile form of CERT_NameToAscii Bug 390296: NSS ignores subject CN even when SAN contains no dNSName Bug 401928: Sup
port generalized PKCS#5 v2 PBEs Bug 403543: pkix: need a way to enable/disable AIA cert fetching Bug 408847: pkix_OcspChecker_Check does not sup
port specified responder (and given signercert) Bug 414003: Crash [[@ CERT_DecodeCertPackage] sometimes with this testcase Bug 415167: Memory leak in certutil Bug 417399: Arena Allocation results are not checked in pkix_pl_InfoAccess_ParseLocation ...
...hing Bug 408847: pkix_OcspChecker_Check does not sup
port specified responder (and given signercert) Bug 414003: Crash [[@ CERT_DecodeCertPackage] sometimes with this testcase Bug 415167: Memory leak in certutil Bug 417399: Arena Allocation results are not checked in pkix_pl_InfoAccess_ParseLocation Bug 420644: Improve SSL tracing of key derivation Bug 426886: Use const char* in PK11_Im
portCertForKey Bug 428103: CERT_EncodeSubjectKeyID is not defined in any public header file Bug 429716: debug builds of libPKIX unconditionally dump socket traffic to stdout Bug 430368: vfychain -t option is undocumented Bug 430369: vfychain -o succeeds even if -pp is not specified Bug 430399: vfychain -pp crashes Bug 430405: Error log is not produced by CERT_PKIXVerifyCert Bug 430743: U...
...And 3 more matches
NSS 3.12.5 release_notes
s. If the string parameter is NULL (as opposed to empty, zero length), then the softoken default is used. These are equivalent to the parameters for PK11_ConfigurePKCS11(). See the following struct in nss.h for details: NSSInitParametersStr Other new functions In secmod.h: SECMOD_GetSkipFirstFlag SECMOD_GetDefaultModDBFlag In prlink.h NSS_SecureMemcmp
PORT_LoadLibraryFromOrigin Modified functions SGN_Update (see cryptohi.h) The parameter "input" of this function is changed from unsigned char * to const unsigned char *. PK11_ConfigurePKCS11 (see nss.h) The name of some parameters have been slightly changed ("des" became "desc"). Deprecated headers The header file key.h is deprecated. Please use keyhi.h inste...
...se use keyhi.h instead. Additional documentation In pk11pub.h: The caller of PK11_DEREncodePublicKey should free the returned SECItem with a SECITEM_FreeItem(..., PR_TRUE) call. PK11_ReadRawAttribute allocates the buffer for returning the attribute value. The caller of PK11_ReadRawAttribute should free the data buffer pointed to by item using a SECITEM_FreeItem(item, PR_FALSE) or
PORT_Free(item->data) call. In secasn1.h: If both pool and dest are NULL, the caller should free the returned SECItem with a SECITEM_FreeItem(..., PR_TRUE) call. If pool is NULL but dest is not NULL, the caller should free the data buffer pointed to by dest with a SECITEM_FreeItem(dest, PR_FALSE) or
PORT_Free(dest->data) call. Environment variables NSS_FIPS Will start NSS...
...been fixed in NSS 3.12.5. ...
...And 3 more matches
NSS 3.20 release notes
3.20, which is a minor release. Distribution Information The HG tag is NSS_3_20_RTM. NSS 3.20 requires NSPR 4.10.8 or newer. NSS 3.20 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_20_RTM/src/ New in NSS 3.20 New Functionality The TLS library has been extended to sup
port DHE ciphersuites in server applications. New Functions in ssl.h SSL_DHEGroupPrefSet - Configure the set of allowed/enabled DHE group parameters that can be used by NSS for a server socket. SSL_EnableWeakDHEPrimeGroup - Enable the use of weak DHE group parameters that are smaller than default minimum size of the library. New Types in sslt.h SSLDHEGroupType - Enumera...
...m size of the library. ...
...he TLS library has been extended to sup
port DHE ciphersuites in server applications. For backward compatibility reasons, the server side implementation of the TLS library keeps all DHE ciphersuites disabled by default. They can be enabled with the new socket option SSL_ENABLE_SERVER_DHE and the SSL_OptionSet or the SSL_OptionSetDefault API. The server side implementation of the TLS does not sup
port session tickets while using a DHE ciphersuite (see bug 1174677). Sup
port for the following ciphersuites has been added: TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 By default, the server side TLS implementation will use DHE parameters with a size of 2048 bits when using DHE ciphersuites. NSS embeds fixed DHE param...
...And 3 more matches
NSS 3.47 release notes
ges to default TLS configuration The next NSS team plans to make two changes to the default TLS configuration in NSS 3.48, which will be released in early December: TLS 1.3 will be the default maximum TLS version. See Bug 1573118 for details. TLS extended master secret will be enabled by default, where possible. See Bug 1575411 for details. ...
...589120 - More CBC padding tests Bug 1465613 - Add ability to distrust certificates issued after a certain date for a specified root cert Bug 1588557 - Bad debug statement in tls13con.c Bug 1579060 - mozilla::pkix tag definitions for issuerUniqueID and subjectUniqueID shouldn't have the CONSTRUCTED bit set Bug 1583068 - NSS 3.47 should pick up fix from bug 1575821 (NSPR 4.23) Bug 1152625 - Sup
port AES HW acceleration on ARMv8 Bug 1549225 - Disable DSA signature schemes for TLS 1.3 Bug 1586947 - PK11_Im
portAndReturnPrivateKey does not store nickname for EC keys Bug 1586456 - Unnecessary conditional in pki3hack, pk11load and stanpcertdb Bug 1576307 - Check mechanism param and param length before casting to mechanism-specific structs Bug 1577953 - Sup
port longer (up to RFC maximum) HKDF ...
... - PK11_Im
portAndReturnPrivateKey does not store nickname for EC keys Bug 1586456 - Unnecessary conditional in pki3hack, pk11load and stanpcertdb Bug 1576307 - Check mechanism param and param length before casting to mechanism-specific structs Bug 1577953 - Sup
port longer (up to RFC maximum) HKDF outputs Bug 1508776 - Remove refcounting from sftk_FreeSession (CVE-2019-11756) Bug 1494063 - Sup
port TLS Ex
porter in tstclnt and selfserv Bug 1581024 - Heap overflow in NSS utility "derdump" Bug 1582343 - Soft token MAC verification not constant time Bug 1578238 - Handle invald tag sizes for CKM_AES_GCM Bug 1576295 - Check all bounds when encrypting with SEED_CBC Bug 1580286 - NSS rejects TLS 1.2 records with large padding with SHA384 HMAC Bug 1577448 - Create additional nested S/MIME test...
...And 3 more matches
NSS 3.52 release notes
n Distribution Information The HG tag is NSS_3_52_RTM. NSS 3.52 requires NSPR 4.25 or newer. NSS 3.52 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_52_RTM/src/ Other releases are available in NSS Releases. Notable Changes in NSS 3.52 Bug 1603628 - Update NSS to sup
port PKCS #11 v3.0. Note: This change modifies the CK_GCM_PARAMS struct to include the ulIvBits field which, prior to PKCS #11 v3.0, was ambiguously defined and not included in the NSS definition. If an application is recompiled with NSS 3.52+, this field must be initialized to a value corresponding to ulIvLen. Alternatively, defining NSS_PKCS11_2_0_COMPAT will yield the old definition. See the...
...the CK_GCM_PARAMS struct to include the ulIvBits field which, prior to PKCS #11 v3.0, was ambiguously defined and not included in the NSS definition. If an application is recompiled with NSS 3.52+, this field must be initialized to a value corresponding to ulIvLen. Alternatively, defining NSS_PKCS11_2_0_COMPAT will yield the old definition. See the bug for more information. Bug 1623374 - Sup
port new PKCS #11 v3.0 Message Interface for AES-GCM and ChaChaPoly. Bug 1612493 - Integrate AVX2 ChaCha20, Poly1305, and ChaCha20Poly1305 from HACL*. Bugs fixed in NSS 3.52 Bug 1633498 - Fix unused variable 'getauxval' error on iOS compilation. Bug 1630721 - Add Softoken functions for FIPS. Bug 1630458 - Fix problem of GYP MSVC builds not producing debug symbol files. Bug 1629663 - Add IKEv1...
...d ChaCha20Poly1305 from HACL*. Bugs fixed in NSS 3.52 Bug 1633498 - Fix unused variable 'getauxval' error on iOS compilation. Bug 1630721 - Add Softoken functions for FIPS. Bug 1630458 - Fix problem of GYP MSVC builds not producing debug symbol files. Bug 1629663 - Add IKEv1 Quick Mode KDF. Bug 1629661 - MPConfig calls in SSL initialize policy before NSS is initialized. Bug 1629655 - Sup
port temporary session objects in ckfw. Bug 1629105 - Add PKCS11 v3.0 functions to module debug logger. Bug 1626751 - Fix error in generation of fuzz32 docker image after updates. Bug 1625133 - Fix implicit declaration of function 'getopt' error. Bug 1624864 - Allow building of gcm-arm32-neon on non-armv7 architectures. Bug 1624402 - Fix compilation error in Firefox Android. Bug 1624130 - Requir...
...And 3 more matches
NSS sources building testing
and NSS source code have recently been re-organized into a new directory structure. In past versions, all files were located in a directory hierarchy that started with the "mozilla" prefix. The NSPR base library was located in directory mozilla/nsprpub. The subdirectories dbm, security/dbm, security/coreconf, security/nss were part of the NSS sources.) The nss directory contains the following im
portant subdirectories: nss/coreconf Contains knowledge for cross platform building. nss/lib Contains all the library code that is used to create the runtime libraries used by applications. nss/cmd Contains a set of various tool programs that are built using NSS. Several tools are general purpose and can be used to inspect and manipulate the storage files that software using the NSS library...
... the NSS library creates and modifies. Other tools are only used for testing purposes. However, all these tools are good examples of how to write software that makes use of the NSS library. nss/test This directory contains the NSS test suite, which is routinely used to ensure that changes to NSS don't introduce regressions. nss/gtests Code for NSS unit tests running in Googletest. It is im
portant to mention the difference between internal NSS code and ex
ported interfaces. Software that would like to use the NSS library must use only the ex
ported interfaces. These can be found by looking at the files with the .def file extension, inside the nss/lib directory hierarchy. Any C function that isn't contained in .def files is strictly for private use within NSS, and applications and test too...
...f files, NSS promises that the binary function interface (ABI) will remain stable. Building NSS NSS is built using gyp and ninja, or with make on systems that don't have those tools. The complete build instructions include more information. Once the build is done, you can find the build output below directory dist/?, where ? will be a name dynamically derived from your system's architecture. ...
...And 3 more matches
NSS tools : certutil
w certificate will derive its authenticity. Use the exact nickname or alias of the CA certificate, or use the CA's email address. Bracket the issuer string with quotation marks if it contains spaces. -d [prefix]directory Specify the database directory containing the certificate and key database files. certutil sup
ports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new SQLite databases (cert9.db, key4.db, and pkcs11.txt). NSS recognizes the following prefixes: . sql: requests the newer database . dbm: requests the legacy database If no prefix is specified the default type is retrie...
...ile name for new certificates or binary certificate requests. Bracket the output-file string with quotation marks if it contains spaces. If this argument is not used the output destination defaults to standard output. -P dbPrefix Specify the prefix used on the certificate and key database file. This argument is provided to sup
port legacy servers. Most applications do not use a database prefix. -p phone Specify a contact telephone number to include in new certificates or certificate requests. Bracket this string with quotation marks if it contains spaces. -q pqgfile or curve-name Read an alternate PQG value from the specified file when generating DSA key pa...
...ces. -q pqgfile or curve-name Read an alternate PQG value from the specified file when generating DSA key pairs. If this argument is not used,certutil generates its own PQG value. PQG files are created with a separate DSA utility. ...
...And 3 more matches
TLS Cipher Suite Discovery
no TLS implementation offers all known cipher suites at all times. An implementation that claimed to offer all defined Cipher Suites would only be able to make that claim for a short time until another new Cipher Suite was defined. At any time, any real implementation implements some subset of the complete set of well-defined cipher suites. Each new release of a TLS implementation may contain sup
port for new Cipher Suites not sup
ported in previous versions. When a new version of a TLS Implementation is made available for use by applications, those applications may wish to immediately use the newly sup
ported Cipher Suites found in the new version, without the application needing to be modified and re-released to know about these new cipher suites. To that end, NSS's libSSL offers a way for app...
...n a new version of a TLS Implementation is made available for use by applications, those applications may wish to immediately use the newly sup
ported Cipher Suites found in the new version, without the application needing to be modified and re-released to know about these new cipher suites. To that end, NSS's libSSL offers a way for applications to discover at run time the set of Cipher Suites sup
ported by that version of libSSL. ...
...pplications may wish to immediately use the newly sup
ported Cipher Suites found in the new version, without the application needing to be modified and re-released to know about these new cipher suites. To that end, NSS's libSSL offers a way for applications to discover at run time the set of Cipher Suites sup
ported by that version of libSSL. libSSL provides enough information about each of the sup
ported cipher suites that the application can construct a display of that information from which the user can choose which cipher suites his application will attempt to use. Here are the details of how an NSS-based application learns what cipher suites are sup
ported and obtains the information to display to the user. libSSL offers a public table of well defined cipher suite numbers. The cipher suite...
...And 3 more matches
Bytecode Descriptions
pr. Emitting the same bytecode for these two expressions would be a bug. Per spec, the latter throws a ReferenceError if x doesn't exist. Format: JOF_IC Pos Stack: val => (+val) The unary + operator. +val doesn't do any actual math. It just calls ToNumber(val). The conversion can call .toString()/.valueOf() methods and can throw. The result on success is always a Number. (Per spec, unary - sup
ports BigInts, but unary + does not.) Format: JOF_IC Neg Stack: val => (-val) The unary - operator. Convert val to a numeric value, then push -val. The conversion can call .toString()/.valueOf() methods and can throw. The result on success is always numeric. Format: JOF_IC BitNot Stack: val => (~val) The bitwise NOT operator (~). val is converted to an integer, then bitwise negated. The conversi...
...erty on the global. This must be used only in scopes where this refers to the global this. NewTarget Stack: => new.target Push the value of new.target. The result is a constructor or undefined. This must be used only in scripts where new.target is allowed: non-arrow function scripts and other scripts that have a non-arrow function script on the scope chain. Implements: GetNewTarget. DynamicIm
port Stack: moduleId => promise Dynamic im
port of the module specified by the string value on the top of the stack. Implements: Im
port Calls. Im
portMeta Stack: => im
port.meta Push the im
port.meta object. This must be used only in module code. Objects Creating objects NewInit Stack: => obj Create and push a new object with no properties. Format: JOF_IC NewObject, NewObjectWithGroup Operands...
...lly push or pop any values. Its use count of 2 is a lie to make the stack depth math work for this very odd control flow instruction. JSOp::Gosub is considered to have two "successors": the target of offset, which is the actual next instruction to run; and the instruction immediately following JSOp::Gosub, even though it won't run until later. We define the successor graph this way in order to sup
port knowing the stack depth at that instruction without first reading the whole finally block. The stack depth at that instruction is, as it happens, the current stack depth minus 2. So this instruction gets nuses == 2. Unfortunately there is a price to be paid in horribleness. When JSOp::Gosub runs, it leaves two values on the stack that the stack depth math doesn't know about. It jumps to the final...
...And 3 more matches
Thread Sanitizer
ral. ...
...build configuration Create the build configuration file .mozconfig with the following content in your mozilla-central directory: mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-tsan mk_add_options MOZ_MAKE_FLAGS=-j12 # Enable LLVM specific code and build workarounds ac_add_options --enable-thread-sanitizer # If clang is already in your $PATH, then these can simply be: # ex
port CC=clang # ex
port CXX=clang++ ex
port CC="/path/to/clang" ex
port CXX="/path/to/clang++" # llvm-symbolizer displays much more complete backtraces when data races are detected. # If it's not already in your $PATH, then uncomment this next line: #ex
port LLVM_SYMBOLIZER="/path/to/llvm-symbolizer" # Add TSan to our compiler flags ex
port CFLAGS="-fsanitize=thread -fPIC -pie" ex
port CXXFLAGS="-fsanitize=thread -fPIC -pi...
...er flags ex
port CFLAGS="-fsanitize=thread -fPIC -pie" ex
port CXXFLAGS="-fsanitize=thread -fPIC -pie" # Additionally, we need the TSan flag during linking. Normally, our C/CXXFLAGS would # be used during linking as well but there is at least one place in our build where # our CFLAGS are not added during linking. ...
...And 3 more matches
Web Replay
ing. Similarly, executions which run out of memory at some point can't be reliably replayed. Executions which are stopped at some point by the slow script dialog can't be reliably replayed. Keeping track of the exact point where an interrupt occurred would require quite a bit of recording overhead, and it doesn't seem worth it to try to do this. The following executions are unlikely to be sup
ported by the initial release, but should be able to be handled at some point in the future: On x64, asm.js code relies on mprotect to handle out of bounds heap accesses; mprotect works differently while replaying, so some cooperation will be needed between the asm.js exception handler and the dirty memory exception handler. Shared array buffers can be used by web content to introduce data races t...
...on the contents of those buffers, going against a fundamental assumption of the record/replay infrastructure. Recording and replaying executions using these buffers will require new techniques like treating all accesses on the buffers as atomic (probably unacceptable overhead) or performing all accesses on the buffer on a single core and keeping track of context switches. DOM workers are not sup
ported yet. For simplicity, debugger integration is currently only able to handle JS code that runs on the main thread. WebGL is not sup
ported yet, as it uses a pretty different rendering path from normal web content. Media elements are not sup
ported yet, as many of these run third party multithreaded code which hasn't been tested with the infrastructure.
Porting Almost all implementation work s...
... The difficulties are in figuring out the set of system library APIs to intercept, in getting the memory management and dirty memory parts of the rewind infrastructure to work, and in handling the different graphics and IPC pathways on different platforms. ...
...And 3 more matches
Gecko Roles
ROLE_MENUBAR Represents the menu bar (positioned beneath the title bar of a window on most platforms or at the top of the screen on Mac OS X) from which menus are selected by the user. ROLE_SCROLLBAR Represents a vertical or horizontal scroll bar, which is part of the client area or used in a control. ...
... ROLE_MENUBAR Represents the menu bar (positioned beneath the title bar of a window on most platforms or at the top of the screen on Mac OS X) from which menus are selected by the user. ROLE_SCROLLBAR Represents a vertical or horizontal scroll bar, which is part of the client area or used in a control. ...
...nts an alert or a condition that a user should be notified about. Assistive Technologies typically respond to the role by reading the entire onscreen contents of containers advertising this role. Should be used for warning dialogs, etc. ROLE_WINDOW Represents the window frame, which contains child objects such as a title bar, client, and other objects contained in a window. The role is sup
ported automatically by Microsoft Windows. ROLE_INTERNAL_FRAME A sub-document. ROLE_MENUPOPUP Represents a menu, which presents a list of options from which the user can make a selection to perform an action. ROLE_MENUITEM Represents a menu item, which is an entry in a menu that a user can choose to carry out a command, select an option. ROLE_TOOLTIP Represents a toolti...
...And 3 more matches
XPCOM array guide
onstructor and copy constructor No Yes Yes* No Can hold objects directly, in which case it owns them. When holding pointers, doesn't own the pointer. nsAutoTArray<T,N> Any that has a default constructor and copy constructor No Yes Yes* Yes Can hold objects directly, in which case it owns them. When holding pointers, doesn't own the pointer. nsISup
portsArray XPCOM Object Yes No Yes* No Reference Counted, Strong (*) Note: Concrete C++ arrays can be made read-only by declaring them const. For example: // HandleList cannot modify the array because of const void HandleList(const nsTArray<T>&); In-place enumeration Most of the arrays presented here provide callback-style means to enumerate members of an array. Instead of...
...sition in the array. Enumerators are used to access the elements in an ordered way, without relying on the underlying array type. These enumerators include: nsISimpleEnumerator - an enumerator for COM objects. nsIStringEnumerator / nsIUTF8StringEnumerator - enumerators for strings Obsolete arrays / enumerators There are some deprecated classes which should not be used by new code. nsISup
portsArray - obsoleted by nsIArray and nsIMutableArray, use those instead. nsIEnumerator - obsoleted by nsISimpleEnumerator, use that instead. nsIBidirectionalEnumerator - obsoleted by nsISimpleEnumerator, use that instead. Which Array should I use? Do not use nsISup
portsArray; it is deprecated. Does your array need to be scriptable? If so, use nsIArray. Example: an array attribute in an ...
... the same method on each member: void NotifyObservers(const nsCOMArray<nsIMyObserver>& observers) { // Using [] doesn't leak! for (PRInt32 i = observers.Count() - 1; i >= 0 ; i--) observers[i]->Observe(); } Be careful with this though, you could end up with a weak pointer if you're converting from non-nsCOMArray code. ...
...And 3 more matches
Setting up the Gecko SDK
he Gecko libraries themselves. Note that mozilla-config.h may be need to be included before other includes in your component's source code. Each module directory is divided into three subdirectories: Module Subdirectories The bin directory contains static libraries, dynamic libraries, and in some cases tools that may be useful in development. The idl directory contains the public IDL files ex
ported by the module. The includes directory contains C++ header files used by your component. XPCOM ex
ports a number of binaries that should be mentioned at this point. The table below refers to the Windows file names for the executables. Application Name Description of functionality regxpcom.exe Registers or Unregisters components with XPCOM xpidl.exe Generates ...
... include directories to this field as well. Assuming you are using the example location for your project, these paths are the following: c:\gecko-sdk\embedstring\include c:\gecko-sdk\xpcom\include c:\gecko-sdk\nspr\include c:\gecko-sdk\string\include Under the C++ language category, disable exception handling. As described in the section Exceptions in XPCOM, exception handling isn't sup
ported across interface boundaries, so setting this option may catch problems during development. The WebLock component needs to link against the appropriate libraries to uses XPCOM Glue. To add these libraries, select the Link tab, then choose the Input category. In this panel, instead of linking to the include subdirectories of the nspr, embedstring, and xpcom directories, add the paths to the bin ...
...ft SDKs\Windows\v7.0\Lib;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib;D:\Projects\xulrunner-sdk\lib This tells the linker where the default libraries to bind to are. ...
...And 3 more matches
Inheriting from implementation classes
enerated IB C++ abstract class doesn't make things easier. So, in code: IDL: interface IA { void funcA(); } interface IB : IA { void funcB(); } interface IC : IB { void funcC(); } C++ implementation: class A : public IA { ??? } class B : public A, public IB { ??? } class C : public B, public IC { ??? } Example solution A.h, as usual: class A : public IA { ... NS_DECL_ISUP
PORTS NS_DECL_IA } A.cpp, as usual: NS_IMPL_ISUP
PORTS1(A, IA) NS_IMETHODIMP A::funcA() { ... } B.h: class B : public A, public IB { ... NS_DECL_ISUP
PORTS_INHERITED NS_FORWARD_IA(A::) // need to disambiguate NS_DECL_IB } B.cpp: NS_IMPL_ISUP
PORTS_INHERITED1(B, A, IB) // this, superclass,added ifaces NS_IMETHODIMP B::funcB() { ... } C.h: class C : public B, public IC...
...A here). The rest stays as-is. ...
...A here). The rest stays as-is. The inheriting classes (B, C here) don't need to change their macros. ...
...And 3 more matches
Interfacing with the XPCOM cycle collector
raversal, it gives up on that edge; this means that every edge involved in a cycle must be participating, otherwise the cycle will not be found. The Traverse and Unlink methods on the helper object are not magic; they are programmer-supplied and must be correct, or else the collector will fail. The collector does not know how to find temporary owning pointers that exist on the stack, so it is im
portant that it only run from near the top-loop of the program. It will not crash if there are extra owning pointers, but it will find itself unable to account for the reference counts it finds in the owned objects, so may fail to collect cycles. How to make your classes participate The interface between the cycle collector and your classes can be accessed directly using the contents of xpcom/base/...
...In general, assuming you are modifying class nsFoo with two nsCOMPtr edges mBar and mBaz, the process can be distilled to a few simple modifications: Include the header nsCycleCollectionParticipant.h in both nsFoo.h and nsFoo.cpp. Add a line declaring that your class nsFoo participates in the cycle collection in nsFoo.cpp: NS_IMPL_CYCLE_COLLECTION_CLASS(nsFoo) Change the line NS_DECL_ISUP
PORTS to NS_DECL_CYCLE_COLLECTING_ISUP
PORTS in the definition of nsFoo. Add a line NS_DECL_CYCLE_COLLECTION_CLASS(nsFoo) within the public
portion of definition of nsFoo. Or NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFoo, nsIBar) if nsFoo inherits from multiple interfaces, where nsIBar is the interface which is returned when you QueryInterface nsFoo to nsISup
ports. (We call nsIBar the canonical I...
...o NS_DECL_CYCLE_COLLECTING_ISUP
PORTS in the definition of nsFoo. Add a line NS_DECL_CYCLE_COLLECTION_CLASS(nsFoo) within the public
portion of definition of nsFoo. Or NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFoo, nsIBar) if nsFoo inherits from multiple interfaces, where nsIBar is the interface which is returned when you QueryInterface nsFoo to nsISup
ports. (We call nsIBar the canonical ISup
ports type for nsFoo.) Add a line NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsFoo) to the interface map of nsFoo in nsFoo.cpp. Or if that doesn't work: NS_INTERFACE_TABLE_HEAD(nsFoo) NS_INTERFACE_TABLE2(nsFoo, nsIBar, nsIBaz) NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsFoo) NS_INTERFACE_MAP_END Change the line NS_IMPL_ADDREF(nsFoo) to NS_...
...And 3 more matches
inIDOMUtils
layout/inspector/inIDOMUtils.idlScriptable DOM utility functions. ...
...rray getBindingURLs(in nsIDOMElement aElement); nsIDOMNodeList getChildrenForNode(in nsIDOMNode aNode, in boolean aShowingAnonymousContent); unsigned long long getContentState(in nsIDOMElement aElement); void getCSSPropertyNames([optional] in unsigned long aFlags, [optional] out unsigned long aCount, [retval, array, size_is(aCount)] out wstring aProps); nsISup
portsArray getCSSStyleRules(in nsIDOMElement aElement, [optional] in DOMString aPseudo); nsIDOMNode getParentForNode(in nsIDOMNode aNode, in boolean aShowingAnonymousContent); unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule); unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule); unsigned long getSelectorCount(in nsIDOMCSSStyleRule aRule); AString ...
...onymous content, then if the element has an XBL binding then this will be the binding's anonymous nodes, otherwise if the element is itself an anonymous node containing an insertion point then this will be a list combining the element's explicit children from its binding parent's anonymous nodes and any children inserted as a result of the insertion point. ...
...And 3 more matches
nsIAccessibleRole
accessible/public/nsIAccessibleRole.idlScriptable This interface defines cross platform (Gecko) roles. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Constants Constant Value Description ROLE_NOTHING 0 Used when accessible has no strong defined role. ROLE_TITLEBAR 1 Represents a title or caption bar for a window. It is used by MSAA only, sup
ported automatically by MS Windows. ROLE_MENUBAR 2 Represents the menu bar (positioned beneath the title bar of a window) from which menus are selected by the user. The role is used by xul:menubar or role="menubar". ROLE_SCROLLBAR 3 Represents a vertical or horizontal scroll bar, which is part of the client area or used in a con...
...cial mouse pointer, which allows a user to manipulate user interface elements such as windows. For example, a user clicks and drags a sizing grip in the lower-right corner of a window to resize it. ROLE_SOUND 5 Represents a system sound, which is associated with various system events. ROLE_CURSOR 6 Represents the system mouse pointer. ROLE_CARET 7 Represents the system caret. The role is sup
ported for caret. ROLE_ALERT 8 Represents an alert or a condition that a user should be notified about. Assistive Technologies typically respond to the role by reading the entire on screen contents of containers advertising this role. Should be used for warning dialogs, etc. The role is used by xul:browsermessage, role="alert", xforms:message. ROLE_WINDOW 9 Represents the window frame, which conta...
...ssistive Technologies typically respond to the role by reading the entire on screen contents of containers advertising this role. Should be used for warning dialogs, etc. The role is used by xul:browsermessage, role="alert", xforms:message. ROLE_WINDOW 9 Represents the window frame, which contains child objects such as a title bar, client, and other objects contained in a window. The role is sup
ported automatically by MS Windows. ROLE_INTERNAL_FRAME 10 A sub-document or iframe. ROLE_MENUPOPUP 11 Represents a menu, which presents a list of options from which the user can make a selection to perform an action. It is used for role="menu". ROLE_MENUITEM 12 Represents a menu item, which is an entry in a menu that a user can choose to carry out a command, select an option. It is used for xul...
...And 3 more matches
nsICachingChannel
For example a HTTP form submission. ...
...For example a HTTP form submission. ...
...For example a HTTP form submission. ...
...And 3 more matches
nsIClipboardDragDropHooks
widget/public/nsIClipboardDragDropHooks.idlScriptable Interfaces for overriding the built-in drag, drop, copy, and paste implementations in the content area and editors. Use this to do things such as prevent a drag from starting, adding or removing data and flavors, or preventing the drop. ...
...Adding them to the first window does not enable them for every window. ...
...Adding them to the first window does not enable them for every window. If more than one implementation is set for a window, the hooks will be called in the order they are added. ...
...And 3 more matches
nsIComponentManager
xpcom/components/nsIComponentManager.idlScriptable This interface provides methods to access factory objects and instantiate instances of classes. ...
...ble This interface provides methods to access factory objects and instantiate instances of classes. ...
...s from: nsISup
ports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5) Method overview void addBootstrappedManifestLocation(in nsILocalFile aLocation); void createInstance(in nsCIDRef aClass, in nsISup
ports aDelegate, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result); void createInstanceByContractID(in string aContractID, in nsISup
ports aDelegate, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result); void getClassObject(in nsCIDRef aClass, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result); void getClassObjectByContractID(in string aContractID, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result); void removeBootstrappedManifestLocation(in nsILocalFile aLocation); ...
...And 3 more matches
nsIComponentRegistrar
xpcom/components/nsIComponentRegistrar.idlScriptable This interface provides methods to access and modify the XPCOM component registry. ...
... aType); void unregisterFactory(in nsCIDRef aClass, in nsIFactory aFactory); void unregisterFactoryLocation(in nsCIDRef aClass, in nsIFile aFile); Methods autoRegister() Register a component (.manifest) file or all component files in a directory. Registration lasts for this run only, and is not cached. Note: Formerly this method would register component files directly. This is no longer sup
ported. Component files must have an associated loader and ex
port the required symbols which this loader defines. For example, if the given file is a native library, it must ex
port the symbol NSGetModule. Other loaders may have different semantics. This method may only be called from the main thread. void autoRegister( in nsIFile aSpec ); Parameters aSpec This parameter indicates either a compone...
...given ContractID, if one exists and is registered. nsCIDPtr contractIDToCID( in string aContractID ); Parameters aContractID The ContractID to be queried. Return value The ClassID corresponding to aContractID if one exists and is registered. enumerateCIDs() This method returns an enumerator over the list of registered ClassIDs. Elements of the enumeration can be QueryInterfaced for the nsISup
portsID interface. From the nsISup
portsID, you can obtain the actual ClassID. nsISimpleEnumerator enumerateCIDs(); Parameters None. Return value An nsISimpleEnumerator over the list of registered classes. Elements of the enumerator implement nsISup
portsID. enumerateContractIDs() This method returns an enumerator over the list of registered ContractIDs. Elements of the enumeration can be QueryInterfac...
...And 3 more matches
nsIContentPrefService
chronous interface nsIContentPrefService2 instead. Provides a way for extensions and browser code to save preferences for specific websites. Preferences are saved as key/value pairs on a per-website basis. dom/interfaces/base/nsIContentPrefService.idlScriptable Please add a summary to this article. Last changed in Gecko 2 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Inherits from: nsISup
ports Implemented by: @mozilla.org/content-pref/service;1. To create an instance, use: var contentPrefService = Components.classes["@mozilla.org/content-pref/service;1"] .getService(Components.interfaces.nsIContentPrefService); Method overview void addObserver(in AString aName, in nsIContentPrefObserver aObserver); nsIVariant getPref(in nsIVariant aGroup, in...
...cko 2.0, the site could only be specified by nsIURI. Now a string can be used as well. nsIVariant getPref( in nsIVariant aGroup, in AString aName, in nsIContentPrefCallback aCallback Optional ); Parameters aGroup The group for which to retrieve a preference; this may be specified as either a URI or as a string; in either case, the group consists of all sites matching the hostname
portion of the specified URI. Specify null to get the preference from the global preference space; those preferences apply to all sites. aName The name of the preference whose value is to be retrieved. aCallback An optional nsIContentPrefCallback to receive the result. If desired, JavaScript callers can instead provide a function to call upon completion. Return value The preference's ...
...and their values for the specified URI. Note: Prior to Gecko 2.0, the site could only be specified by nsIURI. Now a string can be used as well. nsIPropertyBag2 getPrefs( in nsIVariant aGroup ); Parameters aGroup The group whose preferences are to be retrieved; this may be specified as either a URI or as a string; in either case, the group consists of all sites matching the hostname
portion of the specified URI. Specify null to get the preferences from the global preference space; those preferences apply to all sites. Return value The result is an nsIPropertyBag2 containing the preferences and their values. Exceptions thrown NS_ERROR_ILLEGAL_VALUE If aGroup is not a string, nsIURI, or null. getPrefsByName() Returns the values of all preferences with the specified name.
...And 3 more matches
nsICookieManager2
methods that expand upon the nsICookieManager interface. netwerk/cookie/nsICookieManager2.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Inherits from: nsICookieManager This interface is included in The Services.jsm JavaScript code module. ...
...nsICookieService is the normal way to do this. This method is something of a back door. void add( in AUTF8String aHost, in AUTF8String aPath, in ACString aName, in ACString aValue, in boolean aIsSecure, in boolean aIsHttpOnly, in boolean aIsSession, in PRInt64 aExpiry ); Parameters aHost The host or doma...
...in, isSecure, and isHttpOnly. Therefore, if the specified host is "weather.yahoo.com", host or domain cookies for "weather.yahoo.com" and "yahoo.com" would both be counted, while a cookie for "my.weather.yahoo.com" would not. unsigned long countCookiesFromHost( in AUTF8String aHost ); Parameters aHost The host string to look for, such as "google.com". This should consist only of the host
portion of the URI and should not contain a leading dot,
port number, or other information. Return value The number of matching cookies found. findMatchingCookie() Obsolete since Gecko 1.9 (Firefox 3) Find whether a matching cookie already exists, and how many cookies a given host has already set. This is useful when e.g. prompting the user whether to accept a given cook...
...And 3 more matches
nsIMsgIncomingServer
nsIMsgIncomingServer mailnews/base/public/nsIMsgIncomingServer.idlScriptable ??? Add brief description of Interface ??? ...
... folderCache); Attributes Attribute Type Description accountManagerChrome AString Read only. biffMinutes long biffState unsigned long canBeDefaultServer boolean Read only. canCompactFoldersOnServer boolean Read only. canCreateFoldersOnServer boolean canDelete boolean can this server be removed from the account manager? for instance, local mail is not removable, but an im
ported folder is. canEmptyTrashOnExit boolean Read only. canFileMessagesOnServer boolean canHaveFilters boolean Read only. canSearchMessages boolean Read only. canUndoDeleteOnServer boolean Read only. constructedPrettyName AString helper function to construct the pretty name in a server type specific way - for example, mail for foo@test.com, news on news.mozilla.org. Read only. default...
... canFileMessagesOnServer boolean canHaveFilters boolean Read only. canSearchMessages boolean Read only. canUndoDeleteOnServer boolean Read only. constructedPrettyName AString helper function to construct the pretty name in a server type specific way - for example, mail for foo@test.com, news on news.mozilla.org. Read only. defaultCopiesAndFoldersPrefsToServer boolean If the server sup
ports Fcc/Sent/etc, default prefs can point to the server. Otherwise, copies and folders prefs should point to Local Folders. By default this value is set to true via global pref 'allows_specialfolders_usage' (mailnews.js). For Nntp, the value is overridden to be false. If ISPs want to modify this value, they should do that in their rdf file by using this attribute. Please look at mozilla/mailnews/bas...
...And 3 more matches
nsIMutableArray
ffect of insertElementAt(). Conversely, if insertElementAt() is never used, and null elements are never explicitly added to the array, then it is guaranteed that nsIArray.queryElementAt() will never return a null value. Any of these methods may throw NS_ERROR_OUT_OF_MEMORY when the array must grow to complete the call, but the allocation fails. Method overview void appendElement(in nsISup
ports element, in boolean weak); void clear(); void insertElementAt(in nsISup
ports element, in unsigned long index, in boolean weak); void removeElementAt(in unsigned long index); void replaceElementAt(in nsISup
ports element, in unsigned long index, in boolean weak); Methods appendElement() Append an element at the end of the array. void appendElement( in n...
...ment, in boolean weak); void clear(); void insertElementAt(in nsISup
ports element, in unsigned long index, in boolean weak); void removeElementAt(in unsigned long index); void replaceElementAt(in nsISup
ports element, in unsigned long index, in boolean weak); Methods appendElement() Append an element at the end of the array. void appendElement( in nsISup
ports element, in boolean weak ); Parameters element The element to append. weak Whether or not to store the element using a weak reference. Exceptions thrown NS_ERROR_FAILURE When a weak reference is requested, but the element does not sup
port nsIWeakReference. clear() Clear the entire array, releasing all stored objects. void clear(); Parameters None. insertElementAt(...
... index The position in the array: If the position is lower than the current length of the array, the elements at that position and onwards are bumped one position up. ...
...And 3 more matches
nsIProgressEventSink
netwerk/base/public/nsIProgressEventSink.idlScriptable This interface is used to asynchronously convey channel status and progress information that is generally not critical to the processing of the channel. The information is intended to be displayed to the user in some meaningful way. Inherits from: nsISup
ports Last changed in Gecko 1.7 This interface is used to asynchronously convey channel status and progress information that is generally not critical to the processing of the channel. The information is intended to be displayed to the user in some meaningful way. An implementation of this interface can be passed to a channel via the channel's notificationCallbacks attribute. See nsIChannel for more info. The channel will begin passing notifications to the progress event sin...
...gress event sink after its asyncOpen method has been called. Notifications will cease once the channel calls its listener's onStopRequest method or once the channel is canceled (via nsIRequest.cancel()). Note: This interface is actually not specific to channels and may be used with other implementations of nsIRequest. ...
...nce the channel is canceled (via nsIRequest.cancel()). Note: This interface is actually not specific to channels and may be used with other implementations of nsIRequest. ...
...And 3 more matches
nsIProtocolProxyService
netwerk/base/public/nsIProtocolProxyService.idlScriptable This interface provides methods to access information about various network proxies. Inherits from: nsISup
ports Last changed in Gecko 1.7 Implemented by: @mozilla.org/network/protocol-proxy-service;1. To access the service use: var pps = Components.classes["@mozilla.org/network/protocol-proxy-service;1"] .getService(Components.interfaces.nsIProtocolProxyService); Method overview Deprecated since Gecko 18 nsIProxyInfo resolve(in nsIURI aURI, in unsigned long aFlags); nsICancelable asyncResolve(in nsIURI aURI, in unsigned long aFlags,in nsIProtocolProxyCallback aCallback); nsIProxyInfo newProxyInfo(in ACString aType, in AUTF8String aHost,in long a
Port, in unsigned long aFlags, ...
...e resolveAsync instead Previous doc This method returns a nsIProxyInfo instance that identifies a proxy to be used for loading the given URI. Otherwise, this method returns null indicating that a direct connection should be used. If this proxy is unavailable, getFailoverForProxy() may be called to determine the correct secondary proxy to be used. ...
... nsIProxyInfo resolve( in nsIURI aURI, in unsigned long aFlags ); Parameters aURI The URI to test. aFlags A bit-wise combination of the RESOLVE_ flags defined above. Pass 0 to specify the default behavior. Any additional bits that do not correspond to a RESOLVE_ flag are reserved for future use. ...
...And 3 more matches
nsITreeView
Further information about creating treeviews is given in the XUL Tutorial. ...
...g index, in boolean before); Obsolete since Gecko 1.8 boolean canDropOn(in long index); Obsolete since Gecko 1.8 void cycleCell(in long row, in nsITreeColumn col); void cycleHeader(in nsITreeColumn col); void drop(in long row, in long orientation, in nsIDOMDataTransfer dataTransfer); AString getCellProperties(in long row, in nsITreeColumn col, in nsISup
portsArray properties Obsolete since Gecko 22); AString getCellText(in long row, in nsITreeColumn col); AString getCellValue(in long row, in nsITreeColumn col); AString getColumnProperties(in nsITreeColumn col, in nsISup
portsArray properties Obsolete since Gecko 22); AString getImageSrc(in long row, in nsITreeColumn col); long getLevel(in long index); ...
...n col); AString getColumnProperties(in nsITreeColumn col, in nsISup
portsArray properties Obsolete since Gecko 22); AString getImageSrc(in long row, in nsITreeColumn col); long getLevel(in long index); long getParentIndex(in long rowIndex); long getProgressMode(in long row, in nsITreeColumn col); AString getRowProperties(in long index, in nsISup
portsArray properties Obsolete since Gecko 22); boolean hasNextSibling(in long rowIndex, in long afterIndex); boolean isContainer(in long index); boolean isContainerEmpty(in long index); boolean isContainerOpen(in long index); boolean isEditable(in long row, in nsITreeColumn col); boolean isSelectable(in long row, in nsITreeColumn col); b...
...And 3 more matches
xptcall FAQ
Why does xptcall exist? xptcall exists for two reasons: To sup
port invoking arbitrary methods on XPCOM interfaces. To sup
port dynamically impersonating any XPCOM interface. Both of these facilities are required by XPConnect. ...
... What is xptcall? xptcall is a small low level XPCOM method call library. It is implemented using platform specific C/C++ and assembly language code. It is used to facilitate cross language and cross thread method calls.
Porting this code is required in order to make Mozilla run on any given platform. Why does xptcall exist? xptcall exists for two reasons: To sup
port invoking arbitrary methods on XPCOM interfaces. To sup
port dynamically impersonating any XPCOM interface. Both of these facilities are required by XPConnect. These facilities are also used by xpcom/proxy. It may also be used by other subsystems in the future. The xptcall approach was chosen over an approach that would have required generating stub code for calling and implementing all interfaces. Though the chosen...
... calling and implementing all interfaces. Though the chosen approach requires some core platform specific code, it has minimal footprint and is extendable to work with any valid XPCOM interface without requiring additional per platform compiled code to be distributed. What does xptcall really do? The core invoke function has the declaration: XPTC_PUBLIC_API(nsresult) XPTC_InvokeByIndex(nsISup
ports* that, PRUint32 methodIndex, PRUint32 paramCount, nsXPTCVariant* params); nsXPTCVariant is a discriminated union of the types that can be passed as parameters to the target function (including void* to represent arbitrary pointer types). Given the correct set of parameters, this function can call any method on any XPCOM interface. XP...
...And 3 more matches
XPIDL
rmitted wstring const char16_t* char16_t** string Full Unicode set permitted Most of the time you don't want to use this type but AString. Array<T> const nsTArray<T>& nsTArray<T>& array The C++-exposed type T will be an owned variant. (e.g. ns[C]String, RefPtr<T>, or uint32_t) string, wstring, [ptr] native and [ref] native are unsup
ported as element types. In addition to this list, nearly every IDL file includes nsrootidl.idl in some fashion, which also defines the following types: Table 2: Types provided by nsrootidl.idl IDL typedef C++ in parameter C++ out parameter JS type Notes PRTime (XPIDL unsigned long long typedef, 64 bits) number PRTime is in microseconds, while JS...
...id XPIDL types. To declare a WebIDL interface in XPIDL, write webidl InterfaceName;. WebIDL types will be passed as mozilla::dom::InterfaceName* when used as in-parameters, as mozilla::dom::InterfaceName** when used as out or inout-parameters, and as RefPtr<mozilla::dom::InterfaceName> when used as an array element. Other WebIDL types (e.g. dictionaries, enums, and unions), are not currently sup
ported. Constants Constants are technically legal at the top level, but xpidl I forbids them from being placed there; instead, they must be in an interface. The only constants sup
ported are those which become integer types when compiled to source code; string constants and floating point constants, though parseable, cannot be made into a header or xpt file. Constants are emitted in header files us...
...nonymous enums to quiet enum mismatch warnings. Interfaces Specifying interfaces is the primary purpose of using xpidl. Interfaces are basically a collection of constants, methods, and attributes; in Mozilla, these are the primary ways in which JavaScript code can interact with native C++ code. Furthermore, interfaces can also inherit from another interface. Every interface should inherit nsISup
ports in some fashion. However, it is generally not recommended to have a chain of interfaces inheriting from each other if you intend to have a chain of implementations for each interface, as it can cause problems in C++ code. Table 4: Basic interface attributes Attribute Interpretation uuid(12345678-fedc-ba98-7654-0123456789ab) This is the internal way this interface is...
...And 3 more matches
Index
derbird Thunderbird includes a new message indexing and search system (gloda) that improves search performance, provides sophisticated full-text search capabilities and categorized search results. "Gloda" is short for the Thunderbird "global database". 29 Gloda debugging The gloda code has Log4Moz logging statements spread throughout. The following preferences are sup
ported to control how this gets logged: 30 Gloda examples Thunderbird 3, thunderbird This page provides some examples for using gloda. See Creating a gloda message query for more examples. 31 Gloda indexing This page provides a big-picture summary of what the indexer does; please see the source for nitty-gritty details or if this page seems to be wrong. Glod...
...dexing This page provides a big-picture summary of what the indexer does; please see the source for nitty-gritty details or if this page seems to be wrong. GlodaIndexer provides the core indexing logic. GlodaMsgIndexer has the message-specific stuff, although the actual attribute-providers are found in GlodaExplicitAttr and GlodaFundAttr. GlodaABIndexer has the limited address book sup
port. 32 Index Index Found 72 pages: 33 LDAP Sup
port Administration, enterprise, thunderbird This document is intended to "fill in the gaps" about how Enterprise customers can leverage and customize LDAP sup
port in Mozilla Thunderbird. It is not intended as an introduction to LDAP and Mozilla products. It assumes you are already familiar with configuring prefe...
...IMAP, SMTP, and NNTP) designed for use in automated tests. It can also be used in manual QA tests. 41 MailNews xpcshell-tests Automated testing, Developing Mozilla, MailNews, SeaMonkey, thunderbird MailNews xpcshell-tests are written and run in the same manner as the core xpcshell-tests. This page describes additional resources and facilities that MailNews has developed to sup
port the xpcshell-tests; see the core xpcshell-tests page for more information on how to develop these. 42 Mailbox MailNews The mailbox protocol is used to read messages from a local folder berkeley mailbox. It consists of nsMailboxService, nsMailboxUrl, and nsMailboxProtocol. This may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do...
...And 3 more matches
Responsive Design Mode - Firefox Developer Tools
Responsive design is the practice of designing a website so it looks and works properly on a range of different devices -- particularly mobile phones and tablets as well as desktops and laptops. The most obvious factor here is screen size, but there are other factors as well, including the pixel density of the display and whether it sup
ports touch. Responsive Design Mode gives you a simple way to simulate these factors, to test how your website will look and behave on different devices. Toggling Responsive Design Mode There are three ways to toggle Responsive Design Mode: From the Firefox menu: Select Responsive Design Mode from the Web Developer submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on macOS). From the Developer Tools toolbox: Press the Responsi...
...onsive Design Mode button in the Toolbox's toolbar: From the keyboard: Press Ctrl + Shift + M (or Cmd + Opt + M on macOS). Controlling Responsive Design Mode With Responsive Design Mode enabled, the content area for web pages is set to the screen size for a mobile device. Initially, it's set to 320 x 480 pixels. Note: The device you select when in Responsive Design Mode and the orientation (
portrait or landscape) is saved between sessions. Information for the selected device is centered over the display. From left to right, the display includes: Name of the selected device - A drop-down list that includes whatever devices you have selected from the Device Settings screen. Screen size - You can edit the width and height values to change the device size by editing a number directly...
...e - You can edit the width and height values to change the device size by editing a number directly or using the Up and Down keys to increase or decrease the value by 1 pixels on each keypress or hold and Shift to change the value by 10. The mouse wheel changes the size values by 1 pixel at a time You can also change the device's screen size by grabbing the bottom-right corner of the view
port and dragging it to the size you want. Orientation (
portrait or landscape) - This setting persists between sessions Screenshots are saved to Firefox's default download location. If you checked "Screenshot to clipboard" in the Developer Tools Settings page, then the screenshot will be copied to the system clipboard. DPR (pixel ratio) - Beginning with Firefox 6...
...And 3 more matches
Style Editor - Firefox Developer Tools
The Toolbox will appear at the bottom of the browser window, with the Style Editor activated: The Style Editor is divided into three main sections: the style sheet pane on the left the editor on the right the media sidebar. ...
...r you to read and edit. Any changes you make are immediately applied to the page. This makes it easy to experiment with, revise, and test changes. Once you're satisfied with your changes, you can save a copy locally by clicking the Save button on the sheet's entry in the style sheet pane. The editor provides line numbers and syntax highlighting to help make it easier to read your CSS. It also sup
ports a number of keyboard shortcuts. The Style Editor automatically de-minimizes style sheets that it detects, without affecting the original. This makes it much easier to work on pages that have been optimized. The Style Editor sup
ports autocomplete. Just start typing, and it will offer you a list of suggestions. You can switch autocomplete off in the Style Editor settings. The media sidebar Th...
... of the rule is greyed-out if the media query doesn't currently apply. ...
...And 3 more matches
AudioContext.baseLatency - Web APIs
lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
AudioContext.getOutputTimestamp() - Web APIs
ble on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...owser-compat-data and send us a pull request. ...
...And 3 more matches
CSSStyleRule.selectorText - Web APIs
he compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Basic usage of canvas - Web APIs
he actual drawing on the canvas. We'll see how this is done in a dedicated chapter of this tutorial. When no styling rules are applied to the canvas it will initially be fully transparent. Fallback content The <canvas> element differs from an <img> tag in that, like for <video>, <audio>, or <picture> elements, it is easy to define some fallback content, to be displayed in older browsers not sup
porting it, like versions of Internet Explorer earlier than version 9 or textual browsers. You should always provide fallback content to be displayed by those browsers. Providing fallback content is very straightforward: just insert the alternate content inside the <canvas> element. Browsers that don't sup
port <canvas> will ignore the container and render the fallback content inside it. Browsers that...
... like versions of Internet Explorer earlier than version 9 or textual browsers. You should always provide fallback content to be displayed by those browsers. Providing fallback content is very straightforward: just insert the alternate content inside the <canvas> element. Browsers that don't sup
port <canvas> will ignore the container and render the fallback content inside it. Browsers that do sup
port <canvas> will ignore the content inside the container, and just render the canvas normally. For example, we could provide a text description of the canvas content or provide a static image of the dynamically rendered content. This can look something like this: <canvas id="stockGraph" width="150" height="150"> current stock price: $3.15 + 0.15 </canvas> <canvas id="clock" width="150" height="...
...cription of the canvas content or provide a static image of the dynamically rendered content. This can look something like this: <canvas id="stockGraph" width="150" height="150"> current stock price: $3.15 + 0.15 </canvas> <canvas id="clock" width="150" height="150"> <img src="images/clock.png" width="150" height="150" alt=""/> </canvas> Telling the user to use a different browser that sup
ports canvas does not help users who can't read the canvas at all, for example. Providing a useful fallback text or sub DOM helps to make the canvas more accessible. Required </canvas> tag As a consequence of the way fallback is provided, unlike the <img> element, the <canvas> element requires the closing tag (</canvas>). If this tag is not present, the rest of the document would be considered the f...
...And 3 more matches
DOMException() - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...dgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetDOMException() constructorChrome Full sup
port YesEdge Full sup
port 79Firefox ? IE ? Opera Full sup
port YesSafari ? WebView Android Full sup
port YesChrome Android Full sup
port YesFirefox Android ? Opera Android Full sup
port YesSafari iOS ? Samsung I...
...And 3 more matches
DOMHighResTimeStamp - Web APIs
the precision will be 100ms or the value of privacy.resistFingerprinting.reduceTimerPrecision.microseconds, whichever is larger. Properties This type has no properties. It is a double-precision floating-point value. Value The value of a DOMHighResTimeStamp is a double-precision floating-point number which describes the number of milliseconds (accurate to within 5 microseconds if the device sup
ports it) elapsed between two points in time. The starting time can be either a specific time determined by the script for a site or app, or the time origin. The time origin The time origin is a standard time which is considered to be the beginning of the current document's lifetime. It's calculated like this: If the script's global object is a Window, the time origin is determined as follows: ...
...atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
DataTransferItem.webkitGetAsEntry() - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
DirectoryReaderSync - Web APIs
le on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ntribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetDirectoryReaderSync Non-standardChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port 79Prefixed Full sup
port 79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox No sup
port NoIE No sup
port NoOpera No sup
port NoSafari No sup
port ...
...And 3 more matches
Element.currentStyle - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Element: mousewheel event - Web APIs
The obsolete and non-standard mousewheel event is fired asynchronously at an Element to provide updates while a mouse wheel or similar device is operated. The mousewheel event was never part of any standard, and while it was implemented by several browsers, it was never implemented by Firefox. Im
portant: Instead of this obsolete event, use the standard wheel event. Bubbles Yes Cancelable Yes Interface MouseWheelEvent Event handler property onmousewheel The detail property The value of the detail property is always zero, except in Opera, which uses detail similarly to the Firefox-only DOMMouseScroll event's detail value, which indicates the scroll distance in terms of lines, with negative values indicating the scrolling movement ...
... attribute value is an abstract value which indicates how far the wheel turned. If the wheel has rotated away from the user, it's positive, otherwise negative. This means that the delta value sign is different from DOM Level 3 Event's wheel. However, the meaning of the amount of these values is not the same between browsers. See following explanation for the detail. IE and Opera (Presto) only sup
port wheelDelta attribute and do not sup
port horizontal scroll. The wheelDeltaX attribute value indicates the wheelDelta attribute value along the horizontal axis. When a user operates the device for scrolling to right, the value is negative. Otherwise, i.e., if it's to left, the value is positive. The wheelDeltaY attribute value indicates the wheelDelta attribute value along the vertical axis. The ...
..., the value is negative. Otherwise, i.e., if it's to left, the value is positive. The wheelDeltaY attribute value indicates the wheelDelta attribute value along the vertical axis. The sign of the value is the same as the wheelDelta attribute value. Internet Explorer The value is the same as the delta value of Windows' WM_MOUSEWHEEL or WM_MOUSEHWHEEL. It means that if the mouse wheel doesn't sup
port high resolution scroll, the value is 120 per notch. The value isn't changed even if the scroll amount of system settings is page scroll. Chrome On Windows, the value is the same as the delta value of WM_MOUSEWHEEL or WM_MOUSEHWHEEL. And also, the value isn't changed even if the scroll amount of system settings is page scroll, i.e., the value is the same as IE on Windows. On Linux, the value is...
...And 3 more matches
Element.runtimeStyle - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Element.scrollLeftMax - Web APIs
lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
....com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileEntrySync - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...obileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetFileEntrySync Non-standardChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port <=79Prefixed Full sup
port <=79Prefixed Prefixed Implemented with the vendor prefix: webkitFirefox No sup
port NoIE No sup
port NoOpera No sup
port NoSafari No sup
port ...
...And 3 more matches
FileReaderSync.readAsDataURL() - Web APIs
e compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...//github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileReaderSync.readAsText() - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileSystem.name - Web APIs
ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileSystem.root - Web APIs
ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileSystemDirectoryEntry.createReader() - Web APIs
ity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileSystemEntry.filesystem - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
....com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileSystemEntry.fullPath - Web APIs
ibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileSystemEntry.getParent() - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileSystemEntry.name - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
FileSystemFileEntry.file() - Web APIs
ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ructured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Introduction to the File and Directory Entries API - Web APIs
view The File and Directory Entries API includes both asynchronous and synchronous versions of the interfaces. The asynchronous API can be used in cases where you don't want an outstanding operation to block the UI. The synchronous API, on the other hand, allows for simpler programming model, but it must be used with WebWorkers. Usefulness of the API The File and Directory Entries API is an im
portant API for the following reasons: It lets apps have offline and storage features that involve large binary blobs. It can improve performance by letting an app pre-fetch assets in the background and cache locally. It lets users of your web app directly edit a binary file that's in their local file directory. It provides a storage API that is already familiar to your users, who are used to wo...
...ince November18, 2010), and AppCache. The API is a better choice for apps that deal with blobs for the following reasons: The File and Directory Entries API offers client-side storage for use cases that are not addressed by databases. If you want to have large mutable chunks of data, the File and Directory Entries API is a much more efficient storage solution than a database. While Firefox sup
ports blob storage for IndexedDB, Chrome currently does not (Chrome is still implementing sup
port for blob storage in IndexedDB). If you are targeting Chrome for your app and you want to store blobs, the File and Directory Entries API and App Cache are your only choices. However, AppCache storage isn't locally mutable, and doesn't allow for fine-grained client-side management. In Chrome, you can use ...
... a virtualized file system that looks like a full-fledged file system to the web app. It does not necessarily have a relationship to the local file system outside the browser. What this means is that a web app and a desktop app cannot share the same file at the same time. The API does not let your web app reach outside the browser to files that desktop apps can also work on. You can, however, ex
port a file from a web app to a desktop app. For example, you can use the File API, create a blob, redirect an iframe to the blob, and invoke the download manager. The File and Directory Entries API can use different storage types An application can request temporary or persistent storage. Temporary storage is easier to get, because the browser just gives it to you, but it is limited and can be dele...
...And 3 more matches
HTMLElement.offsetParent - Web APIs
he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
HTMLElement.offsetTop - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
HTMLIFrameElement.referrerPolicy - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...//github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
HTMLInputElement.webkitEntries - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...dn/browser-compat-data and send us a pull request. ...
...And 3 more matches
HTMLMediaElement.controlsList - Web APIs
he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...MobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetcontrolsListChrome Full sup
port 58Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 45Safari ? WebView Android Full sup
port 58Chrome Android Full sup
port 58Firefox Android ? Opera Android Full sup
port 43Safari iOS ? Samsung Inter...
...And 3 more matches
HTMLMediaElement.onencrypted - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...s://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
HTMLMediaElement.setMediaKeys() - Web APIs
he compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
HTMLSlotElement.assignedElements() - Web APIs
table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ke to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...n/browser-compat-data and send us a pull request. ...
...And 3 more matches
History.back() - Web APIs
ility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
History.forward() - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
InputEvent.getTargetRanges() - Web APIs
table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ike to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
MediaCapabilitiesInfo - Web APIs
The MediaCapabilitiesInfo interface of the Media Capabilities API is made available when the promise returned by the MediaCapabilities.encodingInfo() or MediaCapabilities.decodingInfo() methods of the MediaCapabilities interface fulfills, providing information as to whether the media type is sup
ported, and whether encoding or decoding such media would be smooth and power efficient. Properties The MediaCapabilitiesInfo interface contains three Boolean attribues: sup
ported: Given the properties defined in the MediaConfiguration, can the specified piece of media content be encoded (if MediaEncodingConfiguration is set) or decode (if MediaDecodingConfiguration is set) at all? If yes, sup
ported is true. Otherwise, it is false. smooth: Given the properties defined in the MediaConfiguration, w...
...perties defined in the MediaConfiguration, can the specified piece of media content be encoded (if MediaEncodingConfiguration is set) or decode (if MediaDecodingConfiguration is set) at all? ...
... false. smooth: Given the properties defined in the MediaConfiguration, will the playback of the specified piece of media be high quality? Will it be smooth? If sup
ported is true, and playback will be smooth, smooth is true, Otherwise, is it false. powerEfficient: Given the properties defined in the MediaConfiguration, will the playback of the specified piece of media be power efficient? If sup
ported is true, and playback will be power efficient, powerEfficient is true, Otherwise, is it false. Browsers will re
port a sup
ported media configuration as smooth and powerEfficient until stats on this device have been recorded. All sup
ported audio codecs are re
ported to be power efficient. Example // MediaConfiguration to be tested const mediaConfig = { type : 'file', audio : { ...
...And 3 more matches
MediaStream.getTracks() - Web APIs
ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Metadata.modificationTime - Web APIs
s page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...bute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...mpat-data and send us a pull request. ...
...And 3 more matches
OfflineAudioCompletionEvent.renderedBuffer - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...//github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
PerformanceLongTaskTiming.attribution - Web APIs
lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Multi-touch interaction - Web APIs
This additional feature can be used to provide richer user interaction models but at the cost of additional complexity in the multi-touch interaction handling. ...
...s pointing input devices such as pen/stylus and touch screens as well as mouse. The pointer is a hardware-agnostic device that can target a specific set of screen coordinates. Having a single event model for pointers can simplify creating Web sites, applications and provide a good user experience regardless of the user's hardware. Pointer events have many similarities to mouse events but they sup
port multiple simultaneous pointers such as multiple fingers on a touch screen. This additional feature can be used to provide richer user interaction models but at the cost of additional complexity in the multi-touch interaction handling. This document demonstrates via example code, using pointer events with different multi-touch interactions. A live version of this application is available on Githu...
... screen. This additional feature can be used to provide richer user interaction models but at the cost of additional complexity in the multi-touch interaction handling. This document demonstrates via example code, using pointer events with different multi-touch interactions. A live version of this application is available on Github. The source code is available on Github; pull requests and bug re
ports are welcome. Example This example demonstrates using pointer events' various event types (pointerdown, pointermove, pointerup pointercancel, etc.) for different multi-touch interactions. Define touch targets The application uses <div> to define three different touch target areas. <style> div { margin: 0em; padding: 2em; } #target1 { background: white; border: 1px solid...
...And 3 more matches
PushSubscription.expirationTime - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...s://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
PushSubscription.subscriptionId - Web APIs
compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...//github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
RTCIceCandidate.address - Web APIs
lt if not otherwise specified. The address field's value is set when the RTCIceCandidate() constructor is used. You can't specify the address in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var address = RTCIceCandidate.address; Value A DOMString providing the IP address from which the candidate comes. ...
...specified. The address field's value is set when the RTCIceCandidate() constructor is used. You can't specify the address in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var address = RTCIceCandidate.address; Value A DOMString providing the IP address from which the candidate comes. ...
... The address field's value is set when the RTCIceCandidate() constructor is used. You can't specify the address in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var address = RTCIceCandidate.address; Value A DOMString providing the IP address from which the candidate comes. ...
...And 3 more matches
RTCIceCandidatePair - Web APIs
The RTCIceCandidatePair dictionary describes a pair of ICE candidates which together comprise a description of a viable connection between two WebRTC endpoints. It is used as the return value from RTCIceTrans
port.getSelectedCandidatePair() to identify the currently-selected candidate pair identified by the ICE agent. Properties local An RTCIceCandidate describing the configuration of the local end of the connection. remote The RTCIceCandidate describing the configuration of the remote end of the connection. ...
... Properties local An RTCIceCandidate describing the configuration of the local end of the connection. remote The RTCIceCandidate describing the configuration of the remote end of the connection. Example In this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair. ...
...Candidate describing the configuration of the local end of the connection. remote The RTCIceCandidate describing the configuration of the remote end of the connection. Example In this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair. ...
...And 3 more matches
RTCIceCandidateStats.networkType - Web APIs
between the local peer and the next hop along the network toward reaching the remote peer. For example, if the networkType is wifi but the user is connected using a cellular hotspot, the connection will be bottlenecked by the underlying cellular network (and any other networks between the two peers). ...
...necked by the underlying cellular network (and any other networks between the two peers). Example This example sets up a periodic function using setInterval() that outputs statistics re
ports for candidates that use or would use a cellular data network to a log view. ...
... that outputs statistics re
ports for candidates that use or would use a cellular data network to a log view. ...
...And 3 more matches
RTCRtpReceiver.track - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
RTCStatsType - Web APIs
The RTCStatsType enumerated type (enum) is a set of strings which define the type of statistics re
ported in a record found in the RTCStatsRe
port object. This type determines which of the RTCStats-based dictionaries the record is based upon. Values candidate-pair An RTCIceCandidatePairStats object providing statistics related to an RTCIceTrans
port. Candidate pairs other than the currently active pair for the trans
port are deleted when the RTCPeerConnection changes its RTCPeerConnection.iceGatheringState to new during an ICE restart. The active candidate pair is deleted after the trans
port switches to another candidate pair; this change cannot be detected otherwise. certificate An RTCCertificateStats object providing statistics related to a certificate being used by an RTCIceTrans
port. ...
...s object which contains statistics about each RTCDataChannel on the connection. inbound-rtp An RTCInboundRtpStreamStats object providing statistics about inbound data being received from remote peers. Since this only provides statistics related to inbound data, without considering the local peer's state, any values that require knowledge of both, such as round-trip time, is not included. This re
port isn't available if there are no connected peers. local-candidate An RTCIceCandidateStats object giving statistics about an ICE local candidate; these candidates are found in the output from RTCIceTrans
port.getLocalCandidates(). outbound-rtp The re
port is an RTCOutboundRtpStreamStats object providing statistics based on the local peer's outgoing data being sent to its peers. This information c...
...t knowing about the other peers' states. peer-connection A RTCPeerConnectionStats object provides statistics related to the overall peer connection's RTCPeerConnection. receiver Provides statistics about a specific RTCRtpReceiver. The statistics object is an RTCAudioReceiverStats object if kind is audio; if kind is video, the object is an RTCVideoReceiverStats object. ...
...And 3 more matches
SVGAnimatedString.baseVal - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
SVGImageElement.decoding - Web APIs
ibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...AndroidOpera for AndroidSafari on iOSSamsung Internetdecoding ExperimentalChrome Full sup
port 65Edge Full sup
port <=79Firefox ? IE ? Opera ? Safari ? WebView Android Full sup
port 65Chrome Android Full sup
port 65Firefox Android ? Opera Android ? Safari iOS ? ...
...And 3 more matches
SVGSVGElement - Web APIs
VGSVGElement.height Read only An SVGAnimatedLength corresponding to the height attribute of the given <svg> element. SVGSVGElement.contentScriptType An SVGAnimatedLength corresponding to the contentScriptType attribute of the given <svg> element. SVGSVGElement.contentStyleType An SVGAnimatedLength corresponding to the contentStyleType attribute of the given <svg> element. SVGSVGElement.view
port An SVGRect containing the position and size of the view
port (implicit or explicit) that corresponds to the given <svg> element. When the browser is actually rendering the content, then the position and size values represent the actual values when rendering. The position and size values are unitless values in the coordinate system of the parent element. If no parent element exists (i.e., <svg> el...
...f no parent element exists (i.e., <svg> element represents the root of the document tree), if this SVG document is embedded as part of another document (e.g., via the HTML <object> element), then the position and size are unitless values in the coordinate system of the parent document. (If the parent uses CSS or XSL layout, then unitless values represent pixel units for the current CSS or XSL view
port.) SVGSVGElement.pixelUnitToMillimeterX A float representing the size of the pixel unit (as defined by CSS2) along the x-axis of the view
port, which represents a unit somewhere in the range of 70dpi to 120dpi, and, on systems that sup
port this, might actually match the characteristics of the target medium. On systems where it is impossible to know the size of a pixel, a suitable default pixel ...
... SVGSVGElement.screenPixelToMillimeterX User interface (UI) events in DOM Level 2 indicate the screen positions at which the given UI event occurred. When the browser actually knows the physical size of a "screen unit", this float attribute will express that information; otherwise, user agents will provide a suitable default value (such as .28mm). ...
...And 3 more matches
SVGStylable - Web APIs
is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...id webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetSVGStylableChrome ? Edge Full sup
port <=18Firefox ? IE ? Opera ? Safari ? WebView Android No sup
port NoChrome Android ? Firefox Android ? Opera Android ? Safari iOS ? ...
...ari ? WebView Android No sup
port NoChrome Android ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ? ...
...And 3 more matches
SVGTransformable - Web APIs
nerated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...bviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetSVGTransformableChrome ? Edge Full sup
port <=18Firefox ? IE ? Opera ? Safari ? WebView Android No sup
port NoChrome Android ? Firefox Android ? Opera Android ? Safari iOS ? ...
...ari ? WebView Android No sup
port NoChrome Android ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ? ...
...And 3 more matches
ScreenOrientation.angle - Web APIs
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
ScreenOrientation.onchange - Web APIs
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
ScreenOrientation.unlock() - Web APIs
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...t https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
SubtleCrypto - Web APIs
extractability given as parameters. SubtleCrypto.deriveKey() Returns a Promise that fulfills with a newly generated CryptoKey derived from the master key and specific algorithm given as parameters. SubtleCrypto.deriveBits() Returns a Promise that fulfills with a newly generated buffer of pseudo-random bits derived from the master key and specific algorithm given as parameters. SubtleCrypto.im
portKey() Returns a Promise that fulfills with a CryptoKey corresponding to the format, the algorithm, raw key data, usages, and extractability given as parameters. SubtleCrypto.ex
portKey() Returns a Promise that fulfills with a buffer containing the key in the requested format. SubtleCrypto.wrapKey() Returns a Promise that fulfills with a wrapped symmetric key for usage (transfer and storage) in...
...ch time you call it, while deriveKey() derives a key from some initial keying material. If you provide the same keying material to two separate calls to deriveKey(), you will get two CryptoKey objects that have the same underlying value. This is useful if, for example, you want to derive an encryption key from a password and later derive the same key from the same password to decrypt the data. ...
...ll it, while deriveKey() derives a key from some initial keying material. If you provide the same keying material to two separate calls to deriveKey(), you will get two CryptoKey objects that have the same underlying value. This is useful if, for example, you want to derive an encryption key from a password and later derive the same key from the same password to decrypt the data. Im
porting and ex
porting keys To make keys available outside your app, you need to ex
port the key, and that's what ex
portKey() is for. You can choose one of a number of ex
port formats. The inverse of ex
portKey() is im
portKey(). You can im
port keys from other systems, and sup
port for standard formats like PKCS #8 and JSON Web Key helps you do this. The ex
portKey() function ex
ports the key in an unencrypted format. I...
...And 3 more matches
TaskAttributionTiming.containerId - Web APIs
lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
TaskAttributionTiming.containerType - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
URLUtilsReadOnly.hash - Web APIs
compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internethash ExperimentalChrome No sup
port NoEdge No sup
port NoFirefox Full sup
port 38 Full sup
port 38 No sup
port 3.5 -- 38Notes Notes Before Firefox 38, Firefox returned the hash percent encoded. This has been fixed to match the spec.IE ...
... NoEdge No sup
port NoFirefox Full sup
port 38 Full sup
port 38 No sup
port 3.5 -- 38Notes Notes Before Firefox 38, Firefox returned the hash percent encoded. ...
... NoFirefox Full sup
port 38 Full sup
port 38 No sup
port 3.5 -- 38Notes Notes Before Firefox 38, Firefox returned the hash percent encoded. ...
...And 3 more matches
URLUtilsReadOnly.hostname - Web APIs
atibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
URLUtilsReadOnly.href - Web APIs
compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
URLUtilsReadOnly.pathname - Web APIs
atibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
URLUtilsReadOnly.protocol - Web APIs
atibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
URLUtilsReadOnly.search - Web APIs
mpatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
URLUtilsReadOnly.toString() - Web APIs
atibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
UserDataHandler - Web APIs
26 (Firefox 26 / Thunderbird 26 / SeaMonkey 2.23 / Firefox OS 1.2)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. ...
...s, its use is discouraged since it could be removed at any time. Try to avoid using it. Summary When associating user data with a key on a node, Node.setUserData() can also accept, in its third argument, a handler which will be called when the object is cloned, im
ported, deleted, renamed, or adopted. Per the specification, exceptions should not be thrown in a UserDataHandler. In both document.im
portNode() and Node.cloneNode(), although user data is not copied over, the handler will be called. Properties None. Methods handle (operation, key, data, src, dst) (no return value) This method is a callback which will be called if a node is being cloned, im
ported, renamed and as well, if deleted or adopted. operation (unsigned short) is an operation type integer (see below). key (DOMString)...
... well, if deleted or adopted. operation (unsigned short) is an operation type integer (see below). key (DOMString) is the user key. data (DOMUserData) is the user data. src (Node) is the source node (null if being deleted). dst (Node) is the destination node (if any, or null). ...
...And 3 more matches
WebGLRenderingContext - Web APIs
eringContext.makeXRCompatible() Ensures the context is compatible with the user's XR hardware, re-creating the context if necessary with a new configuration to do so. This can be used to start an application using standard 2D presentation, then transition to using a VR or AR mode later. Viewing and clipping WebGLRenderingContext.scissor() Defines the scissor box. WebGLRenderingContext.view
port() Sets the view
port. State information WebGLRenderingContext.activeTexture() Selects the active texture unit. WebGLRenderingContext.blendColor() Sets the source and destination blending factors. WebGLRenderingContext.blendEquation() Sets both the RGB blend equation and alpha blend equation to a single equation. WebGLRenderingContext.blendEquationSeparate() Sets the RGB blend equation...
...nt- and/or back-facing polygons can be culled. WebGLRenderingContext.depthFunc() Specifies a function that compares incoming pixel depth to the current depth buffer value. WebGLRenderingContext.depthMask() Sets whether writing into the depth buffer is enabled or disabled. WebGLRenderingContext.depthRange() Specifies the depth range mapping from normalized device coordinates to window or view
port coordinates. WebGLRenderingContext.disable() Disables specific WebGL capabilities for this context. WebGLRenderingContext.enable() Enables specific WebGL capabilities for this context. WebGLRenderingContext.frontFace() Specifies whether polygons are front- or back-facing by setting a winding orientation. WebGLRenderingContext.getParameter() Returns a value for the passed parameter name. ...
...nderingContext.drawElements() Renders primitives from element array data. WebGLRenderingContext.finish() Blocks execution until all previously called commands are finished. WebGLRenderingContext.flush() Empties different buffer commands, causing all commands to be executed as quickly as possible. Working with extensions These methods manage WebGL extensions: WebGLRenderingContext.getSup
portedExtensions() Returns an Array of DOMString elements with all the sup
ported WebGL extensions. WebGLRenderingContext.getExtension() Returns an extension object. Examples WebGL context feature detection In this first example we are going to check whether the browser sup
ports WebGL. To that end we will try to obtain the WebGL rendering context from a canvas element. The WebGL rendering contex...
...And 3 more matches
WebRTC connectivity - Web APIs
r B will receive the Offer from the signal channel and create an Answer. They will then send this back to Peer A along the signal channel. Session descriptions The configuration of an endpoint on a WebRTC connection is called a session description. The description includes information about the kind of media being sent, its format, the transfer protocol being used, the endpoint's IP address and
port, and other information needed to describe a media transfer endpoint. This information is exchanged and stored using Session Description Protocol (SDP); if you want details on the format of SDP data, you can find it in RFC 2327. When a user starts a WebRTC call to another user, a special description is created called an offer. This description includes all the information about the caller's propo...
...onsideration, but any local ICE candidates which have already been gathered since the offer or answer was created. Similarly, pendingRemoteDescription includes any remote ICE candidates which have been provided by calls to RTCPeerConnection.addIceCandidate(). See the individual articles on these properties and methods for more specifics, and Codecs used by WebRTC for information about codecs sup
ported by WebRTC and which are compatible with which browsers. The codecs guide also offers guidance to help you choose the best codecs for your needs. ICE candidates As well as exchanging information about the media (discussed above in Offer/Answer and SDP), peers must exchange information about the network connection. This is known as an ICE candidate and details the available methods the peer is ...
... line toward their worse candidates. Ideally, candidates are UDP (since it's faster, and media streams are able to recover from interruptions relatively easily), but the ICE standard does allow TCP candidates as well. Generally, ICE candidates using TCP are only going to be used when UDP is not available or is restricted in ways that make it not suitable for media streaming. Not all browsers sup
port ICE over TCP, however. ICE allows candidates to represent connections over either TCP or UDP, with UDP generally being preferred (and being more widely sup
ported). Each protocol sup
ports a few types of candidate, with the candidate types defining how the data makes its way from peer to peer. UDP candidate types UDP candidates (candidates with their protocol set to udp) can be one of these typ...
...And 3 more matches
Writing WebSocket servers - Web APIs
A WebSocket server is nothing more than an application listening on any
port of a TCP server that follows a specific protocol. The task of creating a custom server tends to scare people; however, it can be straightforward to implement a simple WebSocket server on your platform of choice. A WebSocket server can be written in any server-side programming language that is capable of Berkeley sockets, such as C(++), Python, PHP, or server-side JavaScript. This is not a tutorial in any specific language, but serves as a guide to facilitate writing your own server. This article assumes you're already familiar with how HTTP works, and that you have a moderate level of programming experience. Depending on language sup
port, knowledge of TCP sockets may be required. The scope of this guide is to prese...
...to a real WebSocket server. This means that you don't have to bloat your server code with cookie and authentication handlers (for example). The WebSocket handshake First, the server must listen for incoming socket connections using a standard TCP socket. Depending on your platform, this may be handled for you automatically. For example, let's assume that your server is listening on example.com,
port 8000, and your socket server responds to GET requests at example.com/chat. Warning: The server may listen on any
port it chooses, but if it chooses any
port other than 80 or 443, it may have problems with firewalls and/or proxies. Browsers generally require a secure connection for WebSockets, although they may offer an exception for local devices. The handshake is the "Web" in WebSockets. It'...
...following (remember each header line ends with \r\n and put an extra \r\n after the last one to indicate the end of the header): HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Additionally, the server can decide on extension/subprotocol requests here; see Miscellaneous for details. The Sec-WebSocket-Accept header is im
portant in that the server must derive it from the Sec-WebSocket-Key that the client sent to it. To get it, concatenate the client's Sec-WebSocket-Key and the string "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" together (it's a "magic string"), take the SHA-1 hash of the result, and return the base64 encoding of that hash. Note: This seemingly overcomplicated process exists so that it's obvious to the cli...
...And 3 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
arting time for showing the text that appears underneath. On the same line, we then have a string of "-->". We finish the first line with a second time, which is the ending time for showing the associated text. We can then have one or more lines that start with a hyphen (-), each containing part of the text track to be shown. We can also place comments in our .vtt file, to help us remember im
portant information about the parts of our file. These should be on separate lines, starting with the string NOTE. You'll find more about these in the below section. It is im
portant to not use "extra" blank lines within a cue, for example between the timings line and the cue payload. WebVTT is line based; a blank line will close the cue. WebVTT comments Comments are an optional component that can b...
...ormal, we can define it as follows using CSS. Where it must be noted that the CSS uses escape sequences the way they are used in HTML pages: WEBVTT 1 00:00.000 --> 00:02.000 That's an, an, that's an L! credit de transcription 00:04.000 --> 00:05.000 Transcrit par Celestes(TM) ::cue(#\31) { color: lime; } ::cue(#credit\ de\ transcription) { color: red; } Positioning of text tracks is also sup
ported, by including positioning information after the timings in a cue, as seen below (see Cue settings for more information): WEBVTT 00:00:00.000 --> 00:00:04.000 position:10%,line-left align:left size:35% Where did he go? 00:00:03.000 --> 00:00:06.500 position:90% align:right size:35% I think he went down this lane. 00:00:04.000 --> 00:00:06.500 position:45%,line-right align:center size:35% Wha...
...y>WWW<rt>World Wide Web</rt>oui<rt>yes</rt></ruby> Voice tag (<v></v>) Similar to class tag, also used to style the contained text using CSS. Example 20 - Voice tag <v Bob>text</v> Interfaces There are two interfaces or APIs used in WebVTT which are: VTTCue interface It is used for providing an interface in Document Object Model API, where different attributes sup
ported by it can be used to prepare and alter the cues in number of ways. Constructor is the first point for starting the Cue which is defined using the default constructor VTTCue(startTime, endTime, text) where starting time, ending time and text for cue can be adjusted. After that we can set the region for that particular cue to which this cue belongs using cue.region. Vertical, horizontal, line, l...
...And 3 more matches
Window.stop() - Web APIs
ility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Window - Web APIs
he local storage object used to store data that may only be accessed by the origin that created it. Window.menubar Read only Returns the menubar object, whose visibility can be toggled in the window. Window.messageManager Returns the message manager object for this window. Window.mozInnerScreenX Read only Returns the horizontal (X) coordinate of the top-left corner of the window's view
port, in screen coordinates. This value is re
ported in CSS pixels. See mozScreenPixelsPerCSSPixel in nsIDOMWindowUtils for a conversion factor to adapt to screen pixels if needed. Window.mozInnerScreenY Read only Returns the vertical (Y) coordinate of the top-left corner of the window's view
port, in screen coordinates. This value is re
ported in CSS pixels. See mozScreenPixelsPerCSSPixel for a con...
... Timing for additional information and examples. Window.personalbar Read only Returns the personalbar object, whose visibility can be toggled in the window. Window.screen Read only Returns a reference to the screen object associated with the window. Window.screenX and Window.screenLeft Read only Both properties return the horizontal distance from the left border of the user's browser view
port to the left side of the screen. Window.screenY and Window.screenTop Read only Both properties return the vertical distance from the top border of the user's browser view
port to the top side of the screen. Window.scrollbars Read only Returns the scrollbars object, whose visibility can be toggled in the window. Window.scrollMaxX Read only The maximum offset that the window can be scrolle...
... Window.scrollX Read only Returns the number of pixels that the document has already been scrolled horizontally. ...
...And 3 more matches
WritableStreamDefaultWriter.ready - Web APIs
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Using XMLHttpRequest - Web APIs
tructor function XMLHttpRequest isn't limited to only XML documents. It starts with "XML" because when it was created the main format that was originally used for Asynchronous Data Exchange were XML Handling responses There are several types of response attributes defined by the living standard specification for the XMLHttpRequest() constructor. These tell the client making the XMLHttpRequest im
portant information about the status of the response. Some cases where dealing with non-text response types may involve some manipulation and analysis are outlined in the following sections. Analyzing and manipulating the responseXML property If you use XMLHttpRequest to get the content of a remote XML document, the responseXML property will be a DOM object containing a parsed XML document. This cou...
...to sending binary data. These involve utilizing the overrideMimeType() method on the XMLHttpRequest object and is a workable solution. var oReq = new XMLHttpRequest(); oReq.open("GET", url); // retrieve data unprocessed as a binary string oReq.overrideMimeType("text/plain; charset=x-user-defined"); /* ... */ However, more modern techniques are available, since the responseType attribute now sup
ports a number of additional content types, which makes sending and receiving binary data much easier. For example, consider this snippet, which uses the responseType of "arraybuffer" to fetch the remote content into a ArrayBuffer object, which stores the raw binary data. var oReq = new XMLHttpRequest(); oReq.onload = function(e) { var arraybuffer = oReq.response; // not responseText /* ... */ ...
... not responseText /* ... */ } oReq.open("GET", url); oReq.responseType = "arraybuffer"; oReq.send(); For more examples check out the Sending and Receiving Binary Data page Monitoring progress XMLHttpRequest provides the ability to listen to various events that can occur while the request is being processed. This includes periodic progress notifications, error notifications, and so forth. Sup
port for DOM progress event monitoring of XMLHttpRequest transfers follows the specification for progress events: these events implement the ProgressEvent interface. The actual events you can monitor to determine the state of an ongoing transfer are: progress The amount of data that has been retrieved has changed. load The transfer is complete; all data is now in the response var oReq = new XM...
...And 3 more matches
XRView - Web APIs
in the reference space that was passed to XRFrame.getViewerPose(); this is called the viewer reference space. The transform property describes the position and orientation of the eye or camera represented by the XRView, given in that reference space. The destination rendering layer To render a frame, you just iterate over the XRViewerPose's views, rendering each of them into the appropriate view
port within the frame's XRWebGLLayer. Currently, the specification (and therefore all current implementations of WebXR) is designed around rendering every XRView into a single XRWebGLLayer, which is then presented on the XR device with half used for the left eye and half for the right eye. The XRView
port for each view is used to position the rendering into the correct half of the layer. If in the fut...
...h view to render into a different layer, there would have to be changes made to the API, so it's safe for now to assume that all views will render into the same layer. Examples Preparing to render every view for a pose To draw eerything the user sees each frame requires iterating over the list of views returned by the XRViewerPose object's views list: for (let view of pose.views) { let view
port = glLayer.getView
port(view); gl.view
port(view
port.x, view
port.y, view
port.width, view
port.height); // Draw the scene; the eye being drawn is identified // by view.eye. } Special view transforms There are a few special transforms that are used on the view while rendering and lighting a scene. Model view matrix The model view matrix is a matrix which defines the position of an object r...
...s used when lighting the scene, in order to transform each surface's normal vectors to ensure that the light is reflected in the correct direction given the orientation and position of the surface relative to the light source or sources. ...
...And 3 more matches
ARIA: textbox role - Accessibility
<textarea> element for multi-line input. Description When an element has the textbox role, the browser sends an accessible textbox event to assistive technologies, which can then notify the user about it. The default is a single line input, in which Return or Enter submits the form; in this case, it is preferable to use an HTML <input> with type="text". To create a multi-line text box which sup
ports line breaks, as in an HTML <textarea>, set aria-multiline="true". Including the HTML contenteditable attribute ensures the text node is editable. <!-- Simple text input field --> <div id="txtboxLabel">Enter your five-digit zipcode</div> <div role="textbox" contenteditable="true" aria-placeholder="5-digit zipcode" aria-labelledby="txtboxLabel"></div> <!-- Multi-line text area --> <div id="txtbo...
... <label for="txtbox">Enter your five-digit zipcode</label> <input type="text" placeholder="5-digit zipcode" id="txtbox"/> <!-- Multi-line text area --> <label for="txtboxMultiline">Enter the tags for the article</label> <textarea id="txtboxMultiline" required></textarea> Where a text field is read-only, indicated this by setting aria-readonly="true" on the element. As...
...x, focus may remain on the textbox while the value of aria-activedescendant on the textbox element refers to a descendant of a popup listbox that is controlled by the textbox.This attribute must be updated programmatically as the focus changes. aria-autocomplete attribute Indicates whether and how the user's input into the field could trigger display of a prediction of the intended value. It sup
ports the following values: inline: Predicted text is inserted after the caret. list: Predicted text is presented as a collection of values. both: Predicted text is presented as a collection of values, with the text needed to complete one value inserted after the caret. none (default): Predicted text is not offered. If list or both is set, the aria-controls and aria-haspopup attributes s...
...And 3 more matches
ARIA - Accessibility
ar.setAttribute("aria-valuenow", percentComplete); } Note that ARIA was invented after HTML4, so does not validate in HTML4 or its XHTML variants. However, the accessibility gains it provides far outweigh any technical invalidity. In HTML5, all ARIA attributes validate. The new landmark elements (<main>, <header>, <nav> etc) have built-in ARIA roles, so there is no need to duplicate them. ...
... was invented after HTML4, so does not validate in HTML4 or its XHTML variants. However, the accessibility gains it provides far outweigh any technical invalidity. In HTML5, all ARIA attributes validate. The new landmark elements (<main>, <header>, <nav> etc) have built-in ARIA roles, so there is no need to duplicate them. Sup
port Like any other web technology, there are varying degrees of sup
port for ARIA. ...
...r HTML4, so does not validate in HTML4 or its XHTML variants. However, the accessibility gains it provides far outweigh any technical invalidity. In HTML5, all ARIA attributes validate. The new landmark elements (<main>, <header>, <nav> etc) have built-in ARIA roles, so there is no need to duplicate them. Sup
port Like any other web technology, there are varying degrees of sup
port for ARIA. ...
...And 3 more matches
Web accessibility for seizures and physical reactions - Accessibility
ures." According to the Epilepsy Foundation's page "How Serious Are Seizures?" , "Sudden unexpected death in epilepsy (SUDEP) is likely the most common disease-related cause of death in with epilepsy. It is not frequent but it is a very real problem and people need to be aware of its risk". The point is, seizures most definitely can be and are fatal, and developers and designers are incredibly im
portant to making the web a safer place for those with sensitivities to photosensitive or musicogenic triggers. Seizures can be fatal, but even the ones that are "only" debilitating can be of such severity, that they render the user incapacitated. Other disorders, such as disorientation, nausea, vomiting, and more can also be so severe that the user is unable to function. The Epilepsy Foundation's ar...
...) and lower than 55 Hz. The Epilepsy Foundation's article "Take advantage of media queries with <style> In setting up media queries, you are enabling controls by the user; these controls are made available in the browser or in the OS. See the MDN document, "Accessibility: What users can to to browse more safely" to see more details of how a user accesses the controls. prefers-reduced-motion Sup
port for prefers-reduced-motion in modern browsers is growing. @media screen and (prefers-reduced-motion: reduce) { } @media screen and (prefers-reduced-motion) { } To see a great example of how to use the code prefers-reduced-motion, visit the MDN document, prefers-reduced-motion, or see the example below from the section on New in Chrome 74. button { animation: vibrate 0.3s linear infinite both...
...eat example of how to use the code prefers-reduced-motion, visit the MDN document, prefers-reduced-motion, or see the example below from the section on New in Chrome 74. button { animation: vibrate 0.3s linear infinite both; } @media (prefers-reduced-motion: reduce) { button { animation: none; } } prefers-color-scheme This can be useful if the ambient light API is not available. Sup
port is emerging. @media (prefers-color-scheme: dark) { /* adust styles for dark mode */ } Window.matchMedia() There is a powerful tool available to developers via Window.matchMedia(). A great resource is MDN's document on Window.matchMedia() media update feature The more often the screen is refreshed, the more stable it appears to the human eye, and the less it "flickers". The vast majority ...
...And 3 more matches
:defined - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
:link - CSS: Cascading Style Sheets
ity The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
@media - CSS: Cascading Style Sheets
ipt, the rules created using @media can be accessed with the CSSMediaRule CSS object model interface. Syntax The @media at-rule may be placed at the top level of your code or nested inside any other conditional group at-rule. /* At the top level of your code */ @media screen and (min-width: 900px) { article { padding: 1rem 3rem; } } /* Nested within another conditional at-rule */ @sup
ports (display: flex) { @media screen and (min-width: 900px) { article { display: flex; } } } For a discussion of media query syntax, please see Using media queries. Description Media types Media types describe the general category of a device. Except when using the not or only logical operators, the media type is optional and the all type will be implied. all Suitable for a...
...ounded by parentheses. Name Summary Notes any-hover Does any available input mechanism allow the user to hover over elements? Added in Media Queries Level 4. any-pointer Is any available input mechanism a pointing device, and if so, how accurate is it? Added in Media Queries Level 4. aspect-ratio Width-to-height aspect ratio of the view
port color Number of bits per color component of the output device, or zero if the device isn't color color-gamut Approximate range of colors that are sup
ported by the user agent and output device Added in Media Queries Level 4. color-index Number of entries in the output device's color lookup table, or zero if the device does not use such a table ...
...ed in Media Queries Level 4. display-mode The display mode of the application, as specified in the web app manifest's display member Defined in the Web App Manifest spec. forced-colors Detect whether user agent restricts color palette Added in Media Queries Level 5. grid Does the device use a grid or bitmap screen? height Height of the view
port hover Does the primary input mechanism allow the user to hover over elements? Added in Media Queries Level 4. inverted-colors Is the user agent or underlying OS inverting colors? Added in Media Queries Level 5. light-level Light level of the environment Added in Media Queries Level 5. monochrome Bits per pixel in the output device's mon...
...And 3 more matches
width - CSS: Cascading Style Sheets
The width CSS descriptor is shorthand for setting both the min-width and the max-width descriptors of the view
port. By providing one view
port length value, that value will determine both the min-width and the max-width to the value provided. If two view
port values are provided the first value will be set to the min-width and the second value will be set max-width. Syntax /* An example with one view
port value: */ @view
port { width: 320px; } /* An example with two view
port values: */ @view
port { width: 320px, 120px; } Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. ...
...idth. Syntax /* An example with one view
port value: */ @view
port { width: 320px; } /* An example with two view
port values: */ @view
port { width: 320px, 120px; } Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial view
port at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. ...
...
port { width: 320px, 120px; } Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial view
port at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. ...
...And 3 more matches
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
e shorthand flex property. The following code would set the flex-grow property to 2, flex-shrink to 1 and flex-basis to auto. .item { flex: 2 1 auto; } If you have read the article Basic Concepts of Flexbox, then you will have already had an introduction to the properties. Here we will explore them in depth in order that you can fully understand what the browser is doing when you use them. Im
portant concepts when working on the main axis There are a few concepts worth digging into before looking at how the flex properties work to control ratios along the main axis. These relate to the natural size of flex items before any growing or shrinking takes place, and to the concept of free space. Flex item sizing In order to work out how much space there is available to lay out flex items, the...
...ht applied using an absolute length unit? There is a concept in CSS of min-content and max-content -- these keywords are defined in the CSS Intrinsic and Extrinsic Sizing Specification, and can be used in place of a length unit. In the live example below for instance I have two paragraph elements that contain a string of text. The first paragraph has a width of min-content. In a browser that sup
ports this keyword you should be able to see that the text has taken all of the soft wrapping op
portunities available to it, becoming as small as it can be without overflowing. This then, is the min-content size of that string. Essentially, the longest word in the string is dictating the size. The second paragraph has a value of max-content and so it does the opposite. It gets as big as it possibly c...
... to see that the text has taken all of the soft wrapping op
portunities available to it, becoming as small as it can be without overflowing. This then, is the min-content size of that string. Essentially, the longest word in the string is dictating the size. The second paragraph has a value of max-content and so it does the opposite. It gets as big as it possibly can be, taking no soft-wrapping op
portunities. It would overflow the box it is in if that container was too narrow. If your browser does not yet sup
port these keywords both paragraphs will be rendered as normal paragraphs in block flow; the below screenshots show the expected rendering. Remember this behaviour and what effects min-content and max-content have as we explore flex-grow and flex-shrink later in this article. Positi...
...And 3 more matches
Testing media queries programmatically - CSS: Cascading Style Sheets
d a MediaQueryList object, you can check the result of the query or receive notifications when the result changes. Creating a media query list Before you can evaluate the results of a media query, you need to create the MediaQueryList object representing the query. To do this, use the window.matchMedia method. ...
...ifications when the result changes. Creating a media query list Before you can evaluate the results of a media query, you need to create the MediaQueryList object representing the query. To do this, use the window.matchMedia method. ...
...Media method. For example, to set up a query list that determines if the device is in landscape or
portrait orientation: const mediaQueryList = window.matchMedia("(orientation:
portrait)"); Checking the result of a query Once you've created your media query list, you can check the result of the query by looking at the value of its matches property: if (mediaQueryList.matches) { /* The view
port is currently in
portrait orientation */ } else { /* The view
port is not currently in
portrait orientation, therefore landscape */ } Receiving query notifications If you need to be aware of changes to the evaluated result of the query on an ongoing basis, it's more efficient to register a listener than to poll the query's result. To do this, call the addListener() method on the MediaQueryList...
...And 3 more matches
border-left-style - CSS: Cascading Style Sheets
mpatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetborder-left-styleChrome Full sup
port 1Edge Full sup
port 12Firefox Full sup
port 1Notes Full sup
port 1Notes Notes Prior to Firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid. This has been fixed in Fir...
... Full sup
port 12Firefox Full sup
port 1Notes Full sup
port 1Notes Notes Prior to Firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid. ...
...x Full sup
port 1Notes Full sup
port 1Notes Notes Prior to Firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid. ...
...And 3 more matches
border-left - CSS: Cascading Style Sheets
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
border-right-style - CSS: Cascading Style Sheets
patibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetborder-right-styleChrome Full sup
port 1Edge Full sup
port 12Firefox Full sup
port 1Notes Full sup
port 1Notes Notes Prior to Firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid. This has been fixed in Fir...
... Full sup
port 12Firefox Full sup
port 1Notes Full sup
port 1Notes Notes Prior to Firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid. ...
...x Full sup
port 1Notes Full sup
port 1Notes Notes Prior to Firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid. ...
...And 3 more matches
border-right - CSS: Cascading Style Sheets
he compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
border-top - CSS: Cascading Style Sheets
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ed data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ttps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
direction - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...red data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
empty-cells - CSS: Cascading Style Sheets
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...d data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tps://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
orphans - CSS: Cascading Style Sheets
y The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
outline-offset - CSS: Cascading Style Sheets
compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ata. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
paint() - CSS: Cascading Style Sheets
ty The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
right - CSS: Cascading Style Sheets
lity The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...uctured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 3 more matches
Setting up adaptive streaming media sources - Developer guides
want to set up an adaptive streaming media source on a server, to be consumed inside an HTML5 media element. How would you do that? This article explains how, looking at two of the most common formats: MPEG-DASH and HLS (HTTP Live Streaming.) Choosing formats In terms of adaptive streaming formats, there are many to choose from; we decided to choose the following two as between them we can sup
port most modern browsers. MPEG-DASH HLS (HTTP Live Streaming) In order to adaptively stream media we need to split the media up into chunks. We are required to provide several different quality files split up over several time points. The more qualities and time points there are, the more 'adaptive' your stream will be, but we will usually want to find a pragmatic balance between size, time to ...
...be generated for you. There are a few profiles we can use. We're going to take a look at Ondemand profile for Video On Demand (VOD) and the LIVE profile. For live services streaming, the LIVE profile is a requirement. The stream switching capabilities are identical between the profiles. ...
... Ondemand Profile This profile will allow switching between streams 'on demand' - that is to say that you only need provide a set of contiguous files and specify the bandwidth for each one and the appropriate file will be chosen automatically. Here's a simple example that provides an audio track representation and four separate video representations. <?xml version="1.0" enc...
...And 3 more matches
HTML5 Parser - Developer guides
's main UI thread, improving overall browser responsiveness. Calls to innerHTML are a lot faster. Dozens of long-standing parser related bugs are now fixed. The HTML5 specification provides a more detailed description than previous HTML standards of how to turn a stream of bytes into a DOM tree. This will result in more consistent behavior across browser implementations. In other words, in sup
porting HTML5, Gecko, WebKit, and Internet Explorer (IE) will behave more consistently with each other. Changed parser behaviors Some changes to the way that the Gecko 2 parser behaves, as compared to earlier versions of Gecko, may affect web developers, depending on how you've written your code in the past and what browsers you've tested it on. Tokenization of left angle-bracket within a tag Give...
...or example, if the document lacked a </title> closing tag, the parser would reparse to look for the first '<' in the document, or if a comment was not closed, it would look for the first '>'. This behavior created a security vulnerability. If an attacker could force a premature end-of-file, the parser might change which parts of the document it considered to be executable scripts. In addition, sup
porting reparsing led to unnecessarily complex parsing code. With HTML5, parsers no longer reparse documents. This change has the following consequences for web developers: If you omit the closing tag for <title>, <style>, <textarea>, or <xmp>, the page will fail to be parsed. IE already fails to parse documents with a missing </title> tag, so if you test with IE, you probably don't have that prob...
...r, so it's unlikely that you have this issue in sites that are tested in multiple browsers. In an inline script, in order to use the literal strings <script, </script>, and <!--, you should prevent them from being parsed literally by expressing them as \u003cscript,\u003c/script>, and \u003c!--. The older practice of escaping the string </script> by surrounding it with comment markers, while sup
ported by HTML5, is problematic in cases where the closing comment marker is omitted (see preceding point). You can avoid such problems by using the character code for the initial '<' instead. (It is valid to use an escape character, e.g., <\/script>, but this strategy does not work for <script and <!--, because \s and \! are not valid JavaScript escapes; the character code strategy is more general-pu...
...And 3 more matches
HTML5 - Developer guides
he classical paradigm where the server could send data only in response to a client's request. WebRTC This technology, where RTC stands for Real-Time Communication, allows connecting to other people and controlling videoconferencing directly in the browser, without the need for a plugin or an external application. Offline & storage Offline resources: The application cache Firefox fully sup
ports the HTML5 offline resource specification. Most others have offline resource sup
port at some level. Online and offline events Firefox 3 sup
ports WHATWG online and offline events, which let applications and extensions detect whether or not there's an active Internet connection, as well as to detect when the connection goes up and down. WHATWG client-side session and persistent storage (aka DOM ...
...wn. WHATWG client-side session and persistent storage (aka DOM storage) Client-side session and persistent storage allows web applications to store structured data on the client side. IndexedDB IndexedDB is a web standard for the storage of significant amounts of structured data in the browser and for high performance searches on this data using indexes. Using files from web applications Sup
port for the new HTML5 File API has been added to Gecko, making it possible for web applications to access local files selected by the user. This includes sup
port for selecting multiple files using the <input> of type file HTML element's new multiple attribute. There also is FileReader. Multimedia Using HTML5 audio and video The <audio> and <video> elements embed and allow the manipulation of ne...
...erencing directly in the browser, without the need for a plugin or an external application. Track and WebVTT The <track> element allows subtitles and chapters. WebVTT is a text track format. 2D/3D graphics AND effects Canvas tutorial Learn about the new <canvas> element and how to draw graphs and other objects in Firefox. HTML5 Text API for <canvas> elements The HTML5 text API is now sup
ported by <canvas> elements. WebGL WebGL brings 3D graphics to the Web by introducing an API that closely conforms to OpenGL ES 2.0 that can be used in HTML5 <canvas> elements. SVG An XML-based format of vectorial images that can directly be embedded in the HTML. Performance and Integration Web Workers Allows delegation of JavaScript evaluation to background threads, allowing these activit...
...And 3 more matches
Global attributes - HTML: Hypertext Markup Language
opzone An enumerated attribute indicating what types of content can be dropped on an element, using the Drag and Drop API. It can have the following values: copy, which indicates that dropping will create a copy of the element that was dragged move, which indicates that the element that was dragged will be moved to this new location. link, will create a link to the dragged data. ex
portparts Used to transitively ex
port shadow parts from a nested shadow tree into a containing light tree. hidden A Boolean attribute indicates that the element is not yet, or is no longer, relevant. For example, it can be used to hide elements of the page that can't be used until the login process has been completed. The browser won't render such elements. This attribute must not be used to hide...
...ing values: empty string and yes, which indicates that the element will be translated. no, which indicates that the element will not be translated. Specifications Specification Status Comment HTML Living StandardThe definition of 'Global attributes' in that specification. Living Standard Shadow Parts Working Draft Added the part and ex
portparts global attributes. HTML 5.2The definition of 'Global attributes' in that specification. Recommendation Snapshot of HTML Living Standard. From HTML 5.1, itemid, itemprop, itemref, itemscope, and itemtype have been added. HTML 5.1The definition of 'Global attributes' in that specification. Recommendation Snapshot of HTML Living Standard. From HTML5, contextmenu, d...
...obal attributes. xml:lang which was initially part of XHTML, is now also part of HTML. hidden, data-*, contenteditable, and translate have been added. HTML 4.01 Specification Recommendation There are no global attributes defined. Several attributes that will become global attributes in subsequent specifications are defined on a subset of elements. ...
...And 3 more matches
Evolution of HTTP - HTTP
TP/0.9, and sometimes as the one-line protocol. HTTP/0.9 - The one-line protocol The initial version of HTTP had no version number; it has been later called 0.9 to differentiate it from the later versions. HTTP/0.9 is extremely simple: requests consist of a single line and start with the only possible method GET followed by the path to the resource (not the URL as both the protocol, server, and
port are unnecessary once connected to the server). GET /mypage.html The response is extremely simple too: it only consisted of the file itself. <HTML> A very simple HTML page </HTML> Unlike subsequent evolutions, there were no HTTP headers, meaning that only HTML files could be transmitted, but no other type of documents. There were no status or error codes: in case of a problem, a specific HTML ...
...biguities and introduced numerous improvements: A connection can be reused, saving the time to reopen it numerous times to display the resources embedded into the single original document retrieved. Pipelining has been added, allowing to send a second request before the answer for the first one is fully transmitted, lowering the latency of the communication. Chunked responses are now also sup
ported. Additional cache control mechanisms have been introduced. Content negotiation, including language, encoding, or type, has been introduced, and allows a client and a server to agree on the most adequate content to exchange. Thanks to the Host header, the ability to host different domains at the same IP address now allows server colocation. A typical flow of requests, all through one single...
...pany, but SSL 2.0 and its successor SSL 3.0 allowed for the creation of e-commerce Web sites by encrypting and guaranteeing the authenticity of the messages exchanged between the server and client. SSL was put on the standards track and eventually became TLS, with versions 1.0, 1.1, 1.2, and 1.3 appearing successfully to close vulnerabilities. During the same time, the need for an encrypted trans
port layer raised: the Web left the relative trustiness of a mostly academic network, to a jungle where advertisers, random individuals or criminals compete to get as much private information about people, try to impersonate them or even to replace data transmitted by altered ones. As the applications built over HTTP became more and more powerful, having access to more and more private information lik...
...And 3 more matches
Content negotiation - HTTP
a script: It is different when fetching a document entered in the address bar or an element linked via an <img>, <video> or <audio> element. Browsers are free to use the value of the header that they think is the most adequate; an exhaustive list of default values for common browsers is available. The Accept-CH header This is part of an experimental technology called Client Hints. Initial sup
port is in Chrome 46 or later. The Device-Memory value is in Chrome 61 or later. The experimental Accept-CH lists configuration data that can be used by the server to select an appropriate response. Valid values are: Value Meaning Device-Memory Indicates the approximate amount of device RAM. This value is an approximation given by rounding to the nearest power of 2 and d...
... or later. The experimental Accept-CH lists configuration data that can be used by the server to select an appropriate response. Valid values are: Value Meaning Device-Memory Indicates the approximate amount of device RAM. This value is an approximation given by rounding to the nearest power of 2 and dividing that number by 1024. For example, 512 megabytes will be re
ported as 0.5. DPR Indicates the client's device pixel ratio. View
port-Width Indicates the layout view
port width in CSS pixels. Width Indicates the resource width in physical pixels (in other words the intrinsic size of an image). The Accept-Charset header The Accept-Charset header indicates to the server what kinds of character encodings are understood by t...
...th in physical pixels (in other words the intrinsic size of an image). The Accept-Charset header The Accept-Charset header indicates to the server what kinds of character encodings are understood by the user-agent. Traditionally, it was set to a different value for each locale for the browser, like ISO-8859-1,utf-8;q=0.7,*;q=0.7 for a Western European locale. With UTF-8 now being well-sup
ported, being the preferred way of encoding characters, and to guarantee better privacy through less configuration-based entropy, browsers omit the Accept-Charset header: Internet Explorer 8, Safari 5, Opera 11, Firefox 10 and Chrome 27 have abandoned this header. The Accept-CH-Lifetime header This is part of an experimental technology called Client Hints and is only available in Chrome 61 or later...
...And 3 more matches
CSP: style-src - HTTP
directive is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the style-src policy: Content-Security-Policy: style-src <source>; Content-Security-Policy: style-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 3 more matches
Public-Key-Pins - HTTP
Note: Public Key Pinning mechanism was deprecated in favor of Certificate Transparency and Expect-CT header. The HTTP Public-Key-Pins response header used to associate a specific cryptographic public key with a certain web server to decrease the risk of MITM attacks with forged certificates, however, it has been removed from modern browsers and is no longer sup
ported. Use Certificate Transparency and Expect-CT header instead. ...
...It is possible to specify multiple pins for different public keys. Some browsers might allow other hashing algorithms than SHA-256 in the future. ...
...multiple pins for different public keys. Some browsers might allow other hashing algorithms than SHA-256 in the future. max-age=<expire-time> The time, in seconds, that the browser should remember that this site is only to be accessed using one of the defined keys. includeSubDomains Optional If this optional parameter is specified, this rule applies to all of the site's subdomains as well. re
port-uri="<uri>" Optional If this optional parameter is specified, pin validation failures are re
ported to the given URL. Example HPKP has the potential to lock out users for a long time if used incorrectly! The use of backup certificates and/or pinning the CA certificate is recommended. Public-Key-Pins: pin-sha256="cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs="; pin-sha256="M8HztCzM3elUxkcj...
...And 3 more matches
Date.prototype.toLocaleDateString() - JavaScript
The new locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function. In older implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...rm of the string returned are entirely implementation dependent. See the Intl.DateTimeFormat() constructor for details on these parameters and how to use them. The default value for each date-time component property is undefined, but if the weekday, year, month, day properties are all undefined, then year, month, and day are assumed to be "numeric". Return value A string representing the date
portion of the given Date instance according to language-specific conventions. Performance When formatting large numbers of dates, it is better to create an Intl.DateTimeFormat object and use the function provided by its format property. Examples Using toLocaleDateString() In basic use without specifying a locale, a formatted string in the default locale and with default options is returned. va...
...locale, a formatted string in the default locale and with default options is returned. ...
...And 3 more matches
Date.prototype.toLocaleTimeString() - JavaScript
The new locales and options arguments let applications specify the language whose formatting conventions should be used and customize the behavior of the function. In older implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...orm of the string returned are entirely implementation dependent. See the Intl.DateTimeFormat() constructor for details on these parameters and how to use them. The default value for each date-time component property is undefined, but if the hour, minute, second properties are all undefined, then hour, minute, and second are assumed to be "numeric". Return value A string representing the time
portion of the given Date instance according to language-specific conventions. Performance When formatting large numbers of dates, it is better to create an Intl.DateTimeFormat object and use the function provided by its format property. Examples Using toLocaleTimeString() In basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var...
...locale, a formatted string in the default locale and with default options is returned. ...
...And 3 more matches
Media type and format guide: image, audio, and video content - Web media technologies
Since nearly its beginning, the web has included sup
port for some form of visual media presentation. Originally, these capabilities were limited, and were expanded organically, with different browsers finding their own solutions to the problems around including still and video imagery on the web. The modern web has powerful features to sup
port the presentation and manipulation of media, with several media-related APIs sup
porting various types of content. Generally, the media formats sup
ported by a browser are entirely up to the browser's creators, which can complicate the work of a web developer. This guide provides an overview of the media file types, codecs, and algorithms that may comprise media used on the web. ...
...entation and manipulation of media, with several media-related APIs sup
porting various types of content. Generally, the media formats sup
ported by a browser are entirely up to the browser's creators, which can complicate the work of a web developer. This guide provides an overview of the media file types, codecs, and algorithms that may comprise media used on the web. It also provides browser sup
port information for various combinations of these, and suggestions for prioritization of formats, as well as which formats excel at specific types of content. ...
...of a web developer. This guide provides an overview of the media file types, codecs, and algorithms that may comprise media used on the web. It also provides browser sup
port information for various combinations of these, and suggestions for prioritization of formats, as well as which formats excel at specific types of content. References Images Image file type and format guide Covers sup
port of image file types and content formats across the major web browsers, as well as providing basic information about each type: benefits, limitations, and use cases of interest to web designers and developers. Image file types for web designers Fundamental information about the various image file types that may be useful for web designers, including best practices and use cases for each type, an...
...And 3 more matches
Critical rendering path - Web Performance
r makes requests for styles, which in turn builds the CSS object model. The browser engine combines the two to create the Render Tree. Layout determines the size and location of everything on the page. Once layout is determined, pixels are painted to the screen. Optimizing the critical rendering path improves the time to first render. Understanding and optimizing the critical rendering path is im
portant to ensure reflows and repaints can happen at 60 frames per second, to ensure performant user interactions and avoid jank. Understanding CRP Web performance includes the server requests and responses, loading, scripting, rendering, layout, and the painting of the pixels to the screen. A request for a web page or app starts with an HTML request. The server returns the HTML - response headers ...
...n HTML request. The server returns the HTML - response headers and data. The browser then begins parsing the HTML, converting the received bytes to the DOM tree. The browser initiates requests every time it finds links to external resources, be they stylesheets, scripts, or embedded image references. Some requests are blocking, which means the parsing of the rest of the HTML is halted until the im
ported asset is handled. The browser continues to parse the HTML making requests and building the DOM, until it gets to the end, at which point it constructs the CSS object model. With the DOM and CSSOM complete, the browser builds the render tree, computing the styles for all the visible content. After the render tree is complete, layout occurs, defining the location and size of all the render tree e...
...ermining the width and height of each element, and where they are in relation to each other. What is the width of an element? Block level elements, by definition, have a default width of 100% of the width of their parent. An element with a width of 50%, will be half of the width of its parent. Unless otherwise defined, the body has a width of 100%, meaning it will be 100% of the width of the view
port. ...
...And 3 more matches
Populating the page: how browsers work - Web Performance
h is used by the renderer to paint a page to the screen. The DOM is the internal representation of the markup for the browser. The DOM is also exposed, and can be manipulated through various APIs in JavaScript. Even if the request page's HTML is larger than the initial 14KB packet, the browser will begin parsing and attempting to render an experience based on the data it has. This is why it's im
portant for web performance optimization to include everything the browser needs to start rendering a page, or at least a template of the page - the CSS and HTML needed for the first render -- in the first 14 kilobytes. But before anything is rendered to the screen, the HTML, CSS, and JavaScript have to be parsed. Building the DOM tree We describe five steps in the critical rendering path. The firs...
...mg src="myimage.jpg" alt="image description"/> <script src="anotherscript.js" async></script> In this example, while the main thread is parsing the HTML and CSS, the preload scanner will find the scripts and image, and start downloading them as well. To ensure the script doesn't block the process, add the async attribute, or the defer attribute if JavaScript parsing and execution order is not im
portant. Waiting to obtain CSS doesn't block HTML parsing or downloading, but it does block JavaScript, because JavaScript is often used to query CSS properties' impact on elements. Building the CSSOM The second step in the critical rendering path is processing CSS and building the CSSOM tree. The CSS object model is similar to the DOM. The DOM and CSSOM are both trees. They are independent data st...
...screen readers. Render Rendering steps include style, layout, paint and, in some cases, compositing. The CSSOM and DOM trees created in the parsing step are combined into a render tree which is then used to compute the layout of every visible element, which is then painted to the screen. In some cases, content can be promoted to their own layers and composited, improving performance by painting
portions of the screen on the GPU instead of the CPU, freeing up the main thread. Style The third step in the critical rendering path is combining the DOM and CSSOM into a render tree.The computed style tree, or render tree, construction starts with the root of the DOM tree, traversing each visible node. Tags that aren't going to be displayed, like the <head> and its children and any nodes with dis...
...And 3 more matches
Optimizing startup performance - Web Performance
mance. How long does your app take to start up? Does it seem to lock up the device or the user's browser while the app loads? That makes users worry that your app is crashed, or that something else is wrong. It's always a good idea to take the time to ensure that your app starts up nicely. This article offers tips and suggestions to help you achieve that goal, both when writing a new app and when
porting an app from another platform to the Web. Starting up nicely Regardless of platform, it's always a good idea to start up as quickly as possible. Since that's a universal issue, we won't be focusing on it too much here. Instead, we're going to look at a more im
portant issue when building Web apps: starting up as asynchronously as possible. That means not running all your startup code in a sin...
... worker that does as much as possible in a background thread (for example, fetching and processing data.) Then, anything that must be done on the main thread (such as user events and rendering UI) should be broken up into small pieces so that the app's event loop continues to cycle while it starts up. This will prevent the app, browser, and/or device from appearing to have locked up. Why is it im
portant to be asynchronous? Other than the reasons suggested above, consider the impact of a non-responsive page or user interface. The user is unable to cancel if they launched your app by mistake. If the app is being run in a browser, it's possible the user may get an "unresponsive app" or "slow script" notification. You should present some kind of interface, such as a progress bar, so that the user...
...synchronous. All pure startup calculations should be performed in background threads, while you keep the run-time of main thread events as short as possible. Include a progress indicator so the user knows what's going on and how long they'll be waiting. In theory, anyway, it should be pretty easy to design your new app to start up nicely. On the other hand, however, it can get tricky when you're
porting an existing app to the Web. A desktop application doesn't need to be written in an asynchronous fashion because usually the operating system handles that for you, or the app is the only thing that matters which is currently running, depending on the operating environment. The source application might have a main loop that can easily be made to operate asynchronously (by running each main loop ...
...And 3 more matches
Privacy, permissions, and information security
is needed to achieve as much privacy and information security as possible. In this article, we examine how to create web content that minimizes the risk of users' personal information or imagery being obtained unexpectedly by third parties. Security and privacy defined Before we go into any depth about the various security and privacy features available to users on the web, let's define some im
portant terms. Personally identifiable information Personally identifiable information (PII) is information which can be used, in whole or in part, to track down and/or identify a specific person. As such, PII extends beyond the web to all aspects of life. For example, if a site leaks a list of users' names and zip codes online, a bad actor could almost certainly track down at least some percent...
...rson. As such, PII extends beyond the web to all aspects of life. For example, if a site leaks a list of users' names and zip codes online, a bad actor could almost certainly track down at least some percentage of those users by simply using the corresponding phone books. Personally identification can include information like usernames, real names, passwords, phone numbers or addresses (or even
portions of them), information about medical history, Social Security Numbers, driver licenses, or any other form of ID or ID number, credit card information, and so forth. It's a very broad range of information. Whenever working with data, always stop and think: is there any way this can be used to even through many steps identify a specific person? Privacy The concept of privacy is somewhat ha...
...ar device the better. Modern browsers take steps to help prevent fingerprinting-based attacks by either not allowing information to be accessed or, where the information must be made available, by introducing variations that prevent it from being used for identification purposes. For example, if a web site queries a user's browser for the elapsed time, a comparison of that time to the time as re
ported by the server might be useful as a factor in fingerprinting. Because of this, browsers typically introduce a small amount of variability to timers in order to make them less useful for identifying the user's system. Privacy and security controls There are multiple layers of controls for helping to protect users against security and privacy breaches. These start at the web server, include the ...
...And 3 more matches
Progressive web app structure - Progressive web apps (PWAs)
tself. Why should I use it? This architecture allows a website to benefit the most from all the PWA features -- it caches the app shell and manages the dynamic content in a way that greatly improves the performance. In addition to the basic shell, you can add other features such as add to home screen or push notifications, safe in the knowledge that the app will still work OK if they are not sup
ported by the user's browser -- this is the beauty of progressive enhancement. The website feels like a native app with instant interaction and solid performance while keeping all the benefits of the web. Being linkable, progressive and responsive by design It's im
portant to remember the PWA advantages and keep them in mind when designing the application. The app shell approach allows websites to b...
...ws websites to be: Linkable: Even though it behaves like a native app, it is still a website -- you can click on the links within the page and send a URL to someone if you want to share it. ...
... Different concept: streams An entirely different approach to server- or client-side rendering can be achieved with the Streams API. ...
...And 3 more matches
Tools for SVG - SVG: Scalable Vector Graphics
<< Previous Now that we covered the basics of the SVG internals, we will take a look at some tools to work with SVG files. Browser sup
port As of Internet Explorer 9, all major browsers sup
port SVG: IE 9, Mozilla Firefox, Safari, Google Chrome and Opera. Mobile devices with Webkit-based browsers also sup
port SVG. On older or smaller devices, chances are that SVG Tiny is sup
ported. Inkscape URL: www.inkscape.org One of the most im
portant tools for a graphics format is a decent drawing program. Inkscape offers state-of-the-art vector drawing, and it's open source. Moreover, it uses SVG as its native file format. To store Inkscape specific data, it extends the SVG file with elements and attributes in a custom namespace, but you can also choose to ex
port as plain SVG. Adobe Il...
...nd it's open source. Moreover, it uses SVG as its native file format. To store Inkscape specific data, it extends the SVG file with elements and attributes in a custom namespace, but you can also choose to ex
port as plain SVG. Adobe Illustrator URL: www.adobe.com/products/illustrator/ Before Adobe acquired Macromedia, it was the most prominent promoter of SVG. From this time stems the good sup
port of SVG in Illustrator. However, the resulting SVG often shows some quirks, that make it necessary to post-process it for general applicability. ...
... Batik offers a viewer (Squiggle), a rasterizer for PNG output, an SVG pretty printer to format SVG files, and a TrueType-to-SVG-Font converter. Together with Apache FOP Batik can transform SVG to PDF. ...
...And 3 more matches
Same-origin policy - Web security
The same-origin policy is a critical security mechanism that restricts how a document or script loaded from one origin can interact with a resource from another origin. It helps isolate potentially malicious documents, reducing possible attack vectors. Definition of an origin Two URLs have the same origin if the protocol,
port (if specified), and host are the same for both. You may see this referenced as the "scheme/host/
port tuple", or just "tuple". (A "tuple" is a set of items that together comprise a whole -- a generic form for double/triple/quadruple/quintuple/etc.) The following table gives examples of origin comparisons with the URL http://store.company.com/dir/page.html: URL Outcome Reason http://store.company.com/dir2/other.html Same origin Only the p...
... For example, about:blank is often used as a URL of new, empty p...
... For example, about:blank is often used as a URL of new, empty popup windows into...
...And 3 more matches
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
ated is placed inside curly brackets: <img src="{$image-dir}/mygraphic.jpg"/> This would result in the following: <img src="/images/mygraphic.jpg"/> The element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the W3C Recommendation and an explanation of the degree of present Gecko sup
port. ...
... This would result in the following: <img src="/images/mygraphic.jpg"/> The element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the W3C Recommendation and an explanation of the degree of present Gecko sup
port. ...
...tax listing, a list of required and optional attributes, a description of type and position, its source in the W3C Recommendation and an explanation of the degree of present Gecko sup
port. Use the {{ListSubpages}} macro once the BCD for <xsl:fallback>, <xsl:im
port>, <xsl:namespace-alias>, <xsl:number>, <xsl:output>, <xsl:stylesheet>, <xsl:text> and <xsl:value-of> is fully migrated. ...
...And 3 more matches
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
This can be done via XMLHttpRequest or XMLDocument.load(). ...
...This can be done via XMLHttpRequest or XMLDocument.load(). ...
...pRequest or XMLDocument.load(). Figure 1 : Instantiating an XSLTProcessor var xsltProcessor = new XSLTProcessor(); // Load the xsl file using synchronous (third param is set to false) XMLHttpRequest var myXMLHTTPRequest = new XMLHttpRequest(); myXMLHTTPRequest.open("GET", "example.xsl", false); myXMLHTTPRequest.send(null); var xslRef = myXMLHTTPRequest.responseXML; // Finally im
port the .xsl xsltProcessor.im
portStylesheet(xslRef); For the actual transformation, XSLTProcessor requires an XML document, which is used in conjunction with the im
ported XSL file to produce the final result. The XML document can be a separate XML file loaded as shown in figure 1, or it can be part of the existing page. To process part of a page's DOM, it is necessary to first create an XML docum...
...And 3 more matches
Content Processes - Archive of obsolete content
cated process (called content and add-on processes, respectively). The project behind this refactor was known as Electrolysis, or E10s. Although E10s has now been suspended, the SDK was designed with this multiprocess model in mind. Afterwards, it was decided to keep the design the way it is: even though it's no longer necessary, it turns out that from a security point of view there are several im
portant advantages to thinking about content and add-on code as living in different processes. Many add-ons have to interact with content. The problem with the multiprocess model is that add-ons and content are now in different processes, and scripts in one process cannot interact directly with scripts in another. We can, however, pass JSON messages between scripts in different processes. The solutio...
... to provide a pipe between each content script and the main add-on script. The idea is to use a single content worker for each content process. The constructor for the content worker takes an object containing one or more named options. Among other things, this allows us to specify one or more content scripts to be loaded. When a content script is first loaded, the content worker automatically im
ports a messaging API that allows it to emit messages over a pipe. On the add-on side, this pipe is exposed via the the
port property on the worker. In addition to the
port property, workers also sup
port the web worker API, which allows scripts to send messages to each other using the postMessage function. This function uses the same pipe internally, and causes a 'message' event to be emitted on the o...
...ies of the window object via a content script is sometimes inconvenient, so it is possible to circumvent this: by defining the property on window.wrappedObject, the property is defined on the underlying object, rather than the wrapper itself. This feature should only be used when you really need it, however. ...
...And 2 more matches
tabs - Archive of obsolete content
Attaching stylesheets New in Firefox 34. You can't attach style sheets to a tab using tab.attach(), but fr...
... Attaching stylesheets New in Firefox 34. You can't attach style sheets to a tab using tab.attach(), but from Firefox 34 onwards you can attach and detach them using t...
...e, tabs.activeTab); } } }); Private windows If your add-on has not opted into private browsing, then you won't see any tabs that are hosted by private browser windows. Tabs hosted by private browser windows won't be seen if you enumerate the tabs module itself, and you won't receive any events for them. To learn more about private windows, how to opt into private browsing, and how to sup
port private browsing, refer to the documentation for the private-browsing module. Converting to XUL tabs To convert from the high-level Tab objects used in this API to the low-level XUL tab objects used in the tabs/utils API and by traditional add-ons, use the viewFor() function ex
ported by the viewFor module. To convert back the other way, from a XUL tab to a high-level Tab object, use the modelF...
...And 2 more matches
test/utils - Archive of obsolete content
ed in the CommonJS Unit Testing suite. Usage Before and After Helper functions before() and after() are available for running a function before or after each test in a suite. They're useful when you need to guarantee a particular state before running a test, and to clean up after your test. let { before, after } = require('sdk/test/utils'); let { search } = require('sdk/places/bookmarks'); ex
ports.testCountBookmarks = function (assert, done) { search().on('end', function (results) { assert.equal(results, 0, 'should be no bookmarks'); done(); }); }; before(ex
ports, function (name, assert) { removeAllBookmarks(); }); require('sdk/test').run(ex
ports); Both before and after may be asynchronous. To make them asynchronous, pass a third argument done, which is a function to call...
... no bookmarks'); done(); }); }; before(ex
ports, function (name, assert) { removeAllBookmarks(); }); require('sdk/test').run(ex
ports); Both before and after may be asynchronous. ...
...nous. ...
...And 2 more matches
cfx to jpm - Archive of obsolete content
ith cfx you are also allowed to omit the "./": var utils = require("utils"); // this will not work with jpm! This second form will not work with jpm. ...
... In jpm the old way to use third-party modules no longer works. ...
... of these modules in the same way that they use the SDK's built-in modules. In jpm the old way to use third-party modules no longer works. Instead, jpm expects third-party modules to be hosted on npm, and you can use them by installing them from npm into your add-on's directory tree, then requiring them. See the tutorial on using third-party modules with jpm. Mobile development jpm does not sup
port the "--force-mobile" option, instead you will need to define engines in package.json and add "fennec" there. There is a known bug in simple options handling which may require the workaround described in https://bug635044.bugzilla.mozilla.org/show_bug.cgi?id=1243467 Commands and command options Permanently removed commands jpm has dropped sup
port for all the "Internal" cfx commands. Permanent...
...And 2 more matches
Creating annotations - Archive of obsolete content
Because this code uses jQuery, you'll need to...
...ta. Updating main.js Go back to main.js and add the code to create the selector into the main function: var selector = pageMod.PageMod({ include: ['*'], contentScriptWhen: 'ready', contentScriptFile: [data.url('jquery-1.4.2.min.js'), data.url('selector.js')], onAttach: function(worker) { worker.postMessage(annotatorIsOn); selectors.push(worker); worker.
port.on('show', function(data) { console.log(data); }); worker.on('detach', function () { detachWorker(this, selectors); }); } }); Make sure the name you use to load jQuery matches the name of the jQuery version you downloaded. The page-mod matches all pages, so each time the user loads a page the page-mod emits the attach event, which will call the listener function we've ...
...e do three things: send the content script a message with the current activation status add the worker to an array called selectors so we can send it messages later on assign a message handler for messages from this worker. If the message is show we will just log the content for the time being. If the message is detach we remove the worker from the selectors array. ...
...And 2 more matches
Listening for Load and Unload - Archive of obsolete content
To follow this tutorial you'll need to have learned the basics of jpm. If your add-on ex
ports a function called main(), then that function will be called whenever the add-on is loaded, and it will be passed an object containing a string describing the reason it was loaded as well as any arguments passed to it. If your add-on ex
ports a function called onUnload(), then that function will be called when the add-on is unloaded, and it will be passed a string describing the reason it was unloaded. You don't have to use ex
ports.main() or ex
ports.onUnload(). You can just place your add-on's code at the top level instead of wrapping it in a function assigned to ex
ports.main(). ...
...called when the add-on is unloaded, and it will be passed a string describing the reason it was unloaded. You don't have to use ex
ports.main() or ex
ports.onUnload(). You can just place your add-on's code at the top level instead of wrapping it in a function assigned to ex
ports.main(). It will be loaded in the same circumstances, but you won't get access to the load/unload reason or arguments. ex
ports.main() Your add-on's main.js code is executed as soon as it is loaded. It is loaded when it is installed, when it is enabled, or when Firefox starts. If your add-on ex
ports a function called main(), that function will be called immediately after the overall main.js is evaluated, and after all top-level require() statements have run (so generally after all dependent modules have been loaded). ...
...in() Your add-on's main.js code is executed as soon as it is loaded. It is loaded when it is installed, when it is enabled, or when Firefox starts. If your add-on ex
ports a function called main(), that function will be called immediately after the overall main.js is evaluated, and after all top-level require() statements have run (so generally after all dependent modules have been loaded). ex
ports.main = function (options, callbacks) {}; options is an object describing the parameters with which your add-on was loaded. ...
...And 2 more matches
Customizing the download progress bar - Archive of obsolete content
="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> </overlay> In jar.mn, make sure that there is an asterisk in front of the entry for myextension.css so that it will be preprocessed. This is required since it contains platform-specific directives, as we will see. ...
...overlay> In jar.mn, make sure that there is an asterisk in front of the entry for myextension.css so that it will be preprocessed. This is required since it contains platform-specific directives, as we will see. ...
...yextension.css so that it will be preprocessed. This is required since it contains platform-specific directives, as we will see. ...
...And 2 more matches
Enhanced Extension Installation - Archive of obsolete content
irectory's extensions folder. This boolean relationship itself is not stored directly in the datasource. Rather, if the system needs to know where an item is located, it checks to see if the item is a member of the the appropriate type container (urn:mozilla:extension:root or urn:mozilla:theme:root) in each of the two datasources. This is clumsy. Item Type The Extension System in Firefox 1.0 sup
ports only two item types, Extensions and Themes. This is a by-product of the fact that there are physical per-type containers in the datasource. Sections of UI that display installed items are rooted on these containers. Tracking Item Type Item type is tracked for the most part by containment in one or other of the two containers. In situations where an item is not yet a member of one of the contai...
...nce is that since there is now only a single instance of this file in the profile location, the file paths are now absolute. <profile>/extensions.rdf -visible items This file contains non-startup and compatibility metadata for extensions that are visible to the user, whether they are enabled or disabled. If an extension is installed at two different Install Locations, the one with the higher im
portance is what is shown in this file. This replaces the individual Extensions.rdf files at the old locations. <profile>/extensions-startup.manifest -all items This file contains a tab delimited set of lines, one per item. This is a list of all installed items, disabled or not, keyed first by Install Location name, then by GUID. The following information is stored for each entry: the persisten...
...s-startup.manifest file is written from the current state of the cache. The Pending Operations List is used by the Install Operation Finalization routine (|_finishOperations|) to get a list of items that are to be operated on. Since all metadata is now stored in the profile directory, there is no longer any need for special Extension System handling of the -register command line flag, so sup
port for that has been removed. Datasource Structure Since there is now only a single RDF/XML datasource for storage of all installed items, the staggered datasource structure used by Firefox 1.0 and the use of an internal composite datasource is no longer required. The Extension System retains an object implementing nsIRDFDataSource (so that it can supply special properties in addition to the set s...
...And 2 more matches
Appendix: What you should know about open-source software licenses - Archive of obsolete content
cope Restricted Use within permitted scope FIXME: Wow, the table is weird! So what's an OSS license? So now you're wondering, what conditions does an OSS license place on software? This can be briefly answered by the Open Source Definition, which was determined by the Open Source Initiative (OSI). This covers three rights and six conditions. What is im
portant to us now is the following three rights: Open source rights: A user can create and distribute copies of the source code; A user can obtain a program's source code; A user can modify the source code. Any OSS license will include these rights. The user is free to use (duplicate, distribute, and modify) the source code, following certain conditions. This means that the author is granting ...
...recommend applying the LGPL to libraries. Pros and cons Programs that have been released under the GPL mandate that any derivative works also be released under the GPL, so the code cannot be wrapped in a proprietary program. However, compared to the BSD license, its terms are complicated, and can be difficult for users to understand. Points to understand about OSS licenses I'll explain some im
portant aspects of OSS licensing that you should be aware of. You don't have to give it away There's nothing in an OSS license that prevents you from charging money for software. One of the advantages of OSS is that it emphasizes that software can be distributed for free, but it can also be distributed for money. Of course, customers who buys the software can then redistribute it themselves, so unl...
...ave developed yourself, you need to pick a license. But what kind of license? Yukihiro Matsumoto, the developer behind the Ruby scripting language, published a "free software license diagnostic" in his personal blog. It asks a series of questions, and your responses help you pick the right license. In brief, it goes like this: Best not to even try: Creating a new license for your own use -> Sup
port is a nightmare. Do you hate the idea of your software ever being embedded in a commercial package? -> Choose the GPL. Do you enthusiastically sup
port the Free Software movement? -> Choose the GPL. Do you want your code to be embedded in a certain OSS project? -> Choose the same license as that project. None of the above: Choose the Modified BSD license. The title hints at Matsumoto's diagno...
...And 2 more matches
JavaScript Object Management - Archive of obsolete content
r. They are minimal, and we add a very small Makefile.in file in the modules directory, just to keep everything separated and organized. With the setup out of the way, let's get to it. What are JavaScript Code Modules? A JavaScript Code Module is a regular JS file that specifies which of the declared elements in it are public. All module files should begin with a declaration like this: var EX
PORTED_SYMBOLS = ["<ModuleNamespace>"]; EX
PORTED_SYMBOLS is a special identifier that tells Firefox that this file is only publishing the object named <ModuleNamespace>. Several objects, functions and variables can be declared on this file, but the only object visible from the outside will be <ModuleNamespace>, which is a namespace in our case. Because of namespacing, we don't need to worry much a...
...<ModuleNamespace>"]; EX
PORTED_SYMBOLS is a special identifier that tells Firefox that this file is only publishing the object named <ModuleNamespace>. Several objects, functions and variables can be declared on this file, but the only object visible from the outside will be <ModuleNamespace>, which is a namespace in our case. ...
...at this file is only publishing the object named <ModuleNamespace>. Several objects, functions and variables can be declared on this file, but the only object visible from the outside will be <ModuleNamespace>, which is a namespace in our case. Because of namespacing, we don't need to worry much about what to ex
port, usually we just need the namespace object. All of the objects inside of it are ex
ported as well, since they are members of the <ModuleNamespace> object. Module files can be im
ported to a chrome script or to other code modules with the following line: Components.utils.im
port("resource://xulschoolhello/messageCount.js"); When using Components.utils.im
port, code modules must be loaded using a file: or resource: URL pointing to a file on the disk. In particular, chrome: URLs (...
...And 2 more matches
XUL user interfaces - Archive of obsolete content
Mozilla overcomes this limitation by providing a specialized language for creating user interfaces: XUL (XML User-interface Language, usually pronounced like "zool"). In XUL, many common user interface features are built in. ...
...Mozilla overcomes this limitation by providing a specialized language for creating user interfaces: XUL (XML User-interface Language, usually pronounced like "zool"). In XUL, many common user interface features are built in. ...
... } else { status.removeAttribute("warning") status.setAttribute("label", aDate.toLocaleDateString()) } } To see the result exactly as intended, use the default theme in your browser. If you use a different theme, it changes some user-interface styles and the demonstration might look strange. Open the document in your Mozilla browser and use the interface. This wiki does not sup
port XUL and JavaScript in pages, so it is not possible to show the demonstration here. It looks something like this: XUL demonstration Day of week calculator Date: 6/27/2005 Day: Sunday Monday Tuesday Wednesday Thurdsay Friday Saturday Clear Today ...
...And 2 more matches
List of Mozilla-Based Applications - Archive of obsolete content
applications is also available. Name Description Additional Information 389 Directory Server LDAP server Uses NSS A380 seatback entertainment system media software This blog post mentions a reference to Mozilla being used but I couldn't find more information about it. ...
... Dogtag certificate system Uses NSS Dojo JavaScript toolkit Uses Mozilla Rhino in ShrinkSafe Eclipse platform open development platform The AJAX Toolkit Framework, Standard Widget Toolkit and EclipseMozilla projects make use of Mozilla Elixon WCMS/XUL Web Content Management System F...
...r MozNet .NET Control embeddable Gecko for .NET applications Wraps XulRunner for use in .NET applications My Internet Browser localized browser Uses Gecko Myna Application Server JavaScript application server for Java Uses Mozilla Rhino NextCMS (fr) CMS Nightingale music player Community run effort to continue Songbird sup
port for Linux OLPC Web Browser browser OneTeam Jabber client OpenDocument Viewer viewer OpenGate's tools CD burner, file browser, and hardware diagnostic softwares OpenGate is the OpenSource side of the EasyNeuf project, "A Free Software Computer, Easy and Preinstalled" Open Mashups development tool OpenOffice.org...
...And 2 more matches
Drag and Drop Example - Archive of obsolete content
An example of implementing drag and drop will be implemented in this section. Dragging Elements Around Here, we'll create a simple board where items from a palette can be dragged onto the board. The user can click on one of several XUL elements on the palette and drag it onto a stack element to create an element of a particular type. First, we'll add the wrapper scripts: <script src="chrome://global/content/nsDragAndDrop.js"/> <script src="chrome://global/content/nsTransferable.js"/> <script src="dragboard.js"/> An additional script file dragboard.js is included which will contain the code we will write ourselves. ...
...as been defined, onDragStart, which will be called by the nsDragAndDrop object when necessary. The function adds the data to be dragged to the transfer object. The elem attribute is retrieved from the target of the drag event. The target will be the element that had the drag start on. We'll use the value of this attribute as the data of the drag. ...
...s retrieved from the target of the drag event. The target will be the element that had the drag start on. We'll use the value of this attribute as the data of the drag. The boardObserver will need three functions, getSup
portedFlavours, onDragOver and onDrop. The onDrop function will grab the data from the drag session and create a new element of the appropriate type. ...
...And 2 more matches
Exception logging in JavaScript - Archive of obsolete content
led at the time execution returned back into C++ code. As a result, if, for example, C++ code called a JavaScript component, which threw an exception, that exception would be logged to the console before control was returned to the C++ caller. This had the unintended consequence of logging "expected" errors at length into the console. ...
...tion would be logged to the console before control was returned to the C++ caller. This had the unintended consequence of logging "expected" errors at length into the console. JavaScript code is sometimes designed to throw exceptions to re
port a result condition back to the C++ caller. These might be perfectly normal circumstances, but the exceptions were dutifully logged nonetheless. Exception re
porting in Firefox 3 Firefox 3 improves re
porting of unhandled exceptions by establishing a set of rules that determines whether or not an exception is worth re
porting: Any methods on interfaces annotated with the [function] attribute in IDL (see, for example, nsIDomEventListener) that throw exceptions always re
port those exceptions into the Error Console. Any exceptions that are generated by XPCon...
...Any methods on interfaces annotated with the [function] attribute in IDL (see, for example, nsIDomEventListener) that throw exceptions always re
port those exceptions into the Error Console. Any exceptions that are generated by XPConnect -- that is, those exceptions whose result codes are defined in nsIXPConnect.idl -- are always logged into the Error Console. The NS_NOINTERFACE error is never re
ported when returned by a JavaScript object's QueryInterface() method on the nsISup
ports interface. The NS_NOINTERFACE error is never re
ported when returned by a JavaScript object's GetInterface() method on the nsIInterfaceRequestor interface. All other errors are re
ported when the last JavaScript frame on the stack returns to a C++ caller without handling the exception. That last point deserves cl...
...And 2 more matches
Introducing the Audio API extension - Archive of obsolete content
cko 28 (Firefox 28 / Thunderbird 28 / SeaMonkey 2.25 / Firefox OS 1.3)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Deprecated since Gecko 22 (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19)This feature has been removed from the Web standards. Though some browsers may still sup
port it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. Please note that this document describes a non-standard experimental API. This API has been deprecated since Gecko 22, disabled since Gecko 28, and removed ...
...ume settings on the media element. Playing, pausing, and seeking the audio also affect the streaming of this raw audio data. The MozAudioAvailable event has 2 attributes: frameBuffer: Framebuffer (i.e., an array) containing decoded audio sample data (i.e., floats) time: Timestamp for these samples measured from the start in seconds The framebuffer contains an array of audio samples. It's im
portant to note that the samples are not separated by channels; they are all delivered together. For example, for a two-channel signal: Channel1-Sample1 Channel2-Sample1 Channel1-Sample2 Channel2-Sample2 Channel1-Sample3 Channel2-Sample3. We can extend the previous example to visualize the timestamp and the first two samples in a <div> element: <!DOCTYPE html> <html> <head> <title>JavaScript ...
...n Hz). For example: // Create a new audio element var audioOutput = new Audio(); // Set up audio element with 2 channel, 44.1KHz audio stream. audioOutput.mozSetup(2, 44100); Once this is done, the samples need to be created. Those samples have the same format as the ones in the mozAudioAvailable event. Then the samples are written in the audio stream with the function mozWriteAudio(). It's im
portant to note that not all the samples might get written in the stream. The function returns the number of samples written, which is useful for the next writing. You can see an example below: // Write samples using a JS Array var samples = [0.242, 0.127, 0.0, -0.058, -0.242, ...]; var numberSamplesWritten = audioOutput.mozWriteAudio(samples); // Write samples using a Typed Array var samples = new ...
...And 2 more matches
Clipboard - Archive of obsolete content
Note: This page documents the Jetpack Prototype, which is no longer under active development. Read the experiment re
port for what we learned from it and the blog post announcing the first SDK release for what we're up to next! Jetpack's clipboard sup
port API provides a standardized way for features to access the clipboard. Features can get and set the clipboard in various flavors of data type. The namespace associated with this API is jetpack.clipboard which provides both read and write access to the clipboard. The API is fairly straightforward; examples can be found here. The API lives in the future and must be im
ported for use. jetpack.future.im
port("clipboard"); Methods set(contentstringflavorstring) stringWrites data from Jetpack to the clipboard. This is the recommended method of...
...ng data to the clipboard. contentThe content to be copied to the clipboard. If no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavorData type. This is an optional parameter. The only flavors currently implemented are 'plain' (text/unicode) and 'html' (which is HTML).string"text" Here's an example of how to use the method to set the clipboard. jetpack.im
port.future("clipboard");// In text formatjetpack.clipboard.set("Hello World");// In other clipboard get(flavor string)Returns data to Jetpack from the clipboard. If flavor is provided, the data is returned in that format. flavorReturns data to Jetpack from the clipboard. If flavor is provided, the data is returned in that format. string Here's an example of how to use the method to get the data on...
...t formatjetpack.clipboard.set("Hello World");// In other clipboard get(flavor string)Returns data to Jetpack from the clipboard. If flavor is provided, the data is returned in that format. flavorReturns data to Jetpack from the clipboard. If flavor is provided, the data is returned in that format. string Here's an example of how to use the method to get the data on the clipboard. ...
...And 2 more matches
Menu - Archive of obsolete content
e, chrome or content, as popup menus or context menus. Two namespaces are associated with this API: jetpack.menu, which provides access to the browser's menus, and jetpack.Menu, the constructor for making new menus. The API is fairly comprehensive, so you may want to start by reading through some examples. Because it is still under development, the API currently lives in the future and must be im
ported before it is used: jetpack.future.im
port("menu"); Menus All menus in Jetpack are jetpack.Menu objects, including both built-in Firefox menus and menus that features create. To create a new menu, use one of the jetpack.Menu constructors below. Constructors jetpack.Menu() Creates an empty menu. jetpack.Menu(menuitems) Creates a menu with the given items. Parameters menuitems An a...
...licked. See bug 534014 for details and a workaround. data string An arbitrary string that the feature may associate with the menuitem. disabled boolean If true, the menuitem is disabled. icon string The URL of an icon to display in the menuitem. Note that some environments, notably Gnome 2.28, do not sup
port menuitem icons either by default or at all. label string The label of the menuitem. menu jetpack.Menu If defined, the menuitem expands into a submenu. mnemonic string A character that is used as the item's shortcut key while the menu is open. It should be one of the characters that appears in the item's label. ...
... jetpack.Menu If defined, the menuitem expands into a submenu. mnemonic string A character that is used as the item's shortcut key while the menu is open. It should be one of the characters that appears in the item's label. On some platforms this character is underlined in the label. type string Currently only "separator" is sup
ported. If this property is undefined, the item is a normal menuitem. Note that when type == "separator", any other properties (such as label) may be specified. Fancy separators may behave differently on different platforms, however. xulId string The ID of the menuitem's backing XUL element, exposed for the benefit of advanced developers. Menu bar menus jetpack.me...
...And 2 more matches
Selection - Archive of obsolete content
Jetpack's selection API provides a method for detecting the selections made by the user. Features can get, set, and listen for selection events in HTML or plain text. The namespace for this api is jetpack.selection. ...
... Jetpack's selection API provides a method for detecting the selections made by the user. Features can get, set, and listen for selection events in HTML or plain text. The namespace for this api is jetpack.selection. ...
... events in HTML or plain text. The namespace for this api is jetpack.selection. This API currently lives in the future and must be im
ported for use: jetpack.future.im
port("selection"); Getting and Setting the Selection The current version of jetpack.selection includes these formats: .text and .html Getting the selection The following is an example of getting the selection from the user. jetpack.im
port.future("selection"); var textOfSel = jetpack.selection.text; var htmlOfSel = jetpack.selection.html; Setting the selection The following is an example of getting the selection from the user. ...
...And 2 more matches
Selection - Archive of obsolete content
Jetpack's selection API provides a method for detecting the selections made by the user. Features can get, set, and listen for selection events in HTML or plain text. The namespace for this api is jetpack.selection. ...
... Jetpack's selection API provides a method for detecting the selections made by the user. Features can get, set, and listen for selection events in HTML or plain text. The namespace for this api is jetpack.selection. ...
... events in HTML or plain text. The namespace for this api is jetpack.selection. This API currently lives in the future and must be im
ported for use: jetpack.future.im
port("selection"); Getting and Setting the Selection The current version of jetpack.selection includes these formats: .text and .html Getting the selection The following is an example of getting the selection from the user. jetpack.im
port.future("selection"); var textOfSel = jetpack.selection.text; var htmlOfSel = jetpack.selection.html; Setting the selection The following is an example of getting the selection from the user. ...
...And 2 more matches
Plug-n-Hack Phase1 - Archive of obsolete content
It is up to the tool authors to decide how the URL of the manifest is published. The tool configures itself by serving an HTML document (we'll call this the Configuration Document) to the browser. ...
...nt) to the browser. This can cause the browser to inspect the manifest and register the tool by firing a CustomEvent with the type ConfigureSecTool and a properties object which specifies the URL of the tool manifest. For example: var manifest = {"detail":{"url":"http://localhost:8080/manifest"}}; var evt = new CustomEvent('ConfigureSecTool', manifest); It is suggested that browsers wishing to sup
port PnH restrict handling of CustomEvents such that they're ignored where the event happens outside of user initiated actions. The Configuration Document should then listen for a number of other events: ConfigureSecToolStarted - this notifies the document that the browser is processing the configuration; if this event is not received within a reasonable amount of time after the ConfigureSecTo...
...outside of user initiated actions. The Configuration Document should then listen for a number of other events: ConfigureSecToolStarted - this notifies the document that the browser is processing the configuration; if this event is not received within a reasonable amount of time after the ConfigureSecTool event has been fired, you might want to warn the user that PnH does not seem to be sup
ported by this browser (perhaps prompting them to install the appropriate addon). ConfigureSecToolFailed - this notifies the document that configuration has failed for some reason. The user should be notified that configuration has failed. ConfigureSecToolSucceeded - this notifies the document that configuration has succeeded. The user can be given a message to this effect. ConfigureSecToolActiv...
...And 2 more matches
Static Analysis for Windows Code under Linux - Archive of obsolete content
This document will describe how to run Mozilla static check for Windows code under Linux platform by creating a cross-compiler with Dehydra sup
port for Mingw. We highly recommend you to read the cross compiling manual and the Dehydra build manual before you start the following reading. Build GCC Corss-compiler with Plugin Sup
port By default GCC does not sup
port plugins. Dehydra requires patching GCC such that it can load plugins as shared libraries: # Prepare a directory mkdir $HOME/dehydra cd $HOME/dehydra #Obtain GCC 4.3 sources wget ftp://mirrors.kernel.org/gnu/gcc/gcc...-4.3.0.tar.bz2 tar jxvf gcc-4.3.0.tar.bz2 # Get the patches which enable plugins cd gcc-4.3.0/ # Create an hg repository. This makes it easy to apply patches, they can be applied manually hg init . hg clone htt...
...le plugins cd gcc-4.3.0/ # Create an hg repository. This makes it easy to apply patches, they can be applied manually hg init . hg clone http://hg.mozilla.org/users/tglek_mo...-moz-plugin-mq .hg/patches # Apply gty.diff and plugin.diff # If you have mq setup, do hg qpush -a (for file in `cat .hg/patches/series`; do cat .hg/patches/$file; done) |patch -p1 cd .. Now, the Gcc source with plugin sup
ports is ready, we should now build a cross compiler from this source. And the instructions are exactly the same with the one here. Follow that instructions strictly for making a cross compiler. Build Dehydra for Cross-compiler Build the Dehydra plugin Dehydra is a shared library which will be loaded by the above plugin-sup
port gcc. Build Dehydra for a cross compiler has nothing difference with b...
...Just follow this and this to compile both Dehydra and Treehydra shared libraries. ...
...And 2 more matches
Venkman Introduction - Archive of obsolete content
method of the Function prototype. If the source text you are debugging is poorly formatted, Pretty Print can help make it easier to read by inserting line breaks and whitespace in appropriate places. When Pretty Print is enabled you will see a green check mark on the toolbar button, and the menu item will be checked as well. The Loaded Scripts View The Loaded Scripts View is in the top left
portion of the window. When a file is loaded by the browser it will appear in this view, and when unloaded it will be removed. Files are listed in alphabetical order, grouped by file type. File names are displayed after a color coded, single letter icon representing the file extension. Figure 6 shows the table of icon and file types. At the time if this writing, the order and grouping of file names ca...
...lumn picker for this view (the box on the top right) can be used to display a Length column. This column displays the size of functions, in lines. Both the Line and Length column are blank for file names. If a function has a breakpoint in it, a small red dot will show up in the function icon, as well as the parent's file icon. The Local Variables View The Local Variables view is on the left
portion of the window, at the bottom. When the debugger is stopped, the Local Variables view displays values for the current function. The scope object holds all arguments and local variables, and the this object holds the value of the this keyword. e Enumerable property r Read Only property p Permanent (cannot be deleted) A Alias to another property ...
... flags for this object. Flags are shown enumerated in Figure 8. If an item visible in the Local Variables View is modified via the Interactive Session View the modification will be immediately reflected in the Local Variable View. At the time of this writing, the Local Variables View's default sort order and grouping are not adjustable. The Call Stack View The Call Stack View is on the left
portion of the window by default, at the bottom. When the debugger is stopped, the Call Stack View displays the list of active functions. The function at the top of the Call Stack View is the one in which the debugger stopped, the function below it is the caller, below that is the caller's caller, and so on. These items are referred to as stack frames. Double-clicking on a stack frame will change the...
...And 2 more matches
Writing textual data - Archive of obsolete content
of the full repertoire. When the file is to be read only by the application/extension itself, using UTF-8 is often the best choice -- it can represent all characters, and ASCII characters are represented efficiently. Writing to a stream In Gecko 1.8 (SeaMonkey 1.0, Firefox 1.5), you can use nsIConverterOutputStream: var charset = "UTF-8"; // Can be any character encoding name that Mozilla sup
ports var os = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .createInstance(Components.interfaces.nsIConverterOutputStream); // This assumes that fos is the nsIOutputStream you want to write to os.init(fos, charset, 0, 0x0000); os.writeString("Umlaute: \u00FC \u00E4\n"); os.writeString("Hebrew: \u05D0 \u05D1\n"); // etc. os.close(); You can also write cha...
...(fos, charset, 0, 0x0000); os.writeString("Umlaute: \u00FC \u00E4\n"); os.writeString("Hebrew: \u05D0 \u05D1\n"); // etc. os.close(); You can also write character arrays using the write function, although using writeString is simpler from JavaScript code. ...
...g the write function, although using writeString is simpler from JavaScript code. The example above passes 0 as the third argument, which disables buffering (Note: the implementation of the converter stream might not sup
port buffering). Passing 0 ensures that data will be immediately written to the underlying stream; however, for better perfomance you should pass a value like 4096 instead. Unsup
ported characters You can specify what should happen with characters that are not sup
ported by the selected character encoding. The last argument to init specifies that: 0x0000 means that writing unsup
ported characters throws an exception (with an error code of NS_ERROR_LOSS_OF_SIGNIFICANT_DATA), and no data will be written. To instead write a replacement character in such cases, specify the charact...
...And 2 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
e the timer fires a command event. There is no default. The timer starts after the user types a character. If the user types another character, the timer resets. type Type: one of the values below You can set the type attribute to one of the values below for a more specialized type of textbox. Don't set the type if you wish to use a regular textbox. autocomplete A textbox that sup
ports autocomplete. For more information about autocomplete textboxes, see the autocomplete documentation (XPFE [Thunderbird/SeaMonkey]) (Firefox) number A textbox that only allows the user to enter numbers. In addition, arrow buttons appear next to the textbox to let the user step through values. There are several attributes that allow the number textbox to be configured, including decimalplaces...
...perty to open or close the popup. searchCount New in Thunderbird 15 Requires SeaMonkey 2.12 Type: integer Returns the number of search components used. This property is read only. searchParam New in Thunderbird 15 Requires SeaMonkey 2.12 Type: string Gets and sets the value of the autocompletesearchparam attribute. ...
...Use in conjuction with the selectionEnd property. The value specifies the index of the first selected character. showCommentColumn Type: boolean Gets and sets the value of the showcommentcolumn (or showCommentColumn) attribute. showImageColumn Type: boolean Gets and sets the value of the showimagecolumn attribute. ...
...And 2 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
e the timer fires a command event. There is no default. The timer starts after the user types a character. If the user types another character, the timer resets. type Type: one of the values below You can set the type attribute to one of the values below for a more specialized type of textbox. Don't set the type if you wish to use a regular textbox. autocomplete A textbox that sup
ports autocomplete. For more information about autocomplete textboxes, see the autocomplete documentation (XPFE [Thunderbird/SeaMonkey]) (Firefox) number A textbox that only allows the user to enter numbers. In addition, arrow buttons appear next to the textbox to let the user step through values. There are several attributes that allow the number textbox to be configured, including decimalplaces...
...rch components used. This property is read only. searchParam New in Thunderbird 15 Requires SeaMonkey 2.12 Type: string Gets and sets the value of the autocompletesearchparam attribute. searchSessions Obsolete since Gecko 26 Type: space-separated list of session names Gets the value of the searchSessions attribute. ...
...Use in conjuction with the selectionEnd property. The value specifies the index of the first selected character. sessionCount Type: integer Holds the number of sessions. showCommentColumn Type: boolean Gets and sets the value of the showcommentcolumn (or showCommentColumn) attribute. ...
...And 2 more matches
XUL Changes for Firefox 1.5 - Archive of obsolete content
> A <scrollcorner> element is added which is used to create the small box in the intersection of the horizontal and vertical scrollbars. <richlistbox> and <richlistitem> The <richlistbox> and <richlistitem> elements are used for creating lists containing arbitrary content. This element works similarly to the <listbox> which is designed primarily for lists of textual items. ...
...A set of icons will appear across the top of the dialog allowing the user to switch panels. ...
... the load and unload events are used only when the page is loaded or unloaded. For more information see Using Firefox 1.5 caching. tabIndex The tabIndex property is now applied to most elements. <radiogroup> Setting the value property on the <radiogroup> element selects the <radio> element in the group with the corresponding value. Dialog: defaultButton property The <dialog> binding now sup
ports the defaultButton property. Setting this property changes the default button of the dialog. It can be set either to one of the buttons of the <dialog> binding (using their names); or to none - in which case no button is set to be the default. Button: icon property The icon property on a button may be used to set stock icons on a button, used on some platforms. For instance <button icon="help">...
...And 2 more matches
textbox - Archive of obsolete content
re the timer fires a command event. There is no default. The timer starts after the user types a character. If the user types another character, the timer resets. type Type: one of the values below You can set the type attribute to one of the values below for a more specialized type of textbox. Don't set the type if you wish to use a regular textbox. autocomplete A textbox that sup
ports autocomplete. For more information about autocomplete textboxes, see the autocomplete documentation (XPFE [Thunderbird/SeaMonkey]) (Firefox) number A textbox that only allows the user to enter numbers. In addition, arrow buttons appear next to the textbox to let the user step through values. There are several attributes that allow the number textbox to be configured, including decimalplaces...
... of the min attribute. placeholder Type: string Gets and sets a string that appears in the textbox when it has no value. readOnly Type: boolean If set to true, then the user cannot modify the value of the element. searchButton Type: boolean Gets and sets the value of the searchbutton attribute. ...
...Use in conjuction with the selectionEnd property. The value specifies the index of the first selected character. size Type: integer Gets and sets the value of the size attribute. spinButtons Type: element The read-only property returns a reference to the spinbuttons element used by the number box. ...
...And 2 more matches
calICalendarView - Archive of obsolete content
tuations. It also fueled the development, however, of the more predictable, but less flexible calIDecoratedView, which usually contains an embedded calICalendarView. calendar/base/public/calICalendarView.idlScriptable Please add a summary to this article. ...
...f-4f59-b7ca-bf42b0fbf24a)] interface calICalendarView : nsISup
ports { attribute calICalendar displayCalender; attribute calICalendarViewController controller; void showDate(in calIDateTime aDate); void setDateRange(in calIDateTime aStartDate, in calIDateTime aEndDate); readonly attribute calIDateTime startDate; readonly attribute calIDateTime endDate; readonly attribute boolean sup
portsDisjointDates; readonly attribute boolean hasDisjointDates; void setDateList(in unsigned long aCount, [array,size_is(aCount)] in calIDateTime aDates); void getDateList(out unsigned long aCount, [array,size_is(aCount),retval] out calIDateTime aDates); attribute calIItemBase selectedItem; attribute calIDateTime selectedDay; Attributes displayCalendar The displayCalendar is an imple...
...sion's loading process. startDate Returns a calIDateTime corresponding to the first date shown by the view endDate Returns a calIDateTime corresponding to the last date shown by the view. Note that this date is typically not immediately useful for querying for the events and tasks shown in the calICalendarView. Typically, one more day must be added to it, in order to make it exclusive. sup
portsDisjointDates Consumers of calICalendarView should check this attribute to determine whether or not the implementation allows for calls to setDateList. If an implementation returns true for this attribute, it must allow for any arbitrary set of dates to be displayed. hasDisjointDates Returns false if the dates being displayed represent a continuous list, and true if certain dates in between s...
...And 2 more matches
2006-10-26 - Archive of obsolete content
Tony inquires why tinderbox is showing that the Fx 1.5.0.x (Linux) has failed since October 20. ...
... Tony inquires why tinderbox is showing that the Fx 1.5.0.x (Linux) has failed since October 20. ...
... Tony inquires why tinderbox is showing that the Fx 1.5.0.x (Linux) has failed since October 20. ...
...And 2 more matches
2006-10-27 - Archive of obsolete content
Tony inquires why tinderbox is showing that the Fx 1.5.0.x (Linux) has failed since October 20. ...
... Tony inquires why tinderbox is showing that the Fx 1.5.0.x (Linux) has failed since October 20. ...
... Tony inquires why tinderbox is showing that the Fx 1.5.0.x (Linux) has failed since October 20. ...
...And 2 more matches
External resources for plugin creation - Archive of obsolete content
a good idea to have an understanding of what is going on under the hood, regardless of the level of abstraction provided. Framework: FireBreath Project home page Project history Description (from the project creators): FireBreath is a cross-platform Browser Plugin Framework written in C++. Plugins created with FireBreath work on all major browsers, including Firefox 3.0 and later. ...
...rovided. Framework: FireBreath Project home page Project history Description (from the project creators): FireBreath is a cross-platform Browser Plugin Framework written in C++. Plugins created with FireBreath work on all major browsers, including Firefox 3.0 and later. Platforms sup
ported include Windows, Linux, and Mac OS X (intel). Feature highlights include thread safety checks, Unicode sup
port (with std::wstring), ActiveX sup
port, built-in drawing model negotiation for Mac, automatic type conversion (including Javascript Arrays and Objects), advanced security features, and more. Sup
ported development environments are Visual Studio on windows, XCode on mac, and GCC on linux. All platforms rely on CMake for easy cross-platform builds. Project: Nixysa Project Home Page Description (from ...
...orm builds. Project: Nixysa Project Home Page Description (from the home page): Nixysa is a framework written in Python to automatically generate glue code for NPAPI plugins (plugins for browsers such as Google Chrome or Firefox), letting you easily expose C++ classes to Javascript from a simple IDL representation. Nixysa was originally conceived for the needs of O3D, but is flexible enough to sup
port a wide range of use cases. Project: JUCE Project Home Page Description (from the home page): JUCE (Jules' Utility Class Extensions) is an all-encompassing C++ class library for developing cross-platform applications. It contains pretty much everything you're likely to need to create most applications, and is particularly good for creating highly-specialised UIs and for handling graphics and soun...
...And 2 more matches
NPWindow - Archive of obsolete content
#ifdef XP_UNIX void * ws_info; /* Platform-dependent additional data */ #endif /* XP_UNIX */ NPWindowType type; /* Window or drawable target */ } NPWindow; Fields The data structure has the following fields: window Platform-specific handle to a native window element in the Netscape window hierarchy on Windows (HWND) and Unix (X Window ID). Mac OS: window is a pointer to an NP_
Port. x, y The x and y coordinates for the top left corner of the plug-in relative to the page (and thus relative to the origin of the drawable). Should not be modified by the plug-in. height, width The height and width of the plug-in area. Should not be modified by the plug-in. clipRect Clipping rectangle of the plug-in; the origin is the top left corner of the drawable or window. Clip...
... height, width The height and width of the plug-in area. Should not be modified by the plug-in. clipRect Clipping rectangle of the plug-in; the origin is the top left corner of the drawable or window. Clipping to the clipRect prevents the plug-in from overwriting the status bar, scroll bars, and other page elements when partially scrolled off the screen. Mac OS: clipRect is the rectangle in
port coordinates to which the plug-in should clip its drawing. ws_info Unix: Contains information about the plug-in's Unix window environment; points to an NPSetWindowCallbackStruct. type NPWindowType value that specifies whether the NPWindow instance represents a window or a drawable. Values: NPWindowTypeWindow: Indicates that the window field holds a platform-specific handle to a windo...
... Values: NPWindowTypeWindow: Indicates that the window field holds a platform-specific handle to a window (as in Navigator 2.0 and Navigator 3.0). The plug-in is considered windowed. NPWindowTypeDrawable: Indicates that the plugin is windowless. The window field holds a platform-specific handle to a drawable or an off-screen pixmap, as follows: Windows: HDC Mac OS: pointer to NP_
Port structure Unix/X11: not used. (The drawable is provided in a GraphicsExpose event, when the paint is requested.) Description The NPWindow structure represents the native window or a drawable, and contains information about coordinate position, size, whether the plug-in is windowed or windowless, and some platform-specific information. The plug-in area is a native window element ...
...And 2 more matches
Using IO Timeout And Interrupt On NT - Archive of obsolete content
Due to a limitation of the present implementation of NSPR IO on NT, programs must follow the following guideline: If a thread calls an NSPR IO function on a file descriptor and the IO function fails with <tt>PR_IO_TIMEOUT_ERROR</tt> or <tt>PR_PENDING_INTERRUPT_ERROR</tt>, the file descriptor must be closed before the thread exits. In this memo we explain the problem this guideline is trying to work around and discuss its limitations. NSPR IO on NT The IO model of NSPR 2.0 is synchronous and blocking. ...
...G_INTERRUPT_ERROR</tt>. On Windows NT, NSPR IO is implemented using NT's overlapped (also called asynchronous) IO. When a thread calls an IO function, the thread issues an overlapped IO request using the overlapped buffer in its <tt>PRThread</tt> structure. Then the thread is put to sleep. In the meantime, there are dedicated internal threads (called the idle threads) monitoring the IO completion
port for completed IO requests. If a completed IO request appears at the IO completion
port, an idle thread fetches it and wakes up the thread that issued the IO request earlier. This is the normal way the thread is awakened. IO Timeout and Interrupt However, NSPR may wake up the thread in two other situations: if the overlapped IO request is not completed before the specified timeout. (Note that...
...verlapped buffer will be pointing to freed memory. This is problematic. Canceling Overlapped IO by Closing the File Descriptor Therefore, we need to cancel the outstanding overlapped IO request before the thread exits. NT's <tt>CancelIo()</tt> function would be ideal for this purpose. Unfortunately, <tt>CancelIo()</tt> is not available on NT 3.51. So we can't go this route as long as we are sup
porting NT 3.51. The only reliable way to cancel outstanding overlapped IO request that works on both NT 3.51 and 4.0 is to close the file descriptor, hence the rule of thumb stated at the beginning of this memo. Limitations This seemingly harsh way to force the completion of outstanding overlapped IO request has the following limitations: It is difficult for threads to shared a file descriptor. ...
...And 2 more matches
CSS - Archive of obsolete content
er of <input type="file">.::-ms-checkThe ::-ms-check CSS pseudo-element is a Microsoft extension that represents checkboxes and radio button groups created by <input type="checkbox"> and <input type="radio">.::-ms-clearThe ::-ms-clear CSS pseudo-element creates a clear button at the edge of an <input type="text"> text control that clears the current value. This pseudo-element is non-standard, sup
ported only in Internet Explorer 10, Internet Explorer 11, and Microsoft Edge.::-ms-expandThe ::-ms-expand CSS pseudo-element is a Microsoft extension that represents the button of a <select> menu control that opens or closes the drop-down menu. Typically it is a triangle that points downward.::-ms-fillThe ::-ms-fill CSS pseudo-element is a Microsoft extension that represents a progress bar displayed ...
...:-ms-expand CSS pseudo-element is a Microsoft extension that represents the button of a <select> menu control that opens or closes the drop-down menu. ...
... that represents the button of a <select> menu control that opens or closes the drop-down menu. ...
...And 2 more matches
Processing XML with E4X - Archive of obsolete content
m instead. First introduced in JavaScript 1.6, E4X introduces a native XML object to the JavaScript language, and adds syntax for embedding literal XML documents in JavaScript code. A full definition of E4X can be found in the Ecma-357 specification. This chapter provides a practical overview of the language; it is not a complete reference. Compatibility issues Prior to widespread browser sup
port for the <script> element, it was common for JavaScript embedded in a page to be surrounded by HTML comment tags to prevent <script> unaware browsers from displaying JavaScript code to the user. This practice is no longer necessary, but remains in some legacy code. For backwards compatibility, E4X defaults to ignoring comments and CDATA sections. You can add an e4x=1 argument to your <script> tag ...
...ings, it is necessary to convert the attribute first, even though the attribute may be converted to a string when used in other contexts (such as insertion into a textbox). if (languages.@type.toString() === 'agile') { ... } or, simply: if (languages.@type == 'agile') { ... } Working with XML objects XML objects provide a number of methods for inspecting and updating their contents. ...
...ke JavaScript arrays length is a method, not a property, and must be called using length(). We can iterate through the matching elements like so: for (var i = 0; i < languages.lang.length(); i++) { alert(languages.lang[i].toString()); } Here we are using identical syntax to that used to access numbered items in an array. ...
...And 2 more matches
GetObject - Archive of obsolete content
Non-standard. Do not use! ...
... Parameters pathname Full path and name of the file containing the object to retrieve. If pathname is omitted, class is required. class Optional Class of the object. The class argument uses the syntax appname.objectype and has these parts: appname Name of the application providing the object. objectype Type or class of object to create. Remarks The GetObject function is not sup
ported in Internet Explorer 9 standards mode, Internet Explorer 10 standards mode, Internet Explorer 11 standards mode, and Windows Store apps or later. Use the GetObject function to access an Automation object from a file. Assign the object returned by GetObject to the object variable. For example: var CADObject; CADObject = GetObject("C:\\CAD\\SCHEMA.CAD"); When this code is executed, the applic...
...n you might have multiple layers to a drawing stored in a file. You could use the following code to activate a layer within a drawing called SCHEMA.CAD: var LayerObject = GetObject("C:\\CAD\\SCHEMA.CAD!Layer3"); If you do not specify the object's class, Automation determines which application to start and which object to activate, based on the file name you provide. Some files, however, may sup
port more than one class of object. For example, a drawing might sup
port three different types of objects: an Application object, a Drawing object, and a Toolbar object, all of which are part of the same file. To specify which object in a file you want to activate, use the optional class argument. For example: var MyObject; MyObject = GetObject("C:\\DRAWINGS\\SAMPLE.DRW", "FIGMENT.DRAWING"); In the...
...And 2 more matches
XForms Custom Controls - Archive of obsolete content
owing categories: custom presentation - XForms controls as rendered by the Mozilla XForms processor do not provide the right look and feel for you. custom data types - existing XForms controls are not able to work properly with your data type advanced XForms controls - you need your controls to be able to do more things than traditional XForms controls can do new host language - you'd like to sup
port XForms in host languages other than XHTML or XUL Custom Presentation The Mozilla XForms extension cannot anticipate all of the possible use cases that will evolve in web applications and web pages as XForms matures and the user base grows. And with these new uses, more and more flexibility will be desired from the controls. Introducing custom controls into your environment may be just the soluti...
...trols There may be times where you need a control that is very specific to your task, but you also want it to work with XForms models and instance nodes just like a regular XForms control. The XForms specification provides for a nice way to do this using XForms binding attributes (like ref, or nodeset) on your custom control element. However, the Mozilla XForms implementation currently doesn't sup
port this approach. But there is a way for you to achieve the same result. You can put the XForms controls inside your XBL binding. Note you should take care to make sure that the embedded XForms controls are able to work with the data type of the instance node that your control is bound to. To give you an idea of what we are talking about, it could look something like this: <content> <xf:input xbl:...
...The XForms implementation has base XBL bindings for every XForms control. You can write implementation bindings that will inherit from these base bindings.
...And 2 more matches
Mozilla XForms Specials - Archive of obsolete content
Introduction This article gives an overview of where the Mozilla XForms Extension deviates from the official XForms 1.0 Specification . This covers both limitations in the extension, and custom extensions. Limitations Repeat Using Attributes The specifications mentions "Creating Repeating Structures Via Attributes", this is partially sup
ported. ...
...t and table or ul It is not possible to mix repeats with either table or ul. That means that it is not possible to do: <table> <xf:repeat ...> <tr> ... </tr> </xf:repeat> </table> or <ul> <xf:repeat ...> <li> ... </li> </xf:repeat> </ul> Section 9.3.2 states that mixing with table will probably never work. Mixing with ul might suffer from the same limitation. ...
...is not possible to mix repeats with either table or ul. That means that it is not possible to do: <table> <xf:repeat ...> <tr> ... </tr> </xf:repeat> </table> or <ul> <xf:repeat ...> <li> ... </li> </xf:repeat> </ul> Section 9.3.2 states that mixing with table will probably never work. Mixing with ul might suffer from the same limitation. Pseudo-class sup
port We currently sup
port all the CSS pseudo-classes in XForms (:enabled, :disabled, etc. ), except for :read-only and :read-write, because of non-specified behaviour of these for (X)HTML. Instead you have to use :-moz-read-only and :-moz-read-write for now. (limitation tracked in bug 313111)Pseudo element sup
port There is no sup
port for the pseudo elements (::value, ::repeat-item, and ::repeat-index ). Instead you will h...
...And 2 more matches
Archived open Web documentation - Archive of obsolete content
Web topics. Talk:background-size Should not the "Browser compatibility" table also list Google Chrome and Konqueror? Chome is not mentioned at all, but is becoming increasingly popular. Konqueror is listed below the table, which seems inconsistent. Znerd 04 August 2009 Browser Detection and Cross Browser Sup
port Improper browser detection can lead to web maintenance nightmares. Rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. This article reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. ...
...g the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. This article reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. Browser Feature Detection An experimental approach to discovering degree of sup
port for Standards CSS Obsolete CSS features Displaying notifications (deprecated) Firefox offers sup
port for "desktop notifications"; these are notifications that are displayed to the user outside the context of the web content, using the standard notification system provided by the operating system. E4X EC...
...It does this by providing access to the XML document in a form that feels natural for ECMAScript programmers. The goal is to provide an alternative, simpler syntax for accessing XML documents than via DOM interfaces. A valid alternative to E4X is a non-native JXON algorithm. ...
...And 2 more matches
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
der. Build nptestplugin.dll with nsITestPlugin.h included for compiling scriptable instance class implementaion. Put nptestplugin.dll to the Plugins folder. Related sources The full sample plugin code can be found in the Mozilla source tree under modules/plugin/samples/4x-scriptable/ IBM Developer Works has published a good article on XPCOM. Examples Example 1. Sample .idl file #include "nsISup
ports.idl" [scriptable, uuid(bedb0778-2ee0-11d5-9cf8-0060b0fbd8ac)] interface nsITestPlugin : nsISup
ports { void nativeMethod(); }; Example 2. Scriptable instance class #include "nsITestPlugin.h" #include "nsIClassInfo.h" // We must implement nsIClassInfo because it signals the // Mozilla Security Manager to allow calls from JavaScript. // helper class to implement all necessary nsIClassInfo...
... return NS_OK;} NS_IMETHOD GetImplementationLanguage(PRUint32 *aImplementationLanguage) {*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK;} // The rest of the methods can safely return error codes... ...
...ription) {return NS_ERROR_NOT_IMPLEMENTED;} NS_IMETHOD GetClassID(nsCID * *aClassID) {return NS_ERROR_NOT_IMPLEMENTED;} NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) {return NS_ERROR_NOT_IMPLEMENTED;} }; class nsScriptablePeer : public nsITestPlugin, public nsClassInfoMixin { public: nsScriptablePeer(); ~nsScriptablePeer(); NS_DECL_ISUP
PORTS NS_DECL_NSITESTPLUGIN }; nsScriptablePeer::nsScriptablePeer() { NS_INIT_ISUP
PORTS(); } nsScriptablePeer::~nsScriptablePeer() { } // Notice that we expose our claim to implement nsIClassInfo. NS_IMPL_ISUP
PORTS2(nsScriptablePeer, nsITestPlugin, nsIClassInfo) // the following method will be callable from JavaScript NS_IMETHODIMP nsScriptablePeer::NativeMethod() { return NS_OK; } Ex...
...And 2 more matches
XUL Parser in Python - Archive of obsolete content
With new widgets and attributes landing all the time, I wanted to get some quicker way of looking at the XUL--at particular builds, at particular widgets, at which elements had which attributes, etc. ...
...(i.e. new "packages") on the fly using search and replace. As I adapt the script in these ways and try to further generalize the actual code as I get time, I will make it available here. In the explanation section below, I try to say a little something about how this script works. It's really just a wrapper around Python's xmllib XML Parser, but I had to sort of fool around with it. Python's sup
port for XML (and potential with XUL) is extensive, and so it's more a matter of choosing an approach and hooking things up than anything else. Source code The source code for the XUL parser is available. It only runs as a hard-coded script right now, so if you want to use it you have to go in and changes some of the stuff like CHROME_DIR and which information you want out. It also, I'm afraid, onl...
...able. It only runs as a hard-coded script right now, so if you want to use it you have to go in and changes some of the stuff like CHROME_DIR and which information you want out. It also, I'm afraid, only works on the win32 platform, where the <tt>dir</tt> command it depends on gets you your XUL files. Again, you can easily use <tt>ls</tt> instead, as I should have done, and pick up some extra sup
port. I will make these adjustments and change it into a real module when I get a second, so that someone can instantiate the parser from their own scripts and use it more flexibly: >>> im
port XULTool >>> myXP = XULParser() >>> CHROME_DIR = 'D:\src\mozilla\xpfe' >>> res = myXP.parseXUL(CHROME_DIR, 'window', 'id') Where something like the above would write out all the XUL window ids in the build. So...
...And 2 more matches
Desktop mouse and keyboard controls - Game development
We'll look at this below. It's also easier to test control-independent features like gameplay on desktop if you develop it there, so you don't have to push the files to a mobile device every time you make a change in the source code. ...
...We'll look at this below. It's also easier to test control-independent features like gameplay on desktop if you develop it there, so you don't have to push the files to a mobile device every time you make a change in the source code. ...
... Keyboard The whole game can be controlled with just the keyboard and nothing else. The built in this.game.input.keyboard object manages the input from the keyboard and has a few helpful methods like addKey() and isDown(). There's also the Phaser.KeyCode object, which contains all the available keyboard keys: In the main menu of the game we can add an extra way ...
...And 2 more matches
Client hints - MDN Web Docs Glossary: Definitions of Web-related terms
Client Hints are a set of HTTP request header fields for proactive content negotiation allowing clients to indicate a list of device and agent specific preferences. Client Hints enable automated delivery of optimized assets like the automatic negotiation of image DPR resolution. Use of client hints isn't automatic: rather, servers must announce that they sup
port client hints. ...
...lient Hints are a set of HTTP request header fields for proactive content negotiation allowing clients to indicate a list of device and agent specific preferences. Client Hints enable automated delivery of optimized assets like the automatic negotiation of image DPR resolution. Use of client hints isn't automatic: rather, servers must announce that they sup
port client hints. ...
...lient Hints enable automated delivery of optimized assets like the automatic negotiation of image DPR resolution. Use of client hints isn't automatic: rather, servers must announce that they sup
port client hints. Servers announce sup
port for Client Hints using the Accept-CH (accept client hints) header or an equivalent HTML meta element with the http-equiv attribute. Accept-CH: DPR, Width, View
port-Width, Downlink and / or <meta http-equiv="Accept-CH" content="DPR, Width, View
port-Width, Downlink"> When a client receives the Accept-CH header, if sup
ported, it appends Client Hint headers that match the advertised field-values. For example, based on Accept-CH example above, the client could append DPR, Width, View
port-Width, and Downlink headers to all subsequent requests. In the second ex...
...And 2 more matches
Practical positioning examples - Learn web development
ditor. Let's look at the HTML contained within the body: <section class="info-box"> <ul> <li><a href="#" class="active">Tab 1</a></li> <li><a href="#">Tab 2</a></li> <li><a href="#">Tab 3</a></li> </ul> <div class="panels"> <article class="active-panel"> <h2>The first tab</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque turpis nibh,
porttitor nec venenatis eu, pulvinar in augue. Vestibulum et orci scelerisque, vulputate tellus quis, lobortis dui. Vivamus varius libero at ipsum mattis efficitur ut nec nisl. Nullam eget tincidunt metus. Donec ultrices, urna maximus consequat aliquet, dui neque eleifend lorem, a auctor libero turpis at sem. Aliquam ut
porttitor urna. Nulla facilisi.</p> </article> <article> <h2>The sec...
...rem, a auctor libero turpis at sem. Aliquam ut
porttitor urna. Nulla facilisi.</p> </article> <article> <h2>The second tab</h2> <p>This tab hasn't got any Lorem Ipsum in it. But the content isn't very exciting all the same.</p> </article> <article> <h2>The third tab</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque turpis nibh,
porttitor nec venenatis eu, pulvinar in augue. And now an ordered list: how exciting!</p> <ol> <li>dui neque eleifend lorem, a auctor libero turpis at sem.</li> <li>Aliquam ut
porttitor urna.</li> <li>Nulla facilisi</li> </ol> </article> </div> </section> So here we've got a <section> element with a class of info-box, which contains a <ul> and a <div>. The u...
... </section> Note: You can feel free to change the fake content for some real content if you like. Changes to the existing CSS Next we need to make some small changes to the existing CSS, to get the info-box placed and positioned. Change your .info-box rule to get rid of margin: 0 auto; (we no longer want the info-box centered), add position: fixed;, and stick it to the top of the browser view
port. It should now look like this: .info-box { width: 450px; height: 400px; position: fixed; top: 0; } Styling the main content The only thing left for this example is to provide the main content with some styling. Add the following rule underneath the rest of your CSS: .fake-content { background-color: #a60000; color: white; padding: 10px; height: 2000px; margin-left: 470px; }...
...And 2 more matches
CSS FAQ - Learn web development
. Why don't my style rules work properly? Style rules that are syntactically correct may not apply in certain situations. You can use DOM Inspector's CSS Style Rules view to debug problems of this kind, but the most frequent instances of ignored style rules are listed below. HTML elements hierarchy The way CSS styles are applied to HTML elements depends also on the elements hierarchy. It is im
portant to remember that a rule applied to a descendent overrides the style of the parent, in spite of any specificity or priority of CSS rules. .news { color: black; } .corpName { font-weight: bold; color: red; } <!-- news item text is black, but corporate name is red and in bold --> <div class="news"> (Reuters) <span class="corpName">General Electric</span> (GE.NYS) announced on Thursday... </d...
... <!-- news item text is black, but corporate name is red and in bold --> <div class="news"> (Reuters) <span class="corpName">General Electric</span> (GE.NYS) announced on Thursday... </div> In case of complex HTML hierarchies, if a rule seems to be ignored, check if the element is inside another element with a different style. Explicitly re-defined style rule In CSS stylesheets, order is im
portant. If you define a rule and then you re-define the same rule, the last definition is used. #stockTicker { font-weight: bold; } .stockSymbol { color: red; } /* other rules */ /* other rules */ /* other rules */ .stockSymbol { font-weight: normal; } <!-- most text is in bold, except "GE", which is red and not bold --> <div id="stockTicker"> NYS: <span cl...
... could be implicitly overridden. #stockTicker { font-size: 12px; font-family: Verdana; font-weight: bold; } .stockSymbol { font: 14px Arial; color: red; } <div id="stockTicker"> NYS: <span class="stockSymbol">GE</span> +1.0 ... </div> In the previous example the problem occurred on rules belonging to different elements, but it could happen also for the same element, because rule order is im
portant. #stockTicker { font-weight: bold; font: 12px Verdana; /* font-weight is now set to normal */ } Use of the * selector The * wildcard selector refers to any element, and it has to be used with particular care. body * { font-weight: normal; } #stockTicker { font: 12px Verdana; } .corpName { font-weight: bold; } .stockUp { color: red; } <div id="section"> NYS: <span class="corpNam...
...And 2 more matches
Styling links - Learn web development
We'll look at all these topics in this article. Prerequisites: Basic computer literacy, HTML basics (study Introduction to HTML), CSS basics (study Introduction to CSS), CSS text and font fundamentals. Objective: To learn how to style link states, and how to use links effectively in common UI features like navigation menus. ...
...ed to the above properties to style your links -- you are free to use any properties you like. Just try not to go too crazy! Styling some links Now we've looked at the default states in some detail, let's look at a typical set of link styles. To start off with, we'll write out our empty rulesets: a { } a:link { } a:visited { } a:focus { } a:hover { } a:active { } This order is im
portant because the link styles build on one another, for example the styles in the first rule will apply to all the subsequent ones, and when a link is being activated, it is also being hovered over. If you put these in the wrong order, things won't work properly. To remember the order, you could try using a mnemonic like LoVe Fears HAte. Now let's add some more information to get this styled proper...
...e.g. the tails on g and y). The border-bottom value has been set as 1px solid, with no color specified. Doing this makes the border adopt the same color as the element's text, which is useful in cases like this where the text is a different color in each case. Finally, a:active is used to give the links an inverted color scheme while they are being activated, to make it clear something im
portant is happening! Active learning: Style your own links In this active learning session, we'd like you to take our empty set of rules and add your own declarations to make the links look really cool. Use your imagination, go wild. We are sure you can come up with something cooler and just as functional as our example above. If you make a mistake, you can always reset it using the Reset button.
...And 2 more matches
How can we design for all types of users? - Learn web development
This article provides basic tips to help you design websites for any kind of user. Prerequisites: You should first read What is accessibility?, since we don't cover accessibility in detail here. Objective: Universal design means design for everybody, regardless of disabilities or technical constraints. This article lists the most im
portant quick-wins for universal design. Summary When you're building a website, one top issue to consider is Universal Design: accommodating all users regardless of disability, technical constraints, culture, location, and so on. Active Learning There is no active learning available yet. Dig deeper Color contrast To keep your text readable, use a text color that contrasts well with the background color. Make it extra easy to...
...e colors on this page and see how we fare in the Colour Contrast Analyser: The luminosity contrast ratio between text and background is 8.30:1, which exceeds the minimum standard (4.5:1) and should enable many visually-impaired people to read this page. Font size You can specify font size on a website either through relative units or absolute units. Absolute units Absolute units are not pro
portionally calculated but refer to a size set in stone, so to speak, and are expressed most of the time in pixels (px). For instance, if in your CSS you declare this: body { font-size:16px; } ... you are telling the browser that whatever happens, the font size must be 16 pixels. Modern browsers get around this rule by pretending that you're asking for "16 pixels when the user sets a zoom factor of ...
...t size must be 16 pixels. Modern browsers get around this rule by pretending that you're asking for "16 pixels when the user sets a zoom factor of 100%". Yet, for many years Internet Explorer adamantly displayed 16 pixels as 16 pixels. In this case, zooming did nothing, even as late as Internet Explorer 8, which we still have to cater to because it's still around. Relative units Also called pro
portional units, relative units are computed relative to a parent element. Relative units are friendlier to accessibility because they respect the settings on the user's system. Relative units are expressed in em, % and rem: Percent-based sizes: % This unit tells your browser that an element's font size must be N% of the previous element whose font size was expressed. If no parent can be found, t...
...And 2 more matches
What is a URL? - Learn web development
Deeper dive Basics: anatomy of a URL Here are some examples of URLs: https://developer.mozilla.org https://developer.mozilla.org/docs/Learn/ https://developer.mozilla.org/search?q=URL Any of those URLs can be typed into your browser's address bar to tell it to load the associated page (resource). A URL is composed of different parts, some mandatory and others optional. Let's see the most im
portant parts using the following URL: http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument http is the protocol. The first part of the URL indicates which protocol the browser must use. A protocol is a set method for exchanging or transferring data around a computer network. Usually for websites it is the HTTP protocol or its secured version, HTTPS. The W...
...wsers also know how to handle other protocols such as mailto: (to open a mail client) or ftp: to handle file transfer, so don't be surprised if you see such protocols. www.example.com is the domain name. It indicates which Web server is being requested. Alternatively, it is possible to directly use an IP address, but because it is less convenient, it is not often used on the Web. :80 is the
port. It indicates the technical "gate" used to access the resources on the web server. It is usually omitted if the web server uses the standard
ports of the HTTP protocol (80 for HTTP and 443 for HTTPS) to grant access to its resources. Otherwise it is mandatory. /path/to/myfile.html is the path to the resource on the Web server. In the early days of the Web, a path like this represented a physic...
...uest. Note: There are some extra parts and some extra rules regarding URLs, but they are not relevant for regular users or Web developers. Don't worry about this, you don't need to know them to build and use fully functional URLs. You might think of a URL like a regular postal mail address: the protocol represents the postal service you want to use, the domain name is the city or town, and the
port is like the zip code; the path represents the building where your mail should be delivered; the parameters represent extra information such as the number of the apartment in the building; and, finally, the anchor represents the actual person to whom you've addressed your mail. How to use URLs Any URL can be typed right inside the browser's address bar to get to the resource behind it. But this ...
...And 2 more matches
Basic native form controls - Learn web development
plement them using HTML. You've already met some form elements, including <form>, <fieldset>, <legend>, <textarea>, <label>, <button>, and <input>. This article covers: The common input types button, checkbox, file, hidden, image, password, radio, reset, submit, and text. Some of the attributes that are common to all form controls. Note: The features discussed in this article are sup
ported in all browsers, which is not the case for all form controls. We cover newer form controls added in HTML5 in the next two articles. If you want a more advanced reference, you should consult our HTML forms element reference, and in particular our extensive <input> types reference. Text input fields Text <input> fields are the most basic form widgets. They are a very convenient way to let the ...
... the form data). They can have a placeholder; this is text that appears inside the text input box that should be used to briefly describe the purpose of the box. They can be constrained in size (the physical size of the box) and maxlength (the maximum number of characters that can be entered into the box). They can benefit from spell checking (using the spellcheck attribute), if the browser sup
ports it. Note: The <input> element is unique amongst HTML elements because it can take many different forms depending on its type attribute value. It is used for creating most types of form widgets including single line text fields, time and date controls, controls without text input like checkboxes, radio buttons, and color pickers, and buttons. Single line text fields A single line text field...
...line text fields A single line text field is created using an <input> element whose type attribute value is set to text, or by omitting the type attribute altogether (text is the default value). The value text for this attribute is also the fallback value if the value you specify for the type attribute is unknown by the browser (for example if you specify type="color" and the browser doesn't sup
port native color pickers). Note: You can find examples of all the single line text field types on GitHub at single-line-text-fields.html (see it live also). Here is a basic single line text field example: <input type="text" id="comment" name="comment" value="I'm a text field"> Single line text fields have only one true constraint: if you type text with line breaks, the browser removes those lin...
...And 2 more matches
Sending form data - Learn web development
be delivered in the HTTP request. Note: To get a better idea of how client-server architectures work, read our Server-side website programming first steps module. On the client side: defining how to send the data The <form> element defines how the data will be sent. All of its attributes are designed to let you configure the request to be sent when a user hits a submit button. The two most im
portant attributes are action and method. The action attribute The action attribute defines where the data gets sent. Its value must be a valid relative or absolute URL. If this attribute isn't provided, the data will be sent to the URL of the page containing the form -- the current page. In this example, the data is sent to an absolute URL -- https://example.com: <form action="https://example.com...
...submitting the form: Open the developer tools. Select "Network" Select "All" Select "foo.com" in the "Name" tab Select "Headers" You can then get the form data, as shown in the image below. The only thing displayed to the user is the URL called. As we mentioned above, with a GET request the user will see the data in their URL bar, but with a POST request they won't. This can be very im
portant for two reasons: If you need to send a password (or any other sensitive piece of data), never use the GET method or you risk displaying it in the URL bar, which would be very insecure. If you need to send a large amount of data, the POST method is preferred because some browsers limit the sizes of URLs. In addition, many servers limit the length of URLs they accept. On the server side: r...
...tions MAMP > Preferences > PHP, and set "Standard Version:" to "7.2.x" (x will differ depending on what version you have installed). Example: Python This example shows how you would use Python to do the same thing -- display the submitted data on a web page. This uses the Flask framework for rendering the templates, handling the form data submission, etc. (see python-example.py). ...
...And 2 more matches
Your first form - Learn web development
be entered (form validation), and paired with text labels that describe their purpose to both sighted and blind users. Designing your form Before starting to code, it's always better to step back and take the time to think about your form. Designing a quick mockup will help you to define the right set of data you want to ask your user to enter. From a user experience (UX) point of view, it's im
portant to remember that the bigger your form, the more you risk frustrating people and losing users. Keep it simple and stay focused: ask only for the data you absolutely need. Designing forms is an im
portant step when you are building a site or application. It's beyond the scope of this article to cover the user experience of forms, but if you want to dig into that topic you should read the followi...
...efore you go any further, make a local copy of our simple HTML template -- you'll enter your form HTML into here. The <form> element All forms start with a <form> element, like this: <form action="/my-handling-form-page" method="post"> </form> This element formally defines a form. It's a container element like a <section> or <footer> element, but specifically for containing forms; it also sup
ports some specific attributes to configure the way the form behaves. All of its attributes are optional, but it's standard practice to always set at least the action and method attributes: The action attribute defines the location (URL) where the form's collected data should be sent when it is submitted. The method attribute defines which HTTP method to send the data with (usually get or post). ...
...m's collected data should be sent when it is submitted. The method attribute defines which HTTP method to send the data with (usually get or post). Note: We'll look at how those attributes work in our Sending form data article later on. For now, add the above <form> element into your HTML <body>. The <label>, <input>, and <textarea> elements Our contact form is not complex: the data entry
portion contains three text fields, each with a corresponding <label>: The input field for the name is a single-line text field. The input field for the e-mail is an input of type email: a single-line text field that accepts only e-mail addresses. The input field for the message is a <textarea>; a multiline text field. In terms of HTML code we need something like the following to implement thes...
...And 2 more matches
Graceful asynchronous programming with Promises - Learn web development
ment to show the stream coming from the camera as a "self view," then takes each of the stream's tracks and adds them to the WebRTC RTCPeerConnection representing a connection to another user. After that, the status display is updated to say "Connected". If getUserMedia() fails, the catch block runs. This uses setStatusMessage() to update the status box to indicate that an error occurred. The im
portant thing here is that the getUserMedia() call returns almost immediately, even if the camera stream hasn't been obtained yet. Even if the handleCallButton() function has already returned to the code that called it, when getUserMedia() has finished working, it calls the handler you provide. As long as the app doesn't assume that streaming has begun, it can just keep on running. Note: You can lea...
...: A promise can only succeed or fail once. It cannot succeed or fail twice and it cannot switch from success to failure or vice versa once the operation has completed. If a promise has succeeded or failed and you later add a success/failure callback, the correct callback will be called, even though the event took place earlier. Explaining basic promise syntax: A real example Promises are im
portant to understand because most modern Web APIs use them for functions that perform potentially lengthy tasks. To use modern web technologies you'll need to use promises. Later on in the chapter, we'll look at how to write your own promise, but for now, we'll look at some simple examples that you'll encounter in Web APIs. In the first example, we'll use the fetch() method to fetch an image from th...
...handle errors if one of the promises fails (rejects, in promise-speak). We can add error handling by running the .catch() method off the previous promise. Add this now: let errorCase = promise3.catch(e => { console.log('There has been a problem with your fetch operation: ' + e.message); }); To see this in action, try misspelling the URL to the image and reloading the page. The error will be re
ported in the console of your browser's developer tools. This doesn't do much more than it would if you just didn't bother including the .catch() block at all, but think about it -- this allows us to control error handling exactly how we want. In a real app, your .catch() block could retry fetching the image, or show a default image, or prompt the user to provide a different image URL, or whatever. ...
...And 2 more matches
Manipulating documents - Learn web development
e DOM in detail, along with some other interesting APIs that can alter your environment in interesting ways. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript -- including JavaScript objects. Objective: To gain familiarity with the core DOM APIs, and the other APIs commonly associated with DOM and document manipulation The im
portant parts of a web browser Web browsers are very complicated pieces of software with a lot of moving parts, many of which can't be controlled or manipulated by a web developer using JavaScript. You might think that such limitations are a bad thing, but browsers are locked down for good reasons, mostly centering around security. Imagine if a web site could get access to your stored passwords or ot...
...oneNode() instead. Removing a node is pretty simple as well, at least when you have a reference to the node to be removed and its parent. In our current case, we just use Node.removeChild(), like this: sect.removeChild(linkPara); When you want to remove a node based only on a reference to itself, which is fairly common, you can use ChildNode.remove(): linkPara.remove(); This method is not sup
ported in older browsers. They have no method to tell a node to remove itself, so you'd have to do the following. linkPara.parentNode.removeChild(linkPara); Have a go at adding the above lines to your code. Manipulating styles It is possible to manipulate CSS styles via JavaScript in a variety of ways. To start with, you can get a list of all the stylesheets attached to a document using Document.
...game in. To start with, make a local copy of our window-resize-example.html and bgtile.png demo files. Open it and have a look -- you'll see that we've got a <div> element covering a small part of the screen, which has got a background tile applied to it. We'll use that to represent our app UI area. First of all, let's grab a reference to the div, and then grab the width and height of the view
port (the inner window, where your document is displayed) and store them in variables -- these two values are handily contained in the Window.innerWidth and Window.innerHeight properties. Add the following lines inside the existing <script> element: const div = document.querySelector('div'); let winWidth = window.innerWidth; let winHeight = window.innerHeight; Next, we'll dynamically alter the wi...
...And 2 more matches
Video and Audio APIs - Learn web development
w to use browser APIs to control video and audio playback. HTML5 video and audio The <video> and <audio> elements allow us to embed video and audio into web pages. As we showed in Video and audio content, a typical implementation looks like this: <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>Your browser doesn't sup
port HTML5 video. Here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> This creates a video player inside the browser like so: You can review what all the HTML features do in the article linked above; for our purposes here, the most interesting attribute is controls, which enables the default set of playback controls. If you don't specify this, you get no playback controls...
...ed above; for our purposes here, the most interesting attribute is controls, which enables the default set of playback controls. If you don't specify this, you get no playback controls: This is not as immediately useful for video playback, but it does have advantages. One big issue with the native browser controls is that they are different in each browser -- not very good for cross-browser sup
port! Another big issue is that the native controls in most browsers aren't very keyboard-accessible. You can solve both these problems by hiding the native controls (by removing the controls attribute), and programming your own with HTML, CSS, and JavaScript. In the next section we'll look at the basic tools we have available to do this. The HTMLMediaElement API Part of the HTML5 spec, the HTMLMed...
...uld be shown on each button (we'll show how this works in the below section), and an aria-label attribute to provide an understandable description of each button, since we're not providing a human-readable label inside the tags. The contents of aria-label attributes are read out by screenreaders when their users focus on the elements that contain them. There is also a timer <div>, which will re
port the elapsed time when the video is playing. Just for fun, we are providing two re
porting mechanisms -- a <span> containing the elapsed time in minutes and seconds, and an extra <div> that we will use to create a horizontal indicator bar that gets longer as the time elapses. To get an idea of what the finished product will look like, check out our finished version. Exploring the CSS Now op...
...And 2 more matches
Handling text — strings in JavaScript - Learn web development
ought to know about strings when learning JavaScript, such as creating strings, escaping quotes in strings, and joining strings together. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To gain familiarity with the basics of strings in JavaScript. The power of words Words are very im
portant to humans -- they are a large part of how we communicate. Since the Web is a largely text-based medium designed to allow humans to communicate and share information, it is useful for us to have control over the words that appear on it. HTML provides structure and meaning to our text, CSS allows us to precisely style it, and JavaScript contains a number of features for manipulating strings, cre...
...here is no more need to open and close multiple string pieces -- the whole lot can just be wrapped in a single pair of backticks. When you want to include a variable or expression inside the string, you include it inside a ${ } construct, which is called a placeholder. You can include complex expressions inside template literals, for example: let examScore = 45; let examHighestScore = 70; examRe
port = `You scored ${ examScore }/${ examHighestScore } (${ Math.round((examScore/examHighestScore*100)) }%). ${ examScore >= 49 ? 'Well done, you passed!' : 'Bad luck, you didn\'t pass this time.' }`; The first two placeholders here are pretty simple, only including a simple value in the string. The third one calculates a percentage result and rounds it to the nearest integer. The fourth one inc...
... gave it a score of ' + (score/highestScore * 100) + '%.'; Template literals respect the line breaks in the source code, so newline characters are no longer needed. This would achieve the same result: output = `I like the song "${ song }". I gave it a score of ${ score/highestScore * 100 }%.`; We would recommend that you get used to using template literals as soon as possible. ...
...And 2 more matches
Object-oriented JavaScript for beginners - Learn web development
he students and teachers at a school. Here we'll look at OOP theory in general, not in the context of any specific programming language. To start this off, we could return to our Person object type from our first objects article, which defines the generic data and functionality of a person. ...
... Creating actual objects From our class, we can create object instances -- objects that contain the data and functionality defined in the class. ...
...access their properties and methods, you have to start calls with person1 or person2; the functionality contained within is neatly packaged away so it won't clash with other functionality. They do, however, have the same name property and greeting() method available. Note that they are using their own name value that was assigned to them when they were created; this is one reason why it is very im
portant to use this, so each one uses its own value, and not some other value. Let's look at the constructor calls again: let person1 = new Person('Bob'); let person2 = new Person('Sarah'); In each case, the new keyword is used to tell the browser we want to create a new object instance, followed by the function name with its required parameters contained in parentheses, and the result is stored in...
...And 2 more matches
Measuring performance - Learn web development
For example, you can use performance metrics to determine how your app performs in comparison to a competitor or you can compare your app's performance across releases. The metrics you choose to measure should be relevant to your users, site, and business goals. They should be collected and measured in a consistent manner and analyzed in a format that can be consumed and understood by non-technical stakeholders. This article introduces web perfomrance metrics that you can use to measure and optimize your site's performance. ...
...ing tools pack your code into single files to reduce the number of HTTP requests or minifiers that remove all whitespace from your code to make the files smaller. We'll talk about both categories in this course. And as well as talking about performance metrics we will of course talk about the metrics that you'll use to measure whether your site's performance is improving. ...
...your code to make the files smaller. We'll talk about both categories in this course. And as well as talking about performance metrics we will of course talk about the metrics that you'll use to measure whether your site's performance is improving. General performance re
porting tools Tools like PageSpeed Insights can measure a website's performance. You can enter a URL and get a performance re
port in seconds. The re
port contains scores about how your website is performing, both for mobile and desktop. ...
...And 2 more matches
Client-Server Overview - Learn web development
HTML structure, because this only needs to be done in one place, in a single template, and not across potentially thousands of static pages. Anatomy of a dynamic request This section provides a step-by-step overview of the "dynamic" HTTP request and response cycle, building on what we looked at in the last article with much more detail. In order to "keep things real" we'll use the context of a s
ports-team manager website where a coach can select their team name and team size in an HTML form and get back a suggested "best lineup" for their next game. The diagram below shows the main elements of the "team coach" website, along with numbered labels for the sequence of operations when the coach accesses their "best team" list. The parts of the site that make it dynamic are the Web Application ...
...eded. Websites created using this style of application push a lot of computational cost from the server to the web browser, and can result in websites that appear to behave a lot more like native apps (highly responsive, etc.). Web frameworks simplify server-side web programming Server-side web frameworks make writing code to handle the operations described above much easier. One of the most im
portant operations they perform is providing simple mechanisms to map URLs for different resources/pages to specific handler functions. This makes it easier to keep the code associated with each type of resource separate. It also has benefits in terms of maintenance, because you can change the URL used to deliver a particular feature in one place, without having to change the handler function. For ex...
.... For example, consider the following Django (Python) code that maps two URL patterns to two view functions. The first pattern ensures that an HTTP request with a resource URL of /best will be passed to a function named index() in the views module. A request that has the pattern "/best/junior", will instead be passed to the junior() view function. # file: best/urls.py # from django.conf.urls im
port url from . im
port views urlpatterns = [ # example: /best/ url(r'^$', views.index), # example: /best/junior/ url(r'^junior/$', views.junior), ] Note: The first parameters in the url() functions may look a bit odd (e.g. r'^junior/$') because they use a pattern matching technique called "regular expressions" (RegEx, or RE). You don't need to know how regular expressions work at t...
...And 2 more matches
Getting started with Ember - Learn web development
on top of traditional object-oriented programming, while still allowing developers to utilize functional programming techniques. Ember makes use of two main syntaxes: JavaScript (or optionally, TypeScript) Ember's own templating language, which is loosely based on Handlebars. The templating language is used to make build and runtime optimizations that otherwise wouldn't be possible. Most im
portantly, it is a superset of HTML -- meaning that anyone who knows HTML can make meaningful contributions to any Ember project with minimal fear of breaking code. Designers and other non-developers can contribute to page templates without any knowledge of JavaScript, and interactivity can be added later. This language also enables lighter asset payloads due to compiling the templates into a "byte c...
...s right there inside the root) and open it in your chosen code editor. ember-cli-build.js is responsible for configuring details about how your project is built -- including bundling all your files together, asset minification, and creating sourcemaps -- with reasonable defaults, so you don't typically need to worry about this file. We will however add lines to the ember-cli-build.js file to im
port our shared CSS files, so that they become part of our build without having to explicitly @im
port them into the app.css file (this would require URL rewrites at build time and therefore be less efficient and more complicated to set up). In ember-cli-build.js, find the following code: let app = new EmberApp(defaults, { // Add options here }); Add the following lines underneath ...
...come part of our build without having to explicitly @im
port them into the app.css file (this would require URL rewrites at build time and therefore be less efficient and more complicated to set up). In ember-cli-build.js, find the following code: let app = new EmberApp(defaults, { // Add options here }); Add the following lines underneath it before saving the file: app.im
port('node_modules/todomvc-common/base.css'); app.im
port('node_modules/todomvc-app-css/index.css'); For more information on what ember-cli-build.js does, and for other ways in which you can customize your build / pipeline, the Ember Guides have a page on Addons and Dependencies. Finally, find app.css, located at app/styles/app.css, and paste in the following: :focus, .view label:focus, .
...And 2 more matches
Ember resources and troubleshooting - Learn web development
comes pre-installed; do I need it? Not at all. While ember-data solves the most common problems that any app dealing with data will run in to, it is possible to roll your own front-end data client. A common alternative is to any fully-featured front-end data client is The Fetch API. Using the design patterns provided by the framework, a Route using fetch() would look something like this: im
port Route from '@ember/routing/route'; ex
port default class MyRoute extends Route { async model() { let response = await fetch('some/url/to/json/data'); let json = await response.json(); return { data: json }; } } See more information on specifying the Route's model here. Why can't I just use JavaScript? This is the most common question Ember folks hear from people who ...
...n and easier-to-reason-about one-way bound data flow. It could be thought of as a build-time transform that wraps its argument with a setter function. ...
...ata flow. It could be thought of as a build-time transform that wraps its argument with a setter function. ...
...And 2 more matches
Vue conditional rendering: editing existing todos - Learn web development
im="newLabel" /> </div> <div class="btn-group"> <button type="button" class="btn" @click="onCancel"> Cancel <span class="visually-hidden">editing {{label}}</span> </button> <button type="submit" class="btn btn__primary"> Save <span class="visually-hidden">edit for {{label}}</span> </button> </div> </form> </template> <script> ex
port default { props: { label: { type: String, required: true }, id: { type: String, required: true } }, data() { return { newLabel: this.label }; }, methods: { onSubmit() { if (this.newLabel && this.newLabel !== this.label) { this.$emit("item-edited", this.newLabel); } }, onCancel() { this.$emit("edi...
...display our ToDoItemEditForm instead of the checkbox. To do that, we'll use another Vue directive: v-if. The v-if directive will only render a block if the value passed to it is truthy. This is similar to how an if statement works in JavaScript. v-if also has corresponding v-else-if and v-else directives to provide the equivalent of JavaScript else if and else logic inside Vue templates. It's im
portant to note that v-else and v-else-if blocks need to be the first sibling of a v-if/v-else-if block, otherwise Vue will not recognize them. You can also attach v-if to a <template> tag if you need to conditionally render an entire template. Lastly, you can use a v-if + v-else at the root of your component to display only one block or another, since Vue will only render one of these blocks at a ti...
...e'll do this in our app, as it will allow us to replace the code that displays our to-do item with the edit form. ...
...And 2 more matches
Handling common accessibility problems - Learn web development
used for their correct purpose) is accessible right out of the box -- such content is readable by sighted viewers (provided you don't do anything silly like make the text way too small or hide it using CSS), but will also be usable by assistive technologies like screen readers (apps that literally read out a web page to their user), and confer other advantages too. Semantic structure The most im
portant quick win in semantic HTML is to use a structure of headings and paragraphs for your content; this is because screen reader users tend to use the headings of a document as signposts to find the content they need more quickly. If your content has no headings, all they will get is a huge wall of text with no signposts to find anything. Examples of bad and good HTML: <font size="7">My heading</f...
...check "Always use the cursor keys to navigate within pages". Next, you have to open your Mac's System Preferences app, then go to Keyboard > Shortcuts, then select the All Controls radio button. Safari doesn't allow you to tab through links by default; to enable this, you need to open Safari's Preferences, go to Advanced, and check the Press Tab to highlight each item on a webpage checkbox. Im
portant: You should perform this kind of test on any new page you write -- make sure the functionality can be accessed by the keyboard. This example highlights the im
portance of using the correct semantic element for the correct job. It is possible to style any element to look like a link or button with CSS, and to behave like a link or button with JavaScript, but they won't actually be links or but...
...e page. Note: This technique will only work if you set your original event handlers via event handler properties (e.g. onclick). addEventListener won't work. This is a lot of extra hassle to build the functionality back in. And there's bound to be other problems with it. Better to just use the right element for the right job in the first place. Text alternatives Text alternatives are very im
portant for accessibility -- if a person has a visual or hearing impairment that stops them being able to see or hear some content, then this is a problem. The simplest text alternative available is the humble alt attribute, which we should include on all images that contain relevant content. This should contain a description of the image that successfully conveys its meaning and content on the page, ...
...And 2 more matches
Command line crash course - Learn web development
there's a good range of options from the "cmd" program to "powershell" -- which can be run from the start menu by typing the program name. And below, you can see the macOS terminal application. How do you access the terminal? Many developers today are using Unix-based tools (e.g. the terminal, and the tools you can access through it). Many tutorials and tools that exist on the web today sup
port (and sadly assume) Unix-based systems, but not to worry -- they are available on most systems. In this section, we'll look at how to get access to the terminal on your chosen system. Linux/Unix As hinted at above, Linux/Unix systems have a terminal available by default, listed among your Applications. macOS macOS has a system called Darwin that sits underneath the graphical user interface. Da...
...ce to the next. Creating, copying, moving, removing There are a number of other basic utility commands that you'll probably end up using quite a lot as you work with the terminal. They are pretty simple, so we won't explain them all in quite as much detail as the previous couple. Have a play with them in a test directory you've created somewhere so that you don't accidentally delete anything im
portant, using the example commands below for guidance: mkdir -- this creates a new directory inside the current directory you are in, with the name you provide after the command name. For example, mkdir my-awesome-website will make a new directory called my-awesome-website. rmdir -- removes the named directory, but only if it's empty. For example rmdir my-awesome-website will remove the directory...
...ore complex commands, you need to think carefully about what the command will do, and try testing them out first before you finally run them in the intended directory. Let's say you had 1000 text files in a directory, and you wanted to go through them all and only delete the ones that have a certain substring inside the filename. If you are not careful, then you might end up deleting something im
portant, losing you a load of your work in the process. One good habit to get into is to write your terminal command out inside a text editor, figure out how you think it should look, and then make a backup copy of your directory and try running the command on that first, to test it. Another good tip -- if you're not comfortable trying terminal commands out on your own machine, a nice safe place to ...
...And 2 more matches
Client-side tooling overview - Learn web development
ect mistakes automatically without having to build your code from scratch each time. A few very common safety net tool types you will find being used by developers are as follows. Linters Linters are tools that check through your code and tell you about any errors that are present, what error types they are, and what code lines they are present on. Often linters can be configured to not only re
port errors, but also re
port any violations of a specified style guide that you team might be using (for example code that is using the wrong number of spaces for indentation, or using template literals rather than regular string literals). eslint is the industry standard JavaScript linter -- a highly configurable tool for catching potential syntax errors and encouraging "best practices" throughout y...
...y, and also adds dependencies for you automatically whenever you try to use them. It can even handle some code transformation duties for you. Webpack is another very popular packaging tool that does similar things. Transformation This stage of your web app lifecycle typically allows you to code in either "future code" (such as the latest CSS or JavaScript features that might not have native sup
port in browsers yet) or code using another language entirely, such as TypeScript. Transformation tools will then generate browser-compatible code for you, to be used in production. Generally web development is thought of as three languages: HTML, CSS, and JavaScript, and there are transformation tools for all of these languages. Transformation offers two main benefits (amongst others): The abilit...
...mation tools for all of these languages. Transformation offers two main benefits (amongst others): The ability to write code using the latest language features and have that transformed into code that works on everyday devices. For example, you might want to write JavaScript using cutting-edge new language features, but still have your final production code work on older browsers that don't sup
port those features. Good examples here include: Babel: A JavaScript compiler that allows developers to write their code using cutting-edge JavaScript, which Babel then takes and converts into old-fashioned JavaScript that more browsers can understand. Developers can also write and publish plugins for Babel. PostCSS: Does the same kind of thing as Babel, but for cutting-edge CSS features. If ...
...And 2 more matches
Accessibility information for UI designers and developers
For form elements, it should be clear what kind of input is expected. Placeholders are best avoided for this, as they are often too low in contrast. It is more helpful to describe what an input element is for in text just above or underneath the input. Error recovery When you detect users provide unexpected input, explain what is wrong and, if possible, how to correct it. This is specifically im
portant in these cases: the user input is about legal commitments or financial transactions it updates or removes the user's data in a system when recording tests responses In those cases, ensure users can change submissions, automatically check for errors. Or provide an op
portunity to review the input before submitting it. Use default controls Controls that are built into browsers come with ...
...t is fine to have a different current menu item or different subnavigation links. Do make sure they appear in the same place. That way, users of screen readers and screen magnifiers can reliably make assumptions about them and skip over them. See also: Understanding Success Criterion 3.2.3: Consistent Navigation Headings The heading structure of a page is like its table of contents, so it is im
portant that the levels are consistent. The most im
portant thing about consistent headings is that no levels are skipped. For example: after a level 2 heading, the first subheading would be a level 3, and never a level 4 or 5. Just like in contracts, if there is a 1.2.4 paragraph, you would expect there to be a paragraph 1.2, of which it is a subsection. Many screenreaders users navigate by headings.
...Designers are encourage to also not skip levels in designs. See also: heading elements Join the Mozilla Accessibility Community Live Chat Both end users and developers are invited for discussion on the live IRC channel at irc.mozilla.org/#accessibility. ...
...And 2 more matches
Theme concepts
the area behind the menu bar, toolbars, address bar, search bar, and tab strip. These theme options can be implemented as static themes (although the theme images themselves may be animated) or as dynamic themes created in a browser extension. If you have a lightweight theme it will be converted to this new theme format automatically before lightweight themes are deprecated. You do not need to
port your theme. However, please feel free to update your themes to use any of the new features described here. Static themes Static themes are specified using the same resources as a browser extension: a manifest.json file to define the theme components with those components stored in the same folder as the manifest.json file or a sub folder. These resources are then packed in a zip for publicatio...
...a sub folder. These resources are then packed in a zip for publication on addons.mozilla.org (AMO) or for self-distribution. For more information on self-distribution, visit Signing and distributing your add-on. You can also use the theme generator on AMO to create a static theme. Additionally, Firefox Color can be used to preview customizations to the browser's theme with options to share and ex
port a theme. A theme and browser extension functionality cannot be defined in one package, such as including a theme to complement an extension. You can, however, programmatically include a theme in an extension using the Theme API. See Dynamic themes. Defining a theme To create a theme (in this example a simple, single image theme): Create a folder in a suitable location on your computer. A...
... a browser extension before, check out Your first extension for a step-by-step guide. Cross-browser compatibility There is currently limited compatibility between themes in the major browsers. Opera takes an entirely different approach, and Microsoft Edge themes are not yet open to developers. ...
...And 2 more matches
Browser chrome tests
The browser chrome test suite is an automated testing framework designed to allow testing of application chrome windows using JavaScript. It currently allows you to run JavaScript code in the same scope as the main Firefox browser window and re
port results using the same functions as the Mochitest test framework. As all tests, they won't work in a build with tests disabled (--disable-tests). Running the browser chrome tests To run Mochitest, first build Mozilla with your changes; then run ./mach mochitest -f browser This will launch your build and open a "browser chrome tests" window, and re
port the results in the UI and to stdout. It is possible to run specific groups of tests. As with Mochitest, the path given as an argument is the path to a test or directory within the Mozilla ...
...ser.xul). Note: Be careful when naming your functions and variables. Since the test files are executed in the same scope as the browser window, conflicting variable names could cause trouble while running the tests. You should attempt to reduce the side effects of the testing code and "clean up" after yourself, to avoid influencing other tests. The comparison functions are identical to those sup
ported by Mochitests, see how the comparison functions work in the Mochitest documentation for more details. The EventUtils helper functions are available on the EventUtils object defined in the global scope. The test file name must be prefixed with "browser_", and must have a file extension of ".js". Files that don't match this pattern will be ignored by the test harness. Using a descriptive file na...
... and helpers in a file called head.js, that must live in the same folder as the browser-chrome tests. This file will be injected into the test scope for each test living in the same folder. Notice that any function call in head.js main scope will run before the main test() method. Asynchronous tests When writing async tests, you can use the add_task method with Promises. The test suite also sup
ports asynchronous tests, using the same function names as Mochitest. Call waitForExplicitFinish() from test() if you want to delay re
porting a result until after test() has returned. Call finish() once the test is complete. Be aware that the test harness will mark tests that take too long to complete as FAILED (the current timeout is 30 seconds). function test() { waitForExplicitFinish(); set...
...And 2 more matches
Command line options
the previous syntax, profile_name must not contain spaces). Do not run profile_dir while running an instance of the application. You can use the -no-remote option to avoid connecting to a running instance. firefox -CreateProfile "JoelUser c:\internet\joelusers-moz-profile" Note: profile_dir must not exist and you must not already have a profile called profile_name. -migration Start with im
port wizard. -new-instance Open new instance, not a new window in running instance, which allows multiple copies of application to be open at a time. firefox -new-instance -P "Another Profile" Note: Not available for Windows, see bug 855899. -no-remote Do not accept or send remote commands. Implies -new-instance. firefox -no-remote -P "Another Profile" Note: Since Firefox 9, this does rea...
... as there lower case invokes purify mode (memory and leak detection). Other platforms accept both upper and lower case. -profile "profile_path" Start with the profile with the given path. Firefox, Thunderbird and SeaMonkey2.x only. "profile_path" can either be an absolute path ("/path/to/profile") or a relative path ("path/to/profile"). Note: On Mac OS X specifying a relative path is not sup
ported anymore from Firefox 4.0 and up due to a regression, see bug 673955. Browser -browser Start with the browser component. Firefox and SeaMonkey only. -foreground Make this instance the active application. -new-tab URL Open URL in a new tab. Firefox and SeaMonkey2.x only. -new-window URL Open URL in a new window. Firefox and SeaMonkey2.x only. --kiosk URL Open URL full screen without u...
...ven URL (where URL is optional). -jsdebugger Start application with browser toolbox (formerly browser debugger). That is different to Venkman debugger (see option -venkman). -jsconsole Start application with the error console, or, in Firefox, the browser console. -purgecaches Gecko (layout engine) has a JavaScript cache, which is not reset on startup, this clears it. -start-debugger-server
port Firefox only. Start the debugger server on
port. This will enable another instance of Firefox to connect the Firefox developer tools to this Firefox instance. See the article on remotely debugging Firefox desktop. The
port argument is optional, and if it is omitted, the server will listen on
port 6000. -venkman Start with the JavaScript debugger, Venkman, if installed. XULRunner -app /path/...
...And 2 more matches
Debugging Frame Reflow
It is the initial reflow: r=0. Other reflow reasons are: incremental reflow resize reflow style change reflow dirty reflow The available width is 9180 twips. The available height is 4470 twips (a=9180,4470). The computed width is 9180 twips. The computed height is 4470 twips (c=9180,4470). The line count is 856 (cnt=856). Below this is a lin...
...=0,0 colG 02D7BFB0 d=0,0 tbl 02D7B7EC d=1500,390 tblO 02D7B5F0 d=1500,390 text 02D7C130 r=0 a=8940,UC c=UC,UC cnt=885 text 02D7C130 d=0,0 block 02D7B210 d=8940,390 area 02D7AFE4 d=9180,630 canvas 00B97C6C d=9180,4470 scroll 00B97EE0 d=9180,4470 scroll 00B97EE0 d=9180,4470 VP 00B97C30 d=9180,4470 The first line shows the reflow of the view
port (VP). This view
port has the address 00B97C30. It is the initial reflow: r=0. Other reflow reasons are: incremental reflow resize reflow style change reflow dirty reflow The available width is 9180 twips. The available height is 4470 twips (a=9180,4470). The computed width is 9180 twips. The computed height is 4470 twips (c=9180,4470). The line count is 856 (cnt=856). Below this is a line that reads: tblO 0...
...e height is 4470 twips (a=9180,4470). The computed width is 9180 twips. The computed height is 4470 twips (c=9180,4470). The line count is 856 (cnt=856). Below this is a line that reads: tblO 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870 Here the UC shows that on initial reflow the available height for the outer table frame is unconstrained. The table cell requires its children to compute the MES. It is re
ported back from the block as: block 02D7BCF8 d=300,300 me=300 The block max. element size is 300 twips. The second table reflow is started at rowG 00B984A4 r=2 a=1500,UC c=1500,UC cnt=879 where the previous information is used. The block has been required to compute the max. element size only once and it re
ports now: block 02D7BCF8 d=1410,300 The block shows the same address as the previous one. Fram...
...And 2 more matches
Makefile - variables
Variable name Description ADD_TO_DEF_FILE CPP_SOURCES CPP_UNIT_TESTS A list of source files to compile as unit tests. CSRCS A list of C source files to compile. DEFINES Additional preprocessor defines for C++ EXPAND_MOZLIBNAME EX
PORTS A list of ex
ported header files and sources to install for external use. EX
PORTS_NAMESPACES Ex
ported package include directory: dist/include/${namespace} EX
PORTS_${namespace} A list of ex
ports/headers that should be copied into the ex
ported namespace directory. EXTRA_COMPONENTS nsDefaultCLH.manifest, JavaScript XPCOMM files ...
....mk) that will force rebuilding. LIBOBJS HAVE_DTRACE Sun Microsystem's dynamic tracing environment is available. LOCAL_INCLUDES Allow use of MOZ_OBJDIR in .mozconfig with older GNU gcc on BeOS. MODULE MODULE_NAME NO_DIST_INSTALL Inhibit generating and copying ex
ports/install targets into $(MOZ_OBJDIR)/dist/install. .NS_PRINTING OBJS OBJ_SUFFIX Filename suffix to use when writing object files. MODULE Instructs the build system where to install ex
ported headers. SIMPLE_PROGRAMS SUPPRESS_DEFAULT_RULES Inhibit processing of Ma...
..._DEFAULT_RULES Inhibit processing of Makefile TIER targets/directory processing will be unordered. TIER Build order dependencies - subdirectories for make to traverse prior to building current. XPIDL_MODULE Module name to use when generating .xpt files, default to MODULE. XPIDLSRCS Internal: A list of .idl files to generate ex
ported headers from. XPIDL_NAME Name of extension to build see also configure.sh Variables Description BUILD_PROJECT_ARG Command line/environment override CONFIGURE_ENV_ARGS Command line/environment override Directory Variable DIRS A list of ...
...And 2 more matches
Performance best practices for Firefox front-end engineers
ing on front-end code produce code which is as performant as possible--not just on its own, but in terms of its impact on other parts of Firefox. Always keep in mind the side effects your changes may have, from blocking other tasks, to interfering with other user interface elements. Avoid the main thread where possible The main thread is where we process user events and do painting. It's also im
portant to note that most of our JavaScript runs on the main thread, so it's easy for script to cause delays in event processing or painting. That means that the more code we can get off of the main thread, the more that thread can respond to user events, paint, and generally be responsive to the user. You might want to consider using a Worker if you need to do some computation that can be done off o...
...xplanation of the Style, Layout, Paint and Composite steps of the pipeline, this Hacks blog post does a great job of explaining it. To achieve a 60 FPS frame rate, all of the above has to happen in 16 milliseconds or less, every frame. Note that requestAnimationFrame() lets you queue up JavaScript to run right before the style flush occurs. This allows you to put all of your DOM writes (most im
portantly, anything that could change the size or position of things in the DOM) just before the style and layout steps of the pipeline, combining all the style and layout calculations into a single batch so it all happens once, in a single frame tick, instead of across multiple frames. See Detecting and avoiding synchronous reflow below for more information. This also means that requestAnimationFram...
...e first time the page loads and the CSS is initially applied, but can happen again if JavaScript modifies the DOM. JavaScript code might, for example, change DOM node attributes (either directly or by adding or removing classes from elements), and can also add, remove, or delete DOM nodes. Because styles are normally scoped to the entire document, the cost of doing these style calculations is pro
portional to the number of DOM nodes in the document (and the number of styles being applied). It is expected that over time, script will update the DOM, requiring us to recalculate styles. Normally, the changes to the DOM just result in the standard style calculation occurring immediately after the JavaScript has finished running during the 16ms window, inside the "Style" step. That's the ideal scen...
...And 2 more matches
Code Samples
Getting the directory where your add-on is located If you need to determine the directory in which your add-on is installed, code like the following will do the trick. Simply replace YOUREXTENSIONID with your add-on's ID. ...
...de like the following will do the trick. Simply replace YOUREXTENSIONID with your add-on's ID. ...
...jsm"); AddonManager.getAddonByID("my-addon@foo.com", function(addon) { alert("My extension's version is " + addon.version); alert("Did I remember to include that file.txt file in my XPI? " + addon.hasResource("file.txt") ? ...
...And 2 more matches
Following the Android Toasts Tutorial from a JNI Perspective
Toast description A toast provides simple feedback about an operation in a small popup. ...
...sm The first step is to look at the Java code and see all the different types, methods, constructors, and fields that are being used. In the toast code we have the following: Types - Context, CharSequence, int, Toast, and void Methods - makeText, show Fields - LENGTH_SHORT No constructors are used. Declare the types We will start by declaring the types needed. In JNI, there is the all-im
portant property called sig. When something is declared, we are stating the sig and the name. The sig's will be represented as JavaScript strings in JNI.jsm, and the sig's of the types are as follows: Java Type Signature boolean Z byte B char C class/object Lclass name in slash notation here; double D float F ...
...ion is android.content.Context. So this will be written as Landroid/content/Context;. For convenience, let's make an object called SIG and populate it with our types. let SIG = { Context: 'Landroid/content/Context;', CharSequence; 'Ljava/lang/CharSequence;', int: 'I', Toast: 'Landroid/widget/Toast;', void: 'V', }; Get Java environment Before we go on to declare the other im
portant features, we need to load our environment variable. We want to wrap this in a try-catch statement so if any errors occur we make sure to unload the classes and the Java environment, this is good for performance. This is the template that will follow our object of signatures: var my_jenv = null; try { my_jenv = JNI.GetForThread(); // do the jni work here } finally { if (my_jenv)...
...And 2 more matches
OS.File for the main thread
See the Promise object documentation for details. Also, OS.File plays very nicely with Task.jsm. ...
... See the Promise object documentation for details. Also, OS.File plays very nicely with Task.jsm. ...
... Example: Copy a file The following snippet copies file "oldname.txt" to "newname.txt". On most operating systems, this operation is handled directly by the operating system itself, which makes it as fast as possible. let p...
...And 2 more matches
Updates
This page is not maintained frequently. Please follow our Monthly IRC Meeting for the latest updates. March 22, 2011 Firefox 4.0 has been released! This new version comes with several bug fixes and new features for MathML. Some improvements are particularly worth noting: A new HTML parser, which lets you use MathML inside non-XHTML documents. Complete sup
port for STIX fonts 1.0. Better rendering of mathematical symbols, especially stretchy operators. October 21, 2010 MathML 3.0 is now a W3C recommendation! June 11, 2010 STIX Fonts Version 1.0 are now compatible with trunk. May 28, 2010 STIX Fonts Version 1.0 Released. April 2010 New Web pages for the Mozilla MathML Project! Documentation is now available on MDC and wiki.mozilla.org. Feel free to complete and improve it...
...entation is now available on MDC and wiki.mozilla.org. Feel free to complete and improve it! May 8, 2007 Mozilla CEO speaks out on the future of Firefox: the complete 8,000 word interview. Interview to the APC Magazine where Mitchell Baker mentions Roger Sidje's work on MathML. ...
...s out on the future of Firefox: the complete 8,000 word interview. Interview to the APC Magazine where Mitchell Baker mentions Roger Sidje's work on MathML. June 5, 2002 Mozilla 1.0 Released "By virtue of embedding Gecko, Mozilla 1.0 and products based on Mozilla code sup
port more web standards, more deeply, more consistently across more platforms than any others. ...
...And 2 more matches
Mozilla Quirks Mode Behavior
bsolete since Gecko 50 List bullets do not inherit the font size of the list (bug 97351). Removed in Firefox 50 (bug 648331). Don't inherit font properties into tables except for font-family. Make TABLE borders gray rather than using the foreground color. Collapse top margin of BODY and TD and bottom margin of TD. Collapse the bottom or top margins of empty elements (bug 97361). Sup
port <PRE wrap>, <PRE cols>, <PRE width>. Orphaned DD has generated content :before instead of margin (bug 5119). Indent nested DL elements (bug 8749). MAP acts like an inline, not a block. Give floated IMG a 3px margin (bug 58899). Residual style tags' size info does not take precedence over heading tags' size (bug 77352). Use box-sizing:border-box for most INPUT types and TEXTAREA.
...nct meaning, and except in shorthands). In quirks mode, the CSS parser allows {} around the contents of style attributes (bug 99554). This behavior is being removed in Firefox 27, for interoperability. (bug 915053) An empty string for the background attribute sets the background URL to empty only in quirks mode. The topmargin, bottommargin, leftmargin, and rightmargin attributes on BODY are sup
ported only in quirks mode (bug 9258). Obsolete since Gecko 35 (Firefox 35.0 / Thunderbird 35.0 / SeaMonkey 2.32) (bug 95530) This quirk is now HTML5 conform and has been adopted in standards mode. The scrollLeft, scrollTop, scrollWidth, and scrollHeight properties are relative to BODY in quirks mode (instead of HTML) (bug 211030). HTML (1-7) and CSS (xx-small - xx-large) font sizes are calculate...
...ot work. Prior to Gecko 36, it also applied to images, and form controls but the quirk has been adapted to match the behavior of other browser (bug 783213). Prior to Gecko 36, the quirk was also applied if another pseudo-class was used in the same selector, if a pseudo-element was used in the selector, or if it was part of a pseudo-class argument (bug 783213). Quirks mode has document.all sup
port (undetected). Images (IMG elements) without alt attributes sometimes display placeholder icons in quirks mode. Obsolete since Gecko 2.0 HTML colors were parsed differently up to Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) (bug 121738). In quirks mode, the URL fragment #top scrolls to the top of the page when there is no such anchor. Obsolete since Gecko 10.0 However, HTML5 requi...
...And 2 more matches
Phishing: a short definition
rmation, such as usernames, passwords, and financial details by disguising as a trustworthy entity online. A relatively simple, yet effective, phishing scheme is sending an email with a fake invoice of a person's favorite shopping site. This email will usually contain a link pretending to lead to the original service, but in reality, taking the victim to an attacker-controlled website. The login
portal might resemble the trusted website's login page very closely, and convince users to enter their credentials, letting others hijack their account. Past and current countermeasures Various technical, and social approaches, exist to combat phishing attacks. None of these are sufficient by themselves, so we see a mix of these deployed by various services. The following is a non-exhaustive list of...
...world of second factors. A second factor is something a user possesses to further authenticate with a service. For example, a USB token, Bluetooth device, mobile phone, or simply a key stored on a separate device. The first factor is usually the password and username. If both factors don't match, the service will reject authentication requests. ...
...USB token, Bluetooth device, mobile phone, or simply a key stored on a separate device. The first factor is usually the password and username. If both factors don't match, the service will reject authentication requests. Public Key Cryptography Many services will soon sup
port W3C Web Authentication, a powerful technology to evade phishing, based on public key cryptography. Web Authentication sup
ports millions of readily avilable FIDO U2F USB security keys, and will sup
port the more advanced FIDO 2.0 keys, once made available. Verification via Text Message If a service sup
ports verification, via SMS, it sends a text message with a one-time PIN to the user's phone number. The user then enter this PIN after the Web service verifies the username and password. This was chosen as an early secon...
...And 2 more matches
Creating a Cookie Log
Please follow the instructions below to run Firefox with cookie logging enabled. Enabling Cookie Logging Windows Open a command prompt (this is under Programs or Programs/Accessories in normal installations of Windows). ...
...\Mozilla Firefox) Type "set NSPR_LOG_FILE=C:\temp\cookie-log.txt", enter Type "set NSPR_LOG_MODULES=cookie:4" and press Enter Run Firefox by typing "firefox.exe" and pressing Enter. Linux Start a command shell (these instructions are for bash, if you use something else, you probably know how to modify these instructions already). Change to the installation directory for Firefox. Type "ex
port NSPR_LOG_FILE=~/cookie-log.txt" and press Enter. Type "ex
port NSPR_LOG_MODULES=cookie:4" and press Enter. Run Firefox by typing "./firefox" and pressing Enter Mac OS X Open Terminal.app, which is located in the /Applications/Utilities folder (these instructions are for bash, the default shell in Mac OS X 10.3 and higher; if you use something else, you probably know how to modify these instru...
...ng Enter Mac OS X Open Terminal.app, which is located in the /Applications/Utilities folder (these instructions are for bash, the default shell in Mac OS X 10.3 and higher; if you use something else, you probably know how to modify these instructions already). Change to the installation directory for Firefox, e.g. type "cd /Applications/Firefox.app/Contents/MacOS" and press Return. Type "ex
port NSPR_LOG_FILE=~/Desktop/cookie-log.txt" and press Return. Type "ex
port NSPR_LOG_MODULES=cookie:4" and press Return. Run Firefox by typing "./firefox-bin" and pressing Return (note that Firefox will launch behind windows for other applications). Creating the Log Now that you have Firefox running with logging enabled, please try to replicate the bug using the steps to reproduce from the bug re...
...And 2 more matches
Nonblocking IO In NSPR
A thread invoking an io function is blocked until the io operation is finished. The blocking io model encourages the use of multiple threads as a programming model. A thread is typically created to attend to one of the simultaneous I/O operations that may potentially block. In the nonblocking io model, a file descriptor may be marked as nonblocking. An io function on a nonblocking file descriptor either succeeds immediately or fails immediately with <tt>PR_WOULD_BLOCK_ERROR</tt>. A single thread is sufficient to attend to multiple nonblocking file descriptors simultaneously. ...
...fails immediately with <tt>PR_WOULD_BLOCK_ERROR</tt>. A single thread is sufficient to attend to multiple nonblocking file descriptors simultaneously. Typically, this central thread invokes <tt>PR_Poll()</tt> on a set of nonblocking file descriptors. (Note: <tt>PR_Poll()</tt> also works with blocking file descriptors, although it is less useful in the blocking io model.) When <tt>PR_Poll()</tt> re
ports that a file descriptor is ready for some io operation, the central thread invokes that io function on the file descriptor. Creating a Nonblocking Socket Only sockets can be made nonblocking. Regular files always operate in blocking mode. This is not a serious constraint as one can assume that disk I/O never blocks. Fundamentally, this constraint is due to the fact that nonblocking I/O and <tt...
...g is omitted for clarity): <tt>PRFileDesc *sock;</tt> <tt>PRIntn optval = 1;</tt> <tt>sock = PR_NewTCPSocket();</tt> /* * Make the socket nonblocking */ PR_SetSockOpt(sock, PR_SockOpt_Nonblocking, &optval, sizeof(optval)); Programming Constraints There are some constraints due to the use of NT asynchronous I/O in the NSPR. In NSPR, blocking sockets on NT are associated with an I/O completion
port. Once associated with an I/O completion
port, we can't disassociate the socket from the I/O completion
port. I have seen some strange problems with using a nonblocking socket associated with an I/O completion
port. So the first constraint is: The blocking/nonblocking io mode of a new socket is committed the first time a potentially-blocking io function is invoked on the socket. Once the io mode ...
...And 2 more matches
Encrypt Decrypt MAC Keys As Session Objects
} rv = FileToItem(&filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* check for headers and trailers and remove them */ if ((body = strstr(nonbody, header)) != NULL) { char *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* maybe this is a MAC file */ if (body) trail = strstr(++body, trailer); if (trail != NULL) { *trail = '\0'; } else { PR_fprintf(PR_STDERR, "input has header but no trailer\n");
PORT_Free(filedata.data); return SECFailure; ...
...PR_fprintf(PR_STDERR, "write error\n"); rv = SECFailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbufLen); ivLen = decbufLen; blockNumber++; } if (rv != SECSuccess) { goto cleanup; } rv = MacFinal(ctxmac, newmac, &newmacLen, sizeof(newmac)); if (rv != SECSuccess) { goto cleanup; } if (
PORT_Memcmp(macItem->data, newmac, newmacLen) == 0) { rv = SECSuccess; } else { PR_fprintf(PR_STDERR, "Check MAC : Failure\n"); PR_fprintf(PR_STDERR, "Extracted : "); PrintAsHex(PR_STDERR, macItem->data, macItem->len); PR_fprintf(PR_STDERR, "Computed : "); PrintAsHex(PR_STDERR, newmac, newmacLen); rv = SECFailure; } cleanup: if (ctxm...
... * Open output file * loop until EOF(input): * read a buffer of ciphertext from input file, * Save last block of ciphertext * decrypt ciphertext buffer using CBC and IV, * compute and check MAC, then remove MAC from plaintext * replace IV with saved last block of ciphertext * write the plain text to output file * close files * re
port success */ SECStatus rv; SECItem ivItem; SECItem encKeyItem; SECItem macKeyItem; SECItem cipherItem; SECItem macItem; SECItem padItem; PK11SymKey *encKey = NULL; PK11SymKey *macKey = NULL; /* open intermediate file, read in hea...
...And 2 more matches
Encrypt and decrypt MAC using token
} rv = FileToItem(&filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* check for headers and trailers and remove them */ if ((body = strstr(nonbody, header)) != NULL) { char *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* maybe this is a MAC file */ if (body) trail = strstr(++body, trailer); if (trail != NULL) { *trail = '\0'; } else { PR_fprintf(PR_STDERR, "input has header but no trailer\n");
PORT_Free(filedata.data); return SECFailure; ...
...PR_fprintf(PR_STDERR, "write error\n"); rv = SECFailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbufLen); ivLen = decbufLen; blockNumber++; } if (rv != SECSuccess) { goto cleanup; } rv = MacFinal(ctxmac, newmac, &newmacLen, sizeof(newmac)); if (rv != SECSuccess) { goto cleanup; } if (
PORT_Memcmp(macItem->data, newmac, newmacLen) == 0) { rv = SECSuccess; } else { PR_fprintf(PR_STDERR, "Check MAC : Failure\n"); PR_fprintf(PR_STDERR, "Extracted : "); PrintAsHex(PR_STDERR, macItem->data, macItem->len); PR_fprintf(PR_STDERR, "Computed : "); PrintAsHex(PR_STDERR, newmac, newmacLen); rv = SECFailure; } cleanup: if (ctxm...
... * Open output file * loop until EOF(input): * read a buffer of ciphertext from input file, * Save last block of ciphertext * decrypt ciphertext buffer using CBC and IV, * compute and check MAC, then remove MAC from plaintext * replace IV with saved last block of ciphertext * write the plain text to output file * close files * re
port success */ SECStatus rv; SECItem ivItem; SECItem encKeyItem; SECItem macKeyItem; SECItem cipherItem; SECItem macItem; SECItem padItem; PK11SymKey *encKey = NULL; PK11SymKey *macKey = NULL; /* open intermediate file, read in hea...
...And 2 more matches
NSS Key Log Format
It has been superseded by CLIENT_RANDOM which also works with o...
...It has been superseded by CLIENT_RANDOM which also works with other key-agreement algorithms (such as ...
... handshake traffic secret for the server side (for TLS 1.3) CLIENT_TRAFFIC_SECRET_0: the first hex-encoded application traffic secret for the client side (for TLS 1.3) SERVER_TRAFFIC_SECRET_0: the first hex-encoded application traffic secret for the server side (for TLS 1.3) EARLY_EX
PORTER_SECRET: the hex-encoded early ex
porter secret (for TLS 1.3, used for 0-RTT keys in older QUIC drafts). EX
PORTER_SECRET: the hex-encoded ex
porter secret (for TLS 1.3, used for 1-RTT keys in older QUIC drafts) The RSA form allows ciphersuites using RSA key-agreement to be logged and was the first form sup
ported by Wireshark 1.6.0. It has been superseded by CLIENT_RANDOM which also works with other key-agreement algorithms (such as those based on Diffie-Hellman) and is sup
ported since Wireshark 1.8.0. Th...
...And 2 more matches
NSS 3.12.6 release notes
re in https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.8.4/. New in NSS 3.12.6 SSL3 & TLS Renegotiation Indication Extension (RFC 5746) By default, NSS 3.12.6 uses the new TLS Renegotiation Indication Extension for TLS renegotiation but allows simple SSL/TLS connections (without renegotiation) with peers that don't sup
port the TLS Renegotiation Indication Extension. The behavior of NSS for renegotiation can be changed through API function calls, or with the following environment variables: NSS_SSL_ENABLE_RENEGOTIATION values: [0|n|N]: SSL_RENEGOTIATE_NEVER Never allow renegotiation - Th...
...SS_SSL_REQUIRE_SAFE_NEGOTIATION values: 1: requireSafeNegotiation = TRUE unset: requireSafeNegotiation = FALSE Controls whether safe renegotiation indication is required for initial handshake. If TRUE, a connection will be dropped at initial handshake if the peer server or client does not sup
port safe renegotiation. The default setting for this option is FALSE. These options can also be set with the following SSL options: sslOptions.enableRenegotiation sslOptions.requireSafeNegotiation New pseudo cipher suite value: TLS_EMPTY_RENEGOTIATION_INFO_SCSV (cannot be negotiated) ...
...NSS logs RSA pre-master secrets to this file. This allows packet sniffers to decrypt TLS connections. See documentation. Note: The code must be built with TRACE defined to use this functionality. Bugs Fixed The following bugs have been fixed in NSS 3.12.6. ...
...And 2 more matches
NSS 3.14.2 release notes
ve been added. They are still under review, and contributions are welcome. The documentation is in the docbook format and can be rendered as HTML and UNIX-style manual pages using an optional build target. New Types: in certt.h cert_pi_useOnlyTrustAnchors in secoidt.h SEC_OID_MS_EXT_KEY_USAGE_CTL_SIGNING Notable Changes in NSS 3.14.2 Bug 805604 - Sup
port for AES-NI and AVX accelerated AES-GCM was contributed by Shay Gueron of Intel. If compiled on Linux systems in 64-bit mode, NSS will include runtime detection to check if the platform sup
ports AES-NI and PCLMULQDQ. If so, NSS uses the optimized code path, reducing the CPU cycles per byte to 1/20 of what was required before the patch (https://bugzilla.mozilla.org/show_bug.cgi?id=805604 and https:...
...(https://bugzilla.mozilla.org/show_bug.cgi?id=540986) SQLite has been updated to 3.7.15. ...
...ild NSS with the system SQLite library and your system SQLite library is older than 3.7.15. Bug 816853 - When using libpkix for certificate validation, applications may now supply additional application-defined trust anchors to be used in addition to those from loaded security tokens, rather than as an alternative to. (https://bugzilla.mozilla.org/show_bug.cgi?id=816853) Bug 772144 - Basic sup
port for running NSS test suites on Android devices.This is currently limited to running tests from a Linux host machine using an SSH connection. Only the SSHDroid app has been tested. Bug 373108 - Fixed a bug where, under certain circumstances, when applications supplied invalid/out-of-bounds parameters for AES encryption, a double free may occur. Bug 813857 - Modification of certificate trust fl...
...And 2 more matches
NSS 3.19.1 release notes
n NSS 3.19.1 Bug 1138554 / CVE-2015-4000 - The minimum strength of keys that libssl will accept for finite field algorithms (RSA, Diffie-Hellman, and DSA) have been increased to 1023 bits. New in NSS 3.19.1 New Functionality No new functionality is introduced in this release. This patch release includes a fix for the recently published logjam attack. ...
...ffie-Hellman, and DSA) have been increased to 1023 bits. New in NSS 3.19.1 New Functionality No new functionality is introduced in this release. This patch release includes a fix for the recently published logjam attack. Notable Changes in NSS 3.19.1 NSS re
ports the bit length of keys more accurately. Thus, the SECKEY_PublicKeyStrength and SECKEY_PublicKeyStrengthInBits functions could re
port smaller values for values that have leading zero values. This affects the key strength values that are re
ported by SSL_GetChannelInfo. ...
...ecently published logjam attack. Notable Changes in NSS 3.19.1 NSS re
ports the bit length of keys more accurately. Thus, the SECKEY_PublicKeyStrength and SECKEY_PublicKeyStrengthInBits functions could re
port smaller values for values that have leading zero values. This affects the key strength values that are re
ported by SSL_GetChannelInfo. ...
...And 2 more matches
NSS 3.21 release notes
M. NSS 3.21 requires NSPR 4.10.10 or newer. NSS 3.21 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_21_RTM/src/ Security Fixes in NSS 3.21 Bug 1158489 / CVE-2015-7575 - Prevent MD5 Downgrade in TLS 1.2 Signatures. ...
...cure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_21_RTM/src/ Security Fixes in NSS 3.21 Bug 1158489 / CVE-2015-7575 - Prevent MD5 Downgrade in TLS 1.2 Signatures. ...
...DF are identifiers for additional PKCS#12 mechanisms for TLS 1.2 that are currently unused in NSS. ...
...And 2 more matches
NSS 3.45 release notes
und, returns SECSuccess and sets *results to NULL. If a failure is encountered while fetching any of the matching certificates, SECFailure is returned and *results will be NULL. ...
... Note: In 3.45, selfserv does not yet sup
port delegated credentials. See Bug 1548360. Note: In 3.45 the SSLChannelInfo is left unmodified, while an upcoming change in 3.46 will set SSLChannelInfo.authKeyBits to that of the delegated credential for better policy enforcement. See Bug 1563078. ...
...LChannelInfo.authKeyBits to that of the delegated credential for better policy enforcement. See Bug 1563078. Bug 1550579 - Replace ARM32 Curve25519 implementation with one from fiat-crypto Bug 1551129 - Sup
port static linking on Windows Bug 1552262 - Expose a function PK11_FindRawCertsWithSubject for finding certificates with a given subject on a given slot Bug 1546229 - Add IPSEC IKE sup
port to softoken Bug 1554616 - Add sup
port for the Elbrus lcc compiler (<=1.23) Bug 1543874 - Expose an external clock for SSL This adds new experimental functions: SSL_SetTimeFunc, SSL_CreateAntiReplayContext, SSL_SetAntiReplayContext, and SSL_ReleaseAntiReplayContext. The experimental function SSL_InitAntiReplay is removed. Bug 1546477 - Various changes in response to the ongoing FI...
...And 2 more matches
NSS Sample Code Sample_3_Basic Encryption and MACing
} rv = FileToItem(&filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* check for headers and trailers and remove them */ if ((body = strstr(nonbody, header)) != NULL) { char *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* maybe this is a MAC file */ if (body) trail = strstr(++body, trailer); if (trail != NULL) { *trail = '\0'; } else { PR_fprintf(PR_STDERR, "input has header but no trailer\n");
PORT_Free(filedata.data); return SECFailure; ...
...PR_fprintf(PR_STDERR, "write error\n"); rv = SECFailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbufLen); ivLen = decbufLen; blockNumber++; } if (rv != SECSuccess) { goto cleanup; } rv = MacFinal(ctxmac, newmac, &newmacLen, sizeof(newmac)); if (rv != SECSuccess) { goto cleanup; } if (
PORT_Memcmp(macItem->data, newmac, newmacLen) == 0) { rv = SECSuccess; } else { PR_fprintf(PR_STDERR, "Check MAC : Failure\n"); PR_fprintf(PR_STDERR, "Extracted : "); PrintAsHex(PR_STDERR, macItem->data, macItem->len); PR_fprintf(PR_STDERR, "Computed : "); PrintAsHex(PR_STDERR, newmac, newmacLen); rv = SECFailure; } cleanup: if (ctxm...
... * Open output file * loop until EOF(input): * read a buffer of ciphertext from input file * save last block of ciphertext * decrypt ciphertext buffer using CBC and IV * compute and check MAC, then remove MAC from plaintext * replace IV with saved last block of ciphertext * write the plain text to output file * close files * re
port success */ SECStatus rv; SECItem ivItem; SECItem encKeyItem; SECItem macKeyItem; SECItem cipherItem; SECItem macItem; SECItem padItem; PK11SymKey *encKey = NULL; PK11SymKey *macKey = NULL; /* open intermediate file, read in hea...
...And 2 more matches
EncDecMAC using token object - sample 3
ase PAD: strcpy(header, PAD_HEADER); strcpy(trailer, PAD_TRAILER); break; } rv = FileToItem(&filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { PR_fprintf(PR_STDERR, "unable to read data from input file\n"); rv = SECFailure; goto cleanup; } /* check for headers and trailers and remove them */ if ((body = strstr(nonbody, header)) != NULL) { char *trail = NULL; nonbody = body; body =
PORT_Strchr(body, '\n'); if (!body) body =
PORT_Strchr(nonbody, '\r'); /* maybe this is a MAC file */ if (body) trail = strstr(++body, trailer); if (trail != NULL) { *trail = '\0'; } else { PR_fprintf(PR_STDERR, "input has header but no trailer\n");
PORT_Free(filedata.data); return SECFailure; } } else { body = nonbody; } cleanup: PR_Close(file); HexToBuf(body, item, isHexData); return SECSuccess; } /...
...xt to out file */ temp = PR_Write(outFile, decbuf, decbufLen); if (temp != decbufLen) { PR_fprintf(PR_STDERR, "write error\n"); rv = SECFailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbufLen); ivLen = decbufLen; blockNumber++; } if (rv != SECSuccess) { goto cleanup; } rv = MacFinal(ctxmac, newmac, &newmacLen, sizeof(newmac)); if (rv != SECSuccess) { goto cleanup; } if (
PORT_Memcmp(macItem->data, newmac, newmacLen) == 0) { rv = SECSuccess; } else { PR_fprintf(PR_STDERR, "Check MAC : Failure\n"); PR_fprintf(PR_STDERR, "Extracted : "); PrintAsHex(PR_STDERR, macItem->data, macItem->len); PR_fprintf(PR_STDERR, "Computed : "); PrintAsHex(PR_STDERR, newmac, newmacLen); rv = SECFailure; } cleanup: if (ctxmac) { PK11_DestroyContext(ctxmac, PR_TRUE); } if (ctxenc) { PK11_Dest...
... IV and CKA_IDs of two keys from it * find those keys in the DB token * Open output file * loop until EOF(input): * read a buffer of ciphertext from input file, * Save last block of ciphertext * decrypt ciphertext buffer using CBC and IV, * compute and check MAC, then remove MAC from plaintext * replace IV with saved last block of ciphertext * write the plain text to output file * close files * re
port success */ SECStatus rv; SECItem ivItem; SECItem encKeyItem; SECItem macKeyItem; SECItem cipherItem; SECItem macItem; SECItem padItem; PK11SymKey *encKey = NULL; PK11SymKey *macKey = NULL; /* open intermediate file, read in header, get IV and CKA_IDs of two keys * from it */ rv = GetIVandCKAIDSFromHeader(headerFileName, &ivItem, &encKeyItem, &macKeyItem); if (rv != SECSuccess) { goto cleanup; } /...
...And 2 more matches
NSS Tools sslstrength
sslstrength Summary A simple command-line client which connects to an SSL-server, and re
ports back the encryption cipher and strength used. Synopsis 1) sslstrength ciphers 2) sslstrength hostname[:
port] [ciphers=xyz] [debug] [verbose] [policy=ex
port|domestic] Description The first form simple lists out the possible ciphers. The letter in the first column of the output is used to identify the cipher preferences in the ciphers= command. The second form attempts to connect to the named ssl host. The hostname argument must be present. However, the
port number is an optional argument, and if not given, will default to the https
port (443). Restricting Ciphers By default, sslstrength assumes that all the preferences are on, so it will use any preferences in your policy. The enabled ci...
...This restricts the available ciphers to the same set used by Communicator. In addition to this, the ciphers command can be used to further restrict the ciphers available. The argument to the ciphers command is a string of characters, where each single character represents a cipher. You can obtain this list of character->cipher mappings by doing 'sslstrength ciphers'. ...
...In addition to this, the ciphers command can be used to further restrict the ciphers available. The argument to the ciphers command is a string of characters, where each single character represents a cipher. You can obtain this list of character->cipher mappings by doing 'sslstrength ciphers'. For example, ciphers=bfi will turn on these cipher preferences and turn off all others. policy=ex
port or policy=domestic will set your policies appropriately. policy will default to domestic if not specified. Step-up Step up is a mode where the connection starts out with 40-bit encryption, but due to a 'change-cipher-spec' handshake, changes to 128-bit encryption. This is only done in 'ex
port mode', with servers with a special certificate. You can tell if you stepped-up, because the output...
...And 2 more matches
Overview of NSS
NSS provides a complete open-source implementation of the crypto libraries used by AOL, Red Hat, Google, and other companies in a variety of products, including the following: Mozilla products, including Firefox, Thunderbird, SeaMonkey, and Firefox OS. AOL Instant Messenger (AIM) Open source client applications such as Evolution, Pidgin, Apache OpenOffice, and LibreOffice. ...
...such as Evolution, Pidgin, Apache OpenOffice, and LibreOffice. Server products from Red Hat: Red Hat Directory Server, Red Hat Certificate System, and the mod_nss SSL module for the Apache web server. Server products from Oracle (formerly Sun Java Enterprise System), including Oracle Communications Messaging Server and Oracle Directory Server Enterprise Edition. SUSE Linux Enterprise Server sup
ports NSS and the mod_nss SSL module for the Apache web server. NSS includes a framework to which developers and OEMs can contribute patches, such as assembler code, to optimize performance on their platforms. NSS 3.x has been certified on 18 platforms. For more detailed information about NSS, see wiki.mozilla.org and NSS FAQ. Source code for a Java interface to NSS is available in the Mozilla CVS...
...to which developers and OEMs can contribute patches, such as assembler code, to optimize performance on their platforms. NSS 3.x has been certified on 18 platforms. For more detailed information about NSS, see wiki.mozilla.org and NSS FAQ. Source code for a Java interface to NSS is available in the Mozilla CVS tree. For details, see Network Security Services for Java. NSS makes use of Netscape
Portable Runtime (NSPR), a platform-neutral open-source API for system functions designed to facilitate cross-platform development. Like NSS, NSPR has been battle-tested in multiple products. For more information, see the NSPR Project Page. Interoperability and Open Standards You can use NSS to sup
port a range of security standards in your application, including the following: SSL v3. The Secure ...
...And 2 more matches
NSS environment variables
me) Name the PKCS#11 module to be traced. PKCS #11 Module Logger 3.6 NSS_DEFAULT_DB_TYPE String ("dbm", "sql", or "extern") Determines the default Database type to open if the app does not specify. NSS_Shared_DB 3.12 NSS_DISABLE_ARENA_FREE_LIST String (any non-empty value) Define this variable to get accurate leak allocation stacks when using leak re
porting software. NSS_Memory_allocation 3.4 NSS_DISABLE_UNLOAD String (any non-empty value) Disable unloading of dynamically loaded NSS shared libraries during shutdown. Necessary on some platforms to get correct function names when using leak re
porting software. 3.11.8 NSS_ENABLE_AUDIT Boolean (1 to enable) Enable auditing of activities of the NSS cryptogra...
... (1 to enable) Enable auditing of activities of the NSS cryptographic module in FIPS mode. Audit Data 3.11.2 NSS_ENABLE_PKIX_VERIFY Boolean (any non-empty value to enable) Use libPKIX, rather than the old cert library, to verify certificates. 3.12 NSS_FIPS String ("fips","true","on","1") Will start NSS in FIPS mode. 3.12.5 NSS_HASH_ALG_SUP
PORT String Specifies agorithms allowed to be used in certain applications, such as in signatures on certificates and CRLs. See documentation at this link. 3.12.3 NSS_OUTPUT_FILE String (filename) Output file path name for the PKCS #11 Module Logger. Default is stdout. 3.7 NSS_SDB_USE_CACHE String ("no","yes","auto") Controls whether NSS uses a local c...
...ation if the peer's hello bears the TLS renegotiation_info extension. This is the safe renegotiation. 3.12.5 Modified in 3.12.6 NSS_SSL_REQUIRE_SAFE_NEGOTIATION Boolean (1 to enable) It controls whether safe renegotiation indication is required for initial handshake. In other words a connection will be dropped at initial handshake if a server or client do not sup
port safe renegotiation. The default setting for this option is FALSE. 3.12.5 NSS_SSL_SERVER_CACHE_MUTEX_TIMEOUT Integer (seconds) Timeout time to detect dead or hung process in multi-process SSL server. Default is 30 seconds. 3.4 NSS_STRICT_NOFORK String ("1", "DISABLED", or any other non-empty value) It is an error to try to use a PKCS#11 crypto mo...
...And 2 more matches
gtstd.html
ow to set up your environment, including certificate and key databases. SSL, PKCS #11, and the Default Security Databases Setting Up the Certificate and Key Databases Building NSS Programs SSL, PKCS #11, and the Default Security Databases The basic relationships among the NSS libraries are described in Introduction to Network Security Services. Before running the sample programs, it's im
portant to understand the relationships between the SSL interface, the PKCS #11 interface, PKCS #11 modules, and the default Netscape security databases. A PKCS #11 module (also called a cryptographic module) manages cryptographic services such as encryption and decryption via the PKCS #11 interface. PKCS #11 modules can be thought of as drivers for cryptographic devices that can be implemented in ei...
...ules. SSL is built on top of NSPR, which handles sockets, threads, and related low-level OS operations. On any given server or client, one or more PKCS #11 modules may be available. Figure 2.1 Relationships among NSS libraries, cryptographic modules, slots, and tokens As shown in the figure, SSL communicates with PKCS #11 modules through the PKCS #11 interface. Any PKCS #11 module that sup
ports PKCS #11 can be used with the NSS libraries. Netscape software uses a file called secmod.db to keep track of the modules available. A PKCS #11 module always has one or more slots, which may be implemented as physical hardware slots in some form of physical reader (for example, for smart cards) or as conceptual slots in software. Each slot for a PKCS #11 module can in turn contain a token, whic...
...the private key for the CA certificate is present in this set of databases, so the CA can issue SSL client and server certificates with these databases. Setting Up the Server DB and Certificate The sections that follow describe how to set up the Server DB and certificate: Create a new certificate database in the server_db directory. >mkdir server_db >certutil -N -d server_db Im
port the new CA certificate into the server's certificate database, and mark it trusted for issuing certificates for SSL client and server authentication. >certutil -A -d server_db -n "MyCo's Root CA" -t "TC,," -a -i CA_db/rootca.crt Create the server certificate request, specifying the subject name for the server certificate. We make the common name (CN) be identical to the hostname of the se...
...And 2 more matches
SSL functions
The NSS home page links to additional SSL documentation. ...
... The NSS home page links to additional SSL documentation. If documentation is available for a function listed below, the function name is linked to either its MDC wiki page or its entry in the old SSL Reference. ...
...s to additional SSL documentation. If documentation is available for a function listed below, the function name is linked to either its MDC wiki page or its entry in the old SSL Reference. The Mozilla Cross Reference (DXR) link for each function provides access to the function definition, prototype definition, and source code references. ...
...And 2 more matches
Utility functions
ialization tasks and other services. If documentation is available for a function listed below, the function name is linked to either its MDC wiki page or its entry in the old SSL Reference. The Mozilla Cross Reference (MXR) link for each function provides access to the function definition, prototype definition, and source code references. The NSS version column indicates which versions of NSS sup
port the function. Function name/documentation Source code NSS versions ATOB_AsciiToData MXR Deprecated 3.2 use NSSBase64_DecodeBuffer ATOB_ConvertAsciiToItem MXR Deprecated 3.2 use NSSBase64_DecodeBuffer BTOA_ConvertItemToAscii MXR Deprecated 3.2 use NSSBase64_EncodeItem BTOA...
... NSSRWLock_LockRead MXR 3.2 and later NSSRWLock_LockWrite MXR 3.2 and later NSSRWLock_New MXR 3.2 and later NSSRWLock_UnlockRead MXR 3.2 and later NSSRWLock_UnlockWrite MXR 3.2 and later NSSSMIME_VersionCheck MXR 3.2.1 and later
PORT_Alloc MXR 3.2 and later
PORT_ArenaAlloc MXR 3.2 and later
PORT_ArenaGrow MXR 3.2 and later
PORT_ArenaMark MXR 3.2 and later
PORT_ArenaRelease MXR 3.2 and later
PORT_ArenaStrdup MXR 3.2 and later
PORT_ArenaUnmark MXR 3.2...
...and later
PORT_ArenaAlloc MXR 3.2 and later
PORT_ArenaGrow MXR 3.2 and later
PORT_ArenaMark MXR 3.2 and later
PORT_ArenaRelease MXR 3.2 and later
PORT_ArenaStrdup MXR 3.2 and later
PORT_ArenaUnmark MXR 3.2 and later
PORT_ArenaZAlloc MXR 3.2 and later
PORT_Free MXR 3.2 and later
PORT_FreeArena MXR 3.2 and later
PORT_GetError MXR 3.2 and later
PORT_NewArena MXR 3.2 and later
PORT_Realloc MXR 3.2 and later
PORT_SetError MXR 3.2 and later ...
...And 2 more matches
NSS Tools crlutil
anagement Tool command options and their arguments are defined as follows: Options -G Create new Certificate Revocation List(CRL). -D Delete Certificate Revocation List from cert database. -I Im
port a CRL to the cert database -E Erase all CRLs of specified type from the cert database -L List existing CRL located in cert database file. -M Modify existing CRL which can be located in cert db or in arbitrary file. If l...
... -d directory Specify the database directory containing the certificate and key database files. On Unix the Certificate Database Tool defaults to $HOME/.netscape (that is, ~/.netscape). On Windows NT the default is the current directory. The NSS database files must reside in the same directory. -i crl-im
port-file Specify the file which contains the CRL to im
port -f password-file Specify a file that will automatically supply the password to include in a certificate or to access a certificate database. This is a plain-text file containing one password. Be sure to prevent unauthorized access to this file. ...
...i crl] [-u url] [-d keydir] [-P dbprefix] [-l alg] [-a] [-B] -L [-n crl-name] [-d krydir] crlutil -D -n nickname [-d keydir] [-P dbprefix] crlutil -E [-d keydir] [-P dbprefix] crlutil -I -i crl [-t crlType] [-u url] [-d keydir] [-P dbprefix] [-B] Creating or modifying a CRL: Listing all CRls or a named CRL: Deleting CRL from db: Erasing CRLs from db: Im
port CRL from file: Examples Creating a New CRL Listing CRLs in a Database Deleting CRL from a Database Im
porting CRL into a Database Modifiying CRL in a Database Creating a New CRL This example creates a new CRL and im
porting it in to a Database in the specified directory: crlutil -G -d certdir -n cert-nickname -c crl-script-file or crlutil -G -d certdir -n cert-nickname <<EO...
...And 2 more matches
NSS Tools sslstrength
sslstrength Summary A simple command-line client which connects to an SSL-server, and re
ports back the encryption cipher and strength used. Synopsis 1) sslstrength ciphers 2) sslstrength hostname[:
port] [ciphers=xyz] [debug] [verbose] [policy=ex
port|domestic] Description The first form simple lists out the possible ciphers. The letter in the first column of the output is used to identify the cipher preferences in the ciphers= command. The second form attempts to connect to the named ssl host. The hostname argument must be present. However, the
port number is an optional argument, and if not given, will default to the https
port (443). Restricting Ciphers By default, sslstrength assumes that all the preferences are on, so it will use any preferences in your policy. The enabled ciphersu...
...This restricts the available ciphers to the same set used by Communicator. In addition to this, the ciphers command can be used to further restrict the ciphers available. The argument to the ciphers command is a string of characters, where each single character represents a cipher. You can obtain this list of character->cipher mappings by doing 'sslstrength ciphers'. ...
...In addition to this, the ciphers command can be used to further restrict the ciphers available. The argument to the ciphers command is a string of characters, where each single character represents a cipher. You can obtain this list of character->cipher mappings by doing 'sslstrength ciphers'. For example, ciphers=bfi will turn on these cipher preferences and turn off all others. policy=ex
port or policy=domestic will set your policies appropriately. policy will default to domestic if not specified. Step-up Step up is a mode where the connection starts out with 40-bit encryption, but due to a 'change-cipher-spec' handshake, changes to 128-bit encryption. This is only done in 'ex
port mode', with servers with a special certificate. You can tell if you stepped-up, because the outpu...
...And 2 more matches
Proxies in Necko
Proxies are implemented transparently to necko users. This means that callers can just create an nsIChannel, not needing to worry about whether the channel will use a proxy or not The basic interfaces for proxies are: nsIProxyInfo, nsIProtocolProxyService, and nsIProxiedProtocolHandler nsIProxyInfo is a simple helper which stores information about the type of the proxy, its host and its
port. nsIIOService The decision whether to use a proxy is made in nsIOService::NewChannelFromURI. It first asks the nsIProtocolProxyService for an nsIProxyInfo. Depending on the type of the proxy info, it either asks the HTTP Protocol Handler or the protocol handler for the requested URI for a new channel with the nsIProxyInfo - if the channel sup
ports nsIProxiedProtocolHandler. Otherwise, the proxy inf...
... made in nsIOService::NewChannelFromURI. It first asks the nsIProtocolProxyService for an nsIProxyInfo. Depending on the type of the proxy info, it either asks the HTTP Protocol Handler or the protocol handler for the requested URI for a new channel with the nsIProxyInfo - if the channel sup
ports nsIProxiedProtocolHandler. Otherwise, the proxy info is discarded. nsIProtocolProxyService The most im
portant function on nsIProtocolProxyService is resolve. It checks whether the passed-in URI should use a proxy, and returns an nsIProxyInfo if so. This works by examining the protocolFlags of the protocol handler for the given URI. If this protocol handler does not sup
port proxies, resolve returns null. Alternatively, if proxies are disabled, or this host is in the list of hosts for which no proxy sho...
...l handler does not sup
port proxies, resolve returns null. Alternatively, if proxies are disabled, or this host is in the list of hosts for which no proxy should be used, null is also returned. If PAC (proxy autoconfiguration) is enabled, it is asked for the proxy string for the given URI, which determines whether to use a proxy. Note that the PROXY method is only used when the protocol handler sup
ports HTTP proxies, as indicated by its protocol flags. Finally, depending on the protocol, the proxy info will be created with the appropriate type, host and
port. SOCKS and nsISocketTrans
portService The aforementioned methods work very well for application-level proxies. However, SOCKS is transparent to upper-level protocols, and can trans
port any other TCP- or UDP-based protocol. Therefore, nsISock...
...And 2 more matches
Tracing JIT
ther, or back out of generated code and into the interpreter. An Assembler is the only component of the tracing JIT that reads or writes native code. Therefore an Assembler contains several machine-specific methods which are implemented in the accompanying nanojit/Native*.* files. An Assembler runs in a single pass over its input, transforming one LIns value to zero or more NIns values. It is im
portant to keep in mind that this pass runs backwards from the last LIns in the input LIR code to the first, generating native code in reverse. Running backwards sometimes makes the logic difficult to follow, but it is an essential factor in maintaining the Assembler's high speed and small size. In the SpiderMonkey tracing JIT there is only ever one Assembler active at a time, associated with the cur...
... a fragment holding native code for that target PC. If it finds such a fragment, it transitions to executing mode. Otherwise it transitions to recording mode. Recording When the trace monitor enters recording mode, it constructs a new trace recorder, of type TraceRecorder. It then passes control back to the SpiderMonkey interpreter. The interpreter continues interpreting bytecode, but with an im
portant difference: each bytecode it interprets is also sent to the trace monitor and recorded in the monitor's trace recorder. Recording mode is temporary -- ideally it only lasts as long as it takes to record a single iteration of a loop in the interpreter -- and can end in a number of ways. All transitions out of recording mode eventually involve returning to monitoring mode: If the recorder is...
...tor interprets a backward jump to a PC that it has a compiled trace of machine code for, the monitor enters executing mode. This mode is relatively simple compared to recording mode. First the monitor allocates a native stack for the trace to use, and a state structure containing various key pointers into the SpiderMonkey interpreter's state, including a pointer to the native stack. It then im
ports the set of jsval values from the SpiderMonkey interpreter that the trace is known to read or write during its execution. This set was determined during recording, and the im
ported values are stored locally within the native stack during execution. The monitor then calls into the native code of the trace, passing in a pointer to the state structure as the sole argument. The native code of the t...
...And 2 more matches
SpiderMonkey Internals
and operates on values of type JS::Value--type-tagged values that represent the full range of JavaScript values. In addition to the interpreter, SpiderMonkey contains a Just-In-Time (JIT) compiler, a garbage collector, code implementing the basic behavior of JavaScript values, a standard library implementing ECMA 262-5.1 ?15 with various extensions, and a few public APIs. Interpreter Like many
portable interpreters, SpiderMonkey's interpreter is mainly a single, tremendously long function that steps through the bytecode one instruction at a time, using a switch statement (or faster alternative, depending on the compiler) to jump to the appropriate chunk of code for the current instruction. A JS-to-JS function call pushes a JavaScript stack frame without growing the C stack. But since JS-to-...
...s are customized to accept a primitive string as the this argument. (Otherwise, SpiderMonkey converts primitive values to objects before invoking their methods, per ECMA 262-3 ?11.2.1.) Error handling SpiderMonkey has two interdependent error-handling systems: JavaScript exceptions (which are not implemented with, or even compatible with, any kind of native C/C++ exception handling) and error re
porting. In general, both functions inside SpiderMonkey and JSAPI callback functions signal errors by calling JS_Re
portError or one of its variants, or JS_SetPendingException, and returning JS_FALSE or NULL. Public APIs The public C/C++ interface, called the JSAPI, is in most places a thin (but source-compatible across versions) layer over the implementation. See the JSAPI User Guide. There is an ad...
... => pc 172 => line 33 line 36 => pc 172 => line 33 line 37 => pc 172 => line 33 line 38 => pc 172 => line 33 line 39 => pc 172 => line 33 line 40 => pc 172 => line 33 jsconfig.h Various configuration macros defined as 0 or 1 depending on how JS_VERSION is defined (as 10 for JavaScript 1.0, 11 for JavaScript 1.1, etc.). Not all macros are tested around related code yet. In particular, JS 1.0 sup
port is missing from SpiderMonkey. js.cpp, jsshell.msg The "JS shell", a simple interpreter program that uses the JS API and more than a few internal interfaces (some of these internal interfaces could be replaced by jsapi.h calls). The js program built from this source provides a test vehicle for evaluating scripts and calling functions, trying out new debugger primitives, etc. A look at the place...
...And 2 more matches
JS_SetOptions
as the ECMA "variables object". This flag is recommended. Without it, the two scripts "x = 1" and "var x = 1", where no variable x is in scope, do two different things. The former creates a property on the global object. The latter creates a property on obj. With this flag, both create a global property. ...
...nd "var x = 1", where no variable x is in scope, do two different things. The former creates a property on the global object. The latter creates a property on obj. With this flag, both create a global property. MXR ID Search for JSOPTION_VAROBJFIX JSOPTION_PRIVATE_IS_NSISUP
PORTS Mozilla extension. The context's private data points to an XPCOM object (see nsISup
ports). This is only meaningful if SpiderMonkey is built with XPConnect. MXR ID Search for JSOPTION_PRIVATE_IS_NSISUP
PORTS JSOPTION_COMPILE_N_GO Caller of JS_CompileScript et al promises to execute the compiled script once only, in the same scope object used for compilation. The caller may not modify objects on the scope chain between compilation and execution. This...
...ses to execute the compiled script once only, in the same scope object used for compilation. The caller may not modify objects on the scope chain between compilation and execution. This enables compile-time scope chain resolution of consts (a performance optimization). MXR ID Search for JSOPTION_COMPILE_N_GO JSOPTION_ATLINE //@line number ["filename"] option sup
ported for the XUL preprocessor and kindred beasts. MXR ID Search for JSOPTION_ATLINE JSOPTION_XML Obsolete since JSAPI 15 ECMAScript for XML (E4X) sup
port: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in HTML script tags. MXR ID Search for JSOPTION_XML JSOPTION_ALLOW_XML Added in SpiderMonkey 15 If this...
...And 2 more matches
SpiderMonkey 1.8.7
4.0. It is much faster than SpiderMonkey 1.8, implements ES-5 (ECMA 262, 5th Edition), and contains many new language and API features, described in detail below. Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or, file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. --22 March 2011 Platform sup
port SpiderMonkey 1.8.7 is sup
ported on all the platforms where Firefox 10 runs. SpiderMonkey 1.8.7 includes type inference, which boosts the speed of the JagerMonkey JIT by about 30% over version 1.8.5. Type inference largely obviates TraceMonkey, so the TraceMonkey JIT has been removed. The JIT is sup
ported only on x86, x86_64 and ARM architectures. On other platforms, the JIT is simply disabled; Ja...
...lications will need significant changes, but most of those changes will be detected by the C/C++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. Here is a list of the most significant changes. XXX is there anything here? These and other changes are explained in detail below. New JavaScript language features XXX needs updating JavaScript 1.8.5 adds sup
port for ECMAScript Edition 5, including ES5 strict mode. For details, see New in JavaScript 1.8.5. Note that there are a very small number of incompatibilities between ES5 and and ES3, the version of ECMAScript sup
ported by SpiderMonkey versions 1.5 through 1.8. These are discussed in Annex E of the ES5 specification. SpiderMonkey 1.8.5 also ships with js-ctypes, a foreign-function interface for pri...
...an now fit a full 32-bit integer (jsint) inside a jsval without promoting to a jsdouble. JSExtendedClass JSExtendedClass has been removed from the API entirely. jsid Previous SpiderMonkey versions could freely interchange jsid and jsval. They are no longer compatible; using JS_ValueToId and JS_IdToValue to convert between the two is mandatory. JSNative, JSFastNative Previous versions of JSAPI sup
ported two types of native functions -- JSNative and JSFastNative. The so-called "Slow Natives" are no longer sup
ported; as such JSFastNative has been renamed to JSNative and relevant interfaces have been updated accordingly. Embedders converting functions from old-JSNative to new-JSNative (JSFastNative) should study the JSFastNative documentation thoroughly, and pay particular that they do not refer...
...And 2 more matches
Mozilla Projects
of Firefox or are tools used to create Firefox, but may be used by other projects as well. Here you'll find links to documentation about these projects. compare-locales compare-locales is a Python script that helps localizers to check their work without running Firefox or another application. Crash re
porting Firefox ships with an open-source crash re
porting system. This system is combination of projects: Emscripten Emscripten is an LLVM to JavaScript compiler. It takes LLVM bytecode (e.g. generated from C/C++ using Clang, or from another language) and compiles that into JavaScript, which can be run on the Web. Firefox Sync Firefox Sync synchro...
...oy uses XULrunner which is bound to break, for details see this post. Mozilla calls McCoy a "simple system" which is a clear sign that something probably is not working, and indeed, is not. McCoy is an application that allows add-on authors to provide secure updates to their users. Applications periodically look for and install updates to their add-ons. It's im
portant that the update information retrieved has not been tampered with since being written by the add-on author. Specifically, it focuses on the process of digitally signing update manifests so the applications can verify the integrity of a manifest retrieved over normally insecure channels. Midas Midas is the code name for Gecko...
...s can verify the integrity of a manifest retrieved over normally insecure channels. Midas Midas is the code name for Gecko's built-in rich text editor. Midas can be enabled via JavaScript on an HTML document. When Midas is enabled, the document becomes editable by the user. Scripting for Midas is based on the DHTML commands sup
ported by Internet Explorer. Internet Explorer sup
ports the ability to make an entire document editable by setting the designMode property of the document object; this is how Midas is invoked in Gecko. Internet Explorer also sup
ports the ability to edit specific elements using the contentEditable attribute; Starting with Firefox 3, Gecko also sup
ports contentEditable. Once Mida...
...And 2 more matches
Animated PNG graphics
It is intended to be a replacement for simple animated images that have traditionally used the GIF format, while adding sup
port for 24-bit images and 8-bit transparency. APNG is a simpler alternative to MNG, providing a spec suitable for the most common usage of animated images on the Internet. ...
... The APNG specification was authored by: Stuart Parmenter <pavlov@pavlov.net> Vladimir Vukicevic <vladimir@pobox.com> Andrew Smith <asmith15@littlesvr.ca> Overview APNG is an extension of the
Portable Network Graphics (PNG) format, adding sup
port for animated images. It is intended to be a replacement for simple animated images that have traditionally used the GIF format, while adding sup
port for 24-bit images and 8-bit transparency. APNG is a simpler alternative to MNG, providing a spec suitable for the most common usage of animated images on the Internet. APNG is backwards-compatible with PNG; any PNG decoder should be able to ignore the APNG-specific chunks and display a single image. Terminology The default image is the image described by the standard 'IDAT' chunks, and is the ...
...a simpler alternative to MNG, providing a spec suitable for the most common usage of animated images on the Internet. APNG is backwards-compatible with PNG; any PNG decoder should be able to ignore the APNG-specific chunks and display a single image. Terminology The default image is the image described by the standard 'IDAT' chunks, and is the image that is displayed by decoders that do not sup
port APNG. The canvas is the area on the output device on which the frames are to be displayed. The contents of the canvas are not necessarily available to the decoder. As per the PNG Specification, if a 'bKGD' chunk exists it may be used to fill the canvas if there is no preferrable background. The output buffer is a pixel array with dimensions specified by the width and height parameters of the PN...
...And 2 more matches
Building the WebLock UI
ond section, XUL, describes the XML-based User Interface Language (XUL) and how you can use it to create a dialog that provides access to the WebLock component and its services. The third section, Overlaying New User Interface Into Mozilla, describes how to create an overlay into the browser that will make this dialog accessible from a Mozilla build. The overlay section, where we discuss how to im
port scripts, images, and other resources from Mozilla into your own UI, is by far the more complicated of the two. If the WebLock component is being installed in Mozilla or another Gecko-based browser, then this third section shows you how to create the entry point in the browser for controlling the web locking. If you are planning on deploying the WebLock component in some other application, you'll...
...ponent in some other application, you'll have to devise a different means of access (e.g., native widgetry that instantiates and controls the WebLock component). Client Code Overview Before we get started on the actual user interface, we should establish how the client code is to access the WebLock component and use its interfaces to control the web locking of the browser. First of all, it's im
portant to be able to represent the basic state of the lock as soon as it's loaded. Like the secure page icon, the weblock icon that appears in the lower right corner of the browser should indicate whether the browser is currently locked or unlocked. Since the WebLock component is always initialized as unlocked, we can have the client code - the JavaScript code in the interface - represent this state ...
...As you can see, weblock is initialized as a global JavaScript variable, available in the scope of these functions and others: var weblock = Components.classes["@dougt/weblock"] .getService() ...
...And 2 more matches
Using XPCOM Components
ccessed by means of those component interfaces. Mozilla is made of XPCOM components. This chapter demonstrates how Mozilla uses some of these XPCOM objects, such as the CookieManager, and shows how access to the WebLock component will be defined. Component Examples You can find out more about how you can use the particular components described here in the XPCOM API Reference. For now, what's im
portant to see is how components like the ones in this section are obtained and used by the Mozilla browser. Cookie Manager Cookie management is one of the many sets of functionality that is made available to the browser in the form of an XPCOM component and that can be reused by developers who want similar functionality in their applications. Whenever a user accesses the Cookie Manager dialog to vi...
...s what binds the application code to the user interface of the Mozilla browser, to other Gecko-based XUL, and to JavaScript environments like xpcshell, which is a command-line JavaScript interpreter and XPCOM tool is built with Mozilla. See http://www.mozilla.org/scriptable/ for more information about XPConnect and JavaScript. This isn't quite all there is to it, of course, but this shows an im
portant aspect of XPCOM. The contractual arrangements that XPCOM enforces open up the way to binary interoperability - to being able to access, use, and reuse XPCOM components at runtime. And they make it possible to use components written in other languages - such as JavaScript, Python, and others - and to use C++-based XPCOM components from these other languages as well. In the Mozilla browser, com...
...mes Boolean attribute that indicates whether to search subframes of current document. matchCase Boolean attribute that indicates whether to match case in the search. entireWord Boolean attribute that specifies whether the entire word should be matched or not. Once you use the interface to get to the component, you can ask the component what other interfaces it sup
ports. This service, which is defined in the basic nsISup
ports interface and implemented by all XPCOM components, allows you to query and switch interfaces on a component as part of the runtime object typing capabilities of XPCOM. It is handled by the QueryInterface method, which was introduced in the chapter An Overview of XPCOM. The XPCOM API Reference provides a full reference of the XPCOM componen...
...And 2 more matches
Components.classes
for the ContractID @mozilla.org/messenger;1, which is not usually used by itself, but whose createInstance and getService methods can be used to create a new instance of the component or to access the singleton instance, if the contract ID represents a service. ...
...f, but whose createInstance and getService methods can be used to create a new instance of the component or to access the singleton instance, if the contract ID represents a service. ...
...ce of the component or to access the singleton instance, if the contract ID represents a service. A new XPCOM component instance can be created from the returned class object as follows: var obj = Components.classes["@mozilla.org/sup
ports-array;1"] .createInstance(Components.interfaces.nsISup
portsArray); which is a shortcut to var obj = Components.classes["@mozilla.org/sup
ports-array;1"] .createInstance(); obj.QueryInterface(Components.interfaces.nsISup
portsArray); If you don't provide a specific interface to createInstance(), it will return an XPConnect wrapper for the component, which only exposes the methods of the nsISup
ports interface (and under certain circumstances the special wrappedJSObject property). To access a service (a singleton co...
...And 2 more matches
Components.utils.Sandbox
ipt code that needs Web APIs (such as accessing the window's DOM) can be executed without interference from untrusted content code. wantComponents A Boolean indicating whether the Components object is available or not in the sandbox. Default: true. If the sandbox interacts with untrusted content this should be set to false when possible to further reduce possible attack surface. wantEx
portHelpers A Boolean: if true, then createObjectIn(), evalInWindow(), and ex
portFunction() are available in the sandbox. Default: false. wantGlobalProperties An array of strings. Each string is the name of an object that you want to make available as a global to code running in the sandbox. The exception is "-Promise": the Promise constructor is available by default for sandboxes, and you u...
...efault: false. wantGlobalProperties An array of strings. Each string is the name of an object that you want to make available as a global to code running in the sandbox. The exception is "-Promise": the Promise constructor is available by default for sandboxes, and you use this option to remove it from the sandbox. Note that "-Promise" is removed in Firefox 37. ...
... to run script as another origin, possibly to interact with the page. In this case, same-origin Xrays are desirable, and wantXrays should be set to true. See Safely accessing content DOM from chrome for more details. Methods available on the Sandbox object dump() - Similar to window.dump(). debug() For more information on the built-in Sandbox functions, please consult the source code. Im
porting functions or objects into the sandbox You can im
port functions or objects into the sandbox simply by assigning them to the sandbox object. For example: mysandbox.doSomething = function() { ... }; Complex objects can be cloned into the sandbox using Components.utils.cloneInto: mysandbox.someObject = Components.utils.cloneInto({ a: 'string', b: 21 }, mysandbox); Obviously you need to consid...
...And 2 more matches
Components.utils
Removed in Gecko 31 Returns an array created in specified compartment. createObjectIn() Creates a new object, created in the scope of the specified object's compartment. dispatch() Dispatches a runnable to the current/main thread. ...
... forceGC() Forces a garbage collection cycle. forceCC() Forces a cycle collection cycle. ...
... forceGC() Forces a garbage collection cycle. forceCC() Forces a cycle collection cycle. ...
...And 2 more matches
imgIContainer
mage/public/imgIContainer.idlScriptable Represents an image in the Gecko rendering engine. It provides access to frames as Thebes surfaces and lets users extract subregions as other imgIContainer objects. It also provides methods for drawing images onto Thebes contexts. Internally, this interface also manages animation of images. 66 Introduced Gecko 1.0 Inherits from: nsISup
ports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) Implemented by: ?????????????????????????????????????. To create an instance, use: Implemented by: ????????????????????????????????????? as a service: var imgIContainer = Components.classes["@mozilla.org/????????????????????????????"] .createInstance(Components.interfaces.imgIContainer); Method ov...
...e code only! Obsolete since Gecko 2.0 gfxImageSurface copyFrame(in PRUint32 aWhichFrame, in PRUint32 aFlags); Native code only! void decodingComplete(); Obsolete since Gecko 2.0 void draw(in gfxContext aContext, in gfxGraphicsFilter aFilter, [const] in gfxMatrix aUserSpaceToImageSpace, [const] in gfxRect aFill, [const] in nsIntRect aSubimage, [const] in nsIntSize aView
portSize, in PRUint32 aFlags); Native code only! void endFrameDecode(in unsigned long framenumber); Obsolete since Gecko 2.0 void ensureCleanFrame(in unsigned long aFramenum, in PRInt32 aX, in PRInt32 aY, in PRInt32 aWidth, in PRInt32 aHeight, in gfxImageFormat aFormat, [array, size_is(imageLength)] out PRUint8 imageData, out unsigned long imageLength); Native code only! Obsolete s...
... void decodingComplete(); Parameters None. Exceptions thrown Missing Exception Missing Description Native code only!draw Draw the current frame on to the context specified. void draw( in gfxContext aContext, in gfxGraphicsFilter aFilter, [const] in gfxMatrix aUserSpaceToImageSpace, [const] in gfxRect aFill, [const] in nsIntRect aSubimage, [const] in nsIntSize aView
portSize, in PRUint32 aFlags ); Parameters aContext The Thebes context to draw the image to. aFilter The filter to be used if we're scaling the image. aUserSpaceToImageSpace The transformation from user space (for example, appunits) to image space. aFill The area in the context to draw pixels to. When aFlags includes FLAG_CLAMP, the image will be extended to this ar...
...And 2 more matches
imgILoader
modules/libpr0n/public/imgILoader.idlScriptable Please add a summary to this article. ...
...nted by @mozilla.org/image/loader;1 as a service: var imgILoader = Components.classes["@mozilla.org/image/loader;1"] .getService(Components.interfaces.imgILoader); Method overview imgIRequest loadImage(in nsIURI aURI, in nsIURI aInitialDocumentURL, in nsIURI aReferrerURI, in nsIPrincipal aLoadingPrincipal, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISup
ports aCX, in nsLoadFlags aLoadFlags, in nsISup
ports cacheKey, in imgIRequest aRequest, in nsIChannelPolicy channelPolicy); imgIRequest loadImageWithChannel(in nsIChannel aChannel, in imgIDecoderObserver aObserver, in nsISup
ports cx, out nsIStreamListener aListener); boolean sup
portImageWithMimeType(in string mimeType); Constants Constant Value Description LOAD_CORS_ANONYMOUS 1 << 16 LO...
...g mimeType); Constants Constant Value Description LOAD_CORS_ANONYMOUS 1 << 16 LOAD_CORS_USE_CREDENTIALS 1 << 17 Methods loadImage() Start the load and decode of an image. imgIRequest loadImage( in nsIURI aURI, in nsIURI aInitialDocumentURL, in nsIURI aReferrerURI, in nsIPrincipal aLoadingPrincipal, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISup
ports aCX, in nsLoadFlags aLoadFlags, in nsISup
ports cacheKey, in imgIRequest aRequest, in nsIChannelPolicy channelPolicy ); Parameters aURI The URI to load. aInitialDocumentURL aReferrerURI The 'referring' URI. aLoadingPrincipal The principal of the loading document. aLoadGroup Loadgroup to put the image load into. aObserver The observer (may be null) aCX Some random data. aLoadFlags Load...
...And 2 more matches
nsIAccessibilityService
ice.idlScriptable Please add a summary to this article. ...
... changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Inherits from: nsIAccessibleRetrieval Method overview nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode); nsIAccessible createRootAccessible(in nsIPresShell aShell, in nsIDocument aDocument); nsIAccessible createHTML4ButtonAccessible(in nsISup
ports aFrame); nsIAccessible createHyperTextAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLBRAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLButtonAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLAccessibleByMarkup(in nsIFrame aFrame, in nsIWeakReference aWeakShell, in nsIDOMNode aDOMNode); nsIAccessible createHTMLLIAccessible(in nsISup
ports aFrame, in nsISup
ports aBulletFrame, in AString aBulletText); nsIAccessible ...
...BRAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLButtonAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLAccessibleByMarkup(in nsIFrame aFrame, in nsIWeakReference aWeakShell, in nsIDOMNode aDOMNode); nsIAccessible createHTMLLIAccessible(in nsISup
ports aFrame, in nsISup
ports aBulletFrame, in AString aBulletText); nsIAccessible createHTMLCheckboxAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell); nsIAccessible createHTMLGenericAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLGenericAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLHRAccessible(in nsISup
ports aFrame); nsIAccessible createHTMLImageAccessible(in nsISup
ports aFrame); nsIAccessible cre...
...And 2 more matches
nsIAppShellService
xpfe/appshell/nsIAppShellService.idlScriptable Provides the AppShellService. ...
... void enterLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void exitLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void getHiddenWindowAndJSContext(out nsIDOMWindow aHiddenDOMWindow, out JSContext aJSContext); Native code only! ...
...indowClosingSurvivalArea(); Obsolete since Gecko 1.8 void exitLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void getHiddenWindowAndJSContext(out nsIDOMWindow aHiddenDOMWindow, out JSContext aJSContext); Native code only! ...
...And 2 more matches
nsIAppStartup
toolkit/components/startup/public/nsIAppStartup.idlScriptable This interface is intended to be used as application startup service. It also helps in quitting applications as well. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6) Implemented by: @mozilla.org/toolkit/app-startup;1. To use the service: var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"] .getService(Components.interfaces.nsIAppStartup); Method overview void createHiddenWindow(); boolean createStartupState(in long aWindowWidth, in long aWindowHeight); Obsolete since Gecko 1.9.1 void destroyHiddenWindow(); void doProfileStartup(in nsIC...
...This can be used, for example, when doing performance te...
...This can be used, for example, when doing performance testing of the start...
...And 2 more matches
nsIBoxObject
layout/xul/base/public/nsIBoxObject.idlScriptable Please add a summary to this article. Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) To get an instance, use the boxObject property. Where possible, element.getClientRects and element.getBoundingClientRect should be used instead. Method overview wstring getLookAndFeelMetric(in wstring propertyName); Obsolete since Gecko 1.9 wstring getProperty(in wstring propertyName); nsISup
ports getPropertyAsSup
ports(in wstring propertyName); void removeProperty(in wstring propertyName); void setProperty(in wstring propertyName, in wstring propertyValue); void setPropertyAsSup
ports(in wstring propertyName, in nsISup
ports value); Attributes Attribute Type Description element nsIDOMElement Read only. first...
...els. Read only. y long The y coordinate of the box, in CSS pixels. Read only. ...
.... y long The y coordinate of the box, in CSS pixels. Read only. ...
...And 2 more matches
nsIChannel
protocol-specific results. For example, QueryInterfacing to nsIHttpChannel allows response headers to be retrieved for the corresponding http transaction. This interface must be used only from the XPCOM main thread. Implemented by netwerk/base/src/nsBaseChannel.cpp and netwerk/protocol/http/src/nsHttpChannel.cpp. Method overview void asyncOpen(in nsIStreamListener aListener, in nsISup
ports aContext); nsIInputStream open(); Attributes Attribute Type Description contentCharset ACString The character set of the channel's content if available and if applicable. This attribute only applies to textual data. Setting contentCharset before the channel has been opened provides a hint to the channel on what the charset should be. The b...
...often be wrongly specified (For example wrong file extension, wrong MIME type, wrong document type stored on a server and so on.), and the caller most likely wants to verify with the actual data. Setting contentType before the channel has been opened provides a hint to the channel as to what the MIME type is. The channel may ignore this hint in deciding on the actual MIME type that it will re
port. Setting contentType after onStartRequest has been fired or after open() is called will override the type determined by the channel. Setting contentType between the time that asyncOpen() is called and the time when onStartRequest is fired has undefined behavior at this time. The value of the contentType attribute is a lowercase string. A value assigned to this attribute will be par...
...still be obtained. This is also used as the RI of the document resulting from the channel, unless the channel has the LOAD_REPLACE flag set. This is never null. Attempts to set it to null must throw. Note: This is distinctly different from the http Referer (referring URI), which is typically the page that contained the original URI (accessible from nsIHttpChannel.) owner nsISup
ports The owner, corresponding to the entity that is responsible for this channel. Used by the security manager to grant or deny privileges to mobile code loaded from this channel. Note: This is a strong reference to the owner, so if the owner is also holding a strong reference to the channel, care must be taken to explicitly drop its reference to the channel. securityInfo nsIS...
...And 2 more matches
nsIContentViewer
docshell/base/nsIContentViewer.idlScriptable Handles displaying content. Inherits from: nsISup
ports Last changed in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) Implemented by: ?????????????????????????????????????. To create an instance, use: var contentViewer = Components.classes["@mozilla.org/????????????????????????????"] .createInstance(Components.interfaces.nsIContentViewer); Method overview void clearHistoryEntry(); void close(in nsISHEntry historyEntry); void destroy(); [noscript,notxpcom,nostdcall] nsIViewPtr findContainerView(); void getBounds(in nsIntRectRef aBounds); Native code only! [noscript,notxpcom] nsIDocumentPtr getDocument(); void hide(); void init(...
...oscript,notxpcom,nostdcall] nsIViewPtr findContainerView(); void getBounds(in nsIntRectRef aBounds); Native code only! [noscript,notxpcom] nsIDocumentPtr getDocument(); void hide(); void init(in nsIWidgetPtr aParentWidget, [const] in nsIntRectRef aBounds); Native code only! void loadComplete(in unsigned long aStatus); void loadStart(in nsISup
ports aDoc); void move(in long aX, in long aY); void open(in nsISup
ports aState, in nsISHEntry aSHEntry); void pageHide(in boolean isUnload); boolean permitUnload([optional] in boolean aCallerClosesWindow); boolean requestWindowClose(); void resetCloseWindow(); void setBounds([const] in nsIntRectRef aBounds); Native code only! ...
...Can return null. Read only. isTabModalPromptAllowed boolean Read only. presContext nsPresContextPtr Read only. Native code only! ...
...And 2 more matches
nsIDocShell
Do not create an instance directly. Instead, retrieve an nsIDocShell from a browser or other document container element. Note that out-of-process browsers do not have an nsIDocShell; instead you can access the nsIDocShell object from a frame script. ...
... boolean isBeingDestroyed(); void loadStream(in nsIInputStream aStream, in nsIURI aURI, in...
... code, all text is encoded as Unicode. When reading a document, a converter is used to translate the text from its original format into Unicode. This attribute lets you: See what converter was used when retrieving the document's data. Override that character set for documents for which the specified fallback or auto-detected character set is incorrect. Reading this value re
ports the encoding that was used when loading the data into the document. Setting this attribute overrides the encoding; however, to update the DOM or display of the content, you need have the data reparsed. Overriding the character set also sets the fallback encoding for the container frame. Note: Prior to Gecko 12.0, this attribute was part of a separate nsIDocCharset interface. ...
...And 2 more matches
nsIFile
xpcom/io/nsIFile.idlScriptable An instance of this interface is a cross-platform representation of a location in the filesystem. Inherits from: nsISup
ports Last changed in Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27) nsIFile is the correct platform-agnostic way to specify a file; you should always use this instead of a string to ensure compatibility. With an nsIFile you can navigate to ancestors or descendants without having to deal with the different path separators used on different platforms, query the state of any file or directory at the position represented by the nsIFile and create, move or copy items in the filesystem. An nsIFile can be retrieved by either instantiating an nsILocalFile using a platform specific path string or by using cross-platform locations...
...ntaining characters encoded in the native charset cannot be safely passed to javascript via xpconnect. Therefore, the UTF-16 forms are scriptable, but the "native methods" are not. In addition, the native form cannot deal with files whose name contains characters outside the default system code page on Windows. ...
...Much of the documentation has not been updated to reflect this change. ...
...And 2 more matches
nsIHttpActivityObserver
netwerk/protocol/http/nsIHttpActivityObserver.idlScriptable This interface provides a way for http trans
port activities to be re
ported to observers. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void observeActivity(in nsISup
ports aHttpChannel, in PRUint32 aActivityType, in PRUint32 aActivitySubtype, in PRTime aTimestamp, in PRUint64 aExtraSizeData, in ACString aExtraStringData); Attributes Attribute Type Description isActive boolean true when the interface is active and should observe HTTP activity, otherwise false. If this is false, the observeActivity() method should not be called. Read only. Note: This attribute is present only for compatibility a...
...ttributes Attribute Type Description isActive boolean true when the interface is active and should observe HTTP activity, otherwise false. If this is false, the observeActivity() method should not be called. Read only. Note: This attribute is present only for compatibility and should not be used. Constants Activity type constants Constant Value Description ACTIVITY_TYPE_SOCKET_TRANS
PORT 0x0001 Socket trans
port activity has occurred. ACTIVITY_TYPE_HTTP_TRANSACTION 0x0002 HTTP trans
port activity has occurred. Activity subtype constants Constant Value Description ACTIVITY_SUBTYPE_REQUEST_HEADER 0x5001 The HTTP request is about to be queued for sending. Observers can look at request headers in aExtraStringData ACTIVITY_SUBTYPE_REQUEST_BODY_SENT 0x5002 The HTTP request's...
...TY_SUBTYPE_RESPONSE_START 0x5003 The HTTP response has started to arrive. ACTIVITY_SUBTYPE_RESPONSE_HEADER 0x5004 The HTTP response header has arrived. ACTIVITY_SUBTYPE_RESPONSE_COMPLETE 0x5005 The complete HTTP response has been received. ACTIVITY_SUBTYPE_TRANSACTION_CLOSE 0x5006 The HTTP transaction has been closed. Methods observeActivity() Called when activity occurs on the HTTP trans
port. You should implement this method to perform whatever tasks you wish to perform when HTTP activity occurs. void observeActivity( in nsISup
ports aHttpChannel, in PRUint32 aActivityType, in PRUint32 aActivitySubtype, in PRTime aTimestamp, in PRUint64 aExtraSizeData, in ACString aExtraStringData ); Parameters aHttpChannel The nsIHttpChannel on which the activity occurred. aActivityType...
...And 2 more matches
nsIHttpChannelInternal
netwerk/protocol/http/nsIHttpChannelInternal.idlScriptable An internal interface for HTTP channels. Using features exposed by this interface is not recommended, as it will change in unpredictable ways. ...
...her an IPv4 or IPv6 address. Note: If Network Address Translation (NAT) is in effect, this may not be the same address the remote host thinks it is talking to. This may throw an NS_ERROR_NOT_AVAILABLE exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsIHttpActivityObserver.isActive attribute is false. See bug 534698 and bug 526207. Read only. local
Port PRInt32 The local
port number to which the channel is bound. This may throw an NS_ERROR_NOT_AVAILABLE exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsIHttpActivityObserver.isActive attribute is false. See bug 534698 and bug 526207. Read only. proxyInfo nsIProxyInfo Get the proxy info in use by the channel. Read only. Obsolete since Gecko 1.9 ...
... Gecko 1.9 remoteAddress AUTF8String The IP address of the remote host to which this channel is bound, in the same format produced by PR_NetAddrToString(). This may throw an NS_ERROR_NOT_AVAILABLE exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsIHttpActivityObserver.isActive attribute is false. See bug 534698 and bug 526207. Read only. remote
Port PRInt32 The remote
port number to which the channel is bound. This may throw an NS_ERROR_NOT_AVAILABLE exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsIHttpActivityObserver.isActive attribute is false. See bug 534698 and bug 526207. Read only. Methods getRequestVersion() Gets the request's major and minor version numbers. void getRequestVersi...
...And 2 more matches
nsINavHistoryQueryOptions
toolkit/components/places/nsINavHistoryService.idlScriptable Represents the global options for executing a query. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10) Method overview nsINavHistoryQueryOptions clone(); Attributes Attribute Type Description applyOptionsToContainers boolean If true, the query options are only applied to the containers. asyncEnabled boolean When true, the root container node generated by these options and all of its descendant containers are opened asynchronously if they sup
port doing so. By default, this is false. ...
...ontainers boolean If true, the query options are only applied to the containers. asyncEnabled boolean When true, the root container node generated by these options and all of its descendant containers are opened asynchronously if they sup
port doing so. By default, this is false. Note: Currently, only bookmark folder containers sup
port being opened asynchronously. excludeItemIfParentHasAnnotation Obsolete since Gecko 13.0 AUTF8String This option excludes items from a bookmarks query if the parent of the item has this annotation. An example is to exclude livemark items (parent folders have the "livemark/feedURI" annotation). Ignored for queries over history. excludeItems b...
...ou multiple results for one URI). Individual result nodes will have type "Visit". RESULTS_AS_FULL_VISIT 2 This is identical to RESULT_TYPE_VISIT except that individual result nodes will have type "FullVisit". This is used for the attributes that are not commonly accessed to save space in the common case (the lists can be very long). Note: Sup
ported only for QUERY_TYPE_HISTORY. RESULTS_AS_DATE_QUERY 3 Returns nsINavHistoryQueryResultNode nodes for each predefined date range where we had visits. Note: Sup
ported only for QUERY_TYPE_HISTORY. RESULTS_AS_SITE_QUERY 4 Returns nsINavHistoryQueryResultNode nodes for each site where we have vi...
...And 2 more matches
nsINavHistoryService
toolkit/components/places/nsINavHistoryService.idlScriptable This interface provides complex query functions, more fine-grained getters and setters. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 22 (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19) Implemented by: "@mozilla.org/browser/nav-history-service;1". To use this service, use: var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"] .getService(Components.interfaces.nsINavHistoryService); Method overview AString getPageTitle(in nsIURI aURI); void markPageAsFollowedBookmark(in nsIURI aURI); void markPageAsFollowedLink(in nsIURI aURI); void markPageAsTyped(in nsIURI aURI)...
...This can be used in UI to determine whether the "clear history" button should be enabl...
...This can be used in UI to determine whether the "clear history" button should be enabled or not. This is much better th...
...And 2 more matches
nsIPrincipal
caps/nsIPrincipal.idlScriptable Provides the interface to a principal, which represents a security context. On the web, for example, a typical principal is comprised of an URL scheme, host, and
port. Inherits from: nsISerializable Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) For details on principals, how they work, and how to get the appropriate one, see Security check basics. ...
...prised of an URL scheme, host, and
port. Inherits from: nsISerializable Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) For details on principals, how they work, and how to get the appropriate one, see Security check basics. ...
...If there isn't one, this will return null. Getting this attribute never throws. Read only. certificateID string The fingerprint ID of this principal's certificate. Throws if there is no certificate associated with this principal. Read only. Obsolete since Gecko 1.8 commonName string The common name for the ...
...And 2 more matches
nsIServerSocket
The nsIServerSocket interface implements a server socket that can accept incoming connections. netwerk/base/public/nsIServerSocket.idlScriptable Please add a summary to this article. Last changed in Gecko 1.6 Inherits from: nsISup
ports Implemented by: @mozilla.org/network/server-socket;1. To create an instance, use: var serverSocket = Components.classes["@mozilla.org/network/server-socket;1"] .createInstance(Components.interfaces.nsIServerSocket); Method overview void init(in long a
Port, in boolean aLoopbackOnly, in long aBackLog); void initWithAddress([const] in PRNetAddrPtr aAddr, in long aBackLog);Native code only! void close(); void asyncListen(in nsIServerSocketListener aListener); PRNetAddr...
...Read only. Methods asyncListen() This method puts the server socket in the listening state. It will asynchronously listen for and accept client connections. The listener will be notified once for each client connection that is accepted. The listener's onSocketAccepted() method will be called on the same thread that called asyncListen() (...
...d init(in long a
Port, in boolean aLoopbackOnly, in long aBackLog); void initWithAddress([const] in PRNetAddrPtr aAddr, in long aBackLog);Native code only! void close(); void asyncListen(in nsIServerSocketListener aListener); PRNetAddr getAddress();Native code only! Attributes Attribute Type Description
port long Returns the
port of this server socket. Read only. Methods asyncListen() This method puts the server socket in the listening state. It will asynchronously listen for and accept client connections. The listener will be notified once for each client connection that is accepted. The listener's onSocketAccepted() method will be called on the same thread that called asyncListen() (the calling thread must have...
...And 2 more matches
nsIServiceManager
xpcom/components/nsIServiceManager.idlScriptable This interface provides a means to obtain global services in an application. The service manager depends on the repository to find and instantiate factories to obtain services. ...
...rviceInstantiated( in nsCIDRef aClass, in nsIIDRef aIID ); Parameters aClass The ClassID of the service that is being tested. aIID The interface type to be tested. Return value true if the service has already been created. Exceptions thrown NS_ERROR_SERVICE_NOT_AVAILABLE Indicates that the service hasn't been instantiated. NS_NOINTERFACE Indicates that the IID given isn't sup
ported. isServiceInstantiatedByContractID() This method tests whether or not a XPCOM service, identified by ContractID, has been instantiated. boolean isServiceInstantiatedByContractID( in string aContractID, in nsIIDRef aIID ); Parameters aContractID The ContractID of the service that is being tested. aIID The interface type to be tested. Return value true if the service has alread...
...ractID( in string aContractID, in nsIIDRef aIID ); Parameters aContractID The ContractID of the service that is being tested. aIID The interface type to be tested. Return value true if the service has already been created. Exceptions thrown NS_ERROR_SERVICE_NOT_AVAILABLE Indicates that the service hasn't been instantiated. NS_NOINTERFACE Indicates that the IID given isn't sup
ported. Remarks The service manager depends on the repository to find and instantiate factories to obtain services. Because services are instantiated lazily, methods are provided to test whether or not a service has already been instantiated. Users of the service manager must first obtain a pointer to the global service manager by calling NS_GetServiceManager. After that, they can request specifi...
...And 2 more matches
nsIWebSocketChannel
nsIWebSocketChannel netwerk/protocol/websocket/nsIWebSocketChannel.idlScriptable Provides sup
port for WebSocket channels. 1.0 66 Introduced Gecko 8.0 Inherits from: nsISup
ports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5) Implemented by: ?????????????????????????????????????. ...
...rd 8.0 / SeaMonkey 2.5) Implemented by: ?????????????????????????????????????. To create an instance, use: var webSocketChannel = Components.classes["@mozilla.org/????????????????????????????"] .createInstance(Components.interfaces.nsIWebSocketChannel); Method overview void asyncOpen(in nsIURI aURI, in ACString aOrigin, in nsIWebSocketListener aListener, in nsISup
ports aContext); void close(in unsigned short aCode, in AUTF8String aReason); void sendBinaryMsg(in ACString aMsg); void sendMsg(in AUTF8String aMsg); Attributes Attribute Type Description extensions ACString Sec-Websocket-Extensions response header value. Read only. loadGroup nsILoadGroup The load group of the WebSockets co...
...orth. originalURI nsIURI The original URI used to construct the protocol connection. This is used in the case of a redirect or URI "resolution" (for example resolving a resource: URI to a file: URI) so that the original pre-redirect URI can still be obtained. This is never null. Read only. protocol ACString Sec-Websocket-Protocol value. securityInfo nsISup
ports Trans
port-level security information (if any). Read only. URI nsIURI The URI corresponding to the protocol connection after any redirections are completed. Read only. Status codes The following values are permitted status codes. Status code Name Description 0-999 Reserved and not used. 1000 CLOSE_NORMAL Normal closure; the co...
...And 2 more matches
nsIWorkerScope
dom/interfaces/threads/nsIDOMWorkers.idlScriptable This interface represents the global scope in which a worker's script runs. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsIWorkerGlobalScope Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Method overview void postMessage(in DOMString aMessage, [optional] in nsIWorkerMessage
Port aMessage
Port); void close(); Attributes Attribute Type Description onclose nsIDOMEventListener A listener object to be called when the worker stops running. onmessage nsIDOMEventListener A listener object to be called when a message is posted on the
port. The message is in the event's data member. Methods close() Allows the worker to terminate itself. If a listener has been establishe...
...when a message is posted on the
port. The message is in the event's data member. Methods close() Allows the worker to terminate itself. If a listener has been established by setting the value of the onclose attribute, it gets called. void close(); Parameters None. postMessage() Posts a message to the scope's parent worker object. ...
...e is posted on the
port. The message is in the event's data member. Methods close() Allows the worker to terminate itself. If a listener has been established by setting the value of the onclose attribute, it gets called. void close(); Parameters None. postMessage() Posts a message to the scope's parent worker object. ...
...And 2 more matches
Streams - Plugins
Normal mode: The browser uses the NPP_Write method to "push" stream data to the instance incrementally as it is available. Random-access mode: The plug-in calls the NPN_RequestRead method to "pull" stream data. In general, this mode is more expensive, because the entire stream must be downloaded to a temporary file before use unless the stream comes from a local file or an HTTP server that sup
ports the byte-range extension to HTTP. File mode: The browser saves the entire stream to a local file and passes the file path to the plug-in instance through the NPP_StreamAsFile method. Use this feature only as a last resort; plug-ins should implement an incremental stream-based interface wherever possible. Streams sent by the plug-in to the browser are like normal-mode streams produced by the b...
...e type, NPStream *stream, NPBool seekable, uint16* stype); The instance parameter refers to the plug-in instance receiving the stream; the type parameter represents the stream's MIME type. The stream parameter is a pointer to the new stream, which is valid until the stream is destroyed. The seekable parameter specifies whether the stream is seekable (true) or not (false). Seekable streams sup
port random access (for example, local files or HTTP servers that sup
port byte-range requests). The plug-in can set the output parameter type to one of these transmission modes: NP_NORMAL: (Default): The plug-in can process the data progressively as it arrives from the network or file system through a series of calls to NPP_WriteReady and NPP_Write. NP_ASFILEONLY: This plug-in gets full random ac...
...er specifies the offset, in bytes, of buf from the beginning of the data in the stream. The len parameter specifies the length, in bytes, of buf, the buffer of data (delivered by the stream). The buffer allocated by the browser is deleted after returning from the function, so the plug-in must make a copy of the data it needs to keep. As an example, suppose that a plug-in (and the HTTP server) sup
ports byte-range requests, and that the browser is in the process of pushing data to the plug-in. If the user now requests a specific page of the document, the plug-in calls NPN_RequestRead with a list of byte ranges. The open stream is converted from normal mode to seek mode in an effort to pass the plug-in data that was already on the way, rather than just discarding it. All NPP_Write calls for stre...
...And 2 more matches
DOM Inspector internals - Firefox Developer Tools
There are three main facets to DOM Inspector. The one you are likely to be most familiar with is its inspector.xul-based primary UI. This is the two-pane inspector that appears when Ctrl+Shift+I (or Cmd+Shift+I) is pressed from one of the applications for which DOM Inspector has explicit sup
port (i.e., menuitems placed via overlay). Besides the DOM Inspector's primary UI, there are a couple other top-level inspectors which differ slightly (the object inspector and DOM Inspector sidebar used in SeaMonkey). Initially, we will begin by focusing on inspector.xul and its entry point, and then expand our focus later to explain how these other inspectors differ. DOM Inspector from a high-level perspective The DOM inspector primary UI consists of some toolbars and a panelset. The panelset...
... host application. In order for DOM Inspector to be useful with its host application, though, there should be a way to launch DOM Inspector within it, e.g., by a menu item and an optional keyboard shortcut such as Ctrl+Shift+I (or Cmd+Shift+I). Either the host applications must provide these themselves (usually bundling DOM Inspector with the application, too), or DOM Inspector must explicitly sup
port them by providing its own menu items and keyboard shortcuts with host-integration overlays. DOM Inspector explicitly sup
ports several Mozilla project applications by providing its own host-integration overlays. These overlays are: browserOverlay.xul tasksOverlay-cz.xul tasksOverlay-ff.xul tasksOverlay-mobile.xul tasksOverlay-sb.xul tasksOverlay-tb.xul tasksOverlay.xul venkmanOverlay.xu...
...Additionally, it defines the content in the main body of the DOM Inspector window, namely, the panelset, document and object viewer panels, and the document browser pane. (The browser pane is not a viewer panel in the sense ...
...And 2 more matches
Browser Console - Firefox Developer Tools
the browser via the command line, and the result of executing them. However, it displays such messages from: web content hosted by all browser tabs the browser's own code add-ons. Messages from add-ons The Browser Console displays messages logged by all Firefox add-ons. Console.jsm To use the console API from a traditional or bootstrapped add-on, get it from the Console module. ...
...s the browser's own code add-ons. Messages from add-ons The Browser Console displays messages logged by all Firefox add-ons. Console.jsm To use the console API from a traditional or bootstrapped add-on, get it from the Console module. One ex
ported symbol from Console.jsm is "console". Below is an example of how to access it, which adds a message to the Browser Console. Components.utils.im
port("resource://gre/modules/Console.jsm"); console.log("Hello from Firefox code"); //output messages to the console Learn more: console API reference Console.jsm source code in the Mozilla DXR HUDService There is also the HUDService which allows access to the Browse Console. The module is available at Mozilla DXR. We see we can not only access the Browser Console but also Web Console. Here i...
...ut messages to the console Learn more: console API reference Console.jsm source code in the Mozilla DXR HUDService There is also the HUDService which allows access to the Browse Console. The module is available at Mozilla DXR. We see we can not only access the Browser Console but also Web Console. Here is an example on how to clear the contents of the Browser console: Components.utils.im
port("resource://devtools/shared/Loader.jsm"); var HUDService = devtools.require("devtools/client/webconsole/hudservice"); var hud = HUDService.getBrowserConsole(); hud.jsterm.clearOutput(true); If you would like to access the content document of the Browser Console this can be done with the HUDService. This example here makes it so that when you mouse over the "Clear" button it will clear the Brows...
...And 2 more matches
Debugger.Object - Firefox Developer Tools
Theoptions argument is as for Debugger.Frame.prototype.eval. asEnvironment() If the referent is a global object, return the Debugger.Environment instance representing the referent as a variable environment for evaluating code. If the referent is not a global object, throw a TypeError. setObjectWatchpoint(handler)(future plan) Set a watchpoint on all the referent's own properties, re
porting events by callinghandler's methods. Any previous watchpoint handler on this Debugger.Object instance is replaced. Ifhandler is null, the referent is no longer watched.Handler may have the following methods, called under the given circumstances: add(frame,name,descriptor) A property namedname has been added to the referent.Descriptor is a property descriptor of the sort accepted by De...
...l without notifying the debugger. extensionsPrevented(frame) The referent has been made non-extensible, as if by a call to Object.preventExtensions. For all watchpoint handler methods: Handler calls receive the handler object itself as the this value. Theframe argument is the current stack frame, whose code is about to perform the operation on the object being re
ported. If the method returns undefined, then SpiderMonkey makes the announced change to the object, and continues execution normally. If the method returns an object: If the object has a superseded property whose value is a true value, then SpiderMonkey does not make the announced change. If the object has a resume property, its value is taken as a resumption value, indicat...
...ced change to the object, and continues execution normally. If the method returns an object: If the object has a superseded property whose value is a true value, then SpiderMonkey does not make the announced change. If the object has a resume property, its value is taken as a resumption value, indicating how execution should proceed. (However, return resumption values are not sup
ported.) If a given method is absent fromhandler, then events of that sort are ignored. The watchpoint consultshandler's properties each time an event occurs, so adding methods to or removing methods fromhandler after setting the watchpoint enables or disables re
porting of the corresponding events. Values passed tohandler's methods are debuggee values. Descriptors passed tohandler's ...
...And 2 more matches
DevTools API - Firefox Developer Tools
Introduction The DevTools API provides a way to register and access developer tools in Firefox. In terms of User Interface, each registered tool lives in its own tab (we call one tab a panel). These tabs are located in a box we call a Toolbox. ...
...selected (not when the toolbox is opened). There is no way to "close/destroy" a ToolPanel. The only way to close a toolPanel is to close its containing toolbox. All these objects implement the EventEmitter interface. API gDevTools The gDevTools API can be used to register new tools, themes and handle toolboxes for different tabs and windows. To use the gDevTools API from an add-on, it can be im
ported with following snippet const { gDevTools } = require("resource:///modules/devtools/gDevTools.jsm"); Methods registerTool(toolDefinition) Registers a new tool and adds a tab to each existing toolbox. Parameters: toolDefinition {ToolDefinition} - An object that contains information about the tool. See ToolDefinition for details. unregisterTool(tool) Unregisters the given tool an...
...has been selected. The parameter is a ToolPanel object. {toolId}-destroy(panel) A tool is about to be destroyed. The parameter is a ToolPanel object. destroy The Toolbox is about to be destroyed. destroyed The Toolbox has been destroyed. ToolDefinition A ToolDefinition object contains all the required information for a tool to be shown in the toolbox. Methods isTargetSup
ported(target) A method that is called during toolbox construction to check if the tool sup
ports debugging the given target. Parameters: target {Target} - The target to check. Return value: A boolean indicating if the tool sup
ports the given target. build(window, toolbox) A method that builds the ToolPanel for this tool. Parameters: window {Window} - The Window object for frame th...
...And 2 more matches
Call Tree - Firefox Developer Tools
These bottlenecks are the places where any optimizations you can make will have the biggest impact. The Call Tree is a sampling profiler. It periodically samples the state of the JavaScript engine and records the stack for the code executing at the time. ...
...xecuting at the time. Statistically, the number of samples taken in which we were executing a particular function corresponds to the amount of time the browser spent executing it. In this article, we'll use the output of a simple program as an example. If you want to get the program to experiment with your profile, you can find it here. You can find the specific profile we discuss here - just im
port it to the performance tool to follow along. There's a short page describing the structure of this program here. Note that we use the same program - the same profile, in fact - in the documentation page for the Flame Chart. The screenshot below shows the output of a program that compares three sorting algorithms - bubble sort, selection sort, and quicksort. To do this, it generates some arrays...
...aken, and the rows are ordered by the number of samples taken while in that function, highest to lowest. Samples is the number of samples that were taken when we were executing this particular function, including its children (the other functions called by this particular function). Total Time is that number translated into milliseconds, based on the total amount of time covered by the selected
portion of the recording. These numbers should roughly be the same as the number of samples. Total Cost is that number as a percentage of the total number of samples in the selected
portion of the recording. Self Time is calculated as the time spent in that particular function, excluding its children. This comes from the captured stacks where this function is the leafmost function. Self Cost is cal...
...And 2 more matches
Console messages - Firefox Developer Tools
e this behavior, enable Persist Logs in the console settings menu (gear icon). The context menu options listed below are available on all message categories. Additional context menu options are described in the subsection for the message category they apply to. Copy Message copies the selected message to the clipboard. Select All selects all messages available in the message display pane. Ex
port Visible Messages To Clipboard copies all messages available in the display pane to the clipboard. File opens a file dialog box so you can save an ex
port of all messages available in the display pane. Message categories Network Network log messages are not shown by default. Use the filtering feature to show them. Network requests are logged with a line that looks like this: ...
...ntent for more details. Loading mixed (insecure) display content on a secure page The page contained mixed display content: that is, the main page was served over HTTPS, but asked the browser to load "display content", such as images, over HTTP. The browser loaded this display content. See Mixed Content for more details. ...
...nsecure) display content on a secure page The page contained mixed display content: that is, the main page was served over HTTPS, but asked the browser to load "display content", such as images, over HTTP. The browser loaded this display content. See Mixed Content for more details. This site specified both an X-Content-Security-Policy/Re
port-Only header and a Content-Security-Policy/Re
port-Only header. The X-Content-Security-Policy/Re
port-Only header(s) will be ignored. See Content Security Policy for more details. The X-Content-Security-Policy and X-Content-Security-Re
port-Only headers will be deprecated in the future. Please use the Content-Security-Policy and Content-Security-Re
port-Only headers with CSP spec compliant syntax instead. See Content Security Policy f...
...And 2 more matches
AnalyserNode.AnalyserNode() - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...dn/browser-compat-data and send us a pull request. ...
...And 2 more matches
BaseAudioContext.createConstantSource() - Web APIs
tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
....com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
BudgetService.getBudget() - Web APIs
age is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetgetBudget ExperimentalDeprecatedNon-standardChrome Full sup
port 55Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 42Safari ? WebView Android Full sup
port 55Chrome Android Full sup
port 55Firefox Android ? Opera Android Full sup
port 42Safari iOS ? Samsung Inter...
...And 2 more matches
BudgetService.getCost() - Web APIs
page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...t ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetgetCost ExperimentalDeprecatedNon-standardChrome Full sup
port 55Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 42Safari ? WebView Android Full sup
port 55Chrome Android Full sup
port 55Firefox Android ? Opera Android Full sup
port 42Safari iOS ? Samsung Inter...
...And 2 more matches
BudgetService.reserve() - Web APIs
page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...t ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetreserve ExperimentalDeprecatedNon-standardChrome Full sup
port 55Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 42Safari ? WebView Android Full sup
port 55Chrome Android Full sup
port 55Firefox Android ? Opera Android Full sup
port 42Safari iOS ? Samsung Inter...
...And 2 more matches
CSSStyleSheet - Web APIs
rom its parent, StyleSheet. A stylesheet consists of a collection of CSSRule objects representing each of the rules in the stylesheet. The rules are contained in a CSSRuleList, which can be obtained from the stylesheet's cssRules property. For example, one rule might be a CSSStyleRule object containing a style such as: h1, h2 { font-size: 16pt; } Another rule might be an at-rule such as @im
port or @media, and so forth. See the Notes section for the various ways a CSSStyleSheet object can be obtained. Properties Inherits properties from its parent, StyleSheet. cssRules Read only Returns a live CSSRuleList which maintains an up-to-date list of the CSSRule objects that comprise the stylesheet. This is normally used to access individual rules like this: styleSheet.cssRules[i] ...
...Read only Returns a live CSSRuleList which maintains an up-to-date list of the CSSRule objects that comprise the stylesheet. This is normally used to access individual rules like this: styleSheet.cssRules[i] // where i = 0..cssRules.length-1 To add or remove items in cssRules, use the CSSStyleSheet's insertRule() and deleteRule() methods. ownerRule Read only If this stylesheet is im
ported into the document using an @im
port rule, the ownerRule property returns the corresponding CSSIm
portRule; otherwise, this property's value is null. Methods Inherits methods from its parent, StyleSheet. deleteRule() Deletes the rule at the specified index into the stylesheet's rule list. insertRule() Inserts a new rule at the specified position in the stylesheet, given the textual repres...
... In some browsers, if a stylesheet is loaded from a different domain, accessing cssRules results in SecurityError. A stylesheet is associated with at most one Document, which it applies to (unless disabled). A list of CSSStyleSheet objects for a given document can be obtained using the document.styleSheets property. A specific style sheet can also be accessed from its owner object (Node or CSSIm
portRule), if any. A CSSStyleSheet object is created and inserted into the document's Document.styleSheets list automatically by the browser, when a stylesheet is loaded for a document. As the stylesheet list cannot be modified directly, there's no useful way to create a new CSSStyleSheet object manually (although Constructable Stylesheet Objects is coming to the web platform soon and is already supp...
...And 2 more matches
DOMParser - Web APIs
vides the ability to parse XML or HTML source code from a string into a DOM Document. Note: XMLHttpRequest can parse XML and HTML directly from a URL-addressable resource, returning a Document in its response property. You can perform the opposite operation--converting a DOM tree into XML or HTML source--using the XMLSerializer interface. In the case of an HTML document, you can also replace
portions of the DOM with new DOM trees built from HTML by setting the value of the Element.innerHTML and outerHTML properties. These properties can also be read to fetch HTML fragments corresponding to the corresponding DOM subtree. Syntax let domparser = new DOMParser() Methods DOMParser.parseFromString() Syntax let doc = domparser.parseFromString(string, mimeType) Return Either Document or X...
... Parsing SVG or HTML The DOMParser can also be used to parse an SVG document (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) or an HTML document (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9). There are three different results possible, selected by the MIME type given. If the MIME type is text/xml, the ...
... /* * DOMParser HTML extension * 2012-09-04 * * By Eli Grey, http://eligrey.com * Public domain. * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. ...
...And 2 more matches
DOMRectReadOnly.fromRect() - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Detecting device orientation - Web APIs
Increasingly, web-enabled devices are capable of determining their orientation; that is, they can re
port data indicating changes to their orientation with relation to the pull of gravity. In particular, hand-held devices such as mobile phones can use this information to automatically rotate the display to remain upright, presenting a wide-screen view of the web content when the device is rotated so that its width is greater than its height. There are two JavaScript events that handle orientation information. The first one is the DeviceOrientationEvent, which is sent when the accelerometer detects a change to the orientation of the device. ...
...tate the display to remain upright, presenting a wide-screen view of the web content when the device is rotated so that its width is greater than its height. There are two JavaScript events that handle orientation information. The first one is the DeviceOrientationEvent, which is sent when the accelerometer detects a change to the orientation of the device. By receiving and processing the data re
ported by these orientation events, it's possible to interactively respond to rotation and elevation changes caused by the user moving the device. The second event is the DeviceMotionEvent, which is sent when a change in acceleration was added. It is different from the DeviceOrientationEvent because it is listening for changes in acceleration as opposed to orientation. Sensors that are commonly capab...
...g storage devices. DeviceOrientationEvent is more commonly found in mobile devices. Processing orientation events All you need to do in order to begin receiving orientation change is to listen to the deviceorientation event: Note: gyronorm.js is a polyfill for normalizing the accelerometer and gyroscope data on mobile devices. This is useful for overcoming some of the differences in device sup
port for device orientation. window.addEventListener("deviceorientation", handleOrientation, true); After registering your event listener (in this case, a JavaScript function called handleOrientation()), your listener function periodically gets called with updated orientation data. The orientation event contains four values: DeviceOrientationEvent.absolute DeviceOrientationEvent.alpha Device...
...And 2 more matches
Document.cookie - Web APIs
r') If not specified, defaults to the current path of the current document location. Note: Prior to Gecko 6.0, paths with quotes were treated as if the quotes were part of the string, instead of as if they were delimiters surrounding the actual path string. This has been fixed. ;domain=domain (e.g., 'example.com' or 'subdomain.example.com'). If not specified, this defaults to the host
portion of the current document location. Contrary to earlier specifications, leading dots in domain names are ignored, but browsers may decline to set the cookie containing such dots. If a domain is specified, subdomains are always included. Note: The domain must match the domain of the JavaScript origin. Setting cookies to foreign domains will be silently ignored. ;max-age=max-age-in-seco...
...mains are always included. Note: The domain must match the domain of the JavaScript origin. Setting cookies to foreign domains will be silently ignored. ;max-age=max-age-in-seconds (e.g., 60*60*24*365 or 31536000 for a year) ;expires=date-in-GMTString-format If neither expires nor max-age specified it will expire at the end of session. When user privacy is a concern, it's im
portant that any web app implementation invalidate cookie data after a certain timeout instead of relying on the browser to do it. Many browsers let users specify that cookies should never expire, which is not necessarily safe. See Date.toUTCString() for help formatting this value. ;secure Cookie to only be transmitted over secure protocol as https. Before Chrome 52, this f...
...when following a regular link. The none value explicitly states no restrictions will be applied. The cookie will be sent in all requests--both cross-site and same-site. The cookie value string can use encodeURIComponent() to ensure that the string does not contain any commas, semicolons, or whitespace (which are disallowed in cookie values). Some user agent implementations sup
port the following cookie prefixes: __Secure- Signals to the browser that it should only include the cookie in requests transmitted over a secure channel. __Host- Signals to the browser that in addition to the restriction to only use the cookie from a secure origin, the scope of the cookie is limited to a path attribute passed down by the server. If the server omits the path attribute the "di...
...And 2 more matches
FederatedCredential - Web APIs
Syntax var myCredential = new FederatedCredential(init) Parameters init Options are: provider: A USVString; identifying the credential provider. Specifications Specification Status Comment Credential Management Level 1 Working Draft Initial definition. Browser compatibility The compatibility table in this page is generated from structured data. ...
...e is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
File.webkitRelativePath - Web APIs
patibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetwebkitRelativePathChrome Full sup
port 13Prefixed Full sup
port 13Prefixed Prefixed Implemented with the vendor prefix: webkitEdge Full sup
port 13Firefox Full sup
port 49IE No sup
port NoOpera No sup
port NoSafari Full sup
port 11.1WebView Android Full sup
port YesChrome Android ...
...And 2 more matches
FileReaderSync.readAsArrayBuffer() - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...thub.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
FileReaderSync.readAsBinaryString() - Web APIs
patibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...f you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...hub.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
FontFaceSetLoadEvent.FontFaceSetLoadEvent() - Web APIs
is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...o the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...lorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetFontFaceSetLoadEvent() constructor ExperimentalChrome Full sup
port 57Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 44Safari ? WebView Android No sup
port NoChrome Android Full sup
port 57Firefox Android ? Opera Android Full sup
port 43Safari iOS ? Samsung Interne...
...And 2 more matches
FontFaceSetLoadEvent.fontfaces - Web APIs
bility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ou'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...om/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
History.scrollRestoration - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
IDBVersionChangeRequest.setVersion() - Web APIs
ble on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ke to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Timing element visibility with the Intersection Observer API - Web APIs
m work in our example here, but they exist to help with the presentation of a blog-like experience. The sidebar is represented using an <aside> element, and is styled as follows: aside { grid-column: 1; grid-row: 2; background-color: cornsilk; padding: 5px 10px; } aside ul { padding-left: 0; } aside ul li { list-style: none; } aside ul li a { text-decoration: none; } The most im
portant thing to note here is that the grid-column is set to 1, to place the sidebar on the left-hand side of the screen. If you change this to -1, it will appear on the right (although some other elements will need some adjustments made to their margins to get the spacing just right). The grid-row is set to 2, to place it alongside the site body. The content body Speaking of the site's body: the ma...
...rsection, since intersection isn't affected by page visibility. Therefore, we need to pause our timers while the page is tabbed out; hence this event listener. Next we set up the options for the IntersectionObserver which will monitor target elements (ads, in our case) for intersection changes relative to the document. The options are configured to watch for intersections with the document's view
port (by setting root to null). We have no margins to extend or contract the intersection root's rectangle; we want to match the boundaries of the document's view
port exactly for intersection purposes. And the threshold is set to an array containing the values 0.0 and 0.75; this will cause our callback to execute whenever a targeted element becomes completely obscured or first starts to become unobscu...
...ond refresh since we're displaying timers in all visible ads for the purposes of this example. You may not need an interval at all, or you might do it differently or using a different time interval. Handling document visibility changes Let's take a look at the handler for the visibilitychange event. Our script receives this event when the document itself becomes visible or invisible. The most im
portant scenario here is when the user switches tabs. Since Intersection Observer only cares about the intersection between the targeted elements and the intersection root, and not the tab's visibility (which is a different issue entirely), we need to use the Page Visibility API to detect these tab switches and disable our timers for the duration. function handleVisibilityChange() { if (document.hi...
...And 2 more matches
Navigator - Web APIs
which provides methods for requesting a new Lock object and querying for an existing Lock object Navigator.mediaCapabilities Read only Returns a MediaCapabilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities. Navigator.maxTouchPoints Read only Returns the maximum number of simultaneous touch contact points are sup
ported by the current device. NavigatorPlugins.mimeTypes Read only Returns an MimeTypeArray listing the MIME types sup
ported by the browser. Navigator.onLine Read only Returns a Boolean indicating whether the browser is working online. Navigator.permissions Read only Returns a Permissions object that can be used to query and update permission status of APIs covered by the Permissions API. ...
...he CredentialsContainer interface which exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out. Navigator.deviceMemory Read only Returns the amount of device memory in gigabytes. This value is an approximation given by rounding to the nearest power of 2 and dividing that number by 1024. ...
...r by 1024. Navigator.doNotTrack Re
ports the value of the user's do-not-track preference. When this value is "yes", your web site or application should not track the user. Navigator.mediaDevices Returns a reference to a MediaDevices object which can then be used to get information about available media devices (MediaDevices.enumerateDevices()), find out what constrainable properties are sup
ported for media on the user's computer and user agent (MediaDevices.getSup
portedConstraints()), and to request access to media using MediaDevices.getUserMedia(). Navigator.mediaSession Returns MediaSession object which can be used to provide metadata that can be used by the browser to present information about the currently-playing media to the user, such as in a global media controls UI. Navigato...
...And 2 more matches
Using the Notifications API - Web APIs
. Getting permission If permission to display notifications hasn't been granted yet, the application needs to use the Notification.requestPermission() method to request this from the user. In its simplest form, we just include the following: Notification.requestPermission().then(function(result) { console.log(result); }); This uses the promise-based version of the method. If you want to sup
port older versions, you might have to use the older callback version, which looks like this: Notification.requestPermission(); The callback version optionally accepts a callback function that is called once the user has responded to the request to display permissions. Example In our todo list demo, we include an "Enable notifications" button that, when pressed, requests notification permissions f...
...permission' in Notification)) { Notification.permission = permission; } // set the button to shown or hidden, depending on what the user answers if(Notification.permission === 'denied' || Notification.permission === 'default') { notificationBtn.style.display = 'block'; } else { notificationBtn.style.display = 'none'; } } // Let's check if the browser sup
ports notifications if (!('Notification' in window)) { console.log("This browser does not sup
port notifications."); } else { if(checkNotificationPromise()) { Notification.requestPermission() .then((permission) => { handlePermission(permission); }) } else { Notification.requestPermission(function(permission) { handlePermission(permission); }...
... To avoid duplicating code, we have stored a few bits of housekeeping code inside the handlePermission() fu...
...And 2 more matches
PaymentAddress - Web APIs
escriptive instructions, or post office box number. PaymentAddress.country Read only A DOMString specifying the country in which the address is located, using the ISO-3166-1 alpha-2 standard. The string is always given in its canonical upper-case form. Some examples of valid country values: "US", "GB", "CN", or "JP". PaymentAddress.city Read only A DOMString which contains the city or town
portion of the address. PaymentAddress.dependentLocality Read only A DOMString giving the dependent locality or sublocality within a city, for example, a neighborhood, borough, district, or UK dependent locality. PaymentAddress.organization Read only A DOMString specifying the name of the organization, firm, company, or institution at the payment address. PaymentAddress.phone Read only A DOMS...
...amples In the following example, the PaymentRequest() constructor is used to create a new payment request, which takes three objects as parameters -- one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options. ...
...ontaining details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options. The first of these three (sup
portedInstruments in the example below) contains a data property that has to conform to the structure defined by the BasicCardRequest dictionary. ...
...And 2 more matches
Payment processing concepts - Web APIs
ification and how to use it. URL-based payment method identifiers These may vary substantially depending on the specifics of the service, and a given processing service may have multiple URLs used, depending on the version of their API, their communication technology, and so forth. https://apple.com/apple-pay Payments are handled using the Apple Pay service. Currently, Apple Pay is only sup
ported by Safari. https://google.com/pay Payments are processed by Google Pay. This is currently sup
ported only by Chrome and Chromium-based browsers. Functions of a payment handler A user agent may provide built-in sup
port for certain types of payments. In addition, the Payment Handler API can be used to establish sup
port for additional payment method providers, in browsers that sup
port it. In e...
...See Merchant validation for details. Verify that the information provided by the user results in a valid transaction. This results in the creation and returning of a payment method-specific object that contains the information needed to handle the transaction. ...
...ormation from the address given by validationURL. Note this function must go through the merchant server, because a client typically does not access the validation URL itself. ...
...And 2 more matches
PerformanceResourceTiming.decodedBodySize - Web APIs
ontent-codings. Note: This feature is available in Web Workers. Syntax resource.decodedBodySize; Return value The size (in octets) received from the fetch (HTTP or cache) of the message body, after removing any applied content-codings. Example The following example, the value of the size properties of all "resource" type events are logged. ...
.... Syntax resource.decodedBodySize; Return value The size (in octets) received from the fetch (HTTP or cache) of the message body, after removing any applied content-codings. Example The following example, the value of the size properties of all "resource" type events are logged. function log_sizes(perfEntry){ // Check for sup
port of the *size properties and print their values // if sup
ported. ...
...content-codings. Example The following example, the value of the size properties of all "resource" type events are logged. function log_sizes(perfEntry){ // Check for sup
port of the *size properties and print their values // if sup
ported. ...
...And 2 more matches
PerformanceResourceTiming.encodedBodySize - Web APIs
re removing any applied content-codings. Syntax resource.encodedBodySize; Return value A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings. Example The following example, the value of the size properties of all "resource" type events are logged. ...
...turn value A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings. Example The following example, the value of the size properties of all "resource" type events are logged. function log_sizes(perfEntry){ // Check for sup
port of the PerformanceEntry.*size properties and print their values // if sup
ported. ...
... Example The following example, the value of the size properties of all "resource" type events are logged. function log_sizes(perfEntry){ // Check for sup
port of the PerformanceEntry.*size properties and print their values // if sup
ported. ...
...And 2 more matches
PerformanceResourceTiming.responseEnd - Web APIs
Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
... Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
... Ca...
...And 2 more matches
PerformanceResourceTiming.transferSize - Web APIs
igin resource, this property returns zero. Syntax resource.transferSize; Return value A number representing the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body (RFC7230). Example The following example, the value of size properties of all "resource" type events are logged. ...
...urn value A number representing the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body (RFC7230). Example The following example, the value of size properties of all "resource" type events are logged. function log_sizes(perfEntry){ // Check for sup
port of the PerformanceEntry.*size properties and print their values // if sup
ported. ...
...0). Example The following example, the value of size properties of all "resource" type events are logged. function log_sizes(perfEntry){ // Check for sup
port of the PerformanceEntry.*size properties and print their values // if sup
ported. ...
...And 2 more matches
PerformanceTiming - Web APIs
me as PerformanceTiming.fetchStart. PerformanceTiming.domainLookupEnd Read only When the domain lookup is finished. If a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as PerformanceTiming.fetchStart. PerformanceTiming.connectStart Read only When the request to open a connection is sent to the network. ...
...anceTiming.fetchStart. PerformanceTiming.domainLookupEnd Read only When the domain lookup is finished. If a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as PerformanceTiming.fetchStart. PerformanceTiming.connectStart Read only When the request to open a connection is sent to the network. ...
...If a persistent connection is used, the value will be the same as PerformanceTiming.fetchStart. ...
...And 2 more matches
Performance API - Web APIs
a clock that is always increasing. ...
...a clock that is always increasing. ...
...a clock that is always increasing. ...
...And 2 more matches
Using Performance Timeline - Web APIs
The standard also includes interfaces that allow an application to be notified when specific performance events occur. Together, these interfaces can be used to help identify an application's performance bottlenecks. Performance extensions Performance Timeline extends the Performance object with three methods that provide different mechanisms to get a set of performance records (metrics), depending on the specified filter criteria. The following example show the usage of these methods getEntries(), getEntriesByName() and getEntriesByType(). ...
...>"; } function do_work (n) { for (var i=0 ; i < n; i++) { var m = Math.random(); } } function print_perf_entry(pe) { log("..name: " + pe.name + "; entryType: " + pe.entryType + "; startTime: " + pe.startTime + "; duration: " + pe.duration); } function print_PerformanceEntries() { if (performance.mark === undefined) { log("... ...
...The following examples show the use of this method. fun...
...And 2 more matches
PhotoCapabilities.imageHeight - Web APIs
Syntax var mediaSettingsRange = photoCapabilities.imageHeight Value A MediaSettingsRange object. Specifications Specification Status Comment MediaStream Image CaptureThe definition of 'imageHeight' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
...lity table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...'d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
imageWidth - Web APIs
Syntax var mediaSettingsRange = photoCapabilities.imageWidth Value A MediaSettingsRange is an object. Specifications Specification Status Comment MediaStream Image CaptureThe definition of 'imageWidth' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
...ility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Pinch zoom gestures - Web APIs
complex multi-touch twist gesture, where the touch points (aka pointers) move in different directions. This example shows how to detect the pinch/zoom gesture, which uses pointer events to detect whether the user moves two pointers closer or farther apart from each other. A live version of this application is available on GitHub. The source code is available on GitHub; pull requests and bug re
ports are welcome. Example In this example, you use the pointer events to simultaneously detect two pointing devices of any type, including fingers, mice, and pens. The pinch in (zoom out) gesture, which moves the two pointers toward each other, changes the target element's background color to lightblue. The pinch out (zoom in) gesture, which moves the two pointers away from each other, changes the ...
...d color to lightblue. The pinch out (zoom in) gesture, which moves the two pointers away from each other, changes the target element's background color to pink. Define touch target The application uses <div> to define the pointers' target areas. <style> div { margin: 0em; padding: 2em; } #target { background: white; border: 1px solid black; } </style> Global state Sup
porting a two-pointer gesture requires preserving a pointer's event state during various event phases. This application uses two global variables to cache the event state. // Global vars to cache event state var evCache = new Array(); var prevDiff = -1; Register event handlers Event handlers are registered for the following pointer events: pointerdown, pointermove and pointerup. The handler for po...
...wn The pointerdown event is fired when a pointer (mouse, pen/stylus or touch point on a touchscreen) makes contact with the contact surface. In this application, the event's state must be cached in case this down event is part of a two-pointer pinch/zoom gesture. function pointerdown_handler(ev) { // The pointerdown event signals the start of a touch interaction. // This event is cached to sup
port 2-finger gestures evCache.push(ev); log("pointerDown", ev); } Pointer move The pointermove event handler detects if a user is invoking a two-pointer pinch/zoom gesture. If two pointers are down, and the distance between the pointers is increasing (signifying a pinch out or zoom in), the element's background color is changed to pink, and if the distance between the pointers is decreasing (a p...
...And 2 more matches
RTCIceCandidateStats.deleted - Web APIs
is no longer under consideration if this value is true. Example In this example, setInterval() is used to set up a function that runs periodically to display the latest statistics for candidates. Only candidates which have not been deleted are included in the output. ...
...cally to display the latest statistics for candidates. Only candidates which have not been deleted are included in the output. ...
...isplay the latest statistics for candidates. Only candidates which have not been deleted are included in the output. ...
...And 2 more matches
RTCPeerConnection.connectionState - Web APIs
rConnection.connectionState; Value The current state of the connection, as a value from the enum RTCPeerConnectionState. RTCPeerConnectionState enum The RTCPeerConnectionState enum defines string constants which describe states in which the RTCPeerConnection may be. These values are returned by the connectionState property. ...
... The current state of the connection, as a value from the enum RTCPeerConnectionState. RTCPeerConnectionState enum The RTCPeerConnectionState enum defines string constants which describe states in which the RTCPeerConnection may be. These values are returned by the connectionState property. This state essentially represents the aggregate state of all ICE trans
ports (which are of type RTCIceTrans
port or RTCDtlsTrans
port) being used by the connection. Constant Description "new" At least one of the connection's ICE trans
ports (RTCIceTrans
ports or RTCDtlsTrans
ports) are in the "new" state, and none of them are in one of the following states: "connecting", "checking", "failed", or "disconnected", or all of the connection's trans
ports are in the "closed" state. ...
...tion. Constant Description "new" At least one of the connection's ICE trans
ports (RTCIceTrans
ports or RTCDtlsTrans
ports) are in the "new" state, and none of them are in one of the following states: "connecting", "checking", "failed", or "disconnected", or all of the connection's trans
ports are in the "closed" state. "connecting" One or more of the ICE trans
ports are currently in the process of establishing a connection; that is, their RTCIceConnectionState is either "checking" or "connected", and no trans
ports are in the "failed" state. ...
...And 2 more matches
RTCPeerConnection.createOffer() - Web APIs
The createOffer() method of the RTCPeerConnection interface initiates the creation of an SDP offer for the purpose of starting a new WebRTC connection to a remote peer. The SDP offer includes information about any MediaStreamTracks already attached to the WebRTC session, codec, and options sup
ported by the browser, and any candidates already gathered by the ICE agent, for the purpose of being sent over the signaling channel to a potential peer to request a connection or to update the configuration of an existing connection. The return value is a Promise which, when the offer has been created, is resolved with a RTCSessionDescription object containing the newly-created offer. Syntax aPromise = myPeerConnection.createOffer([options]); myPeerConnection.createOffer(successCallback, failureCal...
... set this to true. This will cause the returned offer to have different credentials than those already in place. If you then apply the returned offer, ICE will restart. Specify false to keep the same credentials and therefore not restart ICE. The default is false. offerToReceiveAudio Optional (Legacy) A legacy Boolean option which used to control whether or not to offer to the remote peer the op
portunity to try to send audio. If this value is false, the remote peer will not be offered to send audio data, even if the local side will be sending audio data. If this value is true, the remote peer will be offered to send audio data, even if the local side will not be sending audio data. The default behavior is to offer to receive audio only if the local side is sending audio, not otherwise. To e...
...ure there is at least one transceiver set to receive audio that has not been stopped, and if there isn't one, one will be created. Note: You shouldn't use this legacy property. Instead, use RTCRtpTransceiver to control whether or not to accept incoming audio. offerToReceiveVideo Optional (Legacy) A legacy Boolean option which used to control whether or not to offer to the remote peer the op
portunity to try to send video. If this value is false, the remote peer will not be offered to send video data, even if the local side will be sending video data. If this value is true, the remote peer will be offered to send video data, even if the local side will not be sending video data. The default behavior is to offer to receive video only if the local side is sending video, not otherwise. To e...
...And 2 more matches
SVGAnimatedPathData - Web APIs
SVG animated path data interface The SVGAnimatedPathData interface sup
ports elements which have a 'd' attribute which holds SVG path data, and sup
ports the ability to animate that attribute. Interface overview Also implement None Methods None Properties SVGPathSegList animatedNormalizedPathSegList SVGPathSegList animatedPathSegList SVGPathSegList normalizedPathSegList SVGPathSegList pathSegList Normative document SVG 1.1 (2nd Edition) Properties This interface also inherits proper...
... Opera Android ? Safari iOS ? Samsung Internet Android ? ...
... ? Safari iOS ? Samsung Internet Android ? ...
...And 2 more matches
SVGFitToViewBox - Web APIs
SVG fit to view box interface The SVGFitToViewBox interface is used to reflect the viewBox and preserveAspectRatio attributes, and is mixed in to other interfaces for elements that sup
port these two attributes. Interface overview Also implement None Methods None Properties SVGAnimatedPreserveAspectRatio preserveAspectRatio SVGAnimatedRect viewBox Normative document SVG 1.1 (2nd Edition) Properties Name Type Description ...
... Opera Android ? Safari iOS ? Samsung Internet Android ? ...
... ? Safari iOS ? Samsung Internet Android ? ...
...And 2 more matches
Screen Capture API - Web APIs
The Screen Capture API introduces additions to the existing Media Capture and Streams API to let the user select a screen or
portion of a screen (such as a window) to capture as a media stream. This stream can then be recorded or shared with others over the network. Screen Capture API concepts and usage The Screen Capture API is relatively simple to use. Its sole method is MediaDevices.getDisplayMedia(), whose job is to ask the user to select a screen or
portion of a screen to capture in the form of a MediaStream. To start capturing video from the screen, you call getDisplayMedia() on the instance of Media navigator.mediaDevices: captureStream = await navigator.mediaDevices.getDisplayMedia(displayMediaOptions); The Promise returned by getDisplayMedia() resolves to a MediaStream which str...
...ible. The value is one of always, motion, or never. MediaTrackSettings.displaySurface A string indicating what type of display surface is currently being captured. The value is one of application, browser, monitor, or window. MediaTrackSettings.logicalSurface A Boolean value which is true if the video being captured doesn't directly correspond to a single onscreen display area. ...
...motion, or never. MediaTrackSettings.displaySurface A string indicating what type of display surface is currently being captured. The value is one of application, browser, monitor, or window. MediaTrackSettings.logicalSurface A Boolean value which is true if the video being captured doesn't directly correspond to a single onscreen display area. ...
...And 2 more matches
Multi-touch interaction - Web APIs
The touch event interfaces sup
port application-specific single and multi-touch interactions. However, the interfaces can be a bit tricky for programmers to use because touch events are very different from other DOM input events, such as mouse events. The application described in this guide shows how to use touch events for simple single and multi-touch interactions, the basics needed to build application-specific gestures. A live version of this application is available on Github. The source code is available on Github and pull requests and bug re
ports are welcome. Example This example demonstrates using the touchstart, touchmove, touchcancel, and touchend) touch events for the following gestures: single touch, two (simultaneous) touches, more than two simultaneous touches, 1-finger swipe,...
...The code does not include error handling, or vertical moving. Note that the threshold for pinch and zoom movement detection is application specific (and device dependent). // This is a very basic 2-touch move/pinch/zoom handler that does not include // error handling, only handles horizontal moves, etc. function handle_pinch_zoom(ev) { if (ev.ta...
...It also calls preventDefault() to keep the browser from applying further event handling (for example, mouse event emulation). function start_handler(ev) { // If the user makes simultaneous touches, the browser will fire a // separate touchstart event for each touch point. Thus if there are // three simultaneous touches, the first touchstart event will have // targetTouches ...
...And 2 more matches
Touch events - Web APIs
To provide quality sup
port for touch-based user interfaces, touch events offer the ability to interpret finger (or stylus) activity on touch screens or trackpads. The touch events interfaces are relatively low-level APIs that can be used to sup
port application-specific multi-touch interactions such as a two-finger gesture. A multi-touch interaction starts when a finger (or stylus) first touches the contact surface. Other fingers may subsequently touch the surface and optionally move across the touch surface. The interaction ends when the fingers are removed from the surface. During this interaction, an application receives touch events during the start, move, and end phases. ...
...teraction starts when a finger (or stylus) first touches the contact surface. Other fingers may subsequently touch the surface and optionally move across the touch surface. The interaction ends when the fingers are removed from the surface. During this interaction, an application receives touch events during the start, move, and end phases. Touch events are similar to mouse events except they sup
port simultaneous touches and at different locations on the touch surface. The TouchEvent interface encapsulates all of the touchpoints that are currently active. The Touch interface, which represents a single touchpoint, includes information such as the position of the touch point relative to the browser view
port. Definitions Surface The touch-sensitive surface. This may be a screen or trackpad.
...ouch Represents a single point of contact between the user and the touch surface. TouchList Represents a group of touches; this is used when the user has, for example, multiple fingers on the surface at the same time. Example This example tracks multiple touchpoints at a time, allowing the user to draw in a <canvas> with more than one finger at a time. It will only work on a browser that sup
ports touch events. Note: The text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus or other contact method. Create a canvas <canvas id="canvas" width="600" height="600" style="border:solid black 1px;"> Your browser does not sup
port canvas element. </canvas> <br> Log: <pre id="log" style="border: 1px solid #ccc;"></pre> Setting...
...And 2 more matches
UIEvent.layerX - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
WebGL2RenderingContext.samplerParameter[if]() - Web APIs
mpatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Compressed texture formats - Web APIs
The WebGL API provides methods to use compressed texture formats. These are useful to increase texture detail while limiting the additional video memory necessary. By default, no compressed formats are available: a corresponding compressed texture format extension must first be enabled. Usage Unless otherwise specified, this article applies to both WebGL 1 and 2 contexts. If sup
ported, textures can be stored in a compressed format in video memory. This allows for additional detail while limiting the added video memory necessary. Textures are uncompressed on the fly when being accessed by a shader. Note that this advantage doesn't translate to network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as PNG ...
...mory. This allows for additional detail while limiting the added video memory necessary. Textures are uncompressed on the fly when being accessed by a shader. Note that this advantage doesn't translate to network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as PNG and JPG. ...
...ssed by a shader. Note that this advantage doesn't translate to network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as PNG and JPG. As compressed textures require hardware sup
port, therefore no specific formats are required by WebGL; instead, a context can make different formats available, depending on hardware sup
port. This site shows which formats are sup
ported in the used browser. Usage of compressed formats first requires activating the respective extension with WebGLRenderingContext.getExtension(). If sup
ported, it will return an extension object with constants for the added formats and the formats will also be returned by calls to gl.getParameter(gl.COMPRESSED_TEXTURE_FORMATS). (E.g. ext.COMPRESSED_RGBA_...
...And 2 more matches
Using the Web Animations API - Web APIs
eavy techniques such as writing CSS properties and scoping classes onto elements to control playback direction. And unlike pure, declarative CSS, JavaScript also lets us dynamically set values from properties to durations. For building custom animation libraries and creating interactive animations, the Web Animations API might be the perfect tool for the job. Let's see what it can do! Browser Sup
port The basic Web Animations API features discussed in this article are available by default in Firefox 48+ and Chrome 36+. Safari sup
ports Web Animations in its Technology Preview version and there is also a handy polyfill that tests for feature sup
port and adds it where necessary. Writing CSS Animations with the Web Animations API One of the more familiar ways to approach learning the Web Animat...
...the object, separated from the declaration with a comma. In the above example, to make sure that Alice's color changes at 30% (not 50%) for the color change, we are giving it offset: 0.3. Currently, there should be at least two keyframes specified (representing the starting and ending states of the animation sequence). If your keyframe list has only one entry, Element.animate() may throw a NotSup
portedError exception in some browsers until they are updated. So to recap, the keys are equally spaced by default unless you specify an offset on a key. Handy, no? Representing timing properties We'll also need to create an object of timing properties (an AnimationEffectTimingProperties object) corresponding to the values in Alice's animation: var aliceTiming = { duration: 3000, iterations: I...
...ding on which third it falls into var aliceHeight = alicePlayhead / aliceTimeline; if (aliceHeight <= .333){ // Alice got smaller! ... } else if (aliceHeight >= .666) { // Alice got bigger! ... } else { // Alice didn't change significantly ... } } Note: getAnimations() and effect are not shipping in all browsers as of this writing, but the polyfill does sup
port them today. Callbacks and promises CSS Animations and Transitions have their own event listeners, and these are also possible with the Web Animations API: onfinish is the event handler for the finish event and can be triggered manually with finish(). oncancel is the event handler for the cancel event and can be triggers with cancel(). Here we set the callbacks for the cake, bottle, and A...
...And 2 more matches
Using the Web Audio API - Web APIs
1,000 simultaneous sounds without stuttering. Example code Our boombox looks like this: Note the retro cassette deck with a play button, and vol and pan sliders to allow you to alter the volume and stereo panning. We could make this a lot more complex, but this is ideal for simple learning at this stage. Check out the final demo here on Codepen, or see the source code on GitHub. Browser sup
port Modern browsers have good sup
port for most features of the Web Audio API. There are a lot of features of the API, so for more exact information, you'll have to check the browser compatibility tables at the bottom of each reference page. Audio graphs Everything within the Web Audio API is based around the concept of an audio graph, which is made up of nodes. The Web Audio API handles audio ope...
...ar routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. You have input nodes, which are the source of the sounds you are manipulating, modification nodes that change those sounds as desired, and output nodes (destinations), which allow you to save or hear those sounds. Several audio sources with different channel layouts are sup
ported, even within a single context. Because of this modular design, you can create complex audio functions with dynamic effects. Audio context To be able to do anything with the Web Audio API, we need to create an instance of the audio context. This then gives us access to all the features and functionality of the API. // for legacy browsers const AudioContext = window.AudioContext || window.webk...
...t into the audio context const track = audioContext.createMediaElementSource(audioElement); Note: The <audio> element above is represented in the DOM by an object of type HTMLMediaElement, which comes with its own set of functionality. All of this has stayed intact; we are merely allowing the sound to be available to the Web Audio API. ...
...And 2 more matches
Using the Web Storage API - Web APIs
maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores). localStorage does the same thing, but persists even when the browser is closed and reopened. These mechanisms are available via the Window.sessionStorage and Window.localStorage properties (to be more precise, in sup
porting browsers the Window object implements the WindowLocalStorage and WindowSessionStorage objects, which the localStorage and sessionStorage properties are members of) -- invoking one of these will create an instance of the Storage object, through which data items can be set, retrieved, and removed. A different Storage object is used for the sessionStorage and localStorage for each origin -- they ...
...r each origin -- they function and are controlled separately. So, for example, initially calling localStorage on a document will return a Storage object; calling sessionStorage on a document will return a different Storage object. Both of these can be manipulated in the same way, but separately. ...
...rent Storage object. Both of these can be manipulated in the same way, but separately. Feature-detecting localStorage To be able to use localStorage, we should first verify that it is sup
ported and available in the current browsing session. Testing for availability Note: This API is available in current versions of all major browsers. Testing for availability is necessary only if you must sup
port very old browsers, such as Internet Explorer 6 or 7, or in the limited circumstances described below. Browsers that sup
port localStorage have a property on the window object named localStorage. However, just asserting that that property exists may throw exceptions. If the localStorage object does exist, there is still no guarantee that the localStorage API is actually available, as various brow...
...And 2 more matches
Window.devicePixelRatio - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...a. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Window.minimize() - Web APIs
atibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.../github.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Window.openDialog() - Web APIs
ibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...f you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ithub.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Window.routeEvent() - Web APIs
ble in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ke to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Window.scrollY - Web APIs
rolled to upward. If the document is rendered on a subpixel-precise device, then the returned value is also subpixel-precise and may contain a decimal component. If the document isn't scrolled at all up or down, then scrollY is 0. If you need an integer value, you can use Math.round() to round it off. In more technical terms, scrollY returns the Y coordinate of the top edge of the current view
port. If there is no view
port, the returned value is 0. Example // make sure and go down to the second page if (window.scrollY) { window.scroll(0, 0); // reset the scroll position to the top left of the document. } window.scrollByPages(1); Notes Use this property to check that the document hasn't already been scrolled when using relative scroll functions such as scrollBy(), scrollByLines(), or...
...ocument hasn't already been scrolled when using relative scroll functions such as scrollBy(), scrollByLines(), or scrollByPages(). The pageYOffset property is an alias for the scrollY property: window.pageYOffset === window.scrollY; // always true For cross-browser compatibility, use window.pageYOffset instead of window.scrollY. ...
...s(). The pageYOffset property is an alias for the scrollY property: window.pageYOffset === window.scrollY; // always true For cross-browser compatibility, use window.pageYOffset instead of window.scrollY. Additionally, older versions of Internet Explorer (< 9) do not sup
port either property and must be worked around by checking other non-standard properties. ...
...And 2 more matches
Window.setCursor() - Web APIs
tibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...github.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
Window.updateCommands() - Web APIs
ity table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...u'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
only after the request is sent and the connection was established, that is, on readyState LOADED, INTERACTIVE or COMPLETED. By setting the mozBackgroundRequest property of the request object and modifying the example appropriately, you can create your own alert dialog to handle SSL exceptions in your Firefox extension or XULRunner application. // Adapted from the patch for mozTCPSocket error re
porting (bug 861196). const {Cc,Ci} = require("chrome"); function createTCPErrorFromFailedXHR(xhr) { let status = xhr.channel.QueryInterface(Ci.nsIRequest).status; let errType; if ((status & 0xff0000) === 0x5a0000) { // Security module const nsINSSErrorsService = Ci.nsINSSErrorsService; let nssErrorsService = Cc['@mozilla.org/nss_errors_service;1'].getService(nsINSSErrorsService); ...
...ifference let sslErr = Math.abs(nsINSSErrorsService.NSS_SSL_ERROR_BASE) - (status & 0xffff); switch (sslErr) { case 3: // SSL_ERROR_NO_CERTIFICATE, ssl(3) errName = 'SecurityNoCertificateError'; break; case 4: // SSL_ERROR_BAD_CERTIFICATE, ssl(4) errName = 'SecurityBadCertificateError'; break; case 8: // SSL_ERROR_UNSUP
PORTED_CERTIFICATE_TYPE, ssl(8) errName = 'SecurityUnsup
portedCertificateTypeError'; break; case 9: // SSL_ERROR_UNSUP
PORTED_VERSION, ssl(9) errName = 'SecurityUnsup
portedTLSVersionError'; break; case 12: // SSL_ERROR_BAD_CERT_DOMAIN, ssl(12) errName = 'SecurityCertificateDomainMismatchError'; break; default: ...
...
PORTED_VERSION, ssl(9) errName = 'SecurityUnsup
portedTLSVersionError'; break; case 12: // SSL_ERROR_BAD_CERT_DOMAIN, ssl(12) errName = 'SecurityCertificateDomainMismatchError'; break; default: errName = 'SecurityError'; break; } } } else { errType = 'Network'; switch (status) { // connect to host:
port failed case 0x804B000C: // NS_ERROR_CONNECTION_REFUSED, network(13) errName = 'ConnectionRefusedError'; break; // network timeout error case 0x804B000E: // NS_ERROR_NET_TIMEOUT, network(14) errName = 'NetworkTimeoutError'; break; // hostname lookup failed case 0x804B001E: // NS_ERROR_UNKNOWN_HOST, network(30) errName = 'DomainN...
...And 2 more matches
ARIA live regions - Accessibility
anges which are not interactive should be marked as live regions. Below is a list of each related ARIA live region property with a description. aria-live: The aria-live=POLITENESS_SETTING is used to set the priority with which screen reader should treat updates to live regions - the possible settings are: off, polite or assertive. The default setting is off. This attribute is by far the most im
portant. aria-controls: The aria-controls=[IDLIST] is used to associate a control with the regions that it controls. Regions are identified just like an id in a div, and multiple regions can be associated with a control using a space, e.g. aria-controls="myRegionID1 myRegionsID2". Not known if the aria-controls aspect of live regions is implemented in current ATs, or which. Needs research. ...
...he regions that it controls. Regions are identified just like an id in a div, and multiple regions can be associated with a control using a space, e.g. aria-controls="myRegionID1 myRegionsID2". Not known if the aria-controls aspect of live regions is implemented in current ATs, or which. Needs research. Normally, only aria-live="polite" is used. Any region which receives updates that are im
portant for the user to receive, but not so rapid as to be annoying, should receive this attribute. The screen reader will speak changes whenever the user is idle. For regions which are not im
portant, or would be annoying because of rapid updates or other reasons, silence them with aria-live="off". Dropdown box updates useful onscreen information A website specializing in providing information abou...
...ant aria-live="polite" when using this role. status A status bar or area of the screen that provides an updated status of some kind. Screen reader users have a special command to read the current status. To maximize compatibility, add a redundant aria-live="polite" when using this role. alert Error or warning message that flashes on the screen. Alerts are particularly im
portant for client side validation notices to users. (TBD: link to ARIA form tutorial with aria info) To maximize compatibility, some people recommend adding a redundant aria-live="assertive" when using this role. However, adding both aria-live and role="alert" causes double speaking issues in VoiceOver on iOS. progressbar A hybrid between a widget and a live region. Use this with aria-...
...And 2 more matches
system - CSS: Cascading Style Sheets
r will treat all the participating counter styles as extending from the decimal style. ...
...r-style-name> ]where <counter-style-name> = <custom-ident> Examples Cyclic counter If your browser sup
ports it, this example will render a list like this: ? One ? Two ? Three CSS <ul> <li>One</li> <li>Two</li> <li>Three</li> </ul> @counter-style fisheye { system: cyclic; symbols: ?; suffix: " "; } ul { list-style: fisheye; } Result Fixed counter If your browser sup
ports it, this example will render a list like this: ? One ? Two ? Three 4 Four 5 Five CSS <ul> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul> @counter-style circled-digits { system: fixed; symbols: ? ? ...
...One b. Two c. Three aa. Four bb. Five cc. Six aaa. Seven bbb. Eight CSS <ul> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> <li>Six</li> <li>Seven</li> <li>Eight</li> </ul> @counter-style abc { system: symbolic; symbols: a b c; suffix: ". ...
...And 2 more matches
height - CSS: Cascading Style Sheets
The height CSS descriptor is a shorthand descriptor for setting both min-height and max-height of the view
port. By providing one view
port length value will set both, the minimum height and the maximum height, to the value provided. If two view
port values are provided, the first value will set the minimum height and the second value will set the maximum height. Syntax /* One value */ height: auto; height: 320px; height: 15em; /* Two values */ height: 320px 200px; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial view
port at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. Formal...
...Two values */ height: 320px 200px; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial view
port at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. Formal definition Related at-rule@view
portInitial valueas each of the properties of the shorthand:min-height: automax-height: nonePercentagesas each of the properties of the shorthand:min-height: The percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned...
... Working Draft Initial definition ...
...And 2 more matches
Typical use cases of Flexbox - CSS: Cascading Style Sheets
As you lay out your items you want to control the dimensions of the items in that one dimension, or control the spacing between items. These are the uses that flexbox was designed for. ...
...justify-content property. You can read more about this property in Aligning Items in a flex container, which deals with aligning items on the main axis. In the below live example we display the items at their natural size and by using justify-content: space-between make equal amounts of space between the items. You can change how the space is distributed using the space-around value, or where sup
ported, space-evenly. You could also use flex-start to place the space at the end of the items, flex-end to place it before them, or center to centre the navigation items. Space distributed within the items A different pattern for navigation would be to distribute the available space within the items themselves, rather than create space between them. In this case we would use the flex properties t...
...ex-start to place the space at the end of the items, flex-end to place it before them, or center to centre the navigation items. Space distributed within the items A different pattern for navigation would be to distribute the available space within the items themselves, rather than create space between them. In this case we would use the flex properties to allow items to grow and shrink in pro
portion to one another as described in Controlling ratios of flex items along the main axis. If I wanted all of my navigation items to have equal width, then I might use flex: auto, which is the shorthand for flex: 1 1 auto -- all items grow and shrink from a flex-basis of auto. This would mean that the longer item would have more space. In the live example below try changing flex: auto to flex: 1. ...
...And 2 more matches
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
Firefox initially implemented an early version of the Scroll Snap Specification, called Scroll Snap Points. In Firefox 68 the new version of the specification will be shipped and these old properties removed. In this article, we consider questions that might arise related to compatibility across browsers and versions of browsers when adding sup
port for scroll-snap to your web site or app. What should I do if I used the old Firefox implementation? If you have only used the old Firefox implementation of the specification, with the properties that are detailed in Scroll Snap Points, you should update your code to use the new specification. This will ensure your scroll snapping works in all browsers which implement the specification, including Firefox. If you do not do this your scroll snappin...
... 68 and up. The main things to note are as follows: The scroll-snap-type-x and scroll-snap-type-y properties have been dropped The scroll-snap-type property has become a longhand, so the old shorthand syntax like scroll-snap-type:mandatory will stop working Can I use the old implementation as a fallback? If you have already used the old implementation as a fallback, or feel you want to sup
port users of old Firefox (or -webkit prefixed Safari), then you can continue to use the old specification as outlined in the example below. In this initial example we have used the old specification alongside the current specification in order to make scroll snapping work in all browsers which sup
port some form of scroll snapping. The example adds the scroll-snap-points-y and scroll-snap-destinatio...
... Do I need to use both specs? Scroll snapping is one of those nice parts of CSS in which the fallback is that you don't get the enhanced functionality, but everything still works. ...
...And 2 more matches
Syntax - CSS: Cascading Style Sheets
leset, or often simply a rule. A CSS ruleset (or rule) is visualized in the diagram below. As an element of the page may be matched by several selectors, and therefore by several rules potentially containing a given property several times, with different values, the CSS standard defines which one has precedence over the other and must be applied: this is called the cascade algorithm. ...
...ty several times, with different values, the CSS standard defines which one has precedence over the other and must be applied: this is called the cascade algorithm. It is im
portant to note that even if a ruleset characterized by a group of selectors is a kind of shorthand replacing rulesets with a single selector each, this doesn't apply to the validity of the ruleset itself. This leads to an im
portant consequence: if one single basic selector is invalid, like when using an unknown pseudo-element or pseudo-class, the whole selector is invalid and therefore the entire rule is ignored (as invalid too). CSS statements Rulesets are the main building blocks of a style sheet, which often consists of only a big list of them. But there is other information that a Web author wants to convey in the ...
...ing an unknown pseudo-element or pseudo-class, the whole selector is invalid and therefore the entire rule is ignored (as invalid too). CSS statements Rulesets are the main building blocks of a style sheet, which often consists of only a big list of them. But there is other information that a Web author wants to convey in the style sheet, like the character set, other external style sheets to im
port, font face or list counter descriptions and many more. It will use other and specific kinds of statements to do that. A statement is a building block that begins with any non-space characters and ends at the first closing brace or semi-colon (outside a string, non-escaped and not included into another {}, () or [] pair). There are two kinds of statements: Rulesets (or rules) that, as seen,...
...And 2 more matches
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
arance CSS property is used to display an element using platform-native styling, based on the operating system's theme. The -moz-appearance and -webkit-appearance properties are non-standard versions of this propery, used (respectively) by Gecko (Firefox) and by WebKit-based (e.g., Safari) and Blink-based (e.g., Chrome, Opera) browsers to achieve the same thing. Note that Firefox and Edge also sup
port -webkit-appearance, for compatibility reasons. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The -moz-appearance property was used in XUL stylesheets to design custom widgets with platform-appropriate styling. It was ...
...ets with platform-appropriate styling. It was also used in the XBL implementations of the widgets that ship with the Mozilla platform. Starting with Gecko/Firefox 80, these uses were changed to -moz-default-appearance, which should never be used outside of internal stylesheets. Compatibility note: If you wish to use this property on websites, you should test it very carefully. Although it is sup
ported in most modern browsers, its implementation varies widely. In older browsers, even the keyword none does not have the same effect on all form elements across different browsers, and some do not sup
port it at all. The differences are smaller in the newest browsers. Syntax /* CSS Basic User Interface Module Level 4 values */ appearance: none; appearance: auto; appearance: menulist-button; appe...
...arance: button; -webkit-appearance: button; } <div>Lorem</div> Firefox Chrome Safari Edge The element is drawn like a button. checkbox div { color: black; -moz-appearance: checkbox; -webkit-appearance: checkbox; } <div>Lorem</div> Firefox Chrome Safari Edge The element is drawn like a checkbox, including only the actual "checkbox"
portion. listbox div { color: black; height:20px; -moz-appearance: listbox; -webkit-appearance: listbox; } <div>Lorem</div> Firefox Chrome Safari Edge menulist div { color: black; -moz-appearance: menulist; -webkit-appearance: menulist; } <div>Lorem</div> Firefox Chrome Safari Edge meter ...
...And 2 more matches
border-bottom-width - CSS: Cascading Style Sheets
atibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...thub.com/mdn/browser-compat-data and send us a pull request. ...
...And 2 more matches
<color> - CSS: Cascading Style Sheets
pe in detail. To learn more about using color in HTML, see Applying color to HTML elements using CSS. Syntax The <color> data type is specified using one of the options listed below. Note: Although <color> values are precisely defined, their actual appearance may vary (sometimes significantly) from device to device. This is because most devices are not calibrated, and some browsers do not sup
port output devices' color profiles. Color keywords Color keywords are case-insensitive identifiers that represent a specific color, such as red, blue, black, or lightseagreen. Although the names more or less describes their respective colors, they are essentially artificial, without a strict rationale behind the names used. There are a few caveats to consider when using color keywords: HTML on...
...r specific hardware. Note: The list of accepted keywords has undergone many changes during the evolution of CSS: CSS Level 1 only included 16 basic colors, called the VGA colors as they were taken from the set of displayable colors on VGA graphics cards. CSS Level 2 added the orange keyword. Although various colors not in the specification (mostly adapted from the X11 colors list) were sup
ported by early browsers, it wasn't until SVG 1.0 and CSS Colors Level 3 that they were formally defined. They are called the extended color keywords, the X11 colors, or the SVG colors. CSS Colors Level 4 added the rebeccapurple keyword to honor web pioneer Eric Meyer. Specification Keyword RGB hex value Live keyword CSS Level 1 black #000000 silve...
...or example, #0f38 is the same color as #00ff3388. Functional notation: rgb[a](R, G, B[, A]) R (red), G (green), and B (blue) can be either <number>s or <percentage>s, where the number 255 corresponds to 100%. A (alpha) can be a <number> between 0 and 1, or a <percentage>, where the number 1 corresponds to 100% (full opacity). Functional notation: rgb[a](R G B[ / A]) CSS Colors Level 4 adds sup
port for space-separated values in the functional notation. HSL colors The HSL color model defines a given color according to its hue, saturation, and lightness components. An optional alpha component represents the color's transparency. Many designers find HSL more intuitive than RGB, since it allows hue, saturation, and lightness to each be adjusted independently. HSL can also make it easier to ...
...And 2 more matches
display - CSS: Cascading Style Sheets
omes the first inline box of the block box that follows it. Run-in elements act like inlines or blocks, depending on the surrounding elements. That is: If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. Note: Browsers that sup
port the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. This will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. Inside <display-inside> These keywords speci...
... The element behaves like a block element and lays out its content according to the flexbox model. grid The element behaves like a block element and lays out its content according to the grid model. ruby The element behaves like an inline element and lays out its content according to the ruby formatting model. It behaves like the corresponding HTML <ruby> elements. Note: Browsers that sup
port the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block. This will result in expected behavior; for example if you specify an element to be display: grid, you would expect that the box created on the grid container would be a block level box. List Item <display-listitem> The element generates a bloc...
...-listitem> The element generates a block box for the content and a separate list-item inline box. A single value of list-item will cause the element to behave like a list item. This can be used together with list-style-type and list-style-position. list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. Note: In browsers that sup
port the two-value syntax, if no inner value is specified it will default to flow. If no outer value is specified, the principal box will have an outer display type of block. Internal <display-internal> Some layout models such as table and ruby have a complex internal structure, with several different roles that their children and descendants can fill. This section defines those "internal" displ...
...And 2 more matches
filter - CSS: Cascading Style Sheets
peat scroll 0% 0% rgb(238, 238, 238); text-align: left; font-weight: bold; } table.standard-table td { padding: 5px; border: 1px solid rgb(204, 204, 204); text-align: left; vertical-align: top; width:25%; height:auto; } #img3, #img13 { width:100%; height:auto; } grayscale() The grayscale() function converts the input image to grayscale. The value of amount defines the pro
portion of the conversion. A value of 100% is completely grayscale. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. filter: grayscale(100%) <table class="standard-table"> <thead> <tr> <th style="text-align: left;" scope="col">Original image</th> <th style="text-align: left;" scope="...
... text-align: left; vertical-align: top; width:25%; height:auto; } #img3 { height:100%; } <svg style="position: absolute; top: -999999px" xmlns="http://www.w3.org/2000/svg"> <filter id="svgHueRotate" > <feColorMatrix type="hueRotate" values="[angle]" /> <filter /> </svg> invert() The invert() function inverts the samples in the input image. The value of amount defines the pro
portion of the conversion. A value of 100% is completely inverted. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. filter: invert(100%) <table class="standard-table"> <thead> <tr> <th style="text-align: left;" scope="col">Original image</th> <th style="text-align: left;" scope="col"...
...: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; font-weight: bold; } table.standard-table td { padding: 5px; border: 1px solid rgb(204, 204, 204); text-align: left; vertical-align: top; width:25%; height:auto; } #img3 { height:100%; } opacity() The opacity() function applies transparency to the samples in the input image. The value of amount defines the pro
portion of the conversion. A value of 0% is completely transparent. A value of 100% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. This is equivalent to multiplying the input image samples by amount. The lacuna value for interpolation is 1. This function is similar to the more established opacity property; the difference is that with filters, some browsers...
...And 2 more matches
scroll-padding-block-end - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 2 more matches
scroll-padding-bottom - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 2 more matches
scroll-padding-left - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 2 more matches
scroll-padding-right - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 2 more matches
scroll-padding-top - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 2 more matches
Using HTML sections and outlines - Developer guides
Therefore the outline algorithm should not be used to convey document structure to users. Authors are advised to use heading rank (h1-h6) to convey document structure. The HTML5 specification introduced several semantic sectioning elements to help organize the structure of documents. Semantic sectioning elements are specifically designed to communicate structural meaning to browsers and other technologies interpreting the document on behalf of users, such as screen readers and voice assistants. Semantic sectioning elements clarify the larger-scale structures within a document. ...
...ss like navigation. By contrast, the <nav> sectioning element more clearly describes to browsers and other devices the content contained: links or other navigational structures to help users move through and understand where they are in a site's or page's content. New semantic elements were added to HTML5 to improve and clarify the sectioning of websites into meaningful areas of content. It is im
portant for developers to use these semantic elements in line with their intended purposes. Many accessibility tools as well as reader views provided by some browsers rely on semantic sectioning elements. So don't simply swap out an existing tangle of <div> elements for a bunch of <section> elements. Section Elements in HTML5 HTML Navigational Element (<nav>) defines a section that contains naviga...
...ou how. If a significant percentage of your particular target audience is using Internet Explorer 8 or older, then you can follow the below instructions to make them behave as expected. However, global usage of these browsers is now very small, so this is unlikely. HTML5 semantic elements don't need a special DOM interface, but they will need a specific CSS styling in older browser that don't sup
port them explicitly. Unknown elements are styled as display: inline by default, so you'll want to set them to display: block: article, aside, footer, header, nav, section { display: block; } Of course the web developer can style them differently, but keep in mind that in a non-HTML5 browser, the default styling is different from what is expected for such elements. Also note that the <time> eleme...
...And 2 more matches
HTML attribute: required - HTML: Hypertext Markup Language
The Boolean required attribute which, if present, indicates that the user must specify a value for the input before the owning form can be submitted. The required attribute is sup
ported by text, search, url, tel, email, password, date, month, week, time, datetime-local, number, checkbox, radio, file, <input> types along with the <select> and <textarea> form control elements. If present on any of these input types and elements, the :required pseudo class will match. If the attribute is not included, the :optional pseudo class will match. ...
...ute is sup
ported by text, search, url, tel, email, password, date, month, week, time, datetime-local, number, checkbox, radio, file, <input> types along with the <select> and <textarea> form control elements. If present on any of these input types and elements, the :required pseudo class will match. If the attribute is not included, the :optional pseudo class will match. The attribute is not sup
ported or relevant to range and color, as both have default values. It is also not sup
ported on hidden as it can not be expected that a user to fill out a form that is hidden. Nor is it sup
ported on any of the button types, including image. ...
...ired pseudo class will match. If the attribute is not included, the :optional pseudo class will match. The attribute is not sup
ported or relevant to range and color, as both have default values. It is also not sup
ported on hidden as it can not be expected that a user to fill out a form that is hidden. Nor is it sup
ported on any of the button types, including image. Note color and range don't sup
port required, but type color defaults to #00000, and range defaults to the midpoint between min and max -- with min and max defaulting to 0 and 100 respectively in most browsers if not declared -- so always has a value. ...
...And 2 more matches
<acronym> - HTML: Hypertext Markup Language
able in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...browser-compat-data and send us a pull request. ...
...And 2 more matches
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
allow="fullscreen". allowpaymentrequest Set to true if a cross-origin <iframe> should be allowed to invoke the Payment Request API. This attribute is considered a legacy attribute and redefined as allow="payment". csp A Content Security Policy enforced for the embedded resource. See HTMLIFrameElement.csp for details. height The height of the frame in CSS pixels. Default is 150. im
portance The download priority of the resource in the <iframe>'s src attribute. Allowed values: auto (default) No preference. The browser uses its own heuristics to decide the priority of the resource. high The resource should be downloaded before other lower-priority page resources. low The resource should be downloaded after other higher-priority page resources. loading Indi...
... The browser uses its own heuristics to decide the priority of the resource. high The resource should be downloaded before other lower-priority page resources. low The resource should be downloaded after other higher-priority page resources. loading Indicates how the browser should load the iframe: eager: Load the iframe immediately, regardless if it is outside the visible view
port (this is the default value). lazy: Defer loading of the iframe until it reaches a calculated distance from the view
port, as defined by the browser. name A targetable name for the embedded browsing context. This can be used in the target attribute of the <a>, <form>, or <base> elements; the formtarget attribute of the <input> or <button> elements; or the windowName parameter in the window.
...indowName parameter in the window.open() method. referrerpolicy Indicates which referrer to send when fetching the frame's resource: no-referrer: The Referer header will not be sent. no-referrer-when-downgrade (default): The Referer header will not be sent to origins without TLS (HTTPS). origin: The sent referrer will be limited to the origin of the referring page: its scheme, host, and
port. origin-when-cross-origin: The referrer sent to other origins will be limited to the scheme, the host, and the
port. Navigations on the same origin will still include the path. same-origin: A referrer will be sent for same origin, but cross-origin requests will contain no referrer information. strict-origin: Only send the origin of the document as the referrer when the protocol security lev...
...And 2 more matches
<input type="color"> - HTML: Hypertext Markup Language
stom color picker window. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Value A 7-character DOMString specifying a <color> in lower-case hexadecimal notation Events change and input Sup
ported common attributes autocomplete and list IDL attributes list and value Methods select() Value The value of an <input> element of type color is always a DOMString which contains a 7-character string specifying an RGB color in hexadecimal format. While you can input the color in either upper- or lower-case, it will be stored in lower-case form. The value is never...
...ng the value to anything that isn't a valid, fully-opaque, RGB color in hexadecimal notation will result in the value being set to #000000. In particular, you can't use CSS's standardized color names, or any CSS function syntax, to set the value. This makes sense when you keep in mind that HTML and CSS are separate languages and specifications. In addition, colors with an alpha channel are not sup
ported; specifying a color in 9-character hexadecimal notation (e.g. #009900aa) will also result in the color being set to #000000. Note: Any web browser that doesn't sup
port an input of type color will naturally fall back to the type text. Because users can write colors in many different ways (such as rgb(255, 255, 0)), one way to work around this is to set a pattern attribute equal to either #[0-...
... a pattern attribute equal to either #[0-9a-f]{6} or #[0-9A-Fa-f]{6} (preferably the latter because some users may not expect a different result with just a letter-case change) and set a placeholder attribute equal to a color representing the expected format of the user's input, such as #ff0000. Using color inputs Inputs of type color are simple, due to the limited number of attributes they sup
port. Providing a default color You can update the simple example above to set a default value, so that the color well is pre-filled with the default color and the color picker (if any) will also default to that color: <input type="color" value="#ff0000"> If you don't specify a value, the default is #000000, which is black. The value must be in seven-character hexadecimal notation, meaning the "...
...And 2 more matches
<input type="file"> - HTML: Hypertext Markup Language
nipulated using JavaScript code and the File API. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Value A DOMString representing the path to the selected file. ...
...presents the first selected file. JavaScript can access the other files through the input's files property. If no file is yet selected, the string is "" (empty). The string is prefixed with C:\fakepath\, to prevent malicious software from guessing the user's file structure. ...
...ute, if present, indicates that only directories should be available to be selected by the user in the file picker interface. See HTMLInputElement.webkitdirectory for additional details and examples. Note: Though originally implemented only for WebKit-based browsers, webkitdirectory is also usable in Microsoft Edge as well as Firefox 50 and later. However, even though it has relatively broad sup
port, it is still not standard and should not be used unless you have no alternative. Unique file type specifiers A unique file type specifier is a string that describes a type of file that may be selected by the user in an <input> element of type file. Each unique file type specifier may take one of the following forms: A valid case-insensitive filename extension, starting with a period (".") ...
...And 2 more matches
<input type="search"> - HTML: Hypertext Markup Language
styled differently by the user agent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Value A DOMString representing the value contained in the search field. Events change and input Sup
ported Common Attributes autocomplete, list, maxlength, minlength, pattern, placeholder, required, size. IDL attributes value Methods select(), setRangeText(), setSelectionRange(). Value The value attribute contains a DOMString representing the value contained in the search field. You can retrieve this using the HTMLInputElement.value property in JavaScript. searchT...
...ou can retrieve this using the HTMLInputElement.value property in JavaScript. searchTerms = mySearch.value; If no validation constraints are in place for the input (see Validation for more details), the value can be any text string or an empty string (""). ...
...e is a string which indicates whether or not to activate automatic correction while the user is editing this field. Permitted values are: on Enable automatic correction of typos, as well as processing of text substitutions if any are configured. off Disable automatic correction and text substitutions. incremental The Boolean attribute incremental is a WebKit and Blink extension (so sup
ported by Safari, Opera, Chrome, etc.) which, if present, tells the user agent to process the input as a live search. As the user edits the value of the field, the user agent sends search events to the HTMLInputElement object representing the search box. This allows your code to update the search results in real time as the user edits the search. If incremental is not specified, the search event is o...
...And 2 more matches
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element. It is an empty element, meaning that it has no content and does not have a closing tag. It is commonly used to offer the same media content in multiple file formats in order to provide compatibility with a broad range of browsers given their differing sup
port for image file formats and media file formats. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None. Permitted content None, it is an empty element. Tag omission It must have a start...
...all back to using the image specified by the <picture> element's <img> child if it is unable to find a suitable image to use after examing every provided <source>. Usage notes The <source> element is an empty element (or void element), which means that it not only has no content but also has no closing tag. That is, you never use "</source>" in your HTML. ...
... For information about image formats sup
ported by web browsers and guidance on selecting appropriate formats to use, see our Image file type and format guide on the web. For details on the video and audio media types, you can use, see the Guide to media types formats used on the web. Examples Video example This example demonstrates how to offer a video in Ogg format for users whose browsers sup
port Ogg format, and a QuickTime format video for users whose browsers sup
port that. If the audio or video element is not sup
ported by the browser, a notice is displayed instead. If the browser sup
ports the element but does not sup
port any of the specified formats, an error event is raised and the default media controls (if enabled) will indicate an error. Be sure to reference our guide to media types...
...And 2 more matches
Compression in HTTP - HTTP
In practice, web developers don't need to implement compression mechanisms, both browsers and servers have it implemented already, but they have to be sure that the server is configured adequately. ...
... In practice, web developers don't need to implement compression mechanisms, both browsers and servers have it implemented already, but they have to be sure that the server is configured adequately. ...
...rmat. End-to-end compression For compression, end-to-end compression is where the largest performance improvements of Web sites reside. End-to-end compression refers to a compression of the body of a message that is done by the server and will last unchanged until it reaches the client. Whatever the intermediate nodes are, they leave the body untouched. All modern browsers and servers do sup
port it and the only thing to negotiate is the compression algorithm to use. These algorithm are optimized for text. In the 1990s, compression technology was advancing at a rapid pace and numerous successive algorithms have been added to the set of possible choices. Nowadays, only two are relevant: gzip, the most common one, and br the new challenger. To select the algorithm to use, browsers and serv...
...And 2 more matches
Configuring servers for Ogg media - HTTP
deo/ogg .ogv AddType application/ogg .ogg You can find specific information about possible media file types and the codecs used within them in our comprehensive guide to media types and formats on the web. In particular, the article on media container formats will be especially helpful when configuring serers to host media properly. Handle HTTP 1.1 byte range requests correctly In order to sup
port seeking and playing back regions of the media that aren't yet downloaded, Gecko uses HTTP 1.1 byte-range requests to retrieve the media from the seek target position. In addition, Gecko uses byte-range requests to seek to the end of the media (assuming you serve the Content-Length header) in order to determine the duration of the media. Your server should accept the Accept-Ranges: bytes HTTP hea...
...t position. In addition, Gecko uses byte-range requests to seek to the end of the media (assuming you serve the Content-Length header) in order to determine the duration of the media. Your server should accept the Accept-Ranges: bytes HTTP header if it can accept byte-range requests. It must return 206: Partial content to all byte range requests; otherwise, browsers can't be sure you actually sup
port byte range requests. Your server must also return 206: Partial Content for the request Range: bytes=0- as well. Include regular key frames When the browser seeks through Ogg media to a specified time, it has to seek to the nearest key frame before the seek target, then download and decode the video from there until the requested target time. The farther apart your key frames are, the longer th...
..." will preload the media file's metadata and possibly the first few frames of video. Setting payload to auto tells the browser to automatically begin downloading the media as soon as the page is loaded, under the assumption that the user will play it. Configuration for older Firefox versions Serve X-Content-Duration headers Note: As of Firefox 41, the X-Content-Duration header is no longer sup
ported. See bug 1160695 for more details. The Ogg format doesn't encapsulate the duration of media, so for the progress bar on the video controls to display the duration of the video, Gecko needs to determine the length of the media using other means. There are two ways Gecko can do this. The best way is to offer an X-Content-Duration header when serving Ogg media files. This header provides the du...
...And 2 more matches
Connection management in HTTP/1.x - HTTP
In its infancy, HTTP used a single model to handle such connections. ...
...ere created in HTTP/1.1. The persistent-connection model keeps connections opened between successive requests, reducing the time needed to open new connections. The HTTP pipelining model goes one step further, by sending several successive requests without even waiting for an answer, reducing much of the latency in the network. HTTP/2 adds additional models for connection management. It's im
portant point to note that connection management in HTTP applies to the connection between two consecutive nodes, which is hop-by-hop and not end-to-end. The model used in connections between a client and its first proxy may differ from the model between a proxy and the destination server (or any intermediate proxies). The HTTP headers involved in defining the connection model, like Connection and Kee...
...of this efficiency feature of TCP, and performance degrades from optimum by persisting to transmit over a new, cold connection. This model is the default model used in HTTP/1.0 (if there is no Connection header, or if its value is set to close). In HTTP/1.1, this model is only used when the Connection header is sent with a value of close. Unless dealing with a very old system, which doesn't sup
port a persistent connection, there is no compelling reason to use this model. Persistent connections Short-lived connections have two major hitches: the time taken to establish a new connection is significant, and performance of the underlying TCP connection gets better only when this connection has been in use for some time (warm connection). To ease these problems, the concept of a persistent co...
...And 2 more matches
CSP: base-uri - HTTP
Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
...rectives, some of them don't make sense for `<base>`, such as the keywords 'unsafe-inline' and 'strict-dynamic' <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access
port 443 on mail.example.com. https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: default-src - HTTP
Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
...ontent-Security-Policy: default-src <source>; Content-Security-Policy: default-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access
port 443 on mail.example.com. https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: form-action - HTTP
ive default-src fallback No. Not setting this allows anything. Syntax One or more sources can be set for the form-action policy: Content-Security-Policy: form-action <source>; Content-Security-Policy: form-action <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: img-src - HTTP
this directive is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the img-src policy: Content-Security-Policy: img-src <source>; Content-Security-Policy: img-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: navigate-to - HTTP
ive default-src fallback No. Not setting this allows anything. Syntax One or more sources can be set for the navigate-to policy: Content-Security-Policy: navigate-to <source>; Content-Security-Policy: navigate-to <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: script-src-attr - HTTP
Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
...rc: Content-Security-Policy: script-src <source>; Content-Security-Policy: script-src-attr <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access
port 443 on mail.example.com. https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: script-src-elem - HTTP
Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
...rc: Content-Security-Policy: script-src <source>; Content-Security-Policy: script-src-elem <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access
port 443 on mail.example.com. https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: style-src-attr - HTTP
Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
...le-src: Content-Security-Policy: style-src <source>; Content-Security-Policy: style-src-attr <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access
port 443 on mail.example.com. https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: style-src-elem - HTTP
Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
...-src: Content-Security-Policy: style-src <source>; Content-Security-Policy: style-src-elem <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access
port 443 on mail.example.com. https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...And 2 more matches
CSP: upgrade-insecure-requests - HTTP
latter is effectively a no-op. It is recommended to set either directive, but not both, unless you want to force HTTPS on older browsers that do not force it after a redirect to HTTP. The upgrade-insecure-requests directive will not ensure that users visiting your site via links on third-party sites will be upgraded to HTTPS for the top-level navigation and thus does not replace the Strict-Trans
port-Security (HSTS) header, which should still be set with an appropriate max-age to ensure that users are not subject to SSL stripping attacks. Syntax Content-Security-Policy: upgrade-insecure-requests; Examples // header Content-Security-Policy: upgrade-insecure-requests; // meta tag <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> With the above header set on ...
...out any fallback to HTTP. ...
... Specif...
...And 2 more matches
Want-Digest - HTTP
the responder to provide a digest of the requested resource using the Digest response header. The header contains identifiers for one or more digest algorithms that the sender wishes the responder to use to create the digest. The sender may use quality values to indicate its preference ordering among the choices it offers. If Want-Digest does not include any digest algorithms that the server sup
ports, the server may respond with: a digest calculated using a different digest algorithm, or a 400 Bad Request error, and include another Want-Digest header with that response, listing the algorithms that it does sup
port. See the page for the Digest header for more information. Header type General header Forbidden header name no Syntax Want-Digest: <digest-algo...
... <q-value> The quality value to apply to that option. ...
... Header type General header Forbidden header name no Syntax Want-Digest: <digest-algorithm> // Multiple algorithms, weighted with the quality value syntax: Want-Digest: <digest-algorithm><q-value>,<digest-algorithm><q-value> Directives <digest-algorithm> Sup
ported digest algorithms are defined in RFC 3230 and RFC 5843, and include SHA-256 and SHA-512. Some of the sup
ported algorithms, including unixsum and MD5 are subject to collisions and are thus not suitable for applications in which collision-resistance is im
portant. <q-value> The quality value to apply to that option. Examples Want-Digest: sha-256 Want-Digest: SHA-512;q=0.3, sha-256;q=1, md5;q=0 Basic operation The sender provides a list of digests which it is prepared to accept, and the server uses o...
...And 2 more matches
Link prefetching FAQ - HTTP
he next document might contain several large images. Some more examples follow: <link rel="prefetch alternate stylesheet" title="Designed for Mozilla" href="mozspecific.css"> <link rel="next" href="2.html"> Are anchor (<a>) tags prefetched? No, only <link> tags with a relation type of next or prefetch are prefetched. However, if there is sufficient interest, we may expand link prefetching sup
port to include prefetching <a> tags, which include a relation type of next or prefetch in the future. Doing so would probably help content providers avoid the problem of stale prefetching links. Is link prefetching standards compliant? Yes, link prefetching as outlined in this document does not violate any existing web standards. In fact, the HTML 4.01 specification explicitly allows for the defini...
...oad, link prefetching will stop and any prefetch hints will be discarded. If a prefetched document is partially downloaded, then the partial document will still be stored in the cache provided the server sent an "Accept-Ranges: bytes" response header. This header is typically generated by webservers when serving up static content. When the user visits a prefetched document for real, the remaining
portion of the document will be fetched using a HTTP byte-range request. What if I'm downloading something in the background? Will link prefetching compete for bandwidth? Yes and no. If you are downloading something using Mozilla, link prefetching will be delayed until any background downloads complete. For example, if you load a bookmark group (which opens several tabs), any prefetch requests initi...
...nk prefetching in Mozilla may compete for bandwidth with the other application. This is a problem that we hope to address in the future by leveraging operating system services to monitor network idle time. Are there any restrictions on what is prefetched? Yes, only http:// (and, starting in Gecko 1.9.1 https://) URLs can be prefetched. Other protocols (such as FTP) do not provide rich enough sup
port for client side caching. Will Mozilla prefetch documents from a different host? Yes. There is no same-origin restriction for link prefetching. Limiting prefetching to only URLs from the the same server would not offer any increased browser security. Do prefetched requests contain a Referer: header? Yes, prefetched requests include a HTTP Referer: header indicating the document from which the ...
...And 2 more matches
Protocol upgrade mechanism - HTTP
The HTTP/1.1 protocol provides a special mechanism that can be used to upgrade an already established connection to a different protocol, using the Upgrade header field. This mechanism is optional; it cannot be used to insist on a protocol change. Implementations can choose not to take advantage of an upgrade even if they sup
port the new protocol, and in practice, this mechanism is used mostly to bootstrap a WebSockets connection. Note also that HTTP/2 explicitly disallows the use of this mechanism; it is specific to HTTP/1.1. Upgrading HTTP/1.1 Connections The Upgrade header field is used by clients to invite the server to switch to one of the listed protocols, in descending preference order. Because Upgrade is a hop-by-hop header, it also needs to be listed in the Connection header fie...
...r. Sec-WebSocket-Extensions Specifies one or more protocol-level WebSocket extensions to ask the server to use. Using more than one Sec-WebSocket-Extension header in a request is permitted; the result is the same as if you included all of the listed extensions in one such header. Sec-WebSocket-Extensions: extensions extensions A comma-separated list of extensions to request (or agree to sup
port). These should be selected from the IANA WebSocket Extension Name Registry. Extensions which take parameters do so by using semicolon delineation. For example: Sec-WebSocket-Extensions: superspeed, colormode; depth=16 Sec-WebSocket-Key Provides information to the server which is needed in order to confirm that the client is entitled to request an upgrade to WebSocket. This header can be used...
...lude in the response a key of its own, which the client will validate before delivering the upgrade response to you. The server's response's Sec-WebSocket-Accept header will have a value computed based upon the specified key. Sec-WebSocket-Protocol The Sec-WebSocket-Protocol header specifies one or more WebSocket protocols that you wish to use, in order of preference. The first one that is sup
ported by the server will be selected and returned by the server in a Sec-WebSocket-Protocol header included in the response. You can use this more than once in the header, as well; the result is the same as if you used a comma-delineated list of subprotocol identifiers in a single header. Sec-WebSocket-Protocol: subprotocols subprotocols A comma-separated list of subprotocol names, in the order ...
...And 2 more matches
HTTP resources and specifications - HTTP
ec Deprecate modification of 'secure' cookies from non-secure origins IETF Draft RFC 2145 Use and Interpretation of HTTP Version Numbers Informational RFC 6585 Additional HTTP Status Codes Proposed Standard RFC 7538 The Hypertext Transfer Protocol Status Code 308 (Permanent Redirect) Proposed Standard RFC 7725 An HTTP Status Code to Re
port Legal Obstacles On the standard track RFC 2397 The "data" URL scheme Proposed Standard RFC 3986 Uniform Resource Identifier (URI): Generic Syntax Internet Standard RFC 5988 Web Linking Defines the Link header Proposed Standard Experimental spec Hypertext Transfer Protocol (HTTP) Keep-Alive Header Informational (Expired) D...
...RFC 2183 Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field Only a subset of syntax of the Content-Disposition header can be used in the context of HTTP messages. Proposed Standard RFC 7239 Forwarded HTTP Extension Proposed Standard RFC 6455 The WebSocket Protocol Proposed Standard RFC 5246 The Trans
port Layer Security (TLS) Protocol Version 1.2 This specification has been modified by subsequent RFCs, but these modifications have no effect on the HTTP protocol. Proposed Standard RFC 8446 The Trans
port Layer Security (TLS) Protocol Version 1.3 Supersedes TLS 1.2. Proposed Standard RFC 2817 Upgrading to TLS Within HTTP/1.1 Proposed Standard RFC 7540...
...rsion 1.3 Supersedes TLS 1.2. Proposed Standard RFC 2817 Upgrading to TLS Within HTTP/1.1 Proposed Standard RFC 7540 Hypertext Transfer Protocol Version 2 (HTTP/2) Proposed Standard RFC 7541 HPACK: Header Compression for HTTP/2 On the standard track RFC 7838 HTTP Alternative Services On the standard track RFC 7301 Trans
port Layer Security (TLS) Application-Layer Protocol Negotiation Extension Used to negotiate HTTP/2 at the trans
port to save an extra request/response round trip. Proposed Standard RFC 6454 The Web Origin Concept Proposed Standard FetchThe definition of 'CORS' in that specification. Cross-Origin Resource Sharing Living Standard RFC 7034 HTTP Header Fiel...
...And 2 more matches
Meta programming - JavaScript
property lookup, assignment, enumeration, function invocation, etc). With the help of these two objects you are able to program at the meta level of JavaScript. Proxies Introduced in ECMAScript 6, Proxy objects allow you to intercept certain operations and to implement custom behaviors. ...
...r.preventExtensions() Object.preventExtensions() Reflect.preventExtensions() Object.preventExtensions(proxy) only returns true if Object.isExtensible(proxy) is false. handler.getOwnPropertyDescriptor() Object.getOwnPropertyDescriptor() Reflect.getOwnPropertyDescriptor() getOwnPropertyDescriptor must return an object or undefined. ...
...s(proxy) only returns true if Object.isExtensible(proxy) is false. handler.getOwnPropertyDescriptor() Object.getOwnPropertyDescriptor() Reflect.getOwnPropertyDescriptor() getOwnPropertyDescriptor must return an object or undefined. A property cannot be re
ported as non-existent if it exists as a non-configurable own property of target. A property cannot be re
ported as non-existent if it exists as an own property of target and target is not extensible. A property cannot be re
ported as existent if it does not exists as an own property of target and target is not extensible. A property cannot be re
ported as non-configurable if it does not exist as an own property of target or if it exists as a configurable own property of target. The result of...
...And 2 more matches
Date - JavaScript
feedback from web developers, but is not yet ready for production use! Description The ECMAScript epoch and timestamps A JavaScript date is fundamentally specified as the number of milliseconds that have elapsed since midnight on January 1, 1970, UTC. This date and time is the same as the UNIX epoch, which is the predominant base value for computer-recorded date and time values. Note: It's im
portant to keep in mind that while the time value at the heart of a Date object is UTC, the basic methods to fetch the date and time or its components all work in the local (i.e. host system) time zone and offset. It should be noted that the maximum Date is not of the same value as the maximum safe integer (Number.MAX_SAFE_INTEGER is 9,007,199,254,740,991). Instead, it is defined in ECMA-262 that a m...
...o universal time. Date.prototype.setUTCMonth() Sets the month for a specified date according to universal time. Date.prototype.setUTCSeconds() Sets the seconds for a specified date according to universal time. Date.prototype.setYear() Sets the year (usually 2-3 digits) for a specified date according to local time. Use setFullYear() instead. Date.prototype.toDateString() Returns the "date"
portion of the Date as a human-readable string like 'Thu Apr 12 2018'. Date.prototype.toISOString() Converts a date to a string following the ISO 8601 Extended Format. Date.prototype.toJSON() Returns a string representing the Date using toISOString(). Intended for use by JSON.stringify(). Date.prototype.toGMTString() Returns a string representing the Date based on the GMT (UTC) time zone. Use to...
...lowing the ISO 8601 Extended Format. Date.prototype.toJSON() Returns a string representing the Date using toISOString(). Intended for use by JSON.stringify(). Date.prototype.toGMTString() Returns a string representing the Date based on the GMT (UTC) time zone. Use toUTCString() instead. Date.prototype.toLocaleDateString() Returns a string with a locality sensitive representation of the date
portion of this date based on system settings. Date.prototype.toLocaleFormat() Converts a date to a string, using a format string. Date.prototype.toLocaleString() Returns a string with a locality-sensitive representation of this date. Overrides the Object.prototype.toLocaleString() method. Date.prototype.toLocaleTimeString() Returns a string with a locality-sensitive representation of the time p...
...And 2 more matches
Intl - JavaScript
anonical locale names. ...
...sup
port using an algorithm specified in the options.localeMatcher property. locales argument The locales argument requests that a particular locale (or a locale from a list of them) be considered for use in a given operation. A single locale may be specified by either an Intl.Locale object or a string that is a Unicode BCP 47 locale identifier. Multiple locales may be specified (and a best-sup
ported locale determined by evaluating each of them in order and comparing against the locales sup
ported by the implementation) by passing an array (or array-like object, with a length property and corresponding indexed elements) whose elements are either Intl.Locale objects or values that convert to Unicode BCP 47 locale identifier strings. If the locales argument is not provided or is undefined, th...
... "Early modern English" dialect (variant) The subtags identifying languages, scripts, regions (including countries), and (rarely used) variants in Unicode BCP 47 locale identifiers are registered in the IANA Language Subtag Registry. This registry is periodically updated over time, and implementations may not always be up to date, so be careful not to rely too much on tags being universally sup
ported. BCP 47 also allows for extensions, each consisting of a single digit or letter (other than "x") and one or more two- to eight-letter or digit tags, all separated by hyphens. JavaScript internationalization functions use the "u" (Unicode) extension, which can be used to request additional customization of Collator, NumberFormat, or DateTimeFormat objects. Examples: "de-DE-u-co-phonebk": Use...
...And 2 more matches
Object.create() - JavaScript
ve code] }" // ...and all the rest of the properties and methods of Object.prototype. As shown, objects modified this way now look very much like ordinary objects. Polyfill This polyfill covers the main use case, which is creating a new object for which the prototype has been chosen but doesn't take the second argument into account. Note that while the setting of null as [[Prototype]] is sup
ported in the real ES5 Object.create, this polyfill cannot sup
port it due to a limitation inherent in versions of ECMAScript lower than 5. if (typeof Object.create !== "function") { Object.create = function (proto, propertiesObject) { if (typeof proto !== 'object' && typeof proto !== 'function') { throw new TypeError('Object prototype may only be an Object: ' + proto); ...
...5. ...
... // Shape - superclass function Shape() { this.x = 0; this.y =...
...And 2 more matches
Object.entries() - JavaScript
The order of the array returned by Object.entries() does not depend on how an object is defined. If there is a need for certain ordering, then the array should be sorted first, like Object.entries(obj).sort((a, b) => b[0].localeCompare(a[0]));. The source for this interactive example is stored in a GitHub repository. ...
...s own enumerable string-keyed property [key, value] pairs. Description Object.entries() returns an array whose elements are arrays corresponding to the enumerable string-keyed property [key, value] pairs found directly upon object. The ordering of the properties is the same as that given by looping over the property values of the object manually. ...
... pairs. Description Object.entries() returns an array whose elements are arrays corresponding to the enumerable string-keyed property [key, value] pairs found directly upon object. The ordering of the properties is the same as that given by looping over the property values of the object manually. ...
...And 2 more matches
String.prototype.replace() - JavaScript
r or the value returned by the specified function. substr A String that is to be replaced by newSubstr. It is treated as a literal string and is not interpreted as a regular expression. Only the first occurrence will be replaced. newSubstr (replacement) The String that replaces the substring specified by the specified regexp or substr parameter. A number of special replacement patterns are sup
ported; see the "Specifying a string as a parameter" section below. function (replacement) A function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. The arguments supplied to this function are described in the "Specifying a function as a parameter" section below. Return value A new string, with some or all matches of a pattern replaced b...
...the calling String object. It simply returns a new string. To perform a global search and replace, include the g switch in the regular expression. Specifying a string as a parameter The replacement string can include the following special replacement patterns: Pattern Inserts $$ Inserts a "$". $& Inserts the matched substring. $` Inserts the
portion of the string that precedes the matched substring. $' Inserts the
portion of the string that follows the matched substring. $n Where n is a positive integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a RegExp object. Note that this is 1-indexed. If a group n is not present (e.g., if group is 3), it will be replaced as a...
...zed submatch string, provided the first argument was a RegExp object. Note that this is 1-indexed. If a group n is not present (e.g., if group is 3), it will be replaced as a literal (e.g., $3). $<Name> Where Name is a capturing group name. If the group is not in the regular expressions (or not in the match), this will resolve to the empty string. Only available in browser versions sup
porting named capturing groups. Specifying a function as a parameter You can specify a function as the second parameter. In this case, the function will be invoked after the match has been performed. The function's result (return value) will be used as the replacement string. (Note: The above-mentioned special replacement patterns do not apply in this case.) Note that the function will be inv...
...And 2 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
Otherwise, the playback will likely be blocked. The exact situations that result in blocking, and the specifics of how sites become whitelisted vary from browser to browser, but the above are good guidelines to go by. For details, see the auto-play policies for Google Chrome and WebKit. Note: Put another way, playback of any media that includes audio is gener...
...lay through to the end of the media without interruption, assuming there are no dramatic changes in network performance or bandwidth. Example: The autoplay attribute An <audio> element using the autoplay attribute might look like this: <audio id="musicplayer" autoplay> <source src="/music/chapter1.mp4"> </audio> Example 2: Detecting autoplay failure If you rely on autoplay for anything im
portant, or if autoplay failure will impact your app in any way, you will probably want to be able to tell when it autoplay didn't begin. Unfortunately, in the case of the autoplay attribute, recognizing whether or not autoplay successfully began is tricky. There's not an event triggered when autoplay fails. Nor is there an exception thrown or a callback you can set up or even a flag on the media elem...
...ay and the user starting playback manually. The play() method The term "autoplay" also refers to scenarios in which a script tries to trigger the playback of media that includes audio, outside the context of handling a user input event. This is done by calling the media element's play() method. Note: It is strongly recommended that you use the autoplay attribute whenever possible, because sup
port for autoplay preferences are more widespread for the autoplay attribute than for other means of playing media automatically. It also lets the browser take responsibility for starting playback, letting it optimize the timing of that taking place. Example: Playing video This simple example plays the first <video> element found in the document. play() won't let the playback begin unless the docum...
...And 2 more matches
Lazy loading - Web Performance
e resources and through multiple strategies. General Code splitting JavaScript, CSS and HTML can be split into smaller chunks. This enables sending the minimal code required to provide value upfront, improving page-load times. The rest can be loaded on demand. Entry point splitting: separates code by entry point(s) in the app Dynamic splitting: separates code where dynamic im
port() statements are used JavaScript Script type module Any script tag with type="module" is treated like a JavaScript module and is deferred by default. CSS By default, CSS is treated as a render blocking resource, so the browser won't render any processed content until the CSSOM is constructed. CSS must be thin, delivered as quickly as possible, and the usage media types and queries a...
...ted like a JavaScript module and is deferred by default. CSS By default, CSS is treated as a render blocking resource, so the browser won't render any processed content until the CSSOM is constructed. CSS must be thin, delivered as quickly as possible, and the usage media types and queries are advised to unblock rendering. <link href="style.css" rel="stylesheet" media="all"> <link href="
portrait.css" rel="stylesheet" media="orientation:
portrait"> <link href="print.css" rel="stylesheet" media="print"> It is possible to perform some CSS optimizations to achieve that. Fonts By default, font requests are delayed until the render tree is constructed, which can result in delayed text rendering. It is possible to override the default behaviour and preload web font resources using <...
...wser to defer loading of images/iframes that are off-screen until the user scrolls near them. ...
...And 2 more matches
viewBox - SVG: Scalable Vector Graphics
The viewBox attribute defines the position and dimension, in user space, of an SVG view
port. The value of the viewBox attribute is a list of four numbers: min-x, min-y, width and height. The numbers separated by whitespace and/or a comma, which specify a rectangle in user space which is mapped to the bounds of the view
port established for the associated SVG element (not the browser view
port). html,body,svg { height:100% } svg:not(:root) { display: inline-block; } <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- with relative unit such as percentage, the visual size of the square looks unchanged regardless of the viewBox --> <rect x="0" y="0" width="100%" height="100%"/> <!-- with a large viewBox the circle looks small as it is using user units for th...
... --> <c...
... --> <circle cx="50%" cy="50%" r="4" fill="white"/> </svg> The exact effect of this attribute is influenced by the preserveAspectRatio attribute. ...
...And 2 more matches
Introduction - SVG: Scalable Vector Graphics
eate an image either by specifying all the lines and shapes necessary, by modifying already existing raster images, or by a combination of both. The image and its components can also be transformed, composited together, or filtered to change their appearance completely. SVG came about in 1999 after several competing formats had been submitted to the W3C and failed to be fully ratified. SVG is sup
ported by all major browsers. A downside is loading SVG can be slow. SVG does offer benefits, some of which include having a DOM interface available for it, and not requiring third-party extensions. Whether or not to use it often depends on your specific use case. Basic ingredients HTML provides elements for defining headers, paragraphs, tables, and so on. In much the same way SVG provides eleme...
...n. In much the same way SVG provides elements for circles, rectangles, and simple and complex curves. A simple SVG document consists of nothing more than the <svg> root element and several basic shapes that build a graphic together. In addition there is the <g> element, which is used to group several basic shapes together. Starting from there, the SVG image can become arbitrarily complex. SVG sup
ports gradients, rotations, filter effects, animations, interactivity with JavaScript, and so on. But all these extra features of the language rely on this relatively small set of elements to define the graphics area. Before you start There are a number of drawing applications available such as Inkscape which are free and use SVG as their native file format. However, this tutorial will rely on the t...
...ly on the trusty XML or text editor (your choice). The idea is to teach the internals of SVG to those who want to understand it, and that is best done by dirtying your hands with a bit of markup. You should note your final goal though. ...
...And 2 more matches
Compiling a New C/C++ Module to WebAssembly - WebAssembly
It is enabled by default in Firefox 52+ and Chrome 57+/latest Opera (you can also run wasm code in Firefox 47+ by enabling the javascript.options.wasm flag in about:config, or Chrome (51+) and Opera (38+) by going to chrome://flags and enabling the Experimental WebAssembly flag.) Note: If you try to open generated HTML file (hello.html) directly from your local hard drive (e.g. fi...
...Let's look at how this works. To start with, save the following code as hello3.c in a new directory: #include <stdio.h> #include <emscripten/emscripten.h> int main(int argc, char ** argv) { printf("Hello World\n"); } #ifdef __cplusplus extern ...
... } #ifdef __cplusplus extern "C" { #endif void EMSCRIPTEN_KEEPALIVE myFunction(int argc, char ** argv) { printf("MyFunction Called\n"); } #ifdef __cplusplus } #endif By default, Emscripten-generated code always just calls the main() function, and other functions are eliminated as dead code. Putting EMSCRIPTEN_KEEPALIVE before a function name stops this from happening. You also need to im
port the emscripten.h library to use EMSCRIPTEN_KEEPALIVE. Note: We are including the #ifdef blocks so that if you are trying to include this in C++ code, the example will still work. Due to C versus C++ name mangling rules, this would otherwise break, but here we are setting it so that it treats it as an external C function if you are using C++. Now add html_template/shell_minimal.html...
...And 2 more matches
Compiling from Rust to WebAssembly - WebAssembly
give a high-level explanation here, and gloss over some details; to learn more about Rust, please check the free online book The Rust Programming Language. Using wasm-bindgen to communicate between Rust and JavaScript The first part looks like this: use wasm_bindgen::prelude::*; Libraries are called "crates" in Rust. Get it? Cargo ships crates. The third line contains a use command, which im
ports code from a library into your code. In this case, we're im
porting everything in the wasm_bindgen::prelude module. We use these features in the next section. Before we move on to the next section, we should talk a bit more about wasm-bindgen. wasm-pack uses wasm-bindgen, another tool, to provide a bridge between the types of JavaScript and Rust. It allows JavaScript to call a Rust API with a st...
...third line is a function signature, written in Rust. It says "the alert function takes one argument, a string named s." As you might suspect, this is the alert function provided by JavaScript. We call this function in the next section. Whenever you want to call JavaScript functions, you can add them to this file, and wasm-bindgen takes care of setting everything up for you. Not everything is sup
ported yet, but we're working on it. Please file bugs if something is missing. Producing Rust functions that JavaScript can call The final part is this one: #[wasm_bindgen] pub fn greet(name: &str) { alert(&format!("Hello, {}!", name)); } Once again, we see the #[wasm_bindgen] attribute. In this case, it's not modifying an extern block, but a fn; this means that we want this Rust function to b...
... }, "dependencies": { "hello-wasm": "^0.1.0" }, "devDependencies": { "webpack": "^4.25.1", "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.10" } } Note that you need to fill in your own username, after the @, in the dependencies section. Next, we need to configure Webpack. ...
...And 2 more matches
2015 MDN Fellowship Program - Archive of obsolete content
lla to (1) build curriculum, code, or likely both; and (2) receive coaching, training and best practices for effectively communicating and educating with technical information. We expect this to be between 5-10 hours of your time per week. Specific projects (we encourage you to target one of these in your application): TestTheWebForward Brief project description Mozilla participates in an im
portant W3C open testing initiative, TestTheWebForward.com. To sup
port our efforts, the Fellow will review various technical specifications to identify gaps between the documentation and current situation and refine existing tests to adapt to this cross-browser test harness. Activities and Deliverables Identify gaps between existing documentation and current development environments. The work would ...
...preferred. Mentor information Nick Desaulniers, Sleeps at Desk. GitHub: nickdesaulniers Twitter: @LostOracle Web App Performance Brief Project Description Web performance is a feature that needs to be considered from serving content to rendering to interactivity. Finding and addressing performance bottlenecks depends on tooling the browser networking and rendering but also, often more im
portant, user perception. Activities and Deliverables Help us develop a curriculum on MDN for teaching developers to master performance tooling and to develop web apps with performance as a feature. Required skills and experience Experienced Web developer with expertise in JavaScript, CSS, HTML. Knowledge of server-side development, caching and network layers preferred. Mentor information Harald...
...your normal workspace. The Fine Print Mozilla will provide coaching, direction and training on teaching best practices. Subject to Mozilla's travel reimbursement policies, Mozilla will cover Fellows travel, room, per diem food costs and visa costs up to $3,000 to attend the Orientation. Fellows are responsible for obtaining their own visas if any are required (Mozilla will provide reasonable sup
porting documentation). The Fellows will meet the stated deliverables of their projects and meet weekly with their mentor, the program lead and their other Fellows. The Fellow will also share the results of their projects at 1-2 events agreed upon by the Fellow and the Program Director, as well as on their personal channels (blog, social media, etc). The Fellow is responsible for any related visas (M...
...l meet the stated deliverables of their projects and meet weekly with their mentor, the program lead and their other Fellows. The Fellow will also share the results of their projects at 1-2 events agreed upon by the Fellow and the Program Director, as well as on their personal channels (blog, social media, etc). The Fellow is responsible for any related visas (Mozilla can provide any necessary sup
porting documentation). Fellows will be required to sign Mozilla's Fellowship agreement in order to participate. If you've read all of this and still have a question, contact Diane Tate at diane@mozilla.com. If you don't have specific questions and just want to introduce yourself, please use the application form. Applications are closed. The application period has ended. Watch this space for inform...
SDK API Lifecycle - Archive of obsolete content
The API lifecycle aims to balance these competing demands. ...
...formal deprecation process. Unstable The API is in the process of settling, but has not yet had sufficient real-world testing to be considered stable. Backwards-compatibility will be maintained if reasonable. If we do have to make backwards-incompatible changes, we will not guarantee the module will go through the formal deprecation process. Stable The module is a fully-sup
ported part of the SDK. We will avoid breaking backwards compatibility unless absolutely necessary. If we do have to make backwards-incompatible changes, we will go through the formal deprecation process. Deprecated We plan to change this module, and backwards compatibility should not be expected. Don't start using it, and plan to migrate away from this module to its replacement. Th...
...oogle group. The deprecation notice should point developers at a migration guide. Migration The deprecation period defaults to 18 weeks (that is, three releases) although in some cases, generally those out of our control, it might be shorter than this. During this time, the module will be in the deprecated state. The SDK team will track usage of deprecated modules on addons.mozilla.org and sup
port developers migrating their code. The SDK will continue to provide warnings: API documentation will inform users that the module is deprecated. Attempts to use a deprecated module at runtime will log an error to the error console. The AMO validator will throw errors when deprecated modules are used, and these add-ons will therefore fail AMO review. All warnings should include links to furth...
... ...
SDK and XUL Comparison - Archive of obsolete content
Advantages of the SDK Simplicity The SDK provides high-level JavaScript APIs to simplify many common tasks in add-on development, and tool sup
port which greatly simplifies the process of developing, testing, and packaging an add-on. Compatibility Although we can't promise we'll never break a High-Level API, maintaining compatibility across Firefox versions is a top priority for us. We've designed the APIs to be forward-compatible with the new multiple process architecture (codenamed Electrolysis) planned for Firefox. We also expect to sup
port both desktop and mobile Firefox using a single edition of the SDK: so you'll be able to write one extension and have it work on both products. Security If they're not careful...
...an write traditional add-ons that are restartless, you can't use XUL overlays in them, so most traditional add-ons would have to be substantially rewritten anyway. User Experience Best Practices The UI components available in the SDK are designed to align with the usability guidelines for Firefox, giving your users a better, more consistent experience. ...
...use XUL overlays in them, so most traditional add-ons would have to be substantially rewritten anyway. User Experience Best Practices The UI components available in the SDK are designed to align with the usability guidelines for Firefox, giving your users a better, more consistent experience. Mobile Sup
port Starting in SDK 1.5, we've added experimental sup
port for developing add-ons on the new native version of Firefox Mobile. See the tutorial on mobile development. Advantages of XUL-based Add-ons User interface flexibility XUL overlays offer a great deal of options for building a UI and integrating it into the browser. Using only the SDK's sup
ported APIs you have much more limited options for your UI. ...
... Low-level APIs and Third-party Modules That's not the whole story. ...
core/heritage - Archive of obsolete content
eeze(Dog.prototype); Object.freeze(Pet.prototype); Note: Also, this is not quite enough as Object.prototype stays mutable & in fact we do little bit more in SDK to address that, but it's not in the scope of this documentation. Doing all of this manually is both tedious and error prone task. That is why SDK provides utility functions to make it more declarative and less verbose. ...
...It's very similar to Object.create, only difference is that second argument is an object containing properties to be defined, instead of property descriptor map. Also, keep in mind that returned object will be frozen. var { extend } = require('sdk/core/heritage'); var base =...
...ument is an object containing properties to be defined, instead of property descriptor map. Also, keep in mind that returned object will be frozen. var { extend } = require('sdk/core/heritage'); var base = { a: 1 }; var derived = extend(base, { b: 2 }); derived.a // => 1 derived.b // => 2 base.isPrototypeOf(derived) // => true mix Module ex
ports mix utility function that is useful for mixing properties of multiple objects into a single one. Function takes arbitrary number of source objects and returns a fresh object that inherits from the same prototype as a first one and implements all own properties of all given objects. If two or more argument objects have own properties with the same name, the property is overridden, with precedence...
...properties with the same name, the property is overridden, with precedence from right to left, implying, that properties of the object on the left are overridden by a same named property of the object on the right. var { mix } = require('sdk/core/heritage'); var object = mix({ a: 1, b: 1 }, { b: 2 }, { c: 3 }); JSON.stringify(object) // => { "a": 1, "b": 2, "c": 3 } obscure Module ex
ports obscure utility function that is useful for defining non-enumerable properties. Function takes an object and returns a new one in return that inherits from the same object as given one and implements all own properties of given object but as non-enumerable ones: var { obscure } = require('api-utils/heritage'); var object = mix({ a: 1 }, obscure({ b: 2 })); Object.getOwnPropertyNames(foo); //...
core/promise - Archive of obsolete content
handler: readAsync(url). then(parse). then(null, function handleParseError(error) { // handle here both `readAsync` and `parse` errors. }); Consuming promises In general, the whole purpose of promises is to avoid the so-called callback spaghetti. As a matter of fact it would be great if we could convert any synchronous functions to asynchronous by making it aware of promises. Module ex
ports promised function to do exactly that: const { promised } = require('sdk/core/promise'); function sum(x, y) { return x + y }; var asyncSum = promised(sum); var c = sum(a, b); var cAsync = asyncSum(aAsync(), bAsync()); promised takes normal function and composes new promise-aware version of it. The composed function may take both normal values and promises as arguments and returns promise. The ...
...ction (reason) { // rejection handler called because `failAsync` promise // was rejected with its reason propagated return reason; }); Making promises Everything above assumes you get a promise from somewhere else. This is the common case, but every once in a while, you will need to create a promise from scratch. Add-on SDK's promise module provides an API for doing that. defer Module ex
ports defer function, which is where all promises ultimately come from. Lets see the implementation of readAsync that we used in several of the examples above: const { defer } = require('sdk/core/promise'); function readAsync(url) { var deferred = defer(); let xhr = new XMLHttpRequest(); xhr.open("GET", url, true); xhr.onload = function() { deferred.resolve(xhr.responseText); }; xhr.
...eject); return deferred.promise; } var tweets = readAsync(url); timeout(tweets, 20).then(function(data) { ui.display(data); }, function() { alert('Network is being too slow, try again later'); }); Alternative promise APIs There may be cases where you will want to provide more than just then method on your promises. In fact some other promise frameworks do that. Such use cases are also sup
ported. Earlier described defer may be passed optional prototype argument, in order to make the returned promise and all the subsequent promises decendents of that prototype: let { promise, resolve } = defer({ get: function get(name) { return this.then(function(value) { return value[name]; }); } }); promise.get('foo').get('bar').then(console.log); resolve({ foo: { bar: 'taram !!' }...
...t use promised function here, as they reject returned promise if any of the given arguments is rejected. If you need to customize your promises even further you may pass resolve a second optional prototype argument that will have same effect as with defer. Treat errors as promises Now that we can create all kinds of eventual values, it's useful to have a way to create eventual errors. Module ex
ports reject to do exactly that. It takes anything as an argument and returns a promise that is rejected with it. const { reject } = require('sdk/core/promise'); var boom = reject(Error('boom!')); future(function() { return Math.random() < 0.5 ? boom : value }) As with the rest of the APIs a reject may be given a second optional prototype argument to customize resulting promise to your needs. ...
remote/child - Archive of obsolete content
Enables an SDK module loaded into a child process to access web content in the child process and communicate with modules in the main process. Usage The sdk/remote/parent module enables SDK code to load modules into child processes. The sdk/remote/child module is for these "child process modules". It provides two main things: access to web content loaded into this child process
port mechanisms to communicate with the main process Interacting with web content To interact with web content, the sdk/remote/child module provides a frames property that's a list of all content frames loaded into this child process. Each frame then has a content property that's the top-level DOM window for the frame, and addEventListener/removeEventListener functions that enable you to listen to DOM event...
...all content frames loaded into this child process. Each frame then has a content property that's the top-level DOM window for the frame, and addEventListener/removeEventListener functions that enable you to listen to DOM events dispatched by the frame. Communicating with the parent process To communicate with the parent process, the process, frames, and frame objects in sdk/remote/child have a
port object that you can use to receive messages from, and send messages to, code in the parent. See the documentation for sdk/remote/parent for more details. Globals Properties process A Process object. frames A Frames object. Process A link to the main process. Properties
port An event emitter that sends and receives events from the main process. isRemote A boolean property indicating ...
...ng frame and any new frames created in the future. This is a shortcut for enumerating existing frames and then listening for attach events. getFrameForWindow Finds the frame for a top level DOM window. addEventListener Adds an event listener for DOM events dispatched to any existing and future frames. removeEventListener Removes an event listener that was previously registered. Properties
port An event emitter that sends and receives events from every frame in this process. Events attach Triggered when a new content frame is opened (for example, the user opened a new tab). The event listener gets a Frame object as an argument. At this point you can't access frame's content yet, but you can add event listeners: const { frames } = require("sdk/remote/child"); frames.on("attach", ...
...ods addEventListener(event, listener, isCapturing) Adds an event listener for DOM events dispatched by this content frame. This can include load and unload events from any content that is loaded in the frame. Listeners are automatically removed when this frame is destroyed. removeEventListener(event, listener, isCapturing) Removes an event listener that was previously registered. Properties
port An event emitter that can be used to send and receive frame specific events to and from code in the main process. content The top level DOM window currently displaying in this frame. isTab A boolean property indicating whether this frame displays in one of the application's main browser tabs. Events detach Event emitted when this frame disconnects from the application. ...
ui/toolbar - Archive of obsolete content
le.log("hiding"); console.log(e); } Parameters options : object Required options: Name Type title string The toolbar's title. This appears as the name of the toolbar in the Firefox "Toolbars" menu. It must be unique. Optional options: Name Type items array Adding buttons to toolbars is only sup
ported from Firefox 30 onwards. In Firefox 29, you can only add frames. An array of items to appear in the toolbar. Each item in items must be an action button, a toggle button, or a frame instance. Buttons each take up a fixed width. If more than one frame is supplied here, the frames each occupy an equal vertical strip of the toolbar. hidden boolean Boolean indicati...
...uire("sdk/ui/frame"); var frame = new Frame({ url: "./frame.html" }); var toolbar = Toolbar({ title: "My toolbar", items: [frame] }); toolbar.on("show", showing); toolbar.on("hide", hiding); function showing(e) { console.log("showing: " + e.title); } function hiding(e) { console.log("hiding: " + e.title); } Parameters event : string The name of the event to listen to. Toolbar sup
ports the following events: attach, detach, show, and hide. listener : function The listener function. This may be passed arguments, depending on the particular event. once(event, listener) Assign a listener to the first occurrence only of an event emitted by the toolbar. Toolbar sup
ports the following events: attach, detach, show, and hide. The listener is automatically removed after the first ti...
...("sdk/ui/frame"); var frame = new Frame({ url: "./frame.html" }); var toolbar = Toolbar({ title: "My toolbar", items: [frame] }); toolbar.once("show", showing); toolbar.once("hide", hiding); function showing(e) { console.log("showing: " + e.title); } function hiding(e) { console.log("hiding: " + e.title); } Parameters event : string The name of the event to listen to. Toolbar sup
ports the following events: attach, detach, show, and hide. listener : function The listener function. This may be passed arguments, depending on the particular event. removeListener(event, listener) Removes an event listener. For example, this code is equivalent to once(): var { Toolbar } = require("sdk/ui/toolbar"); var { Frame } = require("sdk/ui/frame"); var frame = new Frame({ url: "./fra...
...olbar({ title: "My toolbar", items: [frame] }); toolbar.on("show", showing); toolbar.on("hide", hiding); function showing(e) { console.log("showing: " + e.title); toolbar.removeListener("show", showing); } function hiding(e) { console.log("hiding: " + e.title); toolbar.removeListener("hide", hiding); } Parameters event : string The event the listener is listening for. Toolbar sup
ports the following events: attach, detach, show, and hide. listener : function The listener to remove. off(event, listener) This function is an alias for removeListener(). Parameters event : string The event the listener is listening for. Toolbar sup
ports the following events: attach, detach, show, and hide. listener : function The listener to remove. destroy() Destroys the toolbar. After ...
Displaying annotations - Archive of obsolete content
so the add-on can clean it up. ...
...) { if(annotation.url == document.location.toString()) { createAnchor(annotation); } }); $('.annotated').css('border', 'solid 3px yellow'); $('.annotated').bind('mouseenter', function(event) { self.
port.emit('show', $(this).attr('annotation')); event.stopPropagation(); event.preventDefault(); }); $('.annotated').bind('mouseleave', function() { self.
port.emit('hide'); }); }); function createAnchor(annotation) { annotationAnchorAncestor = $('#' + annotation.ancestorId); annotationAnchor = $(annotationAnchorAncestor).parent().find( ':contains(' + annotation.anchorText + ')').last(); $(annotationAnchor).addClass('annotated'); $(annotationAnchor).attr('annotation', annotation.annotationText); } Save this in data as ma...
...This funct...
...This function: initializes the content script instance with the current set of annotations provides a handler for me...
Implementing the widget - Archive of obsolete content
the widget's files here. This hierarchy isn't mandatory; you could just keep them all under data. But it seems tidier this way. The widget's content script The widget's content script just listens for left- and right- mouse clicks and posts the corresponding message to the add-on code: this.addEventListener('click', function(event) { if(event.button == 0 && event.shiftKey == false) self.
port.emit('left-click'); if(event.button == 2 || (event.button == 0 && event.shiftKey == true)) self.
port.emit('right-click'); event.preventDefault(); }, true); Save this in your data/widget directory as widget.js. The widget's icons You can copy the widget's icons from here: Or, if you're feeling creative, you can make your own icons. Either way, save them in your data/widget direct...
...om here: Or, if you're feeling creative, you can make your own icons. Either way, save them in your data/widget directory. ...
...It creates the widget and responds to messag...
...It creates the widget and responds to messages from the widget's content script by toggling its activation state. ...
Storing annotations - Archive of obsolete content
ebar APIs. Now we are able to create annotations, let's store them using the simple-storage module. In this chapter we will cover three topics relating to persistent storage: using simple-storage to persist objects handling exhaustion of the storage quota allocated to you respecting Private Browsing Storing New Annotations In this section we are only touching the main.js file. First, im
port the simple-storage module with a declaration like: var simpleStorage = require('sdk/simple-storage'); In the module scope, initialize an array which will contain the stored annotations: if (!simpleStorage.storage.annotations) simpleStorage.storage.annotations = []; Now we'll add a function to the module scope which deals with a new annotation. The annotation is composed of the text the user...
...t the array of stored annotations. When the panel sends us a URL we use the tabs module to open it in a new tab. ...
...oggle-switch', label: 'Annotator', contentURL: data.url('widget/pencil-off.png'), contentScriptWhen: 'ready', contentScriptFile: data.url('widget/widget.js') }); widget.
port.on('left-click', function() { console.log('activate/deactivate'); widget.contentURL = toggleActivation() ? data.url('widget/pencil-on.png') : data.url('widget/pencil-off.png'); }); widget.
port.on('right-click', function() { console.log('show annotation list'); annotationList.show(); }); This time execute cfx xpi to build the XPI for the add-on, and install it in Firefox. Activate the add-on, add an annotation, and then right-click the widget. You should see something like this: Restart Firefox, right-click the widget again, and check that the annotation is still there. Unt...
...ent emitted by simple-storage and respond to it. Add the following to your add-on's main function: simpleStorage.on("OverQuota", function () { notifications.notify({ title: 'Storage space exceeded', text: 'Removing recent annotations'}); while (simpleStorage.quotaUsage > 1) simpleStorage.storage.annotations.pop(); }); Because we use a notification to alert the user, we need to im
port the notifications module: var notifications = require("sdk/notifications"); (It should be obvious that this is an incredibly unhelpful way to deal with the problem. A real add-on should give the user a chance to choose which data to keep, and prevent the user from adding any more data until the add-on is back under quota.) Respecting Private Browsing Since annotations record the user's browsi...
Display a Popup - Archive of obsolete content
ck: handleClick }); // Show the panel when the user clicks the button. function handleClick(state) { text_entry.show(); } // When the panel is displayed it generated an event called // "show": we will listen for that event and when it happens, // send our own "show" event to the panel's script, so the // script can prepare the panel for display. ...
...n it happens, // send our own "show" event to the panel's script, so the // script can prepare the panel for display. text_entry.on("show", function() { text_entry.
port.emit("show"); }); // Listen for messages called "text-entered" coming from // the content script. The message payload is the text the user // entered. // In this implementation we'll just log the text to the console. text_entry.
port.on("text-entered", function (text) { console.log(text); text_entry.hide(); }); The content script "get-text.js" looks like this: // When the user hits return, send the "text-entered" // message to main.js. // The message payload is the contents of the edit box. var textArea = document.getElementById("edit-box"); textArea.addEventListener('keyup', function onkeyup(event) { if (event.keyCo...
..."get-text.js" looks like this: // When the user hits return, send the "text-entered" // message to main.js. // The message payload is the contents of the edit box. var textArea = document.getElementById("edit-box"); textArea.addEventListener('keyup', function onkeyup(event) { if (event.keyCode == 13) { // Remove the newline. ...
...nt) { if (event.keyCode == 13) { // Remove the newline. text = textArea.value.replace(/(\r\n|\n|\r)/gm,""); self.
port.emit("text-entered", text); textArea.value = ''; } }, false); // Listen for the "show" event being sent from the // main add-on code. It means that the panel's about // to be shown. // // Set the focus to the text area so the user can // just start typing. ...
Modifying the Page Hosted by a Tab - Archive of obsolete content
.activeTab.attach({ contentScriptFile: [self.data.url('first.js'), self.data.url('second.js')] }); } }); Communicating With the Content Scripts Your add-on script and content scripts can't directly access each other's variables or call each other's functions, but they can send each other messages. To send a message from one side to the other, sender calls
port.emit() and receiver listens using
port.on(). In the content script,
port is a property of the global self object. In the add-on script, tab.attach() returns a worker object containing the
port property you use to send messages to the content script. Let's rewrite the example above to pass a message from the add-on to the content script. The content script now needs to look like this: // "...
...s a property of the global self object. In the add-on script, tab.attach() returns a worker object containing the
port property you use to send messages to the content script. Let's rewrite the example above to pass a message from the add-on to the content script. ...
... Injecting CSS Unlike the page-mod API, tab.attach() doesn't enable you to inject CSS directly into a page. To modify the style of a page, you have to use JavaScript, as in the example above. Learning More To learn more about working with tabs in the...
... Injecting CSS Unlike the page-mod API, tab.attach() doesn't enable you to inject CSS directly into a page. ...
JS XPCOM - Archive of obsolete content
r dealing with XPCOM components in JavaScript. Contract IDs A contract ID is a unique name for an XPCOM object. They are used to create or access well-known objects in XPCOM. Interfaces Every XPCOM object implements one or more interfaces. An interface is simply a list of constants and methods that can be called on the object, an example is nsIFile. Every XPCOM object must implement the nsISup
ports interface. Accessing XPCOM components from JavaScript XPCOM objects are either created as new instances (each creation gives you a completely new COM object) or as services (each access gives you the same COM object, often called a singleton). Whether you must create a new instance or access as a service depends on the contract. In order to get an XPCOM object you need to know the contract ID ...
...l the interfaces available on a component, but in most cases you will have to explicitly check for an interface. With the preferences service from the previous example we can do the following: var preferences = preferences.QueryInterface(Components.interfaces.nsIPrefBranch2); This allows you to use the methods in the nsIPrefBranch2 interface. Determining which interfaces an XPCOM component sup
ports To display a list of all interfaces that an XPCOM component sup
ports, do the following: // |c| is the XPCOM component instance for each (i in Components.interfaces) { if (c instanceof i) { alert(i); } } In this context, instanceof is the same as QueryInterface except that it returns false instead of throwing an exception when |c| doesn't sup
port interface |i|. Another difference is that Quer...
...n this context, instanceof is the same as QueryInterface except that it returns false instead of throwing an exception when |c| doesn't sup
port interface |i|. Another difference is that QueryInterface returns an object, where as instanceof returns a boolean. XPCOMUtils - About protocol handler This example implements a quick about protocol handler in JS using XPCOMUtils.jsm. ...
...that it returns false instead of throwing an exception when |c| doesn't sup
port interface |i|. Another difference is that QueryInterface returns an object, where as instanceof returns a boolean. XPCOMUtils - About protocol handler This example implements a quick about protocol handler in JS using XPCOMUtils.jsm. ...
Miscellaneous - Archive of obsolete content
NU/Linux; and "Darwin" on Mac OS X. ...
...ituation by providing a simple method to restart the application. Example for Firefox: Services.startup.quit(Services.startup.eForceQuit|Services.startup.eRestart); Mouse and keyboard Detecting mouse wheel events When scrolling the mouse wheel on an element, the DOMMouseScroll event fires. event.detail contains the number of lines to scroll. This event is Mozilla-only; other browsers may sup
port window.onmousewheel. <div id="scrollArea" style="overflow: scroll; height: 6em; width: 10em;"> This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. T...
...unner application, follow those steps: First, put the certificates you want to ship into the content/certs folder of your application. Then create a XPCOM service that adds the certificates inside that directory to the certs database on application startup. ...
.../random-generator;1']; var bytebucket = prng.getService(Components.interfaces.nsIRandomGenerator).generateRandomBytes(NOB, buffer); Detecting full screen mode on/off It works for that global 'window' object at least. window.addEventListener('fullscreen', function(){ alert('fullscreen mode on or off') }, false) Getting addon install path First one using addon manager: Components.utils.im
port('resource://gre/modules/AddonManager.jsm'); AddonManager.getAddonById('example@addon', function(addon) { let path = addon.getResourceURI().path; // something like /home/username/.... }); example@addon is extension id. Another one is to utilize bootstrap.js startup function data argument: function startup(data, reason) { // some code ... yourModule(data.installPath.path); // some cod...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
to overlook is the fact that the toolbarpalette element is outside of the window element. If you put the toolbarpalette element inside the window element in your overlay, some weird errors will begin to happen. Always set the label and tooltiptext attributes of a toolbarbutton. In the case of a toolbaritem element (discussed later), use the title attribute instead of label. Tooltips are very im
portant for users that want to know what a button does before clicking it. Setting the image for a toolbar button is done with CSS: #xulschoolhello-hello-world-button { list-style-image: url("chrome://xulschoolhello/skin/hello-world.png"); } It's not really that simple to set the image for a toolbar button, because we need to consider the appearance of the button on different systems, and also ...
...d.png"); } It's not really that simple to set the image for a toolbar button, because we need to consider the appearance of the button on different systems, and also consider the different button states, but we'll get into that further ahead. The CSS file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file. This is very im
portant because the toolbar customization dialog won't work correctly without this. The way to include the file in the manifest is to add this line: style chrome://global/content/customizeToolbar.xul chrome://xulschoolhello/skin/toolbar.css If you are using XBL bindings (explained way ahead) for your toolbar items, you'll have to include the CSS files for those as well, each in a new line like the ...
...nd annoy users. Use custom toolbar items sparingly. Toolbar button icons Creating the icons for toolbar buttons is one of the most difficult tasks when making extensions. It is not too hard to come up with some graphics for the buttons, but it can be hard to make them blend in with Firefox on all operating systems. The way icons are handled in Firefox changed considerably after Firefox 4, so sup
porting older versions is not mentioned here (you can check this document's change history for older revisions, though). These are the current icon sets for Firefox: Windows Mac OS X (Lion and above) Mac OS X Linux (Gnome) Note: the images above are probably not distributable under the same CC license, unlike the rest of this material. Here are the key similarities and differences b...
...fferent toolbars. You should also test that the Reset to Defaults button works correctly. Adding elements to your toolbar that are not toolbarbutton or toolbaritem will cause it to fail. Make sure your icons look OK while the Customize Dialog is open, and after clicking on the OK button. If you use XBL bindings, make sure everything works normally after customizing toolbars. All of this is very im
portant to test because, when the dialog is opened, Firefox changes the DOM of the toolbar, adding wrapper elements that allow the customization. This tends to break very specific CSS, and XBL bindings lose their internal state when moved around the DOM. Adding toolbar buttons to existing toolbars Finally, there is the very common case where you just want to add one button to the main toolbar. In th...
The Box Model - Archive of obsolete content
The XUL box model is a significant improvement over the HTML layout model, which is mostly vertical. ...
...minimum size, then it could be the label determining its size, while the other button would flex taking the rest of the room. Now, if you want a different size distribution in flexible elements, you can use flexibility values higher than 1. In this case, the "Cat" button has a flex value of 3, while the "Parrot" button still has a flex value of 1. The "Cat" button is now larger in a 3 to 1 pro
portion. Note that, again, this can depend on the contents of the elements, in this case, the labels and paddings in the buttons. If the label of the "Parrot" button was something much longer, the size ratio would not be kept. You can have even more control over the size of flexible elements using the minwidth, maxwidth, minheight and maxheight attributes, or their CSS counterparts: min-width, max-wi...
...r CSS counterparts: min-width, max-width, min-height and max-height. The latter are recommended to keep style code in the skin section of the chrome. As their names should make clear, you can control the flexibility boundaries of elements, thus preventing them from growing or shrinking too much. All CSS properties involving lengths should be handled with caution. We recommended that you use pro
portional units (em, %) instead of absolute units (px) whenever possible. Using the former allows the UI to scale pro
portionately depending on font size settings, which are often changed by users with accessibility limitations. A common exception to this rule is when your CSS is directly related to images, where you'll usually handle measurements in pixels (px). Also, just like in HTML, you can con...
...ents both horizontally and vertically. You can either use the align and pack attributes, or the -moz-box-align and -moz-box-pack CSS properties. Packing determines the positioning of the child elements in the direction of the container's orientation. Alignment determines the positioning in the other direction. So, in a flexed hbox, having center alignment and end packing results in this: One im
portant thing to notice is that aligment and flexibility can't be mixed in some cases. If you add flexibility to one of the buttons, the packing will no longer be useful, but the alignment still makes a difference. It also wouldn't make sense to use flexibility or packing in the hbox if it didn't have any available horizontal space; the container element needs to either be flexible itself, or have a f...
User Notifications and Alerts - Archive of obsolete content
Using modal dialogs and alerts is usually a bad idea. They interrupt the user's workflow, demanding immediate action before anything else can be done. Users will find them annoying and probably will learn to dismiss them as quickly as possible without even reading what they have to say. Or they will just get rid of your add-on. This section lists a few alternatives that give you the possibility of notifying the user and requesting action without being too annoying. The notificationbox element You have probably seen these before. ...
...me://xulschoolhello/skin/hello-notification.png", title, message, true, "", this, "XULSchool Hello Message"); We pass this as an argument, assuming that this is an object that implements nsIObserver. We do this when we need to handle clicks on the alert box. The image can have any size, but it is recommended that you use a medium, fixed size. The main disadvantage of using alerts is that sup
port for the Alerts Service is not guaranteed for all platforms and Firefox versions. Sup
port for Windows has existed since Firefox 2. For Mac OS X, sup
port was added on Firefox 3, and only through a third-party tool called Growl. On Linux systems, we have confirmed that it works on Firefox 3 on Ubuntu Linux, but we haven't tested all distributions and Firefox versions. Because of the inconsistent su...
... Custom alerts Creating custom solutions for alerting the user is not complicated, given the advantages of XUL overlays and CSS positioning. ...
... floating XUL on the Mac OS version of Firefox 2 doesn't work. You'll end up with a box with a white background you can't get rid of . On Firefox 3 and above, this seems to have been corrected, using the panel element. The bottom right corner of the browser is the recommended location for an alert, because it normally doesn't block the part of the content where the user is reading, or the most im
portant parts of page content, such as menus and titles. Remember this is not a recommended practice. Imagine having multiple extensions notifying you in their own custom way, probably even at the same time! This is not good from a UI perspective, so you consider custom alerts the very last resort. << PreviousNext >> This tutorial was kindly donated to Mozilla by Appcoast. ...
Tabbed browser - Archive of obsolete content
iven is for a menuitem, but will work equally well for other XUL elements. This will only work in an overlay of browser.xul. XUL: <menuitem oncommand="myExtension.foo(event)" onclick="checkForMiddleClick(this, event)" label="Click me"/> JS: var myExtension = { foo: function(event) { openUILink("http://www.example.com", event, false, true); } } Opening a URL in an on demand tab Cu.im
port("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyServiceGetter(this, "gSessionStore", "@mozilla.org/browser/sessionstore;1", "nsISessionStore"); // Create new tab, but don't load the content. var url = "https://developer.mozilla.org"; var tab = gBrowser.addTab(null, {relatedToCurrent: true}); gSessionStore.setTa...
...ext of a browser.xul overlay. Finally, use gBrowser.browsers.length to get the number of browsers and gBrowser.getBrowserAtIndex() to get a <browser/> element. For example: var num = gBrowser.browsers.length; for (var i = 0; i < num; i++) { var b = gBrowser.getBrowserAtIndex(i); try { dump(b.currentURI.spec); // dump URLs of all open tabs to console } catch(e) { Components.utils.re
portError(e); } } To learn what methods are available for <browser/> and <tabbrowser/> elements, use DOM Inspector or look in browser.xml for corresponding XBL bindings (or just look at the current reference pages on browser and tabbrowser. Getting the browser that fires the http-on-modify-request notification See the Observer notifications page for information on http-on-* notifications. Note t...
...indow); return gBrowser.getBrowserForDocument(domWin.top.document); } catch (e) { dump(e + "\n"); return null; } } Getting the browser that fires the http-on-modify-request notification (example code updated for loadContext) Here an example of the previous section is shown. The previous section was left intact so people can see the old way of doing things. ...
...wser is same as browser var above //can stylize tab like aTab.style.backgroundColor = 'blue'; //can stylize the tab like aTab.style.fontColor = 'red'; var browser = aTab.linkedBrowser; //this is the browser within the tab //this is what the example in the previous section gives //end getting other useful stuff } else { Components.utils.re
portError('EXCEPTION: Load Context Not Found!!'); //this is likely no big deal as the channel proably has no associated window, ie: the channel was loading some resource. but if its an ajax call you may end up here } } } }; Here's a cleaner example of the same thing: Cu.im
port('resource://gre/modules/Services.jsm'); var httpRequestObserver = { observe: f...
Updating addons broken by private browsing changes - Archive of obsolete content
a change described here and you are having trouble updating it. ...
... IDLs nsITransferable: See Using the clipboard for information about the new init method. imgICache: This must no longer be obtained as a service. See the imgICache article for more information. mozIAsyncFavicons/nsIFaviconService: setAndFetch...
...wnloadManager now has activePrivateDownloads, activePrivateDownloadCount, and privateDBConnection members to complement the existing public ones. nsIDownloadManager's addListener method is deprecated. addPrivacyAwareListener should be used instead, or no notifications will be received for private downloads. There is a new download-manager-remove-download-guid notification, which passes an nsISup
portsCString subject for the GUID or null. nsIHttpAuthManager: setAuthIdentity and getAuthIdentity now take an optional boolean parameter to indicate whether the identity is classified as private. nsIStrictTrans
portSecurityService: processStsHeader, removeStsState, isStsHost, and isStsUri now take a flags parameter that understands nsISocketProvider.NO_PERMANENT_STORAGE or nothing. nsIPrivat...
...f Firefox 21. nsIRecentBadCertsService: This is no longer a global service, and has been renamed to nsIRecentBadCerts. To obtain this, acquire the nsIX509CertDB service, and use the new getRecentBadCerts method, passing a boolean indicating whether the private bad certificates or public ones are desired. Observer notifications None of the ones listed above will be sent as of Firefox 20. The sup
porting per-window private browsing article explains further about the equivalent notifications, which are all backwards compatible through to Firefox 12 (and are sent side-by-side with the global private browsing notifications in older versions). Chrome APIs OpenBrowserWindow: Takes an optional parameter to indicate desired properties of the window. Passing {private: true} will cause a private w...
Add-ons - Archive of obsolete content
Archived add-ons documentation. Add-on SDK Using the Add-on SDK, you can create Firefox add-ons. You can use various standard Web technologies: JavaScript, HTML, and CSS, to create the add-ons. The SDK includes JavaScript APIs, which you can use to create add-ons and tools for creating, running, testing, and packaging add-ons. bookmarks.ex
port() Ex
ports bookmarks to an HTML bookmark file. bookmarks.im
port() Im
ports bookmarks from an HTML bookmark file. Bootstrapped extensions browser.bookmarks.ex
port( function() {...} // optional function ) Code snippets ... Creating custom Firefox extensions with the Mozilla build system There is a wealth of material on creating extensions for Firefox. All of these documents currently assume, however, that you are developing your extension usin...
...re already familiar with Building an Extension. Extension Packaging Extensions are packaged in a form of Installable Bundle which can be downloaded and installed by a user, or provided pre-packaged with an application or by an external program. Extensions use a directory structure which can provide chrome, components, and other files to extend the functionality of an XUL program. Extensions sup
port in SeaMonkey 2 Starting with SeaMonkey 2 Alpha 1 SeaMonkey sup
ports toolkit/-style extensions. These type of extensions have many advantages for both users and developers compared to the old xpinstall/-style extensions. Firefox addons developer guide The original document is in Japanese and distributed via the xuldev.org website. So there may be still some reference to the xuldev website (we w...
...d to the old xpinstall/-style extensions. Firefox addons developer guide The original document is in Japanese and distributed via the xuldev.org website. So there may be still some reference to the xuldev website (we want to host source code on MDC, not on xuldev), and to Japanese things (like some specific locales, which have been translated to French since non-latin characters are not well sup
ported). Hotfix Extension This document has been moved to the Add-ons wiki. How to convert an overlay extension to restartless First off, what kind of add-on are we talking about here? Well, XUL overlays and windows, JSM files, chrome & resource mappings with localization, default preferences, but no XPCOM components of your own. Some of that will have to be replaced and the rest will need to be l...
...ved to the Add-ons wiki. How to convert an overlay extension to restartless First off, what kind of add-on are we talking about here? Well, XUL overlays and windows, JSM files, chrome & resource mappings with localization, default preferences, but no XPCOM components of your own. Some of that will have to be replaced and the rest will need to be loaded differently. Inline options Firefox 7 sup
ports a new syntax for defining extensions' preferences for both bootstrapped and traditional extensions. The user interface for the preferences defined with this new syntax appears in the extension's detail view in the Add-on Manager. This functionality originally appeared in Firefox mobile and is now available in Firefox on the desktop as well. Install Manifests An Install Manifest is the file an ...
Underscores in class and ID Names - Archive of obsolete content
Summary: The use of the underscore character in CSS can lead to major display problems in multiple browsers. Learn why this is so, and how to keep your sites from being bitten by this problem. This technical note examines the use of underscores in CSS, and why they should be generally avoided in most circumstances. It is a fairly common practice in many programming languages to use the underscore character (_) in the place of a "space" in variable and function names. ...
...of this writing, technically permitted in class and ID names, there are many historical and practical reasons why they should be avoided. ...
... Netscape 6.x permits underscores and escaped underscores. ...
...res, and so were both non-conformant on this point until the errata was published. The same is true of IE4.x and 5.x for Macintosh. Internet Explorer 6 for Windows, published after the errata, permits underscores and escaped underscores. Opera 3.x through 5.x does not recognize underscores or escaped underscores, and so acts the same as Navigator 4.x in this regard. Recommendation Because sup
port is so inconsistent between current browsers as well as older releases, authors are strongly advised to avoid using underscores in class and ID names. A common substitute is the hyphen character (-), as in: p.urgent-note {color: maroon;} Many authors choose instead to use Camel Case names such as this: p.urgentNote {color: maroon;} If the initial-cap approach is used, however, remember that cl...
Creating a status bar extension - Archive of obsolete content
existing Building an Extension article, you're right. However, this sample will be expanded upon in later articles in the series. Download the sample You can download a copy of this sample to look over -- or to use as the basis for your own extension. Download the sample The install manifest The install manifest, install.rdf, is a text file containing information that tells the host application im
portant information about the extension. <?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>status-bar-sample-1@example.com</em:id> <em:version>1.0</em:version> <em:type>2</em:type> <!-- Front End Metadata --> <em:name>Status Bar Sample 1</e...
...Extension identification information Certain information is needed so Firefox...
...on information It's also necessary to include information that identifies the application or applications in which your extension is designed to run. Although this sample extension only works in Firefox, it's entirely possible to create extensions that work in multiple XUL-based applications. It's also necessary to indicate what versions of the target application or applications your extension sup
ports. If it won't work in older versions of Firefox, or hasn't been tested on newer versions, you can restrict the extension so that only sup
ported versions of the target application will attempt to use it. The target application information is contained within the em:targetApplication Description block. Property name Description id An ID indicating the target application. "{e...
...to use it. The target application information is contained within the em:targetApplication Description block. Property name Description id An ID indicating the target application. "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" is a GUID that uniquely identifies Firefox as the target. minVersion The oldest version of the target application on which the extension is sup
ported. maxVersion The most recent version of the target application on which the extension is known to work. For details on the format of an install manifest, read the Install Manifests section. The chrome manifest The chrome manifest is a file that tells the target application where to look for the chrome package for your extension. The chrome is the set of user interface elements ...
Settings - Archive of obsolete content
Note: This page documents the Jetpack Prototype, which is no longer under active development. Read the experiment re
port for what we learned from it and the blog post announcing the first SDK release for what we're up to next! The jetpack.storage.settings namespace allows jetpacks to specify user-configurable settings. Jetpack will automatically generate a user interface based on the specification. The settings persist across browser sessions and are stored using the Jetpack simple storage API. Settings are private to each jetpack and are not accessible by other jetpacks. Because it is still under development, the API currently lives in the future and must be im
ported before it is used: jetpack.future.im
port("storage.settings"); Specifying settings in a manifest To specify its settin...
...The value of this variable must be an object that contains a property named settings. The value of the settings property is an array of objects representing the settings to expose to users. ...
...With the above manifest the following stored properties are available in the jetpack's code: jetpack.storage.settings.twitter.username jetpack.storage.settings.twitter.password jetpack.storage.settings.facebook.username jetpack.s...
...With the above manifest the following stored properties are available in the jetpack's code: jetpack.storage.settings.twitter.username jetpack.storage.settings.twitter.password jetpack.storage.settings.facebook.username jetpack.storage.settings.facebook.password jetpack.stora...
Simple Storage - Archive of obsolete content
It's a simple key-based persistent object data store. Simple storage is really simple. jetpack.storage.simple is a single, persistent JavaScript object private to each jetpack. For the most part this object is like any other JavaScript object, and a jetpack can set whatever properties it wants on it. ...
...e.open(), although the data comes loaded automatically. Don't abuse these methods, since they cause Firefox -- all of Firefox -- to drop what it's doing to make a trip to the disk. If you call them too often, Firefox may become unresponsive for some of your users. Unless you are doing something strange, let Jetpack flush your data for you. The namespace currently lives in the future and must be im
ported before it is used: jetpack.future.im
port("storage.simple"); Methods sync()As described above, the jetpack.storage.simple object is automatically written to disk, but a feature may force flush by calling jetpack.storage.simple.sync(). Don't abuse this method. open()As described above, the jetpack.storage.simple object is automatically populated when a feature is loaded, but a feature may force ...
...k, but a feature may force flush by calling jetpack.storage.simple.sync(). Don't abuse this method. open()As described above, the jetpack.storage.simple object is automatically populated when a feature is loaded, but a feature may force the object to read from disk by calling jetpack.storage.simple.open(). Don't abuse this method. ...
...ust a normal JavaScript object. They could have simply used jetpack.storage.simple directly. Here's a complete real-world example. It's a simple note-taking jetpack. Select some text on the page, right-click, and select Note. The text will be remembered across browser restarts as a note. All notes are shown in the Tools menu. You can install this example from the Jetpack Gallery. jetpack.future.im
port("menu");jetpack.future.im
port("selection");jetpack.future.im
port("storage.simple");// Create the persistent notes array if it doesn't already exist.jetpack.storage.simple.notes = jetpack.storage.simple.notes || [];var notes = jetpack.storage.simple.notes;// Updates the Jetpack menu with the current notes. We'll add a Notes menu with// a submenu, which lists all the notes. If there are no notes,...
Extensions - Archive of obsolete content
Prism has sup
port for extensions. Extensions are built using the same methods as any Mozilla-based extension. Since Prism is a totally separate host application, there are some Prism-specific issues that you need to handle when creating your extension. Most notably, the Prism application ID and the differences in the user interface (UI). Extensions typically overlay the host application's UI to add toolbar buttons, menus and other features. One of Prism's features is an extreme lack of UI elements, which means that trying to use the same overlays in Firefox and Prism is really not possible. The Basics In order to install an extension in Prism, you need to follow the guidelines for building a Mozilla-based extension. ...
...e (UI). Extensions typically overlay the host application's UI to add toolbar buttons, menus and other features. One of Prism's features is an extreme lack of UI elements, which means that trying to use the same overlays in Firefox and Prism is really not possible. The Basics In order to install an extension in Prism, you need to follow the guidelines for building a Mozilla-based extension. To sup
port Prism specifically, you'll need to add Prism to the list of target applications in the extension's install.rdf file. The code snippet will look something like this: <em:targetApplication> <!- Prism -> <Description> <em:id>prism@developer.mozilla.org</em:id> <em:minVersion>0.8</em:minVersion> <em:maxVersion>1.0.0.*</em:maxVersion> </Description> </em:targetApplication> In additi...
...cription> </em:targetApplication> In addition to the install manifest changes, you may want to expose your extension into the Prism UI. Prism does have a few UI elements, such as a toolbox, toolbar, menubar, popup menus, statusbar and a container for the browser. You can use these UI elements to merge in your extension UI. See the Prism main window XUL file for the actual structure: webrunner.xul
Porting an Existing Extension Since there aren't many extensions designed explicitly for Prism, you may need to
port your favorite extensions. This usually means extracting and editing the install.rdf file to add Prism as a target application. You may also need to modify the extension's overlay to be able to work with the Prism UI. Many archive tools, like 7zip, can edit and update a file in the archi...
...Using this dialog, a user just launches a webapp and opens the Add-ons dialog. Then install the extension by either dragging and dropping the extension onto the dialog, or by clicking the "Install..." button, navigating to the extension and selecting it for installation. ...
RDF Datasource How-To - Archive of obsolete content
P protocol to translate your mail server's inbox as a collection of statements like "message number 126's subject is 'make money fast on the Internet'" and "message number 126 was sent by 'spammer128@hotmail.com'". An "address book" datasource could translate a database file into statements like "spammer128@hotmail.com's real name is 'Billy Dumple'" and "spammer128@hotmail.com is considered an 'im
portant friend'." Statements from one datasource can be combined with statements from another datasource using a composite datasource. By combining statements from the IMAP datasource and address book datasource, above, we'd be able to identify the sender of "message 126" as an "im
portant friend". Deciding on a vocabulary The vocabulary is the set of properties that you will use to express relationshi...
...OM ProgID in order to be instantiated from the repository. Constructing a DLL for a component is beyond the scope of this document; the reader is referred to the RDF factory as a guideline. Registering an RDF datasource is fairly simple: in the DLL's NSRegisterSelf() method, you simply call the component manager's RegisterComponent() method: extern "C" PR_IMPLEMENT(nsresult) NSRegisterSelf(nsISup
ports* aServiceManager, const char* aPath) { nsresult rv; ... // Assume compMgr refers to the component manager rv = compMgr->RegisterComponent(kMyDataSourceCID, "My Data Source", NS_RDF_DATASOURCE_PROGID_PREFIX "my-datasource", aPath, PR_TRUE, PR_TRUE); ... } Replace kMyDataSourceCID with your datasource's CLSID. Replace "My Data Source" with a desc...
...rce" with a value appropriate for your datasource. This value, when prefixed with "rdf:", is a datasource identifier, and may be used with nsIRDFService::GetDataSource() to retrieve your datasource from the RDF service. For example, the above datasource would be accessable as follows: nsIRDFService* rdf; rv = nsServiceManager::GetService(kRDFServiceCID, kIRDFServiceIID, (nsISup
ports**) &rdf); if (NS_SUCCEEDED(rv)) { nsIRDFDataSource* myDataSource; rv = rdf->GetDataSource("rdf:my-datasource", &myDataSource); if (NS_SUCCEEDED(rv)) { // ...do something to myDataSource here... NS_RELEASE(myDataSource); } nsServiceManager::ReleaseService(kRDFServiceCID, rdf); } Displaying RDF as content Now that you've gone through all this...
...This is a space-separated list that may include internal XPCOM datasource "identifiers" (as described above) and URIs for local or remote RDF/XML documents. Each datasource that is listed will be loaded, and the assertions contained in the datasource will be made available to the tree control for display...
Space Manager Detailed Design - Archive of obsolete content
Overview The Space Manager and related classes and structures are an im
portant of the Gecko Layout system, specifically Block Layout. See the High Level Design document for an overview of the Space Manager, and as an introduction to the classes, structures and algorithms container in this, the Detailed Design Document. nsSpaceManager The Space Manager is the central class is a group of classes that manage the occupied and available space that exists in horizontal bands across a canvas. The primary goal of the Space Manager is to provide information about those bands of space to sup
port the CSS notion of floated elements. ...
...ctures and algorithms container in this, the Detailed Design Document. nsSpaceManager The Space Manager is the central class is a group of classes that manage the occupied and available space that exists in horizontal bands across a canvas. The primary goal of the Space Manager is to provide information about those bands of space to sup
port the CSS notion of floated elements. ...
...It is not a general purpose class, and is not intended to be subclasses . Here is the class declaration, taken from the source file as of 01.08.02 /** * Class for dealing with bands of available space. ...
...entation }; Public API Life Cycle The Constructor requires a Presentation Shell, used for arena allocations mostly, and a frame that this Space Manager is rooted on. The coordinate space of this Space Manager is relative to the frame passed in to the constructor. nsSpaceManager(nsIPresShell* aPresShell, nsIFrame* aFrame); ~nsSpaceManager(); Operators 'new' and 'delete' are overridden to sup
port a recycler. Space Manager instances come and go pretty frequently, and this recycler prevents excessive heap allocations and the performance penalties associated with it. The #define NS_SPACE_MANAGER_CACHE_SIZE is used to control the number of Space Manager instances that can be present in the recycler, currently 4. If more than NS_SPACE_MANAGER_CACHE_SIZE are allocated at a time,then standard al...
File object - Archive of obsolete content
pipelines. Creating a pipeline involves spawning arbitrary processes; this means that giving a script access to the File object is exactly equivalent to giving the script access to the UNIX shell or DOS command interpreter. Filesystem access is implemented with NSPR I/O Functions, and as such shares many semantics. Pipelines are implemented with the popen() system call. There is currently no sup
port for p2open()-like semantics. Here is the original proposal for this object, and a status update from December 1998: http://www.mozilla.org/js/js-file-object.html Created By The File constructor: new File(); new File(filename); Parameters filename Name of the file we want to work with. Directories and pipelines are considered special files. Pipelines either begin or end with the pipe (|) ...
...constructed, leading and trailing spaces are removed from the filename, so new File(" abc.txt ") just creates a file called abc.txt. Filenames starting and ending with the pipe symbol (|) are interpreted as pipes. Readable pipelines (i.e. pipe to programs generating output on stdout) begin with the pipe symbol; writeable pipelines end with the pipe symbol. Bi-directional pipelines are not sup
ported. Properties Static Properties File.input A File object that represents the standard input (stdin). File.currentDir A File object that represents the standard output (stdout). File.currentDir A File object that represents the standard error (stderr). File.currentDir A File object referring to the current directory; this property may be set. File.separator The system name separator ...
...CII might imply ASCIIZ) File.mode A string describing the mode used to open the file. File.creationTime A Date object representing the time when the file was created. File.lastModified A Date object representing the time when the file was last modified. File.size The length of the file in bytes; undefined(?) for directories and pipelines. File.hasRandomAccess True if random access is sup
ported for this file. Binary (UTF-8) files and pipelines (including File.intput) do not sup
port random access. File.hasAutoFlush Force a flush on each line break? (readonly) File.position The file position. Writing to the property moves the file pointer. File.isNative True if the file is backed by a native stdio FILE stream. (i.e. file.input, file.output, file.error or a pipeline) Methods F...
....txt"); file.open("write,create", "text"); file.writeln("The quick brown fox jumped over the lazy dogs"); file.close(); Example: Reading from a file var data; var file = new File("myfile.txt"); file.open("read", "text"); data = file.readln(); file.close(); Example: Sending mail through a pipeline var mail = new File("|/usr/lib/sendmail foo@bar.com"); mail.writeln("I love JavaScript.\nPipe sup
port is especially good!"); mail.close(); ...
Table Layout Strategy - Archive of obsolete content
over a large number of subroutines as shown in the chart below. The words The table layout is width oriented and knows the following widths: Minimum content width - min the minimum width that is required to layout the content, all linebreak possibilities will be used percent width - pct the cell width specified in percent, fixed width - fix the cell width specified as px, mm etc., pro
portional width - prop the cell width specified via 1*, 2* etc. and the desired width - des the width the content could fill without any linebreaks. Cells can be members of colspans. These colspans have to distribute their space to the columns they include. This information is hold in the adjusted width's. Due to this there are 10 width informations for every column. MIN_CON DES_CON FIX MIN...
...ine MIN_ADJ 3 // minimum width + padding due to col spans #define DES_ADJ 4 // desired width + padding due to col spans #define FIX_ADJ 5 // fixed width + padding due to col spans #define PCT 6 // percent width of cell or col #define PCT_ADJ 7 // percent width of cell or col from percent colspan #define MIN_PRO 8 // desired width due to pro
portional <col>s or cols attribute #define FINAL 9 // width after the table has been balanced, considering all of the others The priority of allocations for columns is as follows: max(MIN_CON, MIN_ADJ) max (PCT, PCT_ADJ) FIX FIX_ADJ max(DES_CON, DES_ADJ), but use MIN_PRO if present for a fixed width table, the column may get more space if the sum of the col allocations is insufficie...
...d>foo</td><td width="100%">bar</td></tr> </tbody> </table> The conflict free solution, the column should have the minimum width. So we specify it (this breaks in some other browsers) <col width="0*"><col><tbody></tbody>foobar <table border width="200px"> <col width="0*"><col> <tbody> <tr><td>foo</td><td>bar</td></tr> </tbody> </table> This shrink wrapping width has usually the suffix 0Pro
portional Effective columns <tbody></tbody>foobarbazzap <table width="200px" border> <tbody> <tr><td>foo</td><td colspan="2" width="120px">bar</td></tr> <tr><td>baz</td><td>zap</td></tr> </tbody> </table> The colspan here is bogus, so the third column should not get any width. One would expect the first column to be 80 px and the second to be 120 px . The advantage of this limiting to numEff...
...dth="40%"><col width="80%"> <tbody> <tr><td>foo</td><td>bar</td></tr> </tbody> </table> The algorithm tries to satisfy the requirements on a first come first serve base. The second table has <col width="40%"><col>. IE and Opera handle this pretty much the same as mozilla. Original Document Information Author(s): Bernd Mielke Last Updated Date: September 27, 2003 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Creating XPI Installer Modules - Archive of obsolete content
.txt messenger/ messenger.jar ... In addition to these JAR files, there are also several new RDF files. These new files represent a redesign of the way that the Mozilla UI is packaged and installed. Though the chrome directory still includes subdirectories of uncompressed files by default, a new way to aggregate and distribute the files has improved performance, made the UI components more
portable and easier to install, and made the installation process a much easier one. However, this new arrangement does not make things much easier for the web or user interface developer. The relatively simple process of finding the appropriate resources (i.e. XUL, JavaScript, or CSS files) in the chrome subdirectories and editing them with a text editor has been replaced by something a lot of develo...
...The JavaScript file barley.js contains a single function, bar(), defined as follows: function bar() { alert("aphids"); } If you want to use the same GIF image that is used in the Barl...
...<script src="barley.js"/> <image src="barley.gif" /> <box orient="horizontal" autostretch="never"> <button label="barley corn" /> <button label="show aphids" oncommand="bar();" /> </box> </window> The other files that the window im
ports are defined in dark blue. Note that the stylesheet processing instruction at the top of the XUL file does not refer to any new skin, but im
ports communicator.css to make use of that skin's basic widget styles. The JavaScript file barley.js contains a single function, bar(), defined as follows: function bar() { alert("aphids"); } If you want to use the same GIF image that is used in the Barley package, it can be grabbed from here. While you are developing these resources and before you have made them a package of their own, you can t...
...ckage includes its own theme, localization packs, or other components it's convenient (but not necessary to create a subdirectory structure that reflects the role of the different parts. For the Barley package, you only need to create a single subdirectory, content/ (see figure below). barley/ content/ barley.gif barley.js barley.xul Creating the contents.rdf File One of the most im
portant ingredients of the software package is the contents.rdf file that describes the contents of the package in terms that the chrome registry can make sense of. For a package such as this one with its own content but no special localization or custom skin, the contents.rdf file describes package in terms of its relation to the "root" package of Mozilla. In the following listing, the items in red a...
Learn XPI Installer Scripting by Example - Archive of obsolete content
pers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. In particular plugin developers should see how to package a plugin as an extension. This article uses the installer script from browser.xpi install package as the basis for discussing XPI installations in general. This installer script is relatively short, but it exercises most of the im
portant features of the XPInstall API, and it can easily be used as a template for other more general software installations. In this article, we use the unix install file, but the installers for all the platforms are quite similar, and you can easily take what you learn here and apply it to installations on any platform that mozilla sup
ports. About browser.xpi browser.xpi is the XPI archive in whic...
...en the installation is actually begun with a call to performInstall at the end), is the communicatorFolder directory defined at line 22 as "Program." "Program" is one of a short list of keywords that can be used in place of full path names in methods such as addFile. "Program" represents the directory where software itself is installed (e.g., C:\Program Files\ on win32 systems), as opposed to sup
porting directories like "Components", "Chrome", or "Temporary" (see getFolder in the XPInstall API Reference for a list of keywords). Registering the Software Registering software is sometimes a requirement of both the operating system and of the Netscape 6 platform. When you install new chrome, for example, like the browser.xpi install does, you need to alert the chrome registry to these changes, ...
...... In lines 42-58, registerChrome is called as many times as there are different directories that contain content that needs to be registered with the chrome registry. Note that in the first few lines of this process, new content from the XPI is being registered, and in the remainder, it is new skin information. In this most common form of the registerChrome function (it can also be used to sup
port the now-deprecatedmanifest.rdf style of installation archive), the three parameters represent, in order, the chrome SWITCH used to indicate what kind of software is being registered, the target destination of the software (e.g., the "Chrome" folder in the example above), and the path within the XPI (or JAR theme archive) where the contents.rdf file is located. See registerChrome in the XPInstall...
...addition process returns success (0), and also cancelled outside the main block if the earlier verification process is not successful. Note also the comments that indicate the success of various steps in the process--including the performInstall and cancelInstall steps--are written to the install log using the logComment, described in the following section. Installation Logging Logging is an im
portant feature of the XPInstall API that can help you streamline and debug your installations. In the example in the Executing the Installation section and in many places in the installation script, the logComment API is used to write data to a log file that can then be reviewed when things don't go as planned. The install log is created in the product directory by default (where the browser executa...
How to implement a custom XUL query processor component - Archive of obsolete content
Custom query processors are XPCOM components, must implement the nsIXULTemplateQueryProcessor interface and follow some conventions for when registering the component. In this example, we will create a simple JavaScript XPCOM component. The component will hold a small array of JavaScript objects as its datasource. In practice, you would use your own custom source of data. ...
...value="?name"/> <label value="?age"/> <label value="?hair"/> <label value="?eye"/> </row> </template> </rows> </grid> </window> A few things to note. We are not really using the datasources in our sample component, so we set it to a dummy value. An empty string would be ok too. ...
...ent, so we set it to a dummy value. An empty string would be ok too. The querytype is im
portant. It is used to create an instance of our XPCOM object. The contract id of our XPCOM component should be of the form "@mozilla.org/xul/xul-query-processor;1?name=xxx", where the xxx is the querytype used in the XUL template block. ...
...pended to it, so be sure to handle it appropriately. We are not handling any datasources, but instead hard code the datasource in the component. You could easily extend this sample to handle multiple datasources by checking the datasources value in getDatasource and initializeForBuilding. We do not make use of any <query/> or <rule/> elements in the XUL template block. These could be used to sup
port filtering the datasource. ...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
ose. You can also use this page to learn about extensions, and as a starting point if you plan to write a more complex extension. Note that this extension is very simplified. Use other tutorials and articles to find out more--the main Extensions page here is a good starting point. In particular, the articles Creating toolbar buttons and Building an Extension explain the process in more detail. Sup
ported applications You can use the steps on this page only with SeaMonkey 1.x versions. SeaMonkey 2 is being reworked to sup
port the same process as Firefox, Thunderbird and others. This tutorial adds a customizable button to all SeaMonkey's toolbars. It adds a menu choice to ChatZilla's menu bar (because ChatZilla has no toolbar). Note: For a similar tutorial that applies to SeaMonkey 2, Firefox...
... Required tools You will need two tools. Your operating system normally provides them: A way to create and work with files and directories A text editor for plain text files Character encoding Some text editors have a setting for character encoding. ...
...some of the special characters that your language uses. Save the file. Open the file in SeaMonkey (for example, by dragging it and dropping it in the Navigator window, or by choosing File - Open File... from SeaMonkey's menu bar). From SeaMonkey's menu bar, choose View - Character Encoding - Unicode (UTF-8). Check that the text you typed looks OK with this setting. If your text editor does not sup
port UTF-8, search the Internet for a better one that you can download. Optional tools You can optionally use any image editor to customize the images. You can optionally use a jar tool or zip tool to package your button as a cross-platform installable (XPI) for other people to install and use. Making a button There are nine easy steps. When you have completed all the steps, you will have a structure ...
...ange the displayName, description, and author attributes as suits you. Save the file as contents.rdf and navigate to SeaMonkey\chrome again, following steps 2 and 3 as listed above. Restart SeaMonkey and type the chrome url: chrome://myapp/content/myapp.xul, the browser should show you the content of the XUL file. Note: You may have to restart the machine, as SeaMonkey often is configured to keep
portions of code in memory. This may not be the most relevant spot for this addition, I posted this here because the above approach proved successful after hours of unsuccessful tinkering with methods that proved to be obsolete or broken for various reasons. ...
Adding Style Sheets - Archive of obsolete content
</menupopup> </menulist> <spacer class="springspace"/> <menulist id="find-text" flex="1" editable="true" datasources="file:///mozilla/recents.rdf" ref="http://www.xulplanet.com/rdf/recent/all"/> ... <spacer class="titlespace"/> <hbox> <progressmeter id="progmeter" value="50%" style="display:none;"/> The new xml-stylesheet line is used to im
port the style sheet. It will contain the styles instead of having them directly in the XUL file. You can include any number of style sheets in a similar way. Here the style sheet is placed in the same directory as findfile.xul. Some of the styles in the code above have been removed. One that wasn't was the display property on the progressmeter. This will be changed by a script so it was left in, as...
...lespace { height: 10px; } Notice how these styles are equivalent to the styles we had before. However, it is much easier for someone to change the look of the find files dialog now because they could add or modify the style declarations by either modifying the file or by changing the skin. If the user changes the interface skin, the files in a directory other than default will be applied. Im
porting Style Sheets We've already seen how to im
port style sheets for use. An example is shown below: <?xml-stylesheet href="chrome://bookmarks/skin/" type="text/css"?> This might be the first lines of a bookmarks window. It im
ports the bookmarks style sheet, which is bookmarks.css. Mozilla's skin system is smart enough to figure out which style sheet to use, because the specific filename was not in...
...="chrome://bookmarks/skin/" type="text/css"?> This might be the first lines of a bookmarks window. It im
ports the bookmarks style sheet, which is bookmarks.css. Mozilla's skin system is smart enough to figure out which style sheet to use, because the specific filename was not indicated here. We have done a similar thing with the global style sheet file (chrome://global/skin). A style sheet may im
port styles from another stylesheet using the im
port directive. Normally, you will only im
port one style sheet from each XUL file. The global style sheet can be im
ported from within the style sheet associated with the XUL file. ...
...e have done a similar thing with the global style sheet file (chrome://global/skin). A style sheet may im
port styles from another stylesheet using the im
port directive. Normally, you will only im
port one style sheet from each XUL file. The global style sheet can be im
ported from within the style sheet associated with the XUL file. This can be done with the code below, allowing you to remove the im
port from the XUL file: Style im
port from XUL: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> Style im
port from CSS: @im
port url(chrome://global/skin/); The second syntax is preferred because it reduces the number of dependencies within the XUL file itself. Remove the global style sheet im
port from findfile.xul and add the im
port to findfile.css. All elements can be styled usin...
Document Object Model - Archive of obsolete content
ich may be used. Each XUL file that is loaded will have its own document displayed in a window or frame. Although there is only ever one document associated with a window at a time, you may load additional documents using various methods. In Mozilla, the DOM may be accessed and manipulated using JavaScript. The various DOM objects have functions which may be accessed in script, however, it is im
portant to note that the DOM is an API that is accessible by JavaScript. JavaScript itself is just a scripting language that can access these objects because Mozilla provides these objects for use. In JavaScript, there is always a single global object that is always available. You can refer to the properties and methods of the global object without having to qualify them with an object. For example, ...
...r property which holds the window object that opened this one. In this example, we retrieve the opener window and call the getText() function declared in a script used there. Note that we qualified the property with the 'window' identifier just to be clearer. The window's open() method also returns a reference to the new window so you can call functions of the new window from the opener. It is im
portant to note, however, that the open() method returns before the window has fully loaded, so functions will not typically be available yet. The window object isn't defined by any DOM specification, but in Mozilla is sometimes considered part of DOM Level 0, a name used by some developers to refer to the DOM-like functions before they were added to specifications. The actual document displayed in a...
...s a flex attribute set to the value 1. Properties are available in JavaScript using the dot syntax. For example, element.hidden refers to the hidden property of an element. The children are the child tags of the element and will be nested inside the element in the source. It is possible to manipulate the attributes, properties and children of an element dynamically using DOM methods. It is im
portant to note that attributes and properties are separate things. Just because there is an attribute with a given name does not mean that there is a corresponding property with the same name. However, it will often be the case that such a property will exist. For example, to get the flex of an element, you can use the flex property. In this case, the underlying code just returns the value of the att...
...o the namespace 'http://www.w3.org/1999/xhtml'. You can also use the prefix syntax with a colon to use a specific namespace . This is used when you are using several namespaces in a document and you need to be more precise with which namespace is meant. This causes an XHTML button to be created for this case. The fourth button is a little confusing, but might clarify that it is the URI that is im
portant and not the prefix. The fourth example is a XUL button, not an HTML button, despite what the prefix might say. This is an im
portant distinction. In fact, the actual text used for the prefix is irrelevant when determining what kind of element is used. The DOM provides a number of namespace related functions similar to the non-namespace ones. For example, the getAttributeNS() function is simi...
XUL Structure - Archive of obsolete content
ctory where Firefox or another XUL application is built. The chrome URL always begins with 'chrome://'. In much the same way as an 'http://' URL always refers to remote web sites accessed using HTTP, and the 'file://' URL always refers to local files, the 'chrome://' URL always refers to installed packages and extensions. We'll look more at the syntax of a chrome URL in the next section. It is im
portant to note that when accessing content through a chrome URL, it gains the enhanced privileges described above that other kinds of URLs do not. For instance, an HTTP URL does not have any special privileges, and an error will occur if a web page tries, for example, to read a local file. However, a file loaded via a chrome URL will be able to read files with the same access privileges as the instal...
...t through a chrome URL, it gains the enhanced privileges described above that other kinds of URLs do not. For instance, an HTTP URL does not have any special privileges, and an error will occur if a web page tries, for example, to read a local file. However, a file loaded via a chrome URL will be able to read files with the same access privileges as the installed extension. This distinction is im
portant. This means that there are certain things that content of web pages cannot do, such as read the user's bookmarks. This distinction is not based on the kind of content being displayed; only on the type of URL used. Both HTML and XUL placed on a web site have no extra permissions; however both HTML and XUL loaded through a chrome URL have enhanced permissions. Remote XUL was disabled in Firefox...
...XML document. There are subtle differences in functionality. For example, while the form controls on an HTML page are accessible via the document.forms property, this property isn't available for XUL documents, since XUL doesn't have forms in the HTML sense. Likewise, XUL specific features such as overlays and templates are only available in XUL documents. This distinction between documents is im
portant. It is possible to use many XUL features in HTML or XML documents since they aren't document type specific; however other features require the right kind of document. For instance, you can use the XUL layout types in other documents since they don't rely on the XUL document type to function. To summarize the points made above: Mozilla renders both HTML and XUL using the same underlying eng...
...sed by script files. The file browser.properties contains a few such localized strings. This structure allows you to translate Mozilla or a component into a different language by just adding a new locale for that language. You don't have to change the XUL code at all. In addition, another person could supply a separate package that applies a skin or locale to your content part, thus providing sup
port for a new theme or language without having to change the original package. Other Packages There is a special package called toolkit (or global). We saw the global directory earlier for skins. The file toolkit.jar contains the corresponding content part for it. It contains some global dialogs and definitions. It also defines the default appearance and functionality of the various common XUL widg...
Using nsIXULAppInfo - Archive of obsolete content
Starting with Mozilla/XULRunner 1.8, there now is a way to find out which application, application version, and Gecko version your code is running on. This is useful, for example, for extensions that sup
port several Mozilla-based applications or several versions of a single application. This is not useful for scripts on webpages, which should continue using the navigator object when it's not possible to rely on feature-detection. nsIXULAppInfo interface To distinguish between different Mozilla-based applications, use the frozen nsIXULAppInfo interface. ...
...ich should continue using the navigator object when it's not possible to rely on feature-detection. nsIXULAppInfo interface To distinguish between different Mozilla-based applications, use the frozen nsIXULAppInfo interface. The following sections provide a few examples of using nsIXULAppInfo from JavaScript. Note that while Firefox 1.5, Thunderbird 1.5, and XULRunner 1.8-based applications sup
port nsIXULAppInfo, older applications, such as Firefox and Thunderbird 1.0, do not sup
port it. You'll need to have additional code for those older versions. Getting nsIXULAppInfo To get a component implementing nsIXULAppInfo use this code: var appInfo = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULAppInfo); (For explanation see...
...unning under. For example, one of unfrozen functions you're relying on was changed. Note: nsIXULAppInfo provides information about the application and the platform, be careful to use the right one, especially when dealing with XULRunner-based applications. In such cases, you probably want to check nsIXULAppInfo.version and/or nsIXULAppInfo.appBuildID. The latter is useful if you're trying to sup
port nightly development builds of the application, and the former can be useful if you only sup
port official releases, and to distinguish between branch and trunk builds. Example 1: checking Firefox version // assuming we're running under Firefox var appInfo = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULAppInfo); var versionCheck...
...nts.interfaces.nsIXULAppInfo); var platformVer = appInfo.platformVersion; var platformBuildID = appInfo.platformBuildID; Getting nsIXULAppInfo in xpcshell tests In Firefox 21, a testing module was added that provides access to app info during the execution of xpcshell tests. See Bug 809920, and in summary: // Work around the fact that xpcshell doesn't have a proper app-info XPCOM object. Cu.im
port("resource://testing-common/AppInfo.jsm"); updateAppInfo(); Older versions As stated above, older Mozilla 1.7-based applications do not sup
port nsIXULAppInfo. You'll have to write additional code if you choose to sup
port those versions. For example, Firefox and Thunderbird 1.0 stored their ID in the app.id preference (and their version in app.version), so you could use code like this to find ou...
window - Archive of obsolete content
p (and, if currently displayed, the add-on bar) left showing. Note: This has no effect if the tabs on top preference is turned off. disablefastfindType: booleanPut disablefastfind="true" on the root element of a XUL document, which is intended to be loaded in a tab, to disable the find bar for the tab with this document. This is used to prevent the find bar from being displayed when it's not sup
ported by the content (such as in the Add-ons manager tab). drawintitlebar Type: boolean If this attribute is true, the top of the window's content area will begin at the top edge of the title bar, instead of below the title bar. This allows the window to draw in the title bar. This is sup
ported only from window elements, and is ignored on platforms that don't sup
port drawing into the title bar. ...
...The window receives a "fullscreen" event once the change has been made. height Type: string (representing an integer) The preferred height of the element in pixels. ...
... as a parameter to getElementById() and other DOM functions and to reference the element in style sheets. inactivetitlebarcolor Type: color string Specify background color of the window's titlebar when it is inactive (background). Moreover this hides separator between titlebar and window contents. This affects only on Mac OS X. lightweightthemes Type: boolean true if the window sup
ports lightweight themes, otherwise false. lightweightthemesfooter Type: id Specifies the ID of an element to which a lightweight theme's footer image will be applied. screenX Type: integer The horizontal position at which the window appears on the screen. screenY Type: integer The vertical position at which the window appears on the screen. sizemode Type: one of the values...
...ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData See also: DOM window object methods Note The error message "XML Parsing Error: undefined entity..
CommandLine - Archive of obsolete content
with registering and unregistering functions in your command line handler service. This has the advantage to accumulate unhandled arguments until a specific handler is added. This approach has been used in Songbird. Example Notice the changes since Gecko 2.0 (Component registration has moved into the manifest file). ...
...our command line handler service. This has the advantage to accumulate unhandled arguments until a specific handler is added. This approach has been used in Songbird. Example Notice the changes since Gecko 2.0 (Component registration has moved into the manifest file). ...
...sICommandLineHandler; const nsIFactory = Components.interfaces.nsIFactory; const nsIModule = Components.interfaces.nsIModule; const CLASS_ID = Components.ID("178cfbb6-503c-11dc-8314-0800200c9a66"); const CLASS_NAME = "ApplicationNameCLH"; const CONTRACT_ID = "@example.com/applicationname/clh;1"; const CLD_CATEGORY = "m-applicationname"; var appHandler = { /* nsISup
ports */ QueryInterface : function clh_QI(aIID) { if (aIID.equals(nsICommandLineHandler) || aIID.equals(nsIFactory) || aIID.equals(nsISup
ports)) return this; throw Components.results.NS_ERROR_NO_INTERFACE; }, /* nsICommandLineHandler */ handle : function clh_handle(aCmdLine) { var observerService = Components.classes["@mozilla.org/observer-service;1"] ...
...ne-args-changed", null); }, helpInfo : " -test <value> A test attribute\n", /* nsIFactory */ createInstance : function mdh_CI(aOuter, aIID) { if (aOuter != null) { throw Components.results.NS_ERROR_NO_AGGREGATION; } return this.QueryInterface(aIID); }, lockFactory : function mdh_lock(aLock) { /* no-op */ } }; var appHandlerModule = { /* nsISup
ports */ QueryInterface : function mod_QI(aIID) { if (aIID.equals(nsIModule) || aIID.equals(nsISup
ports)) return this; throw Components.results.NS_ERROR_NO_INTERFACE; }, /* nsIModule */ getClassObject : function mod_gch(aCompMgr, aCID, aIID) { if (aCID.equals(CLASS_ID)) return appHandler.QueryInterface(aIID); throw components.results.NS_ERROR_FAILURE;...
Debugging a XULRunner Application - Archive of obsolete content
ion, the -jsconsole argument is after the application.ini argument: e.g. xulrunner.exe /path/to/application.ini -jsconsole By default the JS console only shows errors from web content. To show errors in chrome JavaScript, the pref pref("javascript.options.showInConsole", true) must be set. To log JS errors to disk, set the environment variable XRE_CONSOLE_LOG to the path to the filename. i.e. ex
port XRE_CONSOLE_LOG=/path/to/logfile or set XRE_CONSOLE_LOG=C:\path\to\logfile. To output messages to the JavaScript console There are two ways to output messages to the JS console: Components.utils.re
portError(str) will output str as an "error" (i.e. with the red stop icon next to it). jsdump(str) (function defined below) will output str as a "message" with a speech bubble icon next to it: f...
...Message(str); } For more information about the error console see the Error Console and Browser Console article. Browser Debugger As of Gecko 44, it is no longer possible to start the DevTools server from XUL apps. See bug 1244163. Starting with XULRunner 24, you should use the Firefox Browser Debugger to debug your XULRunner apps. Add the following code to your XUL app: Components.utils.im
port('resource://gre/modules/devtools/dbg-server.jsm'); if (!DebuggerServer.initialized) { DebuggerServer.init(); // Don't specify a window type parameter below if "navigator:browser" // is suitable for your app. DebuggerServer.addBrowserActors("myXULRunnerAppWindowType"); } DebuggerServer.openListener(6000); For XULRunner version 37+ the code to enable the debugger has changed: Components...
...e://gre/modules/devtools/dbg-server.jsm'); if (!DebuggerServer.initialized) { DebuggerServer.init(); // Don't specify a window type parameter below if "navigator:browser" // is suitable for your app. ...
...Type"); } DebuggerServer.openListener(6000); For XULRunner version 37+ the code to enable the debugger has changed: Components.utils.im
port('resource://gre/modules/devtools/dbg-server.jsm'); if (!DebuggerServer.initialized) { DebuggerServer.init(); DebuggerServer.addBrowserActors(); DebuggerServer.allowChromeProcess = true; } let dbgListener=DebuggerServer.createListener(); dbgListener.
portOrPath=6000; dbgListener.open(); Add the following to your prefs.js: (in recent ffox, edit about:config instead) pref("devtools.debugger.remote-enabled", true); In Firefox, go to Tools > Web Developer > Connect... and you should be able to point the debugger to your app. Happy debugging :) Venkman Follow these instructions to install Venkman into your XULRunner application (XULRunner 1.9 an...
calIFileType - Archive of obsolete content
Summary The calIFileType interface provides information about a specific file type. calIFileType is used in calIIm
porter and calIEx
porter to determine which file types are sup
ported for im
port/ex
port. Status: unfrozen. Defined in calendar/base/public/calIIm
portEx
port.idl Interface Code [scriptable, uuid(efef8333-e995-4f45-bdf7-bfcabbd9793e)] interface calIFileType : nsISup
ports { readonly attribute AString defaultExtension; readonly attribute AString extensionFilter; readonly attribute AString description; }; Attributes defaultExtension The default extension that should be associated with files of this type. extensionFilter The extension filter to use in the filepicker's filter list. Separate multiple extensions with semicolon and space. description The description to show to th...
... ...
... ...
... ...
Extentsions FAQ - Archive of obsolete content
of IE in this respect? The IETab (Opens IE in a Firefox tab) should be able do this if you set it to always open "file://*" URLs in an IE tab. The appearance with a FireFox tab isn't quite the same as having a completely separate Explorer window. However, it's functional and does allow for the Explorer to be handling the display of the folder contents, and all of the right-click context menu sup
port is present so it should meet my needs. What is the valid location and things needed to to release a Mozilla extension on Mozallia site? You must remove updateURL from the install.rdf and use a known to AMO minVersion/maxVersion. No confirmation that the answer given worked yet. Is it possible to open the URL in a new tab? var tab = gBrowser.addTab( url ); // And if you want it to load...
...n I backup some of the files before upgrade an extension and put them back afterward? Do I need to write an installation script to achieve this? You shouldn't store data there, so there's nothing to backup. Do not store files within the extension directory. The Profile directory is ment to do so. Storing files within the extension directory is a no-no because it might break the multi-user sup
port of those Mozilla products, as it is possible to install extensions directly within the application directory. Inspector, Talkback and the default theme are nowadays installed like this. Does Firefox clean up the preferences set by extension? If not, how to proceed? When user chooses to uninstall an extension, a nsIObserverService notification is sent out. The problem is, while your extension...
...sible to create a sidebar on the top of the page? Not unless you make it a separate window. There's a bug in bugzilla about stacking other widgets on top of browser/iframe, which hopefully will be fixed for Gecko 1.9. Could someone write an extension that zaps the Google Analytics cookie, the Urchin cookie, switches Gmail and Google Calender to HTTPS? CustomizeGoogle extension already has sup
port for switching Gmail to HTTPS (and calendar possibly, too). Does anyone know how write a bounce email extension? Are you aware of the "mailredirect" extension? It allows bouncing to arbitrary addresses. It seems what you want is a one button access to that extension with a prefilled bounce address, right? could someone make an extension for Thunderbird that preview upcomeing events and numb...
...review upcomeing events and number of new messages? In our company I write this extension that connects to our GroupWare server (HTTP). What server should souch extension work gainst? Did you mean Exchange? How to attach information using the StringProperties of an IMAP message with out changing the properties? String properties are implemented as IMAP user flags. However not all servers sup
port user flags, in which case you get reduced functionality as follows: all flags are stored in your local cache and are lost if your cache gets invalidated, and only "known" properties are copied when messages are copied. The list of "known" properties is: junkscore junkscoreorigin label priority keywords. Keywords - In the GUI they are called Tags. They replace the old Labels (although the labels...
NPN_GetValue - Archive of obsolete content
The value parameter should point to a NPBool, which will be set appropriately if the function returns NPERR_NO_ERROR. NPNVprivate...
...The value parameter should point to a NPBool, which will be set appropriately if the function returns NPERR_NO_ERROR. ...
...The value parameter should point to a NPBool, which will be set appropriately if the function returns NPERR_NO_ERROR. NPNVprivateModeBool: Indicates whether or not the browser is currently in private browsing mode. ...
...ool, which will be set appropriately if the function returns NPERR_NO_ERROR. NPNVdocumentOrigin: The value for this variable is the Unicode serialization of the origin converted to NFKC-encoded (normalized) UTF-8. Memory for this string must be freed by the plugin via NPN_MemFree(). For more information, see the document origin specification. NPNVpluginDrawingModel: (Mac only) NPNVsup
portsQuickDrawBool : (Mac only) NPNVsup
portsCoreGraphicsBool : (Mac only) value Function returns the name of the plug-in in the value parameter. Gecko 1.9.2 note Starting with Gecko 1.9.2 (Firefox 3.6), the variables NPNVserviceManager, NPNVDOMElement, and NPNVDomWindow are no longer sup
ported. Returns If successful, the function returns NPERR_NO_ERROR. If unsuccessful, the...
Building a Theme - Archive of obsolete content
tor/ You should end up with this directory structure: <ext path>/ /install.rdf /chrome.manifest /chrome/ browser/ communicator/ global/ mozapps/ After this, it would be a good idea to read the article Setting up extension development environment and follow the directions there. It's especially im
portant to install the DOM Inspector, which we'll be using in later steps. Create the Install Manifest Open the file called install.rdf that you created at the top of your extension's folder hierarchy and put this inside: <?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-m...
...--> <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minVersion>29.0</em:minVersion> <em:maxVersion>39.*</em:maxVersion> </Description> </em:targetApplication> <!-- Front End MetaData --> <em:name>My Theme</em:name> <em:internalName>sample</em:internalName> <em:description>A test...
...to be no newer than the newest currently available version! In this case, "39.*" indicates that the extension works with Firefox 39 and any subsequent 39.x release. Themes are compatible by default, unless you set strict compatibility mode for your theme. If you get a message that the install.rdf is malformed, it is helpful to load it into firefox using the File->Open File command and it will re
port XML errors to you. See Install Manifests for a complete listing of the required and optional properties. Save the file. Styling the Browser's UI with CSS Firefox's user interface is written in XUL and JavaScript. XUL is an XML grammar that provides user interface widgets like buttons, menus, toolbars, trees, etc. User actions are bound to functionality using JavaScript. These XUL elements a...
...ng loads the file bar.png from the foo theme's skin section. When you load content using a Chrome URI, Firefox uses the Chrome Registry to translate these URIs into the actual source files on disk (or in JAR packages). Create a Chrome Manifest The Chrome Manifest is the file that maps these Chrome URIs to your theme's files. For more information on Chrome Manifests and the properties they sup
port, see the Chrome Manifest Reference. Open the file called chrome.manifest that you created alongside the chrome directory at the root of your extension's source folder hierarchy. Add in this code: skin browser sample chrome/browser/ skin communicator sample chrome/communicator/ skin global sample chrome/global/ skin mozapps sample chrome/mozapps/ ...
-ms-filter - Archive of obsolete content
As of Internet Explorer 10 this feature was removed and should no longer be used. ...
...or> | <EndColorStr> | <GradientType> | <StartColor> | <StartColorStr> ]# where <Enabled> = 'Enabled=' [ true | false ] <EndColor> = 'StartColor=' <color> <EndColorStr> = 'StartColorStr=' <color> <GradientType> = 'GradientType=' <integer> <StartColor> = 'StartColor=' <color> <StartColorStr> = 'StartColorStr=' <color> Enabled Default: true Set to false to disable. ...
...abled> = 'Enabled=' [ true | false ] <EndColor> = 'StartColor=' <color> <EndColorStr> = 'StartColorStr=' <color> <GradientType> = 'GradientType=' <integer> <StartColor> = 'StartColor=' <color> <StartColorStr> = 'StartColorStr=' <color> Enabled Default: true Set to false to disable. EndColor The end color, sup
ports only opaque colors in the #RRGGBB notation. ...
...end color, sup
ports only opaque colors in the #RRGGBB notation. EndColorStr The end color, sup
ports both opaque colors (#RRGGBB) and colors with alpha opacity using the #AARRGGBB notation. GradientType Default: 0 (equivalent to linear-gradient(to bottom, ...)) Set to a non-zero value to make the gradient horizontal (equivalent to linear-gradient(to right, ...)) StartColor The end color, sup
ports only opaque colors in the #RRGGBB notation. StartColorStr The end color, sup
ports both opaque colors (#RRGGBB) and colors with alpha opacity using the #AARRGGBB notation. HTML <div class="gradient horizontal"></div> <div class="gradient vertical"></div> CSS html, body { overflow-x: hidden; max-width: 100vw; } .gradient { width: 100vw; height: 60px; height: 50vh; } .gradient...
ActiveXObject - Archive of obsolete content
The ActiveXObject Object enables and returns a reference to an automation object. This object is used only to instantiate automation objects, and has no members. Syntax let newObj = new ActiveXObject(servername.typename[, location]) Parameters servername The name of the application providing the object. typename The type or class of the object to create. location Optional The name of the network server where the object is to be created. Remarks Automation servers provide at least one type of object. ...
...pplication object, a document object, and a toolbar object. You may be able to identify servername.typename values on a host PC in the HKEY_CLASSES_ROOT registry key. For example, here are a few examples of values you may find there, depending on which programs are installed: Excel.Application Excel.Chart Scripting.FileSystemObject WScript.Shell Word.Document Im
portant: ActiveX objects may present security issues. To use the ActiveXObject, you may need to adjust security settings in Internet Explorer for the relevant security zone. For example, for the local intranet zone, you typically need to change a custom setting to "Initialize and script ActiveX controls not marked as safe for scripting." To identify members of an automation object that you can use i...
....Cells collection. // Make Excel visible through the Application object. ExcelSheet.Application.Visible = true; // Place some text in the first cell of the sheet. ExcelSheet.ActiveSheet.Cells(1,1).Value = "This is column A, row 1"; // Save the sheet. ExcelSheet.SaveAs("C:\\TEST.XLS"); // Close Excel with the Quit method on the Application object. ...
...e sheet. ExcelSheet.SaveAs("C:\\TEST.XLS"); // Close Excel with the Quit method on the Application object. ExcelSheet.Application.Quit(); Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not sup
ported in Windows 8.x Store apps. Note: Creating an ActiveXObject on a remote server is not sup
ported in Internet Explorer 9 standards mode, Internet Explorer 10 standards mode, Internet Explorer 11 standards mode, and Windows Store apps or later. ...
@set - Archive of obsolete content
Strings are not. ...
...Strings are not. ...
...ions. The @set statement creates variables used with conditional compilation statements. Syntax @set @varname = term Parameters varname Valid JavaScript variable name. Must be preceded by an "@" character at all times. term Zero or more unary operators followed by a constant, conditional compilation variable, or parenthesized expression. ...
... Remarks Numeric and Boolean variables are sup
ported for conditional compilation. Strings are not. Variables created using @set are generally used in conditional compilation statements, but can be used anywhere in JavaScript code. Examples of variable declarations look like this: @set @myvar1 = 12 @set @myvar2 = (@myvar1 * 20) @set @myvar3 = @_jscript_version The following operators are sup
ported in parenthesized expressions: ! ~ * / % + - << >> >>> < <= > >= == != === !== & ^ | && | | If a variable is used before it has been defined, its value is NaN. NaN can be checked for using the @if statement: @if (@newVar != @newVar) ... This works because NaN is the only value not equal to itself. Requirements Sup
ported in all versions ...
background-size - Archive of obsolete content
tency. Feel free to put it inside, nothing is set in stone. Konqueror's global market share is 0.05%, (< 5% of Linux users). Given the fact that this reference has serious shortcomings in many places and few contributors, I think spending much time here is not effective. People especially interested in this browser are welcome to contribute. It's hard to get reliable information about its CSS sup
port without having this browser (read: multiple versions of this browser) installed. Are you able and willing to do that for all CSS properties? If so, feel free to change the en/CSS_Reference/Property_Template and all CSS property pages ; ) Start with -webkit-background-size and investigate sup
port of contain and cover keywords and "omitted second value" behavior. [I assume it's the same as Safari...
...rowser (read: multiple versions of this browser) installed. Are you able and willing to do that for all CSS properties? If so, feel free to change the en/CSS_Reference/Property_Template and all CSS property pages ; ) Start with -webkit-background-size and investigate sup
port of contain and cover keywords and "omitted second value" behavior. [I assume it's the same as Safari, since they just back
ported a WebKit patch into KHTML. But we need facts, rather than assumptions.] Btw, some time ago I'v listed Opera in the property template table and removed Netscape because Netscape is Gecko based and Opera has a global market share of > 2% (> 40% in some European countries). User:Jurgen Jeka 2009-08-04 <hr> Is there anyway to have the -moz-border-image only apply if -moz-background-size is not sup...
...ed a WebKit patch into KHTML. But we need facts, rather than assumptions.] Btw, some time ago I'v listed Opera in the property template table and removed Netscape because Netscape is Gecko based and Opera has a global market share of > 2% (> 40% in some European countries). User:Jurgen Jeka 2009-08-04 <hr> Is there anyway to have the -moz-border-image only apply if -moz-background-size is not sup
ported? I'm guessing not, just asking because having both rules in for 3.6 creates a strange effect: -moz-border-image gets inherited by every element on the page User:robertc 2009-08-08 -moz-border-image should not inherit. Some example code? User:Jurgen Jeka 2009-08-09 OK, here's a page with both rules - the CSS is derived from the code on the page here, this is what it looks like in 3.6a2pre on L...
...the whole page, and then again behind the main content. Here's a slightly more complex example (screenshot), and the same page without the -moz-border-image image rule (screenshot). User:robertc 2009-08-09 This is only an issue with <body> and <html>. <body>'s background extends per CSS spec to <html>. Since you have a 8px default margin on <body> and your <body>'s content is smaller than the view
port's height, you see what you see. Styles like this should work: body { border:0; margin:0; padding:0.6em } /* or for less content, if body is small */ html, body { height:100%; } body { border:0; margin:0; padding:0.6em } Furthermore, you may simplify things a bit if you apply the background and border-image styles to <html> rather than <body>. User:Jurgen Jeka 2009-08-12 OK, probably my understa...
Anatomy of a video game - Game development
e possible and it really depends on what your game attempts to accomplish. Your game genre will obviously make a difference but it could even be more subtle than that. You could draw every pixel individually on a canvas or you could layer DOM elements (including multiple WebGL canvases with transparent backgrounds if you want) into a complex hierarchy. Each of these paths will lead to different op
portunities and constraints. It is decision... time You will need to make hard decisions about your main loop: how to simulate the accurate progress of time. If you demand per-frame control then you will need to determine how frequently your game will update and draw. You might even want update and draw to occur at different rates. You will also need to consider how gracefully your game will fail if...
...Let us start by assuming that you will handle user input and update the game state every time you draw. We will branch out later. Note: Changing how your main loop deals with time is a debugging nightmare, everywhere. Think about your needs carefully before working on your main loop. What most browser games should look like If your game can hit the maximum refresh rate of any hardware you sup
port then your job is fairly easy. You can simply update, render, and then do nothing until VSync. /* * Starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (ASI). The browser could accidentally * think this whole example continues from the previous line. The leading semicolon * marks the beginning of our new line if the previous on...
...this tick. update( MyGame.lastTick ); } } MyGame.lastTick = performance.now(); MyGame.lastRender = MyGame.lastTick; // Pretend the first draw was on first update. MyGame.tickLength = 50; // This sets your simulation to run at 20Hz (50ms) setInitialState(); main(performance.now()); // Start the cycle })(); Another alternative is to simply do certain things less often. If a
portion of your update loop is difficult to compute but insensitive to time, you might consider scaling back its frequency and, ideally, spreading it out into chunks throughout that lengthened period. An implicit example of this is found over at The Artillery Blog for Artillery Games, where they adjust their rate of garbage generation to optimize garbage collection. Obviously, cleaning up resources is...
...urces become a concern. Summary I want to be clear that any of the above, or none of them, could be best for your game. The correct decision entirely depends on the trade-offs that you are willing (and unwilling) to make. The concern is mostly with switching to another option. Fortunately, I do not have any experience with this, but I have heard it is an excruciating game of Whack-a-Mole. An im
portant thing to remember for managed platforms, like the web, is that your loop may stop execution for significant periods of time. This could occur when the user unselects your tab and the browser sleeps (or slows) its requestAnimationFrame callback interval. You have many ways to deal with this situation and this could depend on whether your game is single player or multiplayer. Some choices are: ...
Index - Game development
the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (starting in Firefox 28). To see the difference, toggle javascript.options.parallel_parsing in about:config. 26 Audio for Web games Audio, Games, Web Audio API, audio sprites, spatialization, syncing tracks Audio is an im
portant part of any game; it adds feedback and atmosphere. Web-based audio is maturing fast, but there are still many browser differences to navigate. We often need to decide which audio parts are essential to our games' experience and which are nice to have but not essential, and devise a strategy accordingly. This article provides a detailed guide to implementing audio for web games, looking at what...
... Canvas, Games, JavaScript, WebGL, image-rendering, pixel This article discusses a useful technique for giving your canvas/WebGL games a crisp pixel art look, even on high definition monitors. 28 Efficient animation for web games Animation, Games, JavaScript This article covers techniques and advice for creating efficient animation for web games, with a slant towards sup
porting lower end devices such as mobile phones. We touch on CSS transitions and CSS animations, and JavaScript loops involving window.requestAnimationFrame. 29 Implementing controls using the Gamepad API Controls, Gamepad API, Gamepads, Games, JavaScript, controllers The Gamepad API is very easy to develop with. Now it's easier than ever to deliver a console-like experience to th...
...oard, mouse Ok, we've dealt with touch, keyboard and mouse controls. Now let's move on to look at how to set up the game to be controlled using a console gamepad, using the Gamepad API. 33 Mobile touch controls Controls, Games, JavaScript, Mobile, pointer, touch That covers adding touch controls for mobile; in the next article we'll see how to add keyboard and mouse sup
port. 34 Unconventional controls Controls, Doppler, Games, JavaScript, Makey Makey, Proximity, TV Leap Motion, Voice I hope you liked the experiments -- if you have any others that you think might interest other people, feel free to add details of them here. 35 Tiles and tilemaps overview 2D, Canvas, Games, JavaScript, Static, WebGL, tilemap, tiles Tilemaps ar...
... Square tilemaps implementation: Static maps Canvas, Games, JavaScript, Static, atlas, spritesheet, tilemap, tilemaps, tiles This article covers how to implement static square tilemaps using the Canvas API. 38 WebRTC data channels API, Games, NeedsContent, Network, P2P, WebRTC, data channels The WebRTC (Web Real-Time Communications) API is primarily known for its sup
port for audio and video communications; however, it also offers peer-to-peer data channels. This article explains more about this, and shows you how to use libraries to implement data channels in your game. 39 Tools for game development Games, Gecko, Guide, JavaScript On this page you can find links to our game development tools articles, which eventually aims to cover frameworks...
Building up a basic demo with Three.js - Game development
s one of the most popular WebGL libraries, and it is easy to get started with. We are not trying to say it is better than any other WebGL library available, and you should feel free to try another library, such as CopperLicht, GLGE, or PlayCanvas. Environment setup To start developing with Three.js, you don't need much. You should: Make sure you are using a modern browser with good WebGL sup
port, such as the latest Firefox or Chrome. Create a directory to store your experiments in. Save a copy of the latest minimized Three.js library inside your directory. Open the Three.js documentation in a separate tab -- it is useful to refer to. HTML structure Here's the HTML structure we will use: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>MDN Games: Three.js demo</title> ...
...The first <script> element includes the Three.js library in the page, and we will write our example code inside the second. There are two helper variables already included, which store the window's width and height. Before reading further, copy this code to a new text file, and save it in your working directory as index.html. Renderer A renderer is a tool which displays scenes right in ...
... few different renderers: WebGL is the default, and others you can use are Canvas, SVG, CSS, and DOM. They differ in how everything is rendered, so the WebGL implementation will implement differently than the CSS one. Despite the variety of ways they achieve the goal, the experience will look the same for the user. Thanks to this approach, a fallback can be used, if a desired technology is not sup
ported by the browser. var renderer = new THREE.WebGLRenderer({antialias:true}); renderer.setSize(WIDTH, HEIGHT); renderer.setClearColor(0xDDDDDD, 1); document.body.appendChild(renderer.domElement); We are creating a new WebGL renderer, setting its size to fit the whole available space on the screen, and appending the DOM structure to the page. You might have noticed the antialias parameter in the ...
...var camera = new THREE.PerspectiveCamera(70, WIDTH/HEIGHT); camera.position.z = 50; scene.add(camera); Add the above lines to your code, below those previously added. There are other types of camera available (Cube, Orthographic), but the simplest is Perspective. To initialize it, we have to set its field of view and aspect ratio: the former is used to set how much is seen, and the latter is im
portant for the objects on the screen to have the right pro
portions when rendered, and not look stretched. Let's explain values we are setting for the code above: The value we set for the field of view, 70, is something we can experiment with: the higher the value, the greater the amount of scene the camera will show. Imagine a normal camera view, versus a fish eye effect, which allows a lot more t...
WebVR — Virtual Reality for the Web - Game development
se in games. VR devices With the popularity of Oculus Rift and a lot of other devices in production coming soon to the market, the future looks bright -- we already have sufficient technology to make the VR experience "good enough" for playing games. There are many devices to chose from: desktop ones like Oculus Rift or HTC Vive, through consoles with Playstation VR (which admittedly doesn't sup
port WebVR at this time), to mobile experiences like Gear VR or Google Cardboard. Note: For more information, read our WebVR Concepts article. The WebVR API The WebVR API is the central API for capturing information on VR Devices connected to a computer and headset position/orientation/velocity/acceleration information, and converting that into useful data you can use in your games and other ap...
...tion on VR Devices connected to a computer and headset position/orientation/velocity/acceleration information, and converting that into useful data you can use in your games and other applications. Note: There are of course other APIs useful for creating games, for example The Gamepad API for control inputs, and the Device Orientation API for handling display orientation on mobile. Browser sup
port and spec status Currently browser sup
port for the WebVR API is still experimental -- it works in nightly builds of Firefox and experimental builds of Chrome (Mozilla and Google teamed up to work on the implementation together), but sooner rather than later we'll see it in regular builds. The WebVR spec is in Editor's Draft status which means it is still subject to change. The development is led...
...check the WebVR Boilerplate sources -- it's a good example to start learning WebVR from, and a starting point for any web-based VR experience. There's also a markup framework called A-Frame that offers simple building blocks for WebVR, so you can rapidly build and experiment with VR websites and games: read the Building up a basic demo with A-Frame tutorial for more details. Immersion is more im
portant than gameplay or graphics - you have to feel you're "inside" the experience. It's not easy to achieve, but it doesn't require realistic images. Quite the contrary as having a basic shapes flying around in high framerate can make a lot. Remember: experimenting is key - see what works for your game in particular. The future of WebVR It's happening -- consumer devices are reaching the market ri...
...u're "inside" the experience. It's not easy to achieve, but it doesn't require realistic images. Quite the contrary as having a basic shapes flying around in high framerate can make a lot. Remember: experimenting is key - see what works for your game in particular. The future of WebVR It's happening -- consumer devices are reaching the market right now, and we already have JavaScript APIs to sup
port them on the Web. All we need now is a stable specification, good UX and UI, better hardware and more tools and libraries -- and all of that is on the horizon. It's the perfect time to dive in and experiment with WebVR. ...
Implementing controls using the Gamepad API - Game development
the browser. Now in the era of HTML5, we finally have the Gamepad API, which gives us the ability to play browser-based games using gamepad controllers without any plugins. The Gamepad API achieves this by providing an interface exposing button presses and axis changes that can be used inside JavaScript code to handle the input. These are good times for browser gaming. ...
...any plugins. The Gamepad API achieves this by providing an interface exposing button presses and axis changes that can be used inside JavaScript code to handle the input. These are good times for browser gaming. API status and browser sup
port The Gamepad API is still at the Working Draft stage in the W3C process, which means its implementation might still change, but saying that the browser sup
port is already quite good. Firefox 29+ and Chrome 35+ sup
port it out of the box. Opera sup
ports the API in version 22+ (not surprising given that they now use Chrome's Blink engine.) And Microsoft implemented sup
port for the API in Edge recently, which means four main browsers now sup
porting the Gamepad API. Which gamepads are best? The most popular gamepads right now are those from the Xbox 360, X...
...a hidden option to launch Super Turbo Hungry Fridge on the desktop without having a gamepad connected -- click the gamepad icon in the top right corner of the screen. It will launch the game in the Super Turbo mode and you'll be able to control the Fridge with the keyboard: A and D for turning the turret left and right, W for shooting and arrow keys for movement. Implementation There are two im
portant events to use along with the Gamepad API -- gamepadconnected and gamepaddisconnected. The first one is fired when the browser detects the connection of a new gamepad while the second one is fired when a gamepad is disconnected (either physically by the user or due to inactivity.) In the demo, the gamepadAPI object is used to store everything related to the API: var gamepadAPI = { controller...
...above.) disconnect: function(evt) { gamepadAPI.turbo = false; delete gamepadAPI.controller; console.log('Gamepad disconnected.'); }, The disconnect function sets the gamepad.turbo property to false and removes the variable containing the gamepad object. Gamepad object There's lots of useful information contained in the gamepad object, with the states of buttons and axes being the most im
portant: id: A string containing information about the controller. index: A unique indentifier for the connected device. connected: A boolean variable, true if the device is connected. mapping: The layout type of the buttons; standard is the only available option for now. axes: The state of each axis, represented by an array of floating-point values. buttons : The state of each button, represe...
HSTS - MDN Web Docs Glossary: Definitions of Web-related terms
HTTP Strict Trans
port Security lets a web site inform the browser that it should never load the site using HTTP and should automatically convert all attempts to access the site using HTTP to HTTPS requests instead. It consists in one HTTP header, Strict-Trans
port-Security, sent by the server with the resource. In other words, it tells the browser that changing the protocol from HTTP to HTTPS in a URL works (and is more secure) and asks the browser to do it for every request. ...
...P and should automatically convert all attempts to access the site using HTTP to HTTPS requests instead. It consists in one HTTP header, Strict-Trans
port-Security, sent by the server with the resource. In other words, it tells the browser that changing the protocol from HTTP to HTTPS in a URL works (and is more secure) and asks the browser to do it for every request. ...
... to access the site using HTTP to HTTPS requests instead. It consists in one HTTP header, Strict-Trans
port-Security, sent by the server with the resource. In other words, it tells the browser that changing the protocol from HTTP to HTTPS in a URL works (and is more secure) and asks the browser to do it for every request. ...
...uests instead. It consists in one HTTP header, Strict-Trans
port-Security, sent by the server with the resource. In other words, it tells the browser that changing the protocol from HTTP to HTTPS in a URL works (and is more secure) and asks the browser to do it for every request. ...
WebGL - MDN Web Docs Glossary: Definitions of Web-related terms
WebGL (Web Graphics Library) is a JavaScript API that draws interactive 2D and 3D graphics. The Khronos Group maintains WebGL, which is based on OpenGL ES 2.0. ...
... WebGL (Web Graphics Library) is a JavaScript API that draws interactive 2D and 3D graphics. The Khronos Group maintains WebGL, which is based on OpenGL ES 2.0. ...
...cript API that draws interactive 2D and 3D graphics. The Khronos Group maintains WebGL, which is based on OpenGL ES 2.0. You can invoke WebGL within the HTML <canvas> element, which provides a rendering surface. ...
...aphics. The Khronos Group maintains WebGL, which is based on OpenGL ES 2.0. You can invoke WebGL within the HTML <canvas> element, which provides a rendering surface. ...
Accessible multimedia - Learn web development
m, right? Let's investigate. The problem with native HTML5 controls HTML5 video and audio instances even come with a set of inbuilt controls that allow you to control the media straight out of the box. For example (see native-controls.html source code and live): <audio controls> <source src="viper.mp3" type="audio/mp3"> <source src="viper.ogg" type="audio/ogg"> <p>Your browser doesn't sup
port HTML5 audio. Here is a <a href="viper.mp3">link to the audio</a> instead.</p> </audio> <br> <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>Your browser doesn't sup
port HTML5 video. Here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> The controls attribute provides play/pause buttons, seek bar, et...
..., and rabbit320.webm files and save them in a new directory on your hard drive. Create a new file called main.js and save it in the same directory. First of all, let's look at the HTML for the video player, in the HTML: <section class="player"> <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>Your browser doesn't sup
port HTML5 video. Here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> <div class="controls"> <button class="playpause">Play</button> <button class="stop">Stop</button> <button class="rwd">Rwd</button> <button class="fwd">Fwd</button> <div class="time">00:00</div> </div> </section> JavaScript basic setup We've inserted some simple control buttons b...
...er groups of users (such as those on low bandwidth, or who don't understand the language the video is recorded in), you need to include text tracks along with your video content. Note: text tracks are also useful for potentially any user, not just those with disabilities. ...
... app has good enough color contrast and clear presentation so it is perceivable to those with low vision/color blindness, and also make it keyboard accessible. Remember that accessibility is about doing as much as you can, rather than striving for 100% accessibility all the time, which is often impossible. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? We've not written a new set of assessments for this article, because there are already assessments available in our HTML Multimedia and embedding module that test your knowledge of the information presented here. If you haven't already, go and try out the assessments at Test your skills: HTML images and Test your skills: Multimedia and embedding. Summary This chapter has provid...
Styling tables - Learn web development
Normally, table columns tend to be sized according to how much content they contain, which produces some strange results. With table-layout: fixed, you can size your columns according to the width of their headings, and th...
...t of texture, as well as giving those elements a bright purple border. It is useful to have multiple nested elements available so you can layer styles on top of one another. Yes, we could have put both the background image and the linear gradient on the <thead> and <tfoot> elements using multiple background images, but we decided to do it separately for the benefit of older browsers that don't sup
port multiple background images or linear gradients. Zebra striping We wanted to dedicate a separate section to showing you how to implement zebra stripes -- alternating rows of color that make the different data rows in your table easier to parse and read. Add the following CSS to the bottom of your style.css file: /* zebra striping */ tbody tr:nth-child(odd) { background-color: #ff33cc; } tbo...
... same things as the aforementioned formulae. In this case we are giving the odd and even rows different (lurid) colors. We've also added a repeating background tile to all the body rows, which is just a bit of noise (a semi-transparent .png with a bit of visual distortion on it) to provide some texture. Lastly, we've given the entire table a solid background color so that browsers that don't sup
port the :nth-child selector still have a background for their body rows. This color explosion results in the following look: Now, this may be a bit over the top and not to your taste, but the point we are trying to make here is that tables don't have to be boring and academic. Styling the caption There is one last thing to do with our table -- style the caption. To do this, add the following t...
...o break up your table into logical chunks and provide extra places to apply CSS to, so it is easier to layer styles on top of one another if required. Use zebra striping to make alternative rows easier to read. Use text-align to line up your <th> and <td> text, to make things neater and easier to follow. Test your skills! We have covered a lot in this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: tables. Summary With styling tables now behind us, we need something else to occupy our time. The next article explores debugging CSS -- how to solve problems such as layouts not looking like they should, or properties not applying when you think they shoul...
CSS layout - Learn web development
We have covered the necessary prerequisites so we can now dive deep into CSS layout, looking at different display settings, modern layout tools like flexbox, CSS grid, and positioning, and some of the legacy techniques you might still want to know about. ...
...used tools for creating multiple column layouts on webpages. With the advent of Flexbox and Grid it has now returned to its original purpose, as this article explains. Positioning Positioning allows you to take elements out of the normal document layout flow, and make them behave differently, for example sitting on top of one another, or always remaining in the same place inside the browser view
port. This article explains the different position values, and how to use them. Multiple-column layout The multiple-column layout specification gives you a method of laying content out in columns, as you might see in a newspaper. This article explains how to use this feature. Responsive design As more diverse screen sizes have appeared on web-enabled devices, the concept of responsive web design (...
...ce to suit different screen widths, resolutions, etc. It is an idea that changed the way we design for a multi-device web, and in this article we'll help you understand the main techniques you need to know to master it. Beginner's guide to media queries The CSS Media Query gives you a way to apply CSS only when the browser and device environment matches a rule that you specify, for example "view
port is wider than 480 pixels". Media queries are a key part of responsive web design, as they allow you to create different layouts depending on the size of the view
port, but they can also be used to detect other things about the environment your site is running on, for example whether the user is using a touchscreen rather than a mouse. In this lesson you will first learn about the syntax used in me...
... used in CSS layouts, and before CSS Grid Layout they tended to be implemented using floats or other layout features. You imagine your layout as a set number of columns (e.g. 4, 6, or 12), and then fit your content columns inside these imaginary columns. In this article we'll explore how these older methods work, in order that you understand how they were used if you work on an older project. Sup
porting older browsers In this module we recommend using Flexbox and Grid as the main layout methods for your designs. However there will be visitors to your site who use older browsers, or browsers which do not sup
port the methods you have used. This will always be the case on the web -- as new features are developed, different browsers will prioritise different things. This article explains how t...
Fundamental text and font styling - Learn web development
ou get used to it, and you can use em to size everything, not just text. You can have an entire website sized using em, which makes maintenance easy. rems: These work just like em, except that 1 rem is equal to the font size set on the root element of the document (i.e. <html>), not the parent element. This makes doing the maths to work out your font sizes much easier, although if you want to sup
port really old browsers, you might struggle -- rem is not sup
ported in Internet Explorer 8 and below. The font-size of an element is inherited from that element's parent element. This all starts with the root element of the entire document -- <html> -- the font-size of which is set to 16px as standard across browsers. Any paragraph (or another element that doesn't have a different size set by the b...
...} p::first-line { letter-spacing: 4px; word-spacing: 4px; } p { font-size: 1.5rem; color: red; font-family: Helvetica, Arial, sans-serif; line-height: 1.6; letter-spacing: 1px; } Other properties worth looking at The above properties give you an idea of how to start styling text on a webpage, but there are many more properties you could use. We just wanted to cover the most im
portant ones here. Once you've become used to using the above, you should also explore the following: Font styles: font-variant: Switch between small caps and normal font alternatives. font-kerning: Switch font kerning options on and off. font-feature-settings: Switch various OpenType font features on and off. font-variant-alternates: Control the use of alternate glyphs for a given font-face. ...
...hat is not displayed is signaled to users. white-space: Define how whitespace and associated line breaks inside the element are handled. word-break: Specify whether to break lines within words. direction: Define the text direction (This depends on the language and usually it's better to let HTML handle that part as it is tied to the text content.) hyphens: Switch on and off hyphenation for sup
ported languages. line-break: Relax or strengthen line breaking for Asian languages. text-align-last: Define how the last line of a block or a line, right before a forced line break, is aligned. text-orientation: Define the orientation of the text in a line. overflow-wrap: Specify whether or not the browser may break lines within words in order to prevent overflow. writing-mode: Define whether li...
... This assessment tests all the knowledge discussed in this module, so you might want to read the other articles before moving on to it. Summary We hoped you enjoyed playing with text in this article! The next article wi...
What is the difference between webpage, website, web server, and search engine? - Learn web development
argon. Don't worry, we won't overwhelm you with all of it (we have a glossary if you're curious). However, there are a few basic terms you need to understand at the outset, since you'll hear these expressions all the time as you read on. It's easy to confuse these terms sometimes since they refer to related but different functionalities. In fact, you'll sometimes see these terms misused in news re
ports and elsewhere, so getting them mixed up is understandable! We'll cover these terms and technologies in more detail as we explore further, but these quick definitions will be a great start for you: web page A document which can be displayed in a web browser such as Firefox, Google Chrome, Opera, Microsoft Internet Explorer or Edge, or Apple's Safari. These are also often called just "pages."...
...only use the term document. All web pages available on the web are reachable through a unique address. To access a page, just type its address in your browser address bar: Web site A website is a collection of linked web pages (plus their associated resources) that share a unique domain name. Each web page of a given website provides explicit links--most of the time in the form of clickable
portion of text--that allow the user to move from one page of the website to another. To access a website, type its domain name in your browser address bar, and the browser will display the website's main web page, or homepage (casually referred as "the home"): The ideas of a web page and a website are especially easy to confuse for a website that contains only one web page. Such a website is some...
...he browser will display the website's main web page, or homepage (casually referred as "the home"): The ideas of a web page and a website are especially easy to confuse for a website that contains only one web page. Such a website is sometimes called a single-page website. Web server A web server is a computer hosting one or more websites. ...
...In our previous example, if we said, "My web server is not responding", it means that multiple websites on that web server are not available. Search engine Search engines are a common source of confusion on the web. ...
How do I start to design my website? - Learn web development
Prerequisites: None Objective: Learn to define goals to give direction to your web project. Summary When starting with a web project, many people focus on the technical side. Of course you must be familiar with the technique of your craft, but what really matters is what you want to accomplish. Yes, it seems obvious, but too many projects fail not from a lack of technical know-how, but from lack of goals and vision. ...
...n and paper and some time to answer at least the following questions. Note: There are countless ways to carry out project ideation. We cannot lay them all out here (a whole book wouldn't be enough). What we will present here is a simple method to handle what professionals call Project Ideation, Project Planning, and Project Management. What exactly do I want to accomplish? This is the most im
portant question to answer, since it drives everything else. List all the goals you want to reach. It can be anything: selling goods to make money, expressing political opinions, meeting new friends, gigging with musicians, collecting cat pictures, or whatever you want. Suppose you are a musician. You could wish to: Let people hear your music. Sell goodies. Meet other musicians. Talk about your...
...eeting new friends, gigging with musicians, collecting cat pictures, or whatever you want. Suppose you are a musician. You could wish to: Let people hear your music. Sell goodies. Meet other musicians. Talk about your music. Teach music through videos. Publish photos of your cats. Find a new girl/boyfriend. Once you have such a list, you need to prioritize. Order the goals from most im
portant to least im
portant: Find a new girl/boyfriend. Let people hear your music. Talk about your music. Meet other musicians. Sell goodies. Teach music through videos. Publish photos of your cats. Doing this simple exercise--writing goals and sorting them--will help you out when you have decisions to make. (Should I implement these features, use these services, create these designs?) So ...
...epare video files viewable online (Again, could you do this with existing web services?) Give people access to your videos on some part of your website Two things to notice. First, some of these items are not web-related (e.g., record music, write articles). Often those offline activities matter even more than the web side of the project. In sales, for instance, it's far more im
portant and time-consuming to handle supply, payment, and shipment than to build a website where people can place orders. Second, setting out actionable steps leads to new questions you'll need to answer. Usually there turn out to be more questions than we originally thought. (For example, should I learn how to do all this myself, ask someone to do it for me, or use third-party services?) Conclusion...
How to structure a web form - Learn web development
"large"> <label for="size_3">Large</label> </p> </fieldset> </form> Note: You can find this example in fieldset-legend.html (see it live also). When reading the above form, a screen reader will speak "Fruit juice size small" for the first widget, "Fruit juice size medium" for the second, and "Fruit juice size large" for the third. The use case in this example is one of the most im
portant. Each time you have a set of radio buttons, you should nest them inside a <fieldset> element. There are other use cases, and in general the <fieldset> element can also be used to section a form. Ideally, long forms should be spread across multiple pages, but if a form is getting long and must be on a single page, putting the different related sections inside different fieldsets improves usabil...
...e key elements for building accessible forms; however it is your responsibility not to abuse it. If possible, each time you build a form, try to listen to how a screen reader interprets it. If it sounds odd, try to improve the form structure. The <label> element As we saw in the previous article, The <label> element is the formal way to define a label for an HTML form widget. This is the most im
portant element if you want to build accessible forms -- when implemented properly, screenreaders will speak a form element's label along with any related instructions, as well as it being useful for sighted users. Take this example, which we saw in the previous article: <label for="name">Name:</label> <input type="text" id="name" name="user_name"> With the <label> associated correctly with the <inp...
...d inside a <p>. The first is a drop-down menu (<select>) for selecting credit card type. The second is an <input> element of type tel, for entering a credit card number; while we could have used the number type, we don't want the number's spinner UI. The last one is an <input> element of type date, for entering the expiration date of the card; this one will come up with a date picker widget in sup
porting browsers, and fall back to a normal text input in non-sup
porting browsers. These newer input types are reintroduced in The HTML5 input types. Enter the following below the previous section: <section> <h2>Payment information</h2> <p> <label for="card"> <span>Card type:</span> </label> <select id="card" name="usercard"> <option value="visa">Visa</...
...containing only a <button> of type submit, for submitting the form data. Add this to the bottom of your form now: <p> <button type="submit">Validate the payment</button> </p> You can see the finished form in action below (also find it on GitHub -- see our payment-form.html source and running live): Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find a further test to verify that you've retained this information before you move on -- see Test your skills: Form structure. Summary You now have all the knowledge you'll need to properly structure your web forms. We will cover many of the features introduced here in the next few articles, with the next article looking in more detail at using all the different types o...
Debugging HTML - Learn web development
hyperlinks. Objective: Learn the basics of using debugging tools to find problems in HTML. Debugging isn't scary When writing code of some kind, everything is usually fine, until that dreaded moment when an error occurs -- you've done something wrong, so your code doesn't work -- either not at all, or not quite how you wanted it to. For example, the following shows an error re
ported when trying to compile a simple program written in the Rust language. Here, the error message is relatively easy to understand -- "unterminated double quote string". If you look at the listing, you can probably see how println!(Hello, world!"); might logically be missing a double quote. However, error messages can quickly get more complicated and less easy to interpret as programs get bigger, ...
...age still displays even if there are syntax errors. Browsers have built-in rules to state how to interpret incorrectly written markup, so you'll get something running, even if it is not what you expected. This, of course, can still be a problem! Note: HTML is parsed permissively because when the web was first created, it was decided that allowing people to get their content published was more im
portant than making sure the syntax was absolutely correct. The web would probably not be as popular as it is today, if it had been more strict from the very beginning. Active learning: Studying permissive code It's time to study the permissive nature of HTML code. First, download our debug-example demo and save it locally. This demo is deliberately written with some built-in errors for us to ex...
...<strong>strong <em>strong emphasised?</strong> what is this?</em> <li>Unclosed attributes: Another common source of HTML problems. Let's look at an example: <a href="https://www.mozilla.org/>link to Mozilla homepage</a> </ul> Let's review the problems: The paragraph and list item elements have no closing tags. Looking at the imag...
...h the lines and find the errors, but what about a huge, complex HTML document? The best strategy is to start by running your HTML page through the Markup Validation Service -- created and maintained by the W3C, the organization that looks after the specifications that define HTML, CSS, and other web technologies. This webpage takes an HTML document as an input, goes through it, and gives you a re
port to tell you what is wrong with your HTML. To specify the HTML to validate, you can provide a web address, upload an HTML file, or directly input some HTML code. Active learning: Validating an HTML document Let's try this with our sample document. First, load the Markup Validation Service in one browser tab, if it isn't already open. Switch to the Validate by Direct Input tab. Copy all o...
Web performance resources - Learn web development
he size of Javascript to a minimum. Only use as much Javascript as needed for the current page. CSS performance factors Use HTTP/2 on your server (or CDN). Use a CDN for resources which can reduce load times significantly. Compress your resources using gzip, Brotli, and Zopfli. Image optimization (use CSS animation, or SVG if possible). Lazy loading parts of your application outside the view
port. If you do, have a backup plan for SEO (e.g render full page for bot traffic); for example, by using the loading attribute on the <img> element It is also crucial to realize what is really im
portant to your users. It might not be absolute timing, but user perception. Quick Wins CSS Web performance is all about user experience and perceived performance. As we learned in the critical rendering...
... learned in the critical rendering path document, linking CSS with a tradional link tag with rel="stylesheet" is synchronous and blocks rendering. Optimize the rendering of your page by removing blocking CSS. To load CSS asynchronously one can simpy set the media type to print and then change to all once loaded. The following snippet includes an onload attribute, requiring Javascript, so it is im
portant to include a noscript tag with a traditional fallback. <link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'"> <noscript><link rel="stylesheet" href="/path/to/my.css"></noscript> The downside with this approach is the flash of unstyled text (FOUT.) The simplist way to address this is by inlining CSS that is required for any content that is rendered above the f...
...ditional fallback. <link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'"> <noscript><link rel="stylesheet" href="/path/to/my.css"></noscript> The downside with this approach is the flash of unstyled text (FOUT.) The simplist way to address this is by inlining CSS that is required for any content that is rendered above the fold, or what you see in the browser view
port before scrolling. These styles will improve perceived performance as the CSS does not require a file request. <style type="text/css"> // Insert your CSS here </style> Javascript Avoid Javascript blocking by using the async or defer attributes, or link javascript assets after the page's DOM elements. Javascript only block rendering for elements that appear after the script tag in the DOM tree.
...e Firefox Dev Tools to profile your site. Pagespeed Insights can analyze your page and give some general hints to improve performance. Lighthouse can give you a detailed breakdown of many aspects of your site including performance, SEO and accessibility. Test your page's speed using Webpagetest.org, where you can use different real device types and locations. Try the Chrome User Experience Re
port which quantifies real user metrics. Define a performance budget. APIs Gather user metrics using https://github.com/akamai/boomerang Or directly gather with window.performance.timing Things not to do (bad practices) Download everything Use uncompressed media files ...
Multimedia: video - Learn web development
ing video to improve web performance. Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. Objective: To learn about the various video formats, their impact on performance, and how to reduce video impact on overall page load time while serving the smallest video file size based on each browsers file type sup
port. Why optimize your multimedia? For the average website, 25% of bandwidth comes from video. Optimizing video has the potential for very large bandwidth savings that translate into better website performance. Optimizing video delivery It's best to compress all video, optimize <source> order, set autoplay, remove audio from muted video, optimize video preload, and consider streaming the vi...
...compress all video, optimize <source> order, set autoplay, remove audio from muted video, optimize video preload, and consider streaming the video. The sections below describe each of these optimization techniques. Compress all videos Most video compression work compares adjacent frames within a video, with the intent of removing detail that is identical in both frames. Compress the video and ex
port to multiple video formats, including WebM, MPEG-4/H.264, and Ogg/Theora. Your video editing software probably has a feature to reduce file size. If not, there are online tools, such as FFmpeg (discussed in section below), that encode, decode, convert, and perform other optimization functions. Optimize <source> order Order video source from smallest to largest. For example, given video compres...
...rger versions. With the smallest version, make sure that the most compressed video still looks good. There are some compression algorithms that can make video look (bad) like an animated GIF. While a 128 Kb video may seem like it could provide a better user experience than a 10 MB download, a grainy GIF-like video may reflect poorly on the brand or project. See CanIUse.com for current browser sup
port of video and other media types. Video autoplay To ensure that a looping background video autoplays, you must add several attributes to the video tag: autoplay, muted, and playsinline. <video autoplay="" loop="" muted="true" playsinline="" src="backgroundvideo.mp4"> While the loop and autoplay make sense for a looping and autoplaying video, the muted attribute is required for autoplay in mob...
...e home pages. It includes a video that is auto-playing, looping, and muted. There are no controls, so there is no way to hear audio. The audio is often empty, but still present, and still using bandwidth. There is no reason to serve audio with video that is always muted. Removing audio can save 20% of the bandwidth. Depending on your choice of software, you might be able to remove audio during ex
port and compression. If not, a free utility called FFmpeg can do it for you. This is the FFmpeg command string to remove audio: ffmpeg -i original.mp4 -an -c:v copy audioFreeVersion.mp4 Video preload The preload attribute has three available options: auto|metadata|none. The default setting is metadata. These settings control how much of a video file downloads with page load. You can save data by...
The "why" of web performance - Learn web development
Overview: Performance Next Web performance is all about making websites fast, including making slow processes seem fast. This article provides an introduction into why web performance is im
portant to site visitors and for your business goals. Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. Objective: To gain basic familiarity of why web performance is im
portant for good user experience. Web performance refers to how quickly site content loads and renders in a web browser, and how well it responds to user interaction. Bad performing sites are slow to display and slow to respond to input. Bad performing sites increase site abandonment. At its worst, bad performance causes content to be...
...ding experience of CNN.com, which at the time of this writing had over 400 HTTP requests with a file size of over 22.6MB. Imagine loading this on a desktop computer connected to a fibre optic network. This would seem relatively fast, and the file size would be largely irrelevant. Imagine loading that same site using tethered mobile data on a 9 year-old iPad while commuting home on public trans
portation. The same site will be slow to load, possibly verging on unusable depending on cell coverage. You might give up before it finishes loading. Imagine loading that same site on a $35 Huawei device in a rural India with limited coverage or no coverage. The site will be very slow to load--if it loads at all--with blocking scripts possibly timing out, and adverse CPU impact causing browser crashe...
...ion and user satisfaction. Slow content has been shown to lead to site abandonment, with some visitors leaving to never return. Reducing the amount of data that passes between the client and the server lowers the costs to all parties. Reducing HTML/CSS/JavaScript and media file sizes reduces both the time to load and a site's power consumption (see performance budgets). ...
...edia file sizes reduces both the time to load and a site's power consumption (see performance budgets). Tracking performance is im
portant. Multiple factors, including network speed and device capabilities affect performance. There is no single performance metric; and differing business objectives may mean different metrics are more relavant to the goals of the site or the organization that it sup
ports. How the performance of your site is perceivedd is user experience! Conclusion Web performance is im
portant for accessibility and also for other website metrics that serve the goals of an organization or business. Good or bad website performance correlates powerfully to user experience, as well as the overall effectiveness of most sites. This is why you should care about web performance. ...
React interactivity: Editing, filtering, conditional rendering - Learn web development
tasks.map(task => ( <Todo id={task.id} name={task.name} completed={task.completed} key={task.id} toggleTaskCompleted={toggleTaskCompleted} deleteTask={deleteTask} editTask={editTask} /> )); Now open Todo.js. We're going to do some refactoring. A UI for editing In order to allow users to edit a task, we have to provide a user interface for them to do so. First, im
port useState into the Todo component like we did before with the App component, by updating the first im
port statement to this: im
port React, { useState } from "react"; We'll now use this to set an isEditing state, the default state of which should be false. Add the following line just inside the top of your Todo(props) { ... } component definition: const [isEditing, setEditing] = useState(false);...
... initially: const [filter, setFilter] = useState('All'); Defining our filters Our goal right now is two-fold: Each filter should have a unique name. Each filter should have a unique behavior. A JavaScript object would be a great way to relate names to behaviors: each key is the name of a filter; each property is the behavior associated with that name. At the top of App.js, beneath our im
ports but above our App() function, let's add an object called FILTER_MAP: const FILTER_MAP = { All: () => true, Active: task => !task.completed, Completed: task => task.completed }; The values of FILTER_MAP are functions that we will use to filter the tasks data array: The All filter shows all tasks, so we return true for all tasks. The Active filter shows tasks whose completed prop is fa...
... replace the three repeated <FilterButton />s in App.js with this filterList. Replace the following: <FilterButton /> <FilterButton /> <FilterButton /> With this: {filterList} This won't work yet. We've got a bit more work to do first. Interactive filters To make our filter buttons interactive, we should consider what props they need to utilize. We know that the <FilterButton /> should re
port whether it is currently pressed, and it should be pressed if its name matches the current value of our filter state. We know that the <FilterButton /> needs a callback to set the active filter. We can make direct use of our setFilter hook. Update your filterList constant as follows: const filterList = FILTER_NAMES.map(name => ( <FilterButton key={name} name={name} isPressed={nam...
...properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript sup
port in Svelte Deployment and next steps ...
Deploying our app - Learn web development
ow you how to add a simple test into the process. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To finish working through our complete toolchain case study, focusing on deploying the app. Post development There's potentially a large range of problems to be solved in this section of the project's lifecycle. As such, it's im
portant to create a toolchain that handles these problems in a way that requires as little manual intervention as possible. Here's just a few things to consider for this particular project: Generating a production build: Ensuring files are minimised, chunked, have tree-shaking applied, and that versions are "cache busted". Running tests: These can range from "is this code formatted properly?" to ...
...s section will get you over the line to storing your code in a git repository, but it is a far cry from a git tutorial. There's many great tutorials and books available, and our Git and GitHub page is a good place to start. We initialized our working directory as a git working directory earlier on. A quick way to verify this is to run the following command: git status You should get a status re
port of what files are being tracked, what files are staged, and so on -- all terms that are part of the git grammar. If you get the error fatal: not a git repository returned, then the working directory is not a git working directory and you'll need to initialise git using git init. Now we have three tasks ahead of us: Add any changes we've made to the stage (a special name for the place that git...
...bject that really requires its own separate module. We are hoping that this section will at least make you aware of the need for testing, and will plant the seed that inspires you to go and learn more. Although the test for this project does not include a test framework, as with all things in the front-end development world, there are a slew of framework options. The test itself isn't what is im
portant. What is im
portant is how the failure or success is handled. Some deployment platforms will include a specific method for testing as part of their pipeline. Products like GitHub, GitLab, etc., all sup
port running tests against individual commits. As this project is deploying to Netlify, and Netlify only asks about the build command, we will have to make the tests part of the build. If the tes...
... projects. Now, finally, a minute or so after pushing, Netlify will deploy the project update. But only if it passes the test that was introduced. Summary That's it for our sample case study, and for the module! We hope you found it useful. While there is a long way to go before you can consider yourself a client-side tooling wizard, we are hoping that this module has given you that first im
portant step towards understanding client-side tooling, and the confidence to learn more and try out new things. Let's summarise all the parts of the toolchain: Code quality and maintenance are performed by eslint and prettier. These tools are added as devDependancies to the project via npm install --dev eslint prettier eslint-plugin-react (the eslint plugin is needed because this particular proje...
Information for Assistive Technology Vendors
Information for Assistive Technology Vendors Accessibility Features in Mozilla & Call for Testers! Mozilla now has enough accessibility sup
port that we're reading for early adopters and testers to start giving it a try. Please read this page if you're interested in an alternative accessible browser. Keyboard documentation This lists Mozilla's keyboard docs in a single long document. Gecko Info for Windows Accessibility Vendors Mozilla sup
ports MSAA (Microsoft Active Accessibility) in HTML and in our user interface (based on XUL technology). This makes it possible for the vendors of Windows accessibility software, such as screen readers, voice dictation packages and screen magnifiers to provide sup
port for Mozilla. In addition, we provide some simple interfaces via which...
...s MSAA (Microsoft Active Accessibility) in HTML and in our user interface (based on XUL technology). This makes it possible for the vendors of Windows accessibility software, such as screen readers, voice dictation packages and screen magnifiers to provide sup
port for Mozilla. In addition, we provide some simple interfaces via which we expose a read-only DOM (document object model). Mozilla Sup
port for Linux/UNIX Assistive Technology Developers Mozilla sup
ports the AT-SPI (Assistive Technology Service Provider Interface) in HTML and in our user interface (based on XUL technology). This makes it possible for the developers of Linux and UNIX accessibility software, such as screen readers, voice dictation packages and screen magnifiers to provide sup
port for Mozilla. Join the Mozilla Acc...
...always a good chance to find someone to chat with there, day or night. ...
...e to find someone to chat with there, day or night. ...
Information for External Developers Dealing with Accessibility
Contains info on accessible roles, states and events. Accessible Toolkit Checklist A list of what needs to be done for accessibility when building new toolkits, widget by widget. ...
...Contains info on accessible roles, states and events. Accessible Toolkit Checklist A list of what needs to be done for accessibility when building new toolkits, widget by widget. ...
...always a good chance to find someone to chat with there, day or night. ...
...e to find someone to chat with there, day or night. ...
Accessibility and Mozilla
ceThis cross-reference helps us see the difference between today's accessibility API's. All accessibility APIs to date define a list of possible object roles, or general types, such as button, menu item, text, etc. They also define a list of possible object states, such as focused, read-only, checked, etc.Accessibility Features in FirefoxFirefox works with popular screen readers, with the best sup
port currently coming from GW Micro's Window-Eyes 5.5. We are optimistic that JAWS sup
port will catch up this year. In recent articles from both AFB's Access World and NFB's Voice of the Nation's Blind, reviewers found no significant roadblocks in moving to Firefox from Internet Explorer for screen reader users. In fact, the same keyboard commands are still available, so users can become comfortable ...
...elopersWhen you design user interfaces with accessibility in mind, they will work for more people. This page describes a number of design-related aspects to look out for, in no particular order.Accessibility/LiveRegionDevGuideThis page is currently under construction. This developer's guide lays out general guidelines that assistive technology (AT) developers can use in developing live region sup
port. This guide was written from an ATK/AT-SPI point of view as part of the Orca Live Region Sup
port project. However, many of the concepts were also used during the development of FireVox, an AT using IAccessible2.Accessible Toolkit ChecklistPlease contact the Mozilla Accessibility Community with questions or feedback.CSUN Firefox MaterialsFirefox 1.5 is a fast, free, standards compliant web browser...
...owser which is rapidly gaining recognition for its fresh, streamlined approach to browsing the web. In addition to winning major awards such as PC World Product of the Year, Firefox has attracted a huge following among savvy users who simply care enough about their web browsing experience to download a new piece of software. Websites such as online magazines with sophisticated audiences are now re
porting upwards of 25% Firefox usage.Embedding API for AccessibilityEvent Process ProcedureThis diagram outlines how events are processed within Gecko. Gecko info for Windows accessibility vendorsPlease contact the Mozilla Accessibility Community.Information for Assistive Technology VendorsBoth end users and developers are invited for discussion on the live IRC channel at irc.mozilla.org/#accessib...
...accessibility.Mozilla accessibility architectureThis page is maintained by Aaron Leventhal and by the Mozilla Accessibility Community. Feedback and constructive suggestions are encouraged.Mozilla Plugin AccessibilityPlugins in Gecko-based browsers have a lot of accessibility issues. Here is a rundown of problems and the planned solutions:Mozilla's Section 508 ComplianceMozilla's UAAG evaluation re
portThe UAAG document contains a very rich set of accessibility guidelines, that broadly define how accessibility should be implemented by any user agent, i.e. software that renders web content. The UAAG is not the basis for any government accessibility regulations at this time.Multiprocess on WindowsA high-level overview of the ideas behind the a11y+e10s design is available on the wiki.Software acces...
Adding phishing protection data providers
provider. browser.safebrowsing.provider.idnum.keyURL An URL that returns a private key to be used for encrypting of other requests. browser.safebrowsing.provider.idnum.lookupURL The URL to use to look up URLs to see if they're block-listed. This request must be encrypted using the private key returned by the keyURL request. ...
...rowsing.provider.idnum.keyURL An URL that returns a private key to be used for encrypting of other requests. browser.safebrowsing.provider.idnum.lookupURL The URL to use to look up URLs to see if they're block-listed. This request must be encrypted using the private key returned by the keyURL request. ...
...e
portURL An URL used for re
porting when users visit phishing pages and whether or not they decided to heed the warning or to ignore it. browser.safebrowsing.provider.idnum.updateURL An URL used to request an updated list of phishing sites. The server either provides a full list or incremental updates in order to bring the client's tables up to date. browser.safebrowsing.provider.idnum.re
portGenericURL Not currently used; intended for use in re
porting other issues with the phishing protection service. browser.safebrowsing.provider.idnum.re
portErrorURL An URL to which the user is directed in order to re
port a safe page that is incorrectly being re
ported as a phishing site. ...
... tables up to date. browser.safebrowsing.provider.idnum.re
portGenericURL Not currently used; intended for use in re
porting other issues with the phishing protection service. browser.safebrowsing.provider.idnum.re
portErrorURL An URL to which the user is directed in order to re
port a safe page that is incorrectly being re
ported as a phishing site. browser.safebrowsing.provider.idnum.re
portPhishURL An URL to which the user is directed in order to re
port a phishing site that isn't detected by the phishing protection system. Determining the currently-selected data provider If you need to determine the ID number of the currently selected anti-phishing data provider, you can look at the current value of the preference browser.safebrowsing.dataProvider. ...
Android-specific test suites
data structures and logic, and to ensure that basic Android integration works. They should always be preferred to on-device Robocop tests. See https://developer.android.com/training/testing/unit-testing/local-unit-tests.html for more details. Running android-test To run android-test, first build Firefox for Android with your changes; then run ./mach android test This will run the tests and re
port the results to stdout, as well as produce an HTML re
port. While developing, you can launch these tests from within Android Studio, which is the fastest way to iterate on code and tests. Disabling one failing test There is no manifest listing the Android local unit tests. To disable a single test, edit the source code and insert JUnit's @Ignore annotation before the existing @Test annotation. Fo...
...ugzilla. Android-checkstyle Verifies that the Java coding style is consistent throughout. See http://checkstyle.sourceforge.net/index.html and https://docs.gradle.org/2.14/userguide/checkstyle_plugin.html for more details. Running android-checkstyle To run android-checkstyle, first build Firefox for Android with your changes; then run ./mach android checkstyle This will run the tests and re
port the results to stdout, as well as produce an HTML re
port. Disabling one failing test In general, it's not sensible to allow Java code that doesn't observe the existing coding style; in this respect, this job is equivalent to the ESLint jobs that check the JavaScript coding style throughout the tree. However, the existing configuration can be tweaked and the set of files checked can be modified.
...rrect category that the suite controls -- this could be malicious, correctness, or just bad practice. See http://findbugs.sourceforge.net/index.html and https://docs.gradle.org/2.14/userguide/findbugs_plugin.html for more details. Running android-findbugs To run android-findbugs, first build Firefox for Android with your changes; then run ./mach android findbugs This will run the tests and re
port the results to stdout, as well as produce an HTML re
port. Disabling one failing test In general, it's not sensible to allow new Java code to land that findbugs detects issues with. However, the existing configuration can be tweaked and the set of files checked can be modified. Contact information android-checkstyle is currently owned by :mcomella and :nalexander. File tickets in the Firefox f...
...e, and test cases are not needed for the process to be completed. Lint is a simple test that can assure you have a quality code. See https://developer.android.com/studio/write/lint.html and http://tools.android.com/tips/lint for more details. Running android-lint To run android-lint, first build Firefox for Android with your changes; then run ./mach android lint This will lint the code and re
port the results to stdout, as well as produce an HTML re
port. While developing, lint warnings should appear within Android Studio, although this is not infallible. Disabling one failing test In general, it's not sensible to allow new Java code to land that lint detects issues with. However, the existing configuration can be tweaked and some options can be modified. Contact information android-lin...
Debugging JavaScript
set the "Enable chrome and add-on debugging" option in the developer tool settings. Activate it through with the menu Tools > Web Developer > Browser Console. You can also start the Browser Console when you launch Firefox, by launching Firefox from the command line and passing --jsconsole as a flag: /path/to/firefox --jsconsole Log to the Browser Console using the standard console API after im
porting Console.jsm: let console = (Cu.im
port("resource://gre/modules/Console.jsm", {})).console; console.log("Hello from Firefox code"); Error Console This is obsolete and is no longer enabled in Firefox by default. Use the Web Console or the Browser Console instead. Browser Debugger (Built-in) On Firefox 19 or later, it's possible to use the built-in JS debugger on the browser itself. Go to ab...
...f you set the pref javascript.options.strict to true, the JavaScript engine gives you more types of warnings on the Error Console, most of which hint at code bugs that are easy to oversee or even bad syntax. (The pref also warns on common JavaScript idioms that are not errors). Console.log in Browser Console You can dump variables in the Browser Console from addon code, by adding this line to im
port the console utility: const { console } = Components.utils.im
port("resource://gre/modules/devtools/Console.jsm", {}); This has an advantage over dump in that you can list out properties of an object logged with console.log. dump() The dump() function allows you to print text on the native console. Use \n to output a newline at the end. To see anything, you need to set the pref browser.dom.win...
...rosoft Windows you additionally need to start Firefox via the following command to have a native console : firefox.exe -console Using normal JavaScript object inspection, you can write a function that dumps a whole object, similar to this ddumpObject(). Log.jsm (formerly log4moz) This is a partial implementation of the Log4* interfaces (for example, see log4j or log4net). Components.utils.im
port("resource://gre/modules/Log.jsm"); "debugger" keyword You can halt Venkman or Chromebug at a line using the keyword debugger. In debug builds this also dumps a stack trace to the console, even when the debugger is not running. In extensions you can print the callstack using Components.stack like this: function getStackDump() { var lines = []; for (var frame = Components.stack; frame; frame...
... ...
Windows SDK versions
If it does, several features will be disabled if you build with an SDK older than the default, which means that you'll have to specify a non-default SDK version explicitly. Quick start Follow the instructions for whichever version of Visual C++ you're using. Visual Studio Professional 2013 This comes with the Windows 8.1 SDK included. Visual Studio Express 2013 for Windows Desktop This comes with the Windows 8.1 SDK included. Visual Studio Professional 2012 This comes with the Windows 8.0 SDK included. Visual Studio 2012 Express for Windows Desktop This comes with the Windows 8.0 SDK included. ...
...o Professional 2012 This comes with the Windows 8.0 SDK included. Visual Studio 2012 Express for Windows Desktop This comes with the Windows 8.0 SDK included. Visual C++ 10 (VS2010) Professional This comes with the Windows 7 SDK, so you should be all set out of the box. Visual C++ 10 (VS2010) Express Download and install the Windows 7 SDK. Older versions Some of the older version are no longer sup
ported, further information is available at Obsolete Build Caveats and Tips [en-US] under the Windows SDK article. Windows 8 SDK (Official) Features that depend on this SDK include: Metro Firefox front end Gamepad API sup
port You can download the SDK from the Microsoft Download Center [web setup]. Windows 7 SDK Features that depend on this SDK include: Windows 7 taskbar previews Windows 7 downl...
...e. Windows 8 SDK (Official) Features that depend on this SDK include: Metro Firefox front end Gamepad API sup
port You can download the SDK from the Microsoft Download Center [web setup]. Windows 7 SDK Features that depend on this SDK include: Windows 7 taskbar previews Windows 7 download taskbar progress Windows 7 jump lists You can download the SDK (v7.0 [web setup or ISO image] or unsup
ported v7.1 [web setup or ISO image]) from the Microsoft Download Center. Note that if you're running a 64 bit version of Windows you may require the "AMD" version of the SDK even if you have an Intel processor, and you may need to deselect the documentation component in the installer in order to avoid an installation error. (This was certainly the case for 64 bit Windows 7 on a late 2008 MacBook Pro.
...nstallation error. (This was certainly the case for 64 bit Windows 7 on a late 2008 MacBook Pro.) Warning: Due to a bug in Windows 7 SDK, if you get "SDKSETUP encountered an error: Expecting path %SystemRoot% to represent a valid system volume" error you may require to set environmental variable %windir% to something like "C:\Windows" instead of "%SystemRoot%". Older SDKs These are no longer sup
ported, further information is available at Obsolete Build Caveats and Tips [en-US] under the Windows SDK article. Troubleshooting Help! I know I have the correct SDK, but configure.in's still failing! Try the following things in order: Run the Windows SDK Configuration Tool (if available) and make sure the right SDK is selected. Restart the msys console. Delete your entire object directory and st...
Creating Custom Events That Can Pass Data
stom DOM events that can be used to pass data. Using this technique you can add extra parameters and query them. For example, if you want Firefox to perform an action whenever something happens (i.e., something other than the standard mouse/keyboard events) and, depending on the data passed along with this event, you want Firefox to react differently. Note that starting with version 6, Firefox sup
ports DOM Level 3 customEvent, which lets you dispatch custom events with arbitrary data from JavaScript. (see bug 427537) Requirements In order to do this you must be able to do all of the following: Download Mozilla Source Code Build Mozilla Creating Custom Firefox Extensions with the Mozilla Build System. This is the foundation for everything we'll do. What's in a name Despite whatever you may ha...
... everyone else's version of Firefox unless you get your patches into the trunk. At the time of writing the author is not aware of a way to do this that doesn't involve modifications to trunk. What follows a list of the files you'll need to modify, as well as a discussion of each change. mozilla/dom/base/nsDOMClassInfoClasses.h The change you make here is really rather small but it is incredibly im
portant. If you peruse nsDOMClassInfoClasses.h you'll see of list of macros of the form DOMCI_CLASS(foo). You'll want to add an entry to it which looks like this: DOMCI_CLASS({truncated name}) Here's the fun part: Above I mentioned that you must name your events as nsDOM. However, here you want to put the other part of the name (e.g. if you have an event named nsDOMMyFirstEvent your nsDOMClassInfoCla...
...M_CLASSINFO_MAP_BEGIN({truncated name}, nsIDOM{truncatedName}) DOM_CLASSINFO_MAP_ENTRY(nsIDOM{truncated name}) DOM_CLASSINFO_EVENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END Remember, {truncated name} is the same as above. mozilla/content/events/src/nsEventDispatcher.cpp Note: In the mozilla 1.8.x branch this code is actually in mozilla/content/events/src/nsEventListenerManager.cpp This is quite an im
portant file since this holds the CreateEvent method which acts as a factory method DOM events. The change you want to make is in nsEventDispatcher::CreateEvent(). You will find that there is a bunch of code like: if (aEventType.LowerCaseEqualsLiteral("{somethingsomething}event")) return NS_{somethingSomething}Event(aDOMEvent, aPresContext, nsnull); You can either have a function like this or write...
...Event(). You will find that there is a bunch of code like: if (aEventType.LowerCaseEqualsLiteral("{somethingsomething}event")) return NS_{somethingSomething}Event(aDOMEvent, aPresContext, nsnull); You can either have a function like this or write the code straight in nsEventListenerManager::CreateEvent() like this: if (aEventType.LowerCaseEqualsLiteral("nsmyevent")){ //note: the lowercase is im
portant! nsDOMEvent* it = new nsDOMMyEvent(aPresContext, aEvent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } return CallQueryInterface(it, aDOMEvent); } In general though I'd strongly recommend using a function the way that everyone else does. You can find the prototypes for the function in nsIPrivateDOMEvent. Your event In order for your event to work you must do the following:...
Firefox and the "about" protocol
eckerboarding measurement page, which allows to detect checkerboarding issues about:config Provides a way to inspect and change Firefox preferences and settings about:compat Lists overriding site compatability fixes, linked to specific bug issues. ...
...ls Summarizes the developer tools and provides links to documentation for each tool about:downloads Displays all downloads done within Firefox about:home Start page of Firefox when opening a new window about:license Displays licensing information about:logo Firefox logo about:memory Provides a way to display memory usage, save it as re
port and run the GC and CC about:mozilla Special page showing a message from "The Book of Mozilla" about:networking Displays networking information about:newtab Start page when opening a new tab about:performance Displays memory and performance information about Firefox subprocesses/add-ons/tabs about:plugins Displays information about instal...
...See Firefox Reader View for clutter-free web pages about:rights Displays rights information about:robot...
...(question mark) > Troubleshooting Information) about:sync-log Displays a synchronization protocol related to the Sync feature about:telemetry Displays telemetry data collected and sent to Mozilla while Firefox is running (in case the user enabled telemetry) about:url-classifier Displays the...
Integrated Authentication
This document provides an overview of Mozilla's sup
port for integrated authentication. This entails sup
port for the the Simple and Protected GSS-API Negotiation Mechanism (SPNEGO) internet standard (RFC 2478) to negotiate either Kerberos, NTLM, or other authentication protocols sup
ported by the operating system. SPNEGO is commonly referred to as the "negotiate" authentication protocol. Mozilla does not have its own internal implementation of SPNEGO. Instead, it leverages system libraries that provide SPNEGO; SSPI on Microsoft Windows, and GSS-API on Linux, Mac OSX, and other UNIX-like systems. The Mozilla implementation of SPNEGO can be found under extensions/auth/. It used to live in extensions/negotiateauth. ...
...ed to as the "negotiate" authentication protocol. Mozilla does not have its own internal implementation of SPNEGO. Instead, it leverages system libraries that provide SPNEGO; SSPI on Microsoft Windows, and GSS-API on Linux, Mac OSX, and other UNIX-like systems. The Mozilla implementation of SPNEGO can be found under extensions/auth/. It used to live in extensions/negotiateauth. Mozilla also sup
ports raw NTLM authentication using an internal implementation (based on the documentation provided by Eric Glass) that sup
ports NTLMv1/LMv1 and NTLM2 Session Key modes. As of Mozilla 1.7, there is no sup
port for NTLMv2/LMv2. This is mainly due to the fact that NTLMSSP does not provide a means to negotiate use of NTLMv2/LMv2. <i>This document is incomplete ...</i> Flow Diagram The diagram below show...
...NTLM may be negotiated as the authentication protocol. So, it is paramount that the browser does not freely exchange NTLM user credentials with any server that requests them. The NTLM response includes a hash of the user's logon credentials. On older versions of Windows this hash is computed using a relatively weak algorithm (see Hertel for more info on NTLM authentication). Mozilla currently sup
ports a whitelist of sites that are permitted to engage in SPNEGO authentication with the browser. This list is intended to be configured by an IT department prior to distributing Mozilla to end-users. The preferences are: pref("network.negotiate-auth.trusted-uris", site-list); pref("network.negotiate-auth.delegation-uris", site-list); pref("network.automatic-ntlm-auth.trusted-uris", site-list); w...
... ...
AddonManager
t may be before or after the method returns. One of the forces of the AddonManager is that it deals with any kind (type) of add-on in a generic manner. To do so many methods of the AddonManager take the add-on types as parameters. The existing add-on types are defined in XPIProvider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
...eneric manner. To do so many methods of the AddonManager take the add-on types as parameters. The existing add-on types are defined in XPIProvider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
...add-on types as parameters. The existing add-on types are defined in XPIProvider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
...cted as having become enabled during startup. This normally means the application determined that an application change has made the add-on compatible. This doesn't include add-ons that were pending becoming enabled the last time the application was running. Methods addStartupChange() Adds an add-on change from the add-on changes list. This is used to build the lists of changed add-ons re
ported by the getStartupChanges() method. Note: Calling this method more than once for the same add-on will replace the last change that was recorded with the new one; an add-on can only appear once across all change types. void addStartupChange( in string changeType, in string id ); Parameters changeType The type of change that occurred for the specified add-on. This can be one of the Sta...
Add-on Manager
Many functions in the Add-on Manager interface operate asynchronously returning results through callbacks passed to the functions. ...
...ter, depending on when the requested data becomes available. Accessing installed add-ons Information about installed add-ons can be retrieved through the main AddonManager API. All of its functions are asynchronous, meaning that a callback function must be passed to receive the Addon instances. The callback may well only be called after the API function returns. For example: Components.utils.im
port("resource://gre/modules/AddonManager.jsm"); AddonManager.getAllAddons(function(aAddons) { // Here aAddons is an array of Addon objects }); // This code will execute before the code inside the callback Notifications about changes to installed add-ons are dispatched to any registered AddonListeners. They must be registered through the addAddonListener() method. Installing new add-ons New add...
... installed add-ons are dispatched to any registered AddonListeners. They must be registered through the addAddonListener() method. Installing new add-ons New add-ons can be installed by using the getInstallForFile() or getInstallForURL() methods on the AddonManager object. These will pass an AddonInstall instance to the callback, which can then be used to install the add-on: Components.utils.im
port("resource://gre/modules/AddonManager.jsm"); AddonManager.getInstallForURL("http://www.foo.com/test.xpi", function(aInstall) { // aInstall is an instance of AddonInstall aInstall.install(); }, "application/x-xpinstall"); The progress of AddonInstalls can be monitored using an InstallListener. A listener can be registered either for a specific install using the addListener() method or for al...
... changes Requires Gecko 7.0(Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) You can also get lists of add-ons that, at startup, were changed in various ways. The getStartupChanges() method lets you find out which add-ons were installed, removed, updated, enabled, or disabled at application startup. ...
Webapps.jsm
The Webapps.jsm modules exposes the DOMApplicationRegistry, which is responsible for managing all of the Open Web Apps. ...
... The Webapps.jsm modules exposes the DOMApplicationRegistry, which is responsible for managing all of the Open Web Apps. ...
... The Webapps.jsm modules exposes the DOMApplicationRegistry, which is responsible for managing all of the Open Web Apps. ...
...ge: function(aData) receiveMessage: function(aMessage) getAppInfo: function getAppInfo(aAppId) broadcastMessage: function broadcastMessage(aMsgName, aContent) registerUpdateHandler: function(aHandler) unregisterUpdateHandler: function(aHandler) notifyUpdateHandlers: function(aApp, aManifest, aZipPath) _getAppDir: function(aId) _writeFile: function(aPath, aData) doGetList: function() doEx
port: function(aMsg, aMm) doIm
port: function(aMsg, aMm) doExtractManifest: function(aMsg, aMm) doLaunch: function (aData, aMm) launch: function launch(aManifestURL, aStartPoint, aTimeStamp, aOnSuccess, aOnFailure) close: function close(aApp) cancelDownload: function cancelDownload(aManifestURL, aError) startOfflineCacheDownload: function(aManifest, aApp, aProfileDir, aIsUpdate) computeManifest...
source-editor.jsm
This component has been removed from the platform in Firefox 28. The source-editor.jsm JavaScript code module implements an editor specifically tailored for editing source code; its primary purpose is to provide sup
port for web developer tools to display and edit web site code. The editor provided is Eclipse Orion. To use it, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource:///modules/source-editor.jsm"); Warning: Much of the functionality of the source editor is implemented by a secondary code module (by default, source-editor-orion.jsm). You must not directly im
port that code module; it is essentially an implementation detail. Its functionality is all exposed through source-editor.jsm. Method overview Initialization and d...
...r enters a line annotation. SourceEditor.EVENTS.SELECTION "Selection" Fired when the current selection in the editor changes. SourceEditor.EVENTS.TEXT_CHANGED "TextChanged" Fired when the editor's content changes. Methods addBreakpoint Adds a breakpoint to be triggered at a certain line in the code, under an optional condition. Note: Implementing actual sup
port for debugger features such as breakpoints is up to you. The editor simply tracks their existence and marks them with annotations in the editor. void addBreakpoint( Number aLineIndex, [optional] String aCondition ); Parameters aLineIndex The 0-based line number at which to place the breakpoint. aCondition Optional A string describing the condition under which the breakpoint should b...
...( Number aLine, [optional] Number aColumn, [optional] Number aAlign ); Parameters aLine The 0-based line number on which to place the caret. aColumn Optional The 0-based column number at which to place the caret; if you don't provide this parameter, the caret is placed at the beginning of the line specified by aLine. aAlign Optional How to position the line with respect to the view
port when scrolling the line into view. This may be one of SourceEditor.VERTICAL_ALIGN.TOP, SourceEditor.VERTICAL_ALIGN.CENTER, and SourceEditor.VERTICAL_ALIGN_BOTTOM. See Alignment constants for details. The default is SourceEditor.VERTICAL_ALIGN.TOP. setMode() Sets the current syntax highlighting mode for the text being edited. void setMode( String aMode ); Parameters aMode A string indi...
...s aMode A string indicating the file type being edited. See Editor mode constants for possible values. setSelection() Selects the specified range of text. void setSelection( Number aStart, Number aEnd ); Parameters aStart The 0-based offset to the first character to select in the text. aEnd The offset to the first character after the range you wish to select. Remarks It's im
portant to note that the character at offset aEnd is not included in the selection. setText() Replaces a range of text in the editor with the specified string. If you don't specify a range, the entire text is replaced. void setText( String aString, [optional] Number aStart, [optional] Number aEnd ); Parameters aString The text to put into the editor. aStart Optional The 0-based offset...
JavaScript code modules
Components.utils.unload How to unload a JavaScript code module. Code snippets: Modules Examples of how to use code modules. ...
... Components.utils.unload How to unload a JavaScript code module. Code snippets: Modules Examples of how to use code modules. Mozilla Labs JS Modules This page features a list of JavaScript modules, along with download links and documentation, that extension developers can use in their code. ...
... Components.utils.unload How to unload a JavaScript code module. Code snippets: Modules Examples of how to use code modules. Mozilla Labs JS Modules This page features a list of JavaScript modules, along with download links and documentation, that extension developers can use in their code. ...
... can use in their code. Standard code modules AddonManager.jsm An interface to install, manage, and uninstall add-ons. AddonRepository.jsm Provides a search of add-ons in the repository. Assert.jsm Implements the CommonJS Unit Testing specification version 1.1, which provides a basic standardized interface for performing in-code logical assertions with optional, customizable error re
porting. BookmarkHTMLUtils.jsm Provides utility functions for im
porting and ex
porting bookmarks from the old-school "bookmarks.html" style bookmark files. ctypes.jsm Provides an interface that allows JavaScript code to call native libraries without requiring the development of an XPCOM component. CustomizableUI.jsm Allows you to interact with customizable buttons and items in Firefox's main wind...
Bootstrapping a new locale
not real ... see also structure expected more below. ...
... navigate to the directory called "browser" by running the following commands one after the other from your command line: $ cd [ab-CD]/browser/chrome/browser To see what is contained in "browser" type $ ls And, you should see the following output from your terminal: aboutCertError.dtd pageInfo.dtd aboutDialog.dtd pageInfo.properties aboutPrivateBrowsing.dtd pageRe
portFirstTime.dtd aboutRobots.dtd places aboutSessionRestore.dtd preferences aboutSup
port.dtd quitDialog.properties baseMenuOverlay.dtd safeMode.dtd browser.dtd safebrowsing browser.properties sanitize.dtd credits.dtd search.properties engineManager.dtd searchbar.dtd engineManager.prope...
...h provides a very rough guide on where to start and in what order to proceed through translation. The localization phase lists (Firefox 3.5: ff35.phaselist, Firefox 3.6: ff36.phaselist). Description of phases. Land your translated files one by one, making sure it follows the *mozilla-1.9.2* structure. This will familiarize you with our "Hg" commands and will get us something that we can im
port easily when you are done. Working with Bit Bucket Before a team becomes official, we like to get the localizers comfortable with the Hg commands that allow for cloning, pulling, committing, and pushing work to an experimental repository. We use a web service called Bit Bucket to start the learning process. To begin, contact the l10n-drivers to let them know that you are interested in starting...
...You can do this by entering the following URL into your browser: $ https://bitbucket.org/mozillal10n/ab-CD/overview/ (where ab-CD will be replaced by your locale code) At that main page of your newly created Bit Bucket repo, you'll see the Hg commands, $ hg clone http://bitbucket.org/mozillal10n/ab-CD/ ... $ hg pull -u # to pull changes and update $ hg push # to push changes to this repo Im
port existing data? $ cd /path/to/existing/hg/repo/ $ hg push http://bitbucket.org/mozillal10n/ab-CD/ Prefer SSH? $ hg clone ssh://hg@bitbucket.org/mozillal10n/ab-CD/ $ hg push ssh://hg@bitbucket.org/mozillal10n/ab-CD/ As you begin to move through your translations, you should "commit" the changes locally and "push" your work to this experimental respository. For instance, if you have finished tr...
Localizing extension metadata on addons.mozilla.org
Remember, all fields are optional when localizing. ...
... When you submit a new extension to AMO, the process is divided into several steps. In step 2, you'll be asked to provide the attributes listed above in the add-on's default locale (selected in step 1). The values you provide here are used as fallback values if someone requests a language that doesn't exist. Step 4 allows you to translate any of the above fields into any other language AMO sup
ports. Remember, all fields are optional when localizing. Any field that is blank will just show up in the default locale. Getting translation help You are kindly advised NOT to use any automatic online translation, which can bring unpleasant low-quality output to users. Always prefer a qualified human translation. AMO doesn't directly provide translation assistance to extension authors, but there ...
...ion assistance to extension authors, but there are a couple services that can help: BabelZilla.org BabelZilla.org is a community dedicated to the localization of extensions for Moz family apps. They are volunteer translators from all over the world and are maintaining translations for more than 400 extensions with an online translation system. They also provide help for adding a localization sup
port to your extension if there is no localization structure yet. You can already request for AMO fields localization on the forums, and these fields will be added soon to the Web Translation System. Amazon Mechanical Turk This is not free, but for a very modest amount of money you can get your AMO page quickly translated by native speakers. Create an account and then, using the "Basic Open-ended Qu...
...Localization codes AMO offers 33 localizations, including English. Here is a list of the codes: Arabic (ar), Catalan (ca), Czech (cs), Danish (da), German (de), Greek (el), Basque (eu), Spanish (es-ES), Farsi (fa), Finnish (fi), French (fr), Gaeilge (ga-IE), Hebrew (he), Hungarian (hu), Indonesian (id), Italian (it), Japanese (ja), Korean (ko), Mongolian (mn), Dutch (nl), Polish (pl), Brazilian
Portuguese (pt-BR), European
Portuguese (pt-PT), Romanian (ro), Russian (ru), Slovakian (sk), Albanian (sq), Swedish (sv-SE), Ukrainian (uk), Vietnamese (vi), Chinese (zh-CN) and Taiwanese (zh-TW). ...
BloatView
mber to look for the worst offenders. (Should be zero!) Objects Total - The total count of objects allocated of a given class. Objects Rem - The number of objects allocated of a given class that weren't deleted. (Should be zero!) Interesting things to look for: Are your classes in the list? - Look! If they aren't, then you're not using the NS_IMPL_ADDREF and NS_IMPL_RELEASE (or NS_IMPL_ISUP
PORTS which calls them) for xpcom objects, or MOZ_COUNT_CTOR and MOZ_COUNT_DTOR for non-xpcom objects. Not having your classes in the list is not ok. That means no one is looking at them, and we won't be able to tell if someone introduces a leak. (See below for how to fix this.) The Bytes Leaked for your classes should be zero! - Need I say more? If it isn't, you should use the other tools to fix it.
...show the same statistics but counting objects or AddRef'd references rather than bytes. Comparing Bloat Logs You can also compare any two bloat logs (either those produced when the program shuts down, or written to the bloatlogs directory) by running the following program. ...
...The delta numbers show the percentage change between runs for the amount of leaks and amount of bloat (negative numbers are better!). The bloat number is a metric determined by multiplying the total number of objects allocated of a given class by the class size. Note that although this isn't necessarily the amount of memory consumed at ...
... If your object is not an xpcom object then some manual editing is in order. The following sample code shows what must be done: MyType::MyType() { MOZ_COUNT_CTOR(MyType); ... } MyType::~MyType() { MOZ_COUNT_DTOR(MyType); ... } ...
Power profiling overview
It serves as a starting point for anybody doing power profiling for the first time. Basic physics concepts In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. In SI units, energy is measured in Joules, and power is measured in Watts, which is equivalent to Joules per second. Although power is an instantaneous concept, in practice measurements of it are determined in a non-instantaneous fashion, i.e. by dividing an energy amount by a non-infinitesimal time period. ...
...are popular applications and can be power-intensive, and therefore can significantly affect battery life. As a result, it is worth optimizing (i.e. reducing) the power consumption caused by Firefox and Firefox OS. Intel processor basics Processor layout The following diagram (from the Intel Power Governor documentation) shows how machines using recent Intel processors are constructed. The im
portant points are as follows. The processor has one or more packages. These are part of the actual processor that you buy from Intel. Client processors (e.g. Core i3/i5/i7) have one package. Server processors (e.g. Xeon) typically have two or more packages. Each package contains multiple cores. Each core typically has hyper-threading, which means it contains two logical CPUs. The part of the pa...
...s the active/busy state, where instructions are being executed. The other states have higher numbers and reflect increasing deeper idle states. The deeper an idle state is, the less power it uses, but the longer it takes to wake up from. Note: the ACPI standard specifies four states, C0, C1, C2 and C3. Intel maps these to processor-specific states such as C0, C1, C2, C6 and C7. and many tools re
port C-states using the latter names. The exact relationship is confusing, and chapter 13 of the Intel optimization manual has more details. The im
portant thing is that C0 is always the active state, and for the idle states a higher number always means less power consumption. The other thing to note about C-states is that they apply both to cores and the entire package -- i.e. if all cores are idle ...
...r example, the Gecko Profiler takes samples at 1000Hz using a timer. Each of these samples can trigger a wakeup, which consumes power and obscures Firefox's natural wakeup patterns. For this reason, integrating power measurements into the Gecko Profiler is unlikely to be useful, and other power profiling tools typically use much lower sampling rates (e.g. 1Hz.) P-states Intel processors also sup
port multiple P-states. P0 is the state where the processor is operating at maximum frequency and voltage, and higher-numbered P-states operate at a lower frequency and voltage to reduce power consumption. Processors can have dozens of P-states, but the transitions are controlled by the hardware and OS and so P-states are of less interest to application developers than C-states. Power and power-relat...
Refcount tracing and balancing
Refcount tracing and balancing are advanced techniques for tracking down leak of refcounted objects found with BloatView. The first step is to run Firefox with refcount tracing enabled, which produces one or more log files. Refcount tracing logs calls to Addref and Release, preferably for a particular set of classes, including call-stacks in symbolic form (on platforms that sup
port this). Refcount balancing is a follow-up step that analyzes the resulting log to help a developer figure out where refcounting went wrong. How to build for refcount tracing Build with --enable-debug or --enable-logrefcnt. How to run with refcount tracing on There are several environment variables that can be used. First, you select one of three environment variables to choose what kind of logging you wa...
... never use this without XPCOM_MEM_LOG_CLASSES and/or XPCOM_MEM_LOG_OBJECTS, because without some filtering the logging will be completely useless due to how slow the browser will run and how large the logs it produces will be. XPCOM_MEM_COMPTR_LOG This environment variable enables logging of additions and releases of objects into nsCOMPtrs. ...
...This results in slower code, but at least you get some data about where the leaks might be occurring from. ...
... all platforms. However, having an nsCOMPtr log and using it in the creation of the balance tree allows AddRef and Release calls that we know are matched to be eliminated from the tree, so it makes it much easier to debug reference count leaks of objects that have a large amount of reference counting traffic. XPCOM_MEM_ALLOC_LOG For platforms that don't have stack-crawl sup
port, XPCOM sup
ports logging at the call site to AddRef/Release using the usual cpp __FILE__ and __LINE__ number macro expansion hackery. This results in slower code, but at least you get some data about where the leaks might be occurring from. You must also set one or two additional environment variables, XPCOM_MEM_LOG_CLASSES and XPCOM_MEM_LOG_OBJECTS, to reduce the set of objects being logged, in order to impro...
MailNews automated testing
Functional testing xpcshell-tests and make check These are core test harnesses to which MailNews adds its own tests. These tests are run against almost every changeset that gets committed to the Thunderbird and SeaMonkey code bases. xpcshell-tests are run in JavaScript without any chrome present. ...
... Functional testing xpcshell-tests and make check These are core test harnesses to which MailNews adds its own tests. These tests are run against almost every changeset that gets committed to the Thunderbird and SeaMonkey code bases. xpcshell-tests are run in JavaScript without any chrome present. ...
...e the quickest tests to run. MailNews provides additional facilities as described on the MailNews automated testing page (see below). "make check" is used to run compiled code tests. These tests can go beyond the limitations of xpcshell-tests (for example, access c++ code) and other testing options that don't test at the right level. Testing frameworks The AsyncTestUtils Extended Framework sup
ports: Asynchronous test operation: A reasonably convenient means of writing tests that involve asynchronous operations by using generators. In the long term we would like to lose this extra complexity in favor of the event-loop-spinning style of operation used by mozmill. Message synthesis: Create messages by specifying what properties the messages should have. Message injection: Inject synthesi...
... complexity in favor of the event-loop-spinning style of operation used by mozmill. Message synthesis: Create messages by specifying what properties the messages should have. Message injection: Inject synthesized messages via local or IMAP (using a fake server). Message manipulation: Mark messages as read, tag them, untag them, move them to other folders, trash them, etc. Enhanced logging: Sup
ports generating rich JSON streams to disk or over the network for consumption by LogSploder or other tools. Performance testing Mail leak and bloat tests These tests start up Thunderbird or SeaMonkey and record any leaks found, as well as the total memory requirement. Although currently based on simple tests, these are useful for determining if new leaks have been introduced. For more informatio...
Cryptography functions
ons based on the PKCS #11 interface. If documentation is available for a function listed below, the function name is linked to either its MDC wiki page or its entry in the old SSL Reference. The Mozilla Cross Reference (MXR) link for each function provides access to the function definition, prototype definition, and source code references. The NSS version column indicates which versions of NSS sup
port the function. Function name/documentation Source code NSS versions PK11_AlgtagToMechanism MXR 3.2 and later PK11_Authenticate MXR 3.2 and later PK11_BlockData MXR 3.2 and later PK11_ChangePW MXR 3.2 and later PK11_CheckUserPassword MXR ...
... PK11_DestroyTokenObject MXR 3.2 and later PK11_DigestBegin MXR 3.2 and later PK11_DigestKey MXR 3.2 and later PK11_DigestOp MXR 3.2 and later PK11_DigestFinal MXR 3.2 and later PK11_DoesMechanism MXR 3.2 and later PK11_Ex
portEncryptedPrivateKeyInfo MXR 3.2 and later PK11_Ex
portEncryptedPrivKeyInfo MXR 3.9 and later PK11_Ex
portPrivateKeyInfo MXR 3.2 and later PK11_Finalize MXR 3.2 and later PK11_FindBestKEAMatch MXR 3.2 and later PK11_FindCertAndKeyByRecipientList MXR 3...
...er PK11_GetTokenInfo MXR 3.2 and later PK11_GetTokenName MXR 3.2 and later PK11_GetWindow MXR 3.2 and later PK11_GetWrapKey MXR 3.2 and later PK11_HashBuf MXR 3.2 and later PK11_HasRootCerts MXR 3.4 and later PK11_Im
portCert MXR 3.5 and later PK11_Im
portCertForKeyToSlot MXR 3.2 and later PK11_Im
portCRL MXR 3.6 and later PK11_Im
portDERCert MXR 3.6 and later PK11_Im
portDERPrivateKeyInfoAndReturnKey MXR 3.4 and later PK11_Im
portEncryptedPrivateKeyInfo MXR 3.2 and lat...
...nd later PK11_Im
portCertForKeyToSlot MXR 3.2 and later PK11_Im
portCRL MXR 3.6 and later PK11_Im
portDERCert MXR 3.6 and later PK11_Im
portDERPrivateKeyInfoAndReturnKey MXR 3.4 and later PK11_Im
portEncryptedPrivateKeyInfo MXR 3.2 and later PK11_Im
portPrivateKeyInfo MXR 3.2 and later PK11_Im
portPrivateKeyInfoAndReturnKey MXR 3.4 and later PK11_Im
portPublicKey MXR 3.4 and later PK11_Im
portSymKeyWithFlags MXR 3.4 and later PK11_InitPin MXR 3.2 and later PK11_IsFIPS MXR 3.2 and later ...
NSS 3.14.1 release notes
purposes of testing. New Functions in ocspt.h CERT_CreateOCSPSingleResponseGood CERT_CreateOCSPSingleResponseUnknown CERT_CreateOCSPSingleResponseRevoked CERT_CreateEncodedOCSPSuccessResponse CERT_CreateEncodedOCSPErrorResponse New Types in ocspt.h CERTOCSPResponderIDType Notable Changes in NSS 3.14.1 Windows CE sup
port has been removed from the code base. Bug 812399 - In NSS 3.14, a regression caused Bug 641052 / CVE-2011-3640 to be re-introduced under certain situations. This regression only affected applications that initialize NSS via the NSS_NoDB_Init function. NSS 3.14.1 includes the complete fix for this issue. Bug 357025 - NSS 3.14 added sup
port for tokens that make use of CKA_ALWAYS_AUTHENTICATE. Ho...
...NSS now correctly respects the supplied cipherOrder. Applications which use multiple PKCS#11 modules, which do not indicate which tokens should be used by default for particular algorithms, and which do make use of cipherOrder may now find that cryptographic operations occur on a different PKCS#11 token. ...
..., which do not indicate which tokens should be used by default for particular algorithms, and which do make use of cipherOrder may now find that cryptographic operations occur on a different PKCS#11 token. Bug 802429 - The NSS softoken is now the default token for SHA-256 and SHA-512. In previous versions of NSS, these algorithms would be handled by the most recently added PKCS#11 token that sup
ported them. Bug 611451 - When built with the current version of Apple XCode on Mac OS X, the NSS shared libraries will now only ex
port the public NSS functions. Bug 810582 - TLS False Start is now only used with servers that negotiate a cipher suite that sup
ports forward secrecy. Note: The criteria for False Start may change again in future NSS releases. Bugs fixed in NSS 3.14.1 The followin...
...l older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.14.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered in this release should be re
ported by filing a bug re
port at https://bugzilla.mozilla.org with the Product of NSS. ...
NSS 3.15.1 release notes
elease for NSS 3.15. The bug fixes in NSS 3.15.1 are described in the "Bugs Fixed" section below. Distribution Information NSS 3.15.1 source distributions are also available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_15_1_RTM/src/ New in NSS 3.15.1 New Functionality TLS 1.2: TLS 1.2 (RFC 5246) is sup
ported. HMAC-SHA256 cipher suites (RFC 5246 and RFC 5289) are sup
ported, allowing TLS to be used without MD5 and SHA-1. Note the following limitations. The hash function used in the signature for TLS 1.2 client authentication must be the hash function of the TLS 1.2 PRF, which is always SHA-256 in NSS 3.15.1. AES GCM cipher suites are not yet sup
ported. New Functions None. Ne...
...protocol version of TLS 1.2 on the wire, value 0x0303. TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_NULL_SHA256 - New TLS 1.2 only HMAC-SHA256 cipher suites. in sslerr.h SSL_ERROR_UNSUP
PORTED_HASH_ALGORITHM, SSL_ERROR_DIGEST_FAILURE, SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM - New error codes for TLS 1.2. in sslt.h ssl_hmac_sha256 - A new value in the SSLMACAlgorithm enum type. ssl_signature_algorithms_xtn - A new value in the SSLExtensionType enum type. New PKCS #11 Mechanisms None. Notable Changes in NSS 3.15.1 Bug 856060 - Enforce name constra...
...8 - Fix ssltap to print the certificate_status handshake message correctly. Bug 882829 - On Windows, NSS initialization fails if NSS cannot call the RtlGenRandom function. Bug 875601 - SECMOD_CloseUserDB/SECMOD_OpenUserDB fails to reset the token delay, leading to spurious failures. Bug 884072 - Fix a typo in the header include guard macro of secmod.h. Bug 876352 - certutil now warns if im
porting a PEM file that contains a private key. Bug 565296 - Fix the bug that shlibsign exited with status 0 even though it failed. The NSS_SURVIVE_DOUBLE_BYPASS_FAILURE build option is removed. Bugs fixed in NSS 3.15.1 https://bugzilla.mozilla.org/buglist.cgi?list_id=5689256;resolution=FIXED;classification=Components;query_format=advanced;target_milestone=3.15.1;product=NSS Compatibility NSS...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.15.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.16.2.3 release notes
Fixed" section below. Distribution Information The HG tag is NSS_3_16_2_3_RTM. NSS 3.16.2.3 requires NSPR 4.10.6 or newer. NSS 3.16.2.3 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_16_2_3_RTM/src/ New in NSS 3.16.2.3 This patch release fixes a bug and contains a back
port of the TLS_FALLBACK_SCSV feature, which was originally made available in NSS 3.17.1. New Functionality TLS_FALLBACK_SCSV is a signaling cipher suite value that indicates a handshake is the result of TLS version fallback. New Macros in ssl.h SSL_ENABLE_FALLBACK_SCSV - an SSL socket option that enables TLS_FALLBACK_SCSV. Off by default. in sslerr.h SSL_ERROR_INAPPROPRIAT...
... SSL_ENABLE_FALLBACK_SCSV - an SSL socket option that enables TLS_FALLBACK_SCSV. Off by default. in sslerr.h SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT - a new SSL error code. in sslproto.h TLS_FALLBACK_SCSV - a a signaling cipher suite value that indicates a handshake is the result of TLS version fallback. ...
...r code. in sslproto.h TLS_FALLBACK_SCSV - a a signaling cipher suite value that indicates a handshake is the result of TLS version fallback. Notable Changes in NSS 3.16.2.3 Bug 1057161: Check that an im
ported elliptic curve public key is valid. Previously NSS would only validate the peer's public key before performing ECDH key agreement. Now EC public keys are validated at im
port time. Bugs fixed in NSS 3.16.2.3 Bug 1057161 - NSS hangs with 100% CPU on invalid EC key Bug 1036735 - Add sup
port for draft-ietf-tls-downgrade-scsv to NSS Compatibility NSS 3.16.2.3 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.2.3 shared libraries without recompiling or reli...
...ible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.2.3 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.16.2 release notes
16.2 are described in the "Bugs Fixed" section below. Distribution Information The HG tag is NSS_3_16_2_RTM. NSS 3.16.2 requires NSPR 4.10.6 or newer. NSS 3.16.2 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_16_2_RTM/src/ New in NSS 3.16.2 New Functionality DTLS 1.2 is sup
ported. The TLS application layer protocol negotiation (ALPN) extension is also sup
ported on the server side. RSA-OEAP is sup
ported. Use the new PK11_PrivDecrypt and PK11_PubEncrypt functions with the CKM_RSA_PKCS_OAEP mechanism. New Intel AES assembly code for 32-bit and 64-bit Windows, contributed by Shay Gueron and Vlad Krasnov of Intel. New Functions in cert.h CERT_AddExtensionByOID - ...
...TYPE. PK11_PubEncrypt - encrypts with a public key. The algorithm is specified with a CK_MECHANISM_TYPE. New Macros in sslerr.h SSL_ERROR_NEXT_PROTOCOL_NO_CALLBACK - An SSL error code that means the next protcol negotiation extension was enabled, but the callback was cleared prior to being needed. ...
..._ERROR_NEXT_PROTOCOL_NO_PROTOCOL - An SSL error code that means the server sup
ports no protocols that the client advertises in the ALPN extension. Notable Changes in NSS 3.16.2 The btoa command has a new command-line option -w suffix, which causes the output to be wrapped in BEGIN/END lines with the given suffix. Use "c" as a shorthand for the suffix CERTIFICATE. The certutil commands sup
ports additionals types of subject alt name extensions: --extSAN type:name[,type:name]... ...
...the ALPN extension. Notable Changes in NSS 3.16.2 The btoa command has a new command-line option -w suffix, which causes the output to be wrapped in BEGIN/END lines with the given suffix. Use "c" as a shorthand for the suffix CERTIFICATE. The certutil commands sup
ports additionals types of subject alt name extensions: --extSAN type:name[,type:name]... The certutil commands sup
ports generic certificate extensions, by loading binary data from files, which have been prepared using external tools, or which have been extracted and dumped to file from other existing certificates: --dump-ext-val OID --extGeneric OID:critical-flag:filename[,OID:critical-flag:filename]... The certutil command has three new certificate usage specifiers: L: certificateUsageSSLCA...
NSS 3.17.1 release notes
dvisories The following security-relevant bugs have been resolved in NSS 3.17.1. Users are encouraged to upgrade immediately. Bug 1064636 - (CVE-2014-1568) RSA Signature Forgery in NSS. See also MFSA 2014-73 for details. New in NSS 3.17.1 This patch release adds new functionality and fixes a bug that caused NSS to accept forged RSA signatures. A new symbol, _SGN_VerifyPKCS1DigestInfo is ex
ported in this release. As with all ex
ported NSS symbols that have a leading underscore '_', this is an internal symbol for NSS use only. Applications that use or depend on these symbols can and will break in future NSS releases. New Functionality TLS_FALLBACK_SCSV is a signaling cipher suite value that indicates a handshake is the result of TLS version fallback. New Macros in ssl.h SS...
...ion that enables TLS_FALLBACK_SCSV. Off by default. in sslerr.h SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT - a new SSL error code. in sslproto.h TLS_FALLBACK_SCSV - a a signaling cipher suite value that indicates a handshake is the result of TLS version fallback. Notable Changes in NSS 3.17.1 Signature algorithms now use SHA-256 instead of SHA-1 by default. Added sup
port for Linux on little-endian powerpc64. Bugs fixed in NSS 3.17.1 This Bugzilla query returns all the bugs fixed in NSS 3.17.1: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.17.1 Acknowledgements The NSS development team would like to thank Antoine Delignat-Lavaud, security researcher at Inria Paris in t...
... Compatibility NSS 3.17.1 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.17.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.17.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.25 release notes
NSS 3.25 source distributions are available on ftp.mozilla.org for secure HTTPS download at the following location. Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_25_RTM/src/ New in NSS 3.25 New Functionality Implemented DHE key agreement for TLS 1.3. Added sup
port for ChaCha with TLS 1.3. ...
... tag is NSS_3_25_RTM. NSS 3.25 requires Netscape
Portable Runtime (NSPR) 4.12 or newer. NSS 3.25 source distributions are available on ftp.mozilla.org for secure HTTPS download at the following location. Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_25_RTM/src/ New in NSS 3.25 New Functionality Implemented DHE key agreement for TLS 1.3. Added sup
port for ChaCha with TLS 1.3. Added sup
port for TLS 1.2 ciphersuites that use SHA384 as the PRF. Removed the limitation that allowed NSS to only sup
port certificate_verify messages that used the same signature hash algorithm as the PRF when using TLS 1.2 client authentication. Several functions have been added to the public API of the NSS Cryptoki Framework. New Functions in nssckfw.h N...
...n. Several functions have been added to the public API of the NSS Cryptoki Framework. New Functions in nssckfw.h NSSCKFWSlot_GetSlotID NSSCKFWSession_GetFWSlot NSSCKFWInstance_DestroySessionHandle NSSCKFWInstance_FindSessionHandle Notable Changes in NSS 3.25 An SSL socket can no longer be configured to allow both TLS 1.3 and SSL v3. Regression fix: NSS no longer re
ports a failure if an application attempts to disable the SSL v2 protocol. The trusted CA certificate list has been updated to version 2.8. The following CA certificate was Removed CN = Sonera Class1 CA SHA-256 Fingerprint: CD:80:82:84:CF:74:6F:F2:FD:6E:B5:8A:A1:D5:9C:4A:D4:B3:CA:56:FD:C6:27:4A:89:26:A7:83:5F:32:31:3D The following CA certificates were Added CN =...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.25 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.27 release notes
NSS 3.27 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_27_RTM/src/ New in NSS 3.27 New Functionality Allow custom named group priorities for TLS key exchange handshake (SSL_NamedGroupConfig). ...
...NSS 3.27 requires Netscape
Portable Runtime (NSPR) 4.13 or newer. NSS 3.27 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_27_RTM/src/ New in NSS 3.27 New Functionality Allow custom named group priorities for TLS key exchange handshake (SSL_NamedGroupConfig). ...
...a.org/pub/mozilla.org/security/nss/releases/NSS_3_27_RTM/src/ New in NSS 3.27 New Functionality Allow custom named group priorities for TLS key exchange handshake (SSL_NamedGroupConfig). Added sup
port for RSA-PSS signatures in TLS 1.2 and TLS 1.3 New Functions in ssl.h SSL_NamedGroupConfig Notable Changes in NSS 3.27 UPDATE 2016-10-02: The maximum TLS version sup
ported has been increased to TLS 1.3 (draft). Although the maximum TLS version enabled by default is still TLS 1.2, there are applications that query the list of TLS protocol versions sup
ported by NSS, and enable all sup
ported versions. For those applications, updating to NSS 3.27 may result in TLS 1.3 (draft) to be enabled. The TLS 1.3 (draft) protocol can be disabled, by defining symbol NSS_DI...
... backwards compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.27 shared libraries without recompiling or relinking. Applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.30 release notes
Introduction The Network Security Services (NSS) team has released NSS 3.30, which is a minor release. Distribution information The hg tag is NSS_3_30_RTM. NSS 3.30 requires Netscape
Portable Runtime (NSPR); 4.13.1 or newer. NSS 3.30 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_30_RTM/src/ New in NSS 3.30 New Functionality In the PKCS#11 root CA module (nssckbi), CAs with positive trust are marked with a new boolean attribute, CKA_NSS_MOZILLA_CA_POLICY, set to true. Applications that need to distinguish them from other other root CAs, may use the ex
ported function PK11_HasAttributeSet. Sup
port for callback functions that can be used to monitor SSL/TLS...
...ssionTicketKeyPair - configures an asymmetric key pair, for use in wrapping session ticket keys, used by the server. This function currently only accepts an RSA public/private key pair. New Macros in ciferfam.h PKCS12_AES_CBC_128, PKCS12_AES_CBC_192, PKCS12_AES_CBC_256 - cipher family identifiers corresponding to the PKCS#5 v2.1 AES based encryption schemes used in the PKCS#12 sup
port in NSS in pkcs11n.h CKA_NSS_MOZILLA_CA_POLICY - identifier for a boolean PKCS#11 attribute, that should be set to true, if a CA is present because of it's acceptance according to the Mozilla CA Policy Notable Changes in NSS 3.30 The TLS server code has been enhanced to sup
port session tickets when no RSA certificate (e.g. only an ECDSA certificate) is configured. RSA-PSS si...
...tribute, that should be set to true, if a CA is present because of it's acceptance according to the Mozilla CA Policy Notable Changes in NSS 3.30 The TLS server code has been enhanced to sup
port session tickets when no RSA certificate (e.g. only an ECDSA certificate) is configured. RSA-PSS signatures produced by key pairs with a modulus bit length that is not a multiple of 8 are now sup
ported. The pk12util tool now sup
ports im
porting and ex
porting data encrypted in the AES based schemes defined in PKCS#5 v2.1. Bugs fixed in NSS 3.30 This Bugzilla query returns all the bugs fixed in NSS 3.30: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.30 Compatibility NSS 3.30 shared libraries are bac...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.30 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.31 release notes
NSS 3.31 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_31_RTM/src/ New in NSS 3.31 New Functionality Allow certificates to be specified by RFC7512 PKCS#11 URIs. ...
...h Several new macros that start with PK11URI_PATTR_ for path attributes defined in RFC7512. Several new macros that start with PK11URI_QATTR_ for query attributes defined in RFC7512. Notable Changes in NSS 3.31 The APIs that set a TLS version range have been changed to trim the requested range to the overlap with a systemwide crypto policy, if configured. SSL_VersionRangeGetSup
ported can be used to query the overlap between the library's sup
ported range of TLS versions and the systemwide policy. Previously, SSL_VersionRangeSet and SSL_VersionRangeSetDefault returned a failure if the requested version range wasn't fully allowed by the systemwide crypto policy. They have been changed to return success, if at least one TLS version overlaps between the requested range and the ...
...owed by the systemwide crypto policy. They have been changed to return success, if at least one TLS version overlaps between the requested range and the systemwide policy. An application may call SSL_VersionRangeGet and SSL_VersionRangeGetDefault to query the TLS version range that was effectively activated. Corrected the encoding of Domain Name Constraints extensions created by certutil NSS sup
ports a clean seeding mechanism for *NIX systems now using only /dev/urandom. This is used only when SEED_ONLY_DEV_URANDOM is set at compile time. CERT_AsciiToName can handle OIDs in dotted decimal form now. Bugs fixed in NSS 3.31 This Bugzilla query returns all the bugs fixed in NSS 3.31: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&pr...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.31 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.33 release notes
NSS 3.33 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_33_RTM/src/ Notable Changes in NSS 3.33 TLS compression is no longer sup
ported. API calls that attempt to enable compression are accepted without failure. ...
...is a minor release. Distribution information The hg tag is NSS_3_33_RTM. NSS 3.33 requires Netscape
Portable Runtime (NSPR) 4.17, or newer. NSS 3.33 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_33_RTM/src/ Notable Changes in NSS 3.33 TLS compression is no longer sup
ported. API calls that attempt to enable compression are accepted without failure. However, TLS compression will remain disabled. This version of NSS uses a formally verified implementation of Curve25519 on 64-bit systems. The compile time flag DISABLE_ECC has been removed. When NSS is compiled without NSS_FORCE_FIPS=1 startup checks are no longer performed. Fixes CVE-2017-7805, a potential use-af...
...an additional password context parameter. CERT_FindCertByNicknameOrEmailAddrCX - a variation of existing function CERT_FindCertByNicknameOrEmailAddr that accepts an additional password context parameter. CERT_FindCertByNicknameOrEmailAddrForUsageCX - a variation of existing function CERT_FindCertByNicknameOrEmailAddrForUsage that accepts an additional password context parameter. in sec
port.h NSS_SecureMemcmpZero - check if a memory region is all zero in constant time.
PORT_ZAllocAligned - allocate aligned memory.
PORT_ZAllocAlignedOffset - allocate aligned memory for structs. in ssl.h SSL_GetExperimentalAPI - access experimental APIs in libssl. Bugs fixed in NSS 3.33 This Bugzilla query returns all the bugs fixed in NSS 3.33: https://bugzilla.mozill...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.33 shared libraries, without recompiling, or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (select product 'NSS'). ...
NSS 3.44 release notes
ttps://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_44_RTM/src/ Other releases are available in NSS Releases. New in NSS 3.44 New Functionality New Functions in lib/certdb/cert.h CERT_GetCertificateDer - Access the DER-encoded form of a CERTCertificate. ...
... releases are available in NSS Releases. New in NSS 3.44 New Functionality New Functions in lib/certdb/cert.h CERT_GetCertificateDer - Access the DER-encoded form of a CERTCertificate. Notable Changes in NSS 3.44 It is now possible to build NSS as a static library (Bug 1543545) Initial sup
port for building for iOS. ...
... should make at most one sql query, rather than one for each attribute 1531236 - Provide accessor for CERTCertificate.derCert 1536734 - lib/freebl/crypto_primitives.c assumes a big endian machine 1532384 - In NSS test certificates, use @example.com (not @bogus.com) 1538479 - Post-Handshake messages after async server authentication break when using record layer separation 1521578 - x25519 sup
port in pk11pars.c 1540205 - freebl build fails with -DNSS_DISABLE_CHACHAPOLY 1532312 - post-handshake auth doesn't interoperate with OpenSSL 1542741 - certutil -F crashes with segmentation fault 1546925 - Allow preceding text in try comment 1534468 - Expose ChaCha20 primitive 1418944 - Quote CC/CXX variables passed to nspr 1543545 - Allow to build NSS as a static library 1487597 - Early data ...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.44 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.50 release notes
-108 KBKDF - PKCS#11 implementation. See Bug 1599603 for details. Bugs fixed in NSS 3.50 Bug 1599514 - Update DTLS 1.3 implementation to Draft-30 Bug 1603438 - Fix native tools build failure due to lack of zlib include dir if external Bug 1599603 - NIST SP800-108 KBKDF - PKCS#11 implementation Bug 1606992 - Cache the most recent PBKDF1 password hash, to speed up repeated SDR operations, im
portant with the increased KDF iteration counts. NSS 3.49.1 sped up PBKDF2 operations, though PBKDF1 operations are also relevant for older NSS databases (also included in NSS 3.49.2) Bug 1608895 - Gyp builds on taskcluster broken by Setuptools v45.0.0 (for lacking Python3) Bug 1574643 - Upgrade HACL* verified implementations of ChaCha20, Poly1305, and 64-bit Curve25519 Bug 1608327 - Two problems w...
... Bug 1547639 - Update zlib in NSS to 1.2.11 Bug 1609181 - Detect ARM (32-bit) CPU features on FreeBSD Bug 1602386 - Fix build on FreeBSD/powerpc* Bug 1608151 - Introduce NSS_DISABLE_ALTIVEC Bug 1612623 - Depend on NSPR 4.25 Bug 1609673 - ...
... AES-NI for non-GCM AES ciphers on platforms with no assembly-optimized implementation, such as macOS. Bug 1547639 - Update zlib in NSS to 1.2.11 Bug 1609181 - Detect ARM (32-bit) CPU features on FreeBSD Bug 1602386 - Fix build on FreeBSD/powerpc* Bug 1608151 - Introduce NSS_DISABLE_ALTIVEC Bug 1612623 - Depend on NSPR 4.25 Bug 1609673 - Fix a crash when NSS is compiled without libnssdbm sup
port, but the nssdbm shared object is available anyway. This Bugzilla query returns all the bugs fixed in NSS 3.50: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.50 Compatibility NSS 3.50 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x sh...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.50 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.54 release notes
020, which is a minor release. Distribution Information The HG tag is NSS_3_54_RTM. NSS 3.54 requires NSPR 4.26 or newer. NSS 3.54 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_54_RTM/src/ Other releases are available in NSS Releases. Notable Changes in NSS 3.54 Sup
port for TLS 1.3 external pre-shared keys (Bug 1603042). Use ARM Cryptography Extension for SHA256, when available. (Bug 1528113). Certificate Authority Changes The following CA certificates were Added: Bug 1645186 - certSIGN Root CA G2 SHA-256 Fingerprint: 657CFE2FA73FAA38462571F332A2363A46FCE7020951710702CDFBB6EEDA3305 Bug 1645174 - e-Szigno Root CA 2017 ...
...- VeriSign Class 3 Public Primary Certification Authority - G3 SHA-256 Fingerprint: EB04CF5EB1F39AFA762F2BB120F296CBA520C1B97DB1589565B81CB9A17B7244 A number of certificates had their Email trust bit disabled. See Bug 1618402 for a complete list. Bugs fixed in NSS 3.54 Bug 1528113 - Use ARM Cryptography Extension for SHA256. Bug 1603042 - Add TLS 1.3 external PSK sup
port. Bug 1642802 - Add uint128 sup
port for HACL* curve25519 on Windows. Bug 1645186 - Add "certSIGN Root CA G2" root certificate. Bug 1645174 - Add Microsec's "e-Szigno Root CA 2017" root certificate. Bug 1641716 - Add Microsoft's non-EV root certificates. Bug 1621151 - Disable email trust bit for "O=Government Root Certification Authority; C=TW" root. Bug 1645199 - Remove AddTrust root certifi...
...rtification Authority; C=TW" root. Bug 1645199 - Remove AddTrust root certificates. Bug 1641718 - Remove "LuxTrust Global Root 2" root certificate. Bug 1639987 - Remove "Staat der Nederlanden Root CA - G2" root certificate. Bug 1618402 - Remove Symantec root certificates and disable email trust bit. Bug 1640516 - NSS 3.54 should depend on NSPR 4.26. Bug 1642146 - Fix undefined reference to `
PORT_ZAlloc_stub' in seed.c. Bug 1642153 - Fix infinite recursion building NSS. Bug 1642638 - Fix fuzzing assertion crash. Bug 1642871 - Enable SSL_SendSessionTicket after resumption. Bug 1643123 - Sup
port SSL_Ex
portEarlyKeyingMaterial with External PSKs. Bug 1643557 - Fix numerous compile warnings in NSS. Bug 1644774 - SSL gtests to use ClearServerCache when resetting self-encrypt keys. Bug 16...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.54 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS Sample Code Sample_1_Hashing
hash of a file and save it to another file. This program illustrates the use of NSS message APIs. ...
... char *hashName; SECOidTag oid; } NameTagPair; /* The hash algorithms sup
ported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* * Maps a hash name to a SECOidTag. ...
...A1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* * Maps a hash name to a SECOidTag. ...
...hOIDTag = HashNameToOIDTag(hashName); if (hashOIDTag == SEC_OID_UNKNOWN) { fprintf(stderr, "%s: invalid digest type - %s\n", progName, hashName); Usage(progName); } /* Digest it and print the result */ rv = DigestFile(PR_STDOUT, PR_STDIN, hashOIDTag); if (rv != SECSuccess) { fprintf(stderr, "%s: problem digesting data (%d)\n", progName,
PORT_GetError()); } rv = NSS_Shutdown(); if (rv != SECSuccess) { exit(-1); } return 0; } </sechash.h></secmodt.h></secoid.h></prio.h></plgetopt.h></prtypes.h></prprf.h> ...
Hashing - sample 1
MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. ...
... char *hashName; SECOidTag oid; } NameTagPair; /* The hash algorithms sup
ported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* * Maps a hash name to a SECOidTag. ...
...A1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* * Maps a hash name to a SECOidTag. ...
...hOIDTag = HashNameToOIDTag(hashName); if (hashOIDTag == SEC_OID_UNKNOWN) { fprintf(stderr, "%s: invalid digest type - %s\n", progName, hashName); Usage(progName); } /* Digest it and print the result */ rv = DigestFile(PR_STDOUT, PR_STDIN, hashOIDTag); if (rv != SECSuccess) { fprintf(stderr, "%s: problem digesting data (%d)\n", progName,
PORT_GetError()); } rv = NSS_Shutdown(); if (rv != SECSuccess) { exit(-1); } return 0; } ...
sample1
1. A program to compute the hash of a file and save it to another file. ...
...ame; SECOidTag oid; } NameTagPair; /* The hash algorithms sup
ported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* Maps a hash name to a SECOidTag. ...
... "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* Maps a hash name to a SECOidTag. ...
... hashOIDTag = HashNameToOIDTag(hashName); if (hashOIDTag == SEC_OID_UNKNOWN) { fprintf(stderr, "%s: invalid digest type - %s\n", progName, hashName); Usage(progName); } /* Digest it and print the result */ rv = DigestFile(PR_STDOUT, PR_STDIN, hashOIDTag); if (rv != SECSuccess) { fprintf(stderr, "%s: problem digesting data (%d)\n", progName,
PORT_GetError()); } rv = NSS_Shutdown(); if (rv != SECSuccess) { exit(-1); } return 0; } ...
Notes on TLS - SSL 3.0 Intolerant Servers
The connection seems terminated and a blank page is displayed. This is the main symptom of the problem when Mozilla based browsers encounter TLS/SSL 3.0 intolerant servers. Cause There are some number of web servers in production today which incorrectly implement the SSL 3.0 specification. This incorrect implementation causes them to reject connection attempts from clients that are compliant with the SSL 3.0 and TLS (aka SSL 3.1) specifications. ...
...back detection incorrectly are not interoperable with TLS/SSL spec-compliant clients. Normally the servers which have this problem are not equipped to deal with the TLS protocol, but instead of rolling back to SSL 3.0 as the rollback provision provides, they terminate/drop the connection, thus resulting in most cases a blank page display. For up-to-date information, you can read a Bugzilla bug re
port which keeps track of this problem with Mozilla-based browsers. See bug 59321. Servers currently known to exhibit this intolerant behavior As of this writing, this problem has been re
ported for the following servers: (Wherever there is an upgraded version which fixes the problem, it is indicated by an asterisked remark in the parentheses. ) Domino-Go-Webserver/4.6.2.6 (and perhaps some later ...
...option setting at: Edit | Preferences | Privacy and Security | SSL | Enable TLS, and turn it OFF if it is ON for these earlier browsers. Netscape 6.1 or Mozilla 0.9.2 and later These browsers shipped with the TLS option ON but also included a graceful rollback mechanism on the client side when they encounter known TLS/SSL 3.0 intolerant servers. Firefox 2 and later Starting with Firefox 2, sup
port for SSL 2.0 has been disabled by default; unless it is expressly re-enabled by the user using about:config. Website Administrators: How to avoid this problem? Upgrade to a newer version if available, which corrects this problem. There will be other network clients which implement TLS/SSL 3.0 specification correctly and have a problem with your site. Let's not perpetuate the problem servers. ...
...ot catch all problem servers. When you find a secure site which simply does not display any page content or drops the connection, check to see if the preference option Edit | Preferences | Privacy and Security | SSL | Enable TLS is turned ON. If so, turn it OFF. Now re-visit the problem site. If the content displays this time, you are most likely witnessing a TLS/SSL 3.0 intolerant server. Re
port such a problem to the server's administrator. How to re
port an intolerant server Optional:Get the name of the SSL server software used by the website. To do so, add http://toolbar.netcraft.com/site_re
port?url= to the beginning of the URL. The server software will appear next to Server under SSL Certificate Information. For instance, to check https://bugzilla.mozilla.org/, then visit htt...
PKCS 12 functions
The public functions listed here perform PKCS #12 operations required by some of the NSS tools and other applications. The Mozilla Cross Reference (MXR) link for each function provides access to the function definition, prototype definition, and source code references. The NSS version column indicates which versions of NSS sup
port the function. ...
...definition, prototype definition, and source code references. The NSS version column indicates which versions of NSS sup
port the function. ...
... SEC_PKCS12CreateEx
portContext MXR 3.2 and later SEC_PKCS12CreatePasswordPrivSafe MXR 3.2 and later SEC_PKCS12CreateUnencryptedSafe MXR 3.2 and later SEC_PKCS12DecoderFinish MXR 3.2 and later SEC_PKCS12DecoderGetCerts MXR 3.4 and later SEC_PKCS12DecoderIm
portBags MXR 3.2 and later SEC_PKCS12DecoderIterateInit MXR 3.10 and later SEC_PKCS12DecoderIterateNext MXR 3.10 and later SEC_PKCS12DecoderSetTargetTokenCAs MXR 3.8 and later SEC_PKCS12DecoderStart MXR 3.2 and later SEC_PKCS12DecoderUpdate MXR 3.2 and...
... SEC_PKCS12DecoderSetTargetTokenCAs MXR 3.8 and later SEC_PKCS12DecoderStart MXR 3.2 and later SEC_PKCS12DecoderUpdate MXR 3.2 and later SEC_PKCS12DecoderValidateBags MXR 3.2 and later SEC_PKCS12DecoderVerify MXR 3.2 and later SEC_PKCS12DestroyEx
portContext MXR 3.2 and later SEC_PKCS12EnableCipher MXR 3.2 and later SEC_PKCS12Encode MXR 3.2 and later SEC_PKCS12IsEncryptionAllowed MXR 3.2 and later SEC_PKCS12SetPreferredCipher MXR 3.2 and later ...
NSS tools : ssltab
It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII characters. The two parts are separated by a vertical bar. Nonprinting characters are replaced by dots. ...
...h, two separate parts are printed for each record: the plain hex/ASCII output, and the parsed SSL output. -x Turn on hex/ASCII printing of undecoded data inside parsed SSL records. Used only with the -s option. This option uses the same output format as the -h option. -l prefix Turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p
port Change the default rendezvous
port (1924) to another
port. The following are well-known
port numbers: * HTTP 80 * HTTPS 443 * SMTP 25 * FTP 21 * IMAP 143 * IMAPS 993 (IMAP over SSL) * NNTP 119 * NNTPS 563 (NNTP over SSL) Usage and Examples You can use the SSL Debugging Tool to intercept any connection information. Although you can run the tool at its most basic by issuing the ssltap command with ...
...In your browser window, enter the URL http://intercept:1924. ...
...In your browser window, enter the URL http://intercept:1924. The browser retrieves the requested page from the server at www.netscape.com, but the page is intercepted and passed on to the browser by the debugging tool on intercept. ...
NSS tools : ssltap
It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII characters. The two parts are separated by a vertical bar. Nonprinting characters are replaced by dots. ...
...h, two separate parts are printed for each record: the plain hex/ASCII output, and the parsed SSL output. -x Turn on hex/ASCII printing of undecoded data inside parsed SSL records. Used only with the -s option. This option uses the same output format as the -h option. -l prefix Turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p
port Change the default rendezvous
port (1924) to another
port. The following are well-known
port numbers: * HTTP 80 * HTTPS 443 * SMTP 25 * FTP 21 * IMAP 143 * IMAPS 993 (IMAP over SSL) * NNTP 119 * NNTPS 563 (NNTP over SSL) Usage and Examples You can use the SSL Debugging Tool to intercept any connection information. Although you can run the tool at its most basic by issuing the ssltap command with ...
...In your browser window, enter the URL http://intercept:1924. ...
...In your browser window, enter the URL http://intercept:1924. The browser retrieves the requested page from the server at www.netscape.com, but the page is intercepted and passed on to the browser by the debugging tool on intercept. ...
NSS Tools certutil
t can create and modify the Netscape Communicator cert8.db and key3.db database files. It can also list, generate, modify, or delete certificates within the cert8.db file and create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key3.db file. Starting from NSS 3.35, the database format was upgraded to sup
port SQLite as described in this document. It means that cert9.db and key4.db files may be targeted instead. The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database. This document discusses certificate and key database management. For information security module database management, see ...
...erating a new RSA private and public key pair. This argument makes it possible to use hardware-generated seed values and unnecessary to manually create a value from the keyboard. The minimum file size is 20 bytes. -1 Add a key usage extension to a certificate that is being created or added to a database. This extension allows a certificate's key to be dedicated to sup
porting specific operations such as SSL server or object signing. The Certificate Database Tool will prompt you to select a particular usage for the certificate's key. These usages are described under Standard X.509 v3 Certificate Extensions in Appendix A.3 of theRed Hat Certificate System Administration Guide. -2 Add a basic constraint extension to a certificate that is ...
...ning. The Certificate Database Tool will prompt you to select a particular usage for the certificate's key. These usages are described under Standard X.509 v3 Certificate Extensions in Appendix A.3 of theRed Hat Certificate System Administration Guide. -2 Add a basic constraint extension to a certificate that is being created or added to a database. This extension sup
ports the certificate chain verification process. The Certificate Database Tool will prompt you to select the certificate constraint extension. Constraint extensions are described in Standard X.509 v3 Certificate Extensions in Appendix A.3 of theRed Hat Certificate System Administration Guide. -3 Add an authority keyID extension to a certificate that is being created or a...
...rocess. The Certificate Database Tool will prompt you to select the certificate constraint extension. Constraint extensions are described in Standard X.509 v3 Certificate Extensions in Appendix A.3 of theRed Hat Certificate System Administration Guide. -3 Add an authority keyID extension to a certificate that is being created or added to a database. This extension sup
ports the identification of a particular certificate, from among multiple certificates associated with one subject name, as the correct issuer of a certificate. The Certificate Database Tool will prompt you to select the authority keyID extension. Authority key ID extensions are described under Standard X.509 v3 Certificate Extensions in Appendix B.3 of theRed Hat Certificate System Administration Gui...
NSS Tools modutil
er flags. The JAR file should also contain any files to be installed on the target machine, including the PKCS #11 module library file and other files such as documentation. See the section JAR Installation File for information on creating the special script needed to perform an installation through a server or with the Security Module Database Tool (that is, in environments without JavaScript sup
port). For general installation instructions and to install a module in environments where JavaScript sup
port is available (as in Netscape Communicator), see the document Using the JAR Installation Manager to Install a PKCS #11 Cryptographic Module. -delete modulename Delete the named module. Note that you cannot delete the Netscape Communicator internal PKCS #11 module. -changepw tokenname Change...
...s and arguments. The options and arguments in square brackets are optional, those without square brackets are required. ...
... This information file contains special scripting and must be declared in the JAR archive's manifest file. The script can have any name. ...
...all white space (for example, spaces, tabs, and carriage returns) is considered equal and is used only to delimit tokens. Keys Keys are case-insensitive. This section discusses the following keys: Global KeysPer-Platform KeysPer-File Keys Global Keys ForwardCompatible Gives a list of platforms that are forward compatible. If the current platform cannot be found in the list of sup
ported platforms, then the ForwardCompatible list is checked for any platforms that have the same OS and architecture in an earlier version. If one is found, its attributes are used for the current platform. Platforms (required) Gives a list of platforms. Each entry in the list is itself a key-value pair: the key is the name of the platform and the value list contains various attributes of the pla...
NSS Tools ssltap
mozilla.dev.tech.crypto The SSL Debugging Tool is an SSL-aware command-line proxy. It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking. Availability This tool is known to build on Solaris 2.5.1 (SunOS 5.5.1) and Windows NT 4.0. Description The ssltap command opens a socket on a rendezvous
port and waits for an incoming connection from the client side. Once this connection arrives, the tool makes another connection to the specified host name and
port on the server side. It passes any data sent by the client to the server and vice versa. The tool also displays the data to the shell window from which it was called. It can do this for plain HTTP connections or any TCP protocol, as well as ...
...TP connections or any TCP protocol, as well as for SSL streams, as described here. The tool cannot and does not decrypt any encrypted message data. You use the tool to look at the plain text and binary data that are part of the handshake procedure, before the secure connection is established. Syntax To run the SSL Debugging Tool, type this command in a command shell: ssltap [-vhfsxl] [-p
port] hostname:
port Options The command does not require any options other than hostname:
port, but you normally use them to control the connection interception and output. The options for the command are the following: -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, f...
...th -h, two separate parts are printed for each record: the plain hex/ASCII output, and the parsed SSL output. -x Turn on hex/ASCII printing of undecoded data inside parsed SSL records. Used only with the -s option. This option uses the same output format as the -h option. -l Turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p
port Change the default rendezvous
port (1924) to another
port. The following are well-known
port numbers: HTTP 80 HTTPS 443 SMTP 25 FTP 21 IMAP 143 IMAPS 993 (IMAP over SSL) NNTP 119 NNTPS 563 (NNTP over SSL) Examples You can use the SSL Debugging Tool to intercept any connection information. Although you can run the tool at its most basic by issuing the ssltap command ...
...(1924) to another
port. The following are well-known
port numbers: HTTP 80 HTTPS 443 SMTP 25 FTP 21 IMAP 143 IMAPS 993 (IMAP over SSL) NNTP 119 NNTPS 563 (NNTP over SSL) Examples You can use the SSL Debugging Tool to intercept any connection information. Although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:
port, the information you get in this way is not very useful. For example, assume your development machine is called intercept. The simplest way to use the debugging tool is to execute the following command from a command shell: ssltap www.netscape.com:80 The program waits for an incoming connection on the default
port 1924. In your browser window, enter the URL http://intercept:1924. The browser re...
certutil
from which a new certificate will derive its authenticity. Use the exact nickname or alias of the CA certificate, or use the CA's email address. Bracket the issuer string with quotation marks if it contains spaces. -d [sql:]directory Specify the database directory containing the certificate and key database files. certutil sup
ports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new SQLite databases (cert9.db, key4.db, and pkcs11.txt). If the prefix sql: is not used, then the tool assumes that the given databases are in the old format. -e Check a certificate's signature during the process of validating a cert...
...eywords: o digital signature o nonRepudiation o keyEncipherment o dataEncipherment o keyAgreement o certSigning o crlSigning o critical -2 Add a basic constraint extension to a certificate that is being created or added to a database. ...
...The Certificate Database Tool will prompt you to select the authority key ID extension. ...
...odutil) assume that the given security databases follow the more common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: $ certutil -L -d sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: ex
port NSS_DEFAULT_DB_TYPE="sql" This line can be set added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: o https://wiki.mozilla.org/NSS_Shared_DB_Howto F...
NSS tools : signtool
gntool, creates digital signatures and uses a Java Archive (JAR) file to associate the signatures with files in a directory. Electronic software distribution over any network involves potential security problems. To help address some of these problems, you can associate digital signatures with the files in a JAR archive. Digital signatures allow SSL-enabled clients to perform two im
portant operations: * Confirm the identity of the individual, company, or other entity whose digital signature is associated with the files * Check whether the files have been tampered with since being signed If you have a signing certificate, you can use Netscape Signing Tool to digitally sign files and package them as a JAR file. An object-signing certificate is a special kind o...
...ment System: you must download the the CA certificate in addition to obtaining your own signing certificate. CA certificates for several certificate authorities are preinstalled in the Communicator certificate database. When you receive an object-signing certificate for your own use, it is automatically installed in your copy of the Communicator client software. Communicator sup
ports the public-key cryptography standard known as PKCS #12, which governs key
portability. You can, for example, move an object-signing certificate and its associated private key from one computer to another on a credit-card-sized device called a smart card. Options -b basename Specifies the base filename for the .rsa and .sf files in the META-INF directory to co...
... over a network, a test certificate created with -G is not signed by a recognized certificate authority. Instead, it is self-signed. In addition, a single test signing certificate functions as both an object-signing certificate and a CA. When you are using it to sign objects, it behaves like an object-signing certificate. When it is im
ported into browser software such as Communicator, it behaves like an object-signing CA and cannot be used to sign objects. The -G option is available in Netscape Signing Tool 1.0 and later versions only. By default, it produces only RSA certificates with 1024-byte keys in the internal token. However, you can use the -s option specify the required...
... The certificate information is read from standard input. Therefore, the information can be read from a file using the redirection operator (<) in some operating systems. To create a file for this purpose, enter each of the seven input fields, in order, on a separate line. Make sure there is a newline character at the end of the last line.
NSS tools : ssltap
It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII characters. ...
...nd the parsed SSL output. -x Turn on hex/ASCII printing of undecoded data inside parsed SSL records. Used only with the -s option. This option uses the same output format as the -h option. -l prefix Turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. ...
... Turn on hex/ASCII printing of undecoded data inside parsed SSL records. Used only with the -s option. This option uses the same output format as the -h option. -l prefix Turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p
port Change the default rendezvous
port (1924) to another
port. The following are well-known
port numbers: * HTTP 80 * HTTPS 443 * SMTP 25 * FTP 21 * IMAP 143 * IMAPS 993 (IMAP over SSL) * NNTP 119 * NNTPS 563 (NNTP over SSL) Usage and Examples You can use the SSL Debugging Tool to intercept any connection information. Al...
... HTTPS 443 * SMTP 25 * FTP 21 * IMAP 143 * IMAPS 993 (IMAP over SSL) * NNTP 119 * NNTPS 563 (NNTP over SSL) Usage and Examples You can use the SSL Debugging Tool to intercept any connection information. Although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:
port, the information you get in this way is not very useful. For example, assume your development machine is called intercept. The simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com The program waits for an incoming connection on the default
port 1924. In your browser window, enter the URL http://intercept:1924.
Necko Architecture
's primary responsibility is moving data from one location, to another location. These locations are represented in the form we have all grown to know and love as URIs. A URL implements the URI interface. The URI interface does resource-generic things like getting/setting the scheme, or getting/setting the spec (everything beyond the first colon ':'). URLs provide getting/setting of paths, hosts,
ports, filenames, etc. URLs are the most commonly used form of a URI. Because of their im
portance, Necko provides its own standard implementation of URLs (with class id NS_STANDARDURL_CID), which does all of the standard parsing necessary for most URLs. Necko also provides a simple URI implementation for convenience. URIs (recall that a URL is just one implementation of a URI) can be created as indivi...
...e protocol handler to create the URL. The nsIIOService can also create channels. It does this by looking up the protocol handler and asking it to create the channel. The primary responsibility of protocol handlers is to create channel instances that know how to interpret the protocol that the handler registered for. However, a protocol handler implementation also might "cache" the underlying trans
ports so channels it creates can reuse them later. The channel does the true work of protocol interpretation and data movement (if any). Although the protocol handler creates channels, protocol interpretation doesn't begin until the user initiates the transaction using the nsIChannel API. Receiving data & nsIStreamListener You can read or write, from or to a channel using either the synchronous API...
...hen things are happening. In the case of an asynchronous read... when you receive the OnDataAvailable() callback, you are handed an nsIInputSteam which you can read the data from (you will more than likely need to be able to handle multiple OnDataAvailable() callbacks, buffering the data you receive as necessary). The transaction is not complete until you receive an "stopped" notification. Trans
ports Underlying I/O functionality has been consolidated into "trans
ports." There is a trans
port for each type of I/O. Necko implements a file trans
port and a socket trans
port that the protocol implementations (channels) use to actually move bytes to and from. How do I add my own protocol handler? Adding your own protocol handler is a straightforward process in Necko. There are a minimum of two in...
... ...
Rhino overview
useful, yet they impose significant constraints on implementations that hamper or prevent optimization. The deprecated features are the __proto__ and __parent__ properties, and the constructors With, Closure, and Call. Attempts to invoke these constructors with the language version 1.4 will result in an error. For other versions, a warning will be generated. Internationalization The messages re
ported by the JavaScript engine are by default retrieved from the property file org/mozilla/javascript/resources/Messages.properties. If other properties files with extensions corresponding to the current locale exist, they will be used instead. JavaScript Language Versions Some behavior in the JavaScript engine is dependent on the language version. In browser embeddings, this language version is se...
...he implementation of a traditional URL-based security policy for JavaScript as in Netscape Navigator. Embeddings that trust the JavaScript code they execute may ignore the security features. Embeddings that run untrusted JavaScript code must do two things to enable the security features. First, every Context that is created must be supplied an instance of an object that implements the SecuritySup
port interface. This will provide Rhino the sup
port functionality it needs to perform security-related tasks. Second, the value of the property security.requireSecurityDomain should be changed to true in the resource bundle org.mozilla.javascript.resources.Security. The value of this property can be determined at runtime by calling the isSecurityDomainRequired method of Context. Setting this property...
...tyManager.getClassContext()). Then, the class of the code that called to request the restricted action can be obtained by looking an appropriate index into the class context array. If the caller is JavaScript the class obtained may be one of two types. First, it may be the class of the interpreter if interpretive mode is in effect. Second, it may be a generated class if classfile generation is sup
ported. An embedding can distinguish the two cases by calling isInterpreterClass() in the Context class. If it is the interpreter class, call the getInterpreterSecurityDomain() method of Context to obtain the security domain of the currently executing interpreted script or function. Otherwise, it must be a generated class, and an embedding can call getSecurityDomain() in the class implementing Securit...
...An embedding can distinguish the two cases by calling isInterpreterClass() in the Context class. If it is the interpreter class, call the getInterpreterSecurityDomain() method of Context to obtain the security domain of the currently executing interpreted script or function. Otherwise, it must be a generated class, and an embedding can call getSecurityDomain() in the class implementing SecuritySup
port. When the class was defined and loaded, the appropriate security domain was associated with it, and can be retrieved by calling this method. Once the security domain has been determined, an embedding can perform whatever checks are appropriate to determine whether access should be allowed. ...
JSAPI Cookbook
ord (If your constructor doesn't take any arguments, you can skip the second step and call JS_New(cx, constructor, 0, NULL) in step 3.) /* JSAPI */ /* Step 1 - Get the value of |Person| and check that it is an object. */ JS::RootedValue constructor_val(cx); if (!JS_GetProperty(cx, JS_GetGlobalObject(cx), "Person", &constructor_val)) return false; if (!constructor_val.isObject()) { JS_Re
portError(cx, "Person is not a constructor"); return false; } JS::RootedObject constructor(cx, &constructor_val.toObject()); /* Step 2 - Set up the arguments. */ JS::RootedString name_str(cx, JS_NewStringCopyZ(cx, "Dave")); if (!name_str) return false; JS::AutoValueArray<2> args(cx); args[0].setString(name_str); args[1].setInt32(24); /* Step 3 - Call |new Person(...args)|, passing the argum...
... floating point (see the next example). */ JS::CallArgs args = JS::CallArgsFromVp(argc, vp); args.rval().setInt32(23); return true; Returning a floating-point number // JavaScript return 3.14159; /* JSAPI */ JS::CallArgs args = JS::CallArgsFromVp(argc, vp); args.rval().setDouble(3.14159); Exception handling throw The most common idiom is to create a new Error object and throw that. ...
...setDouble(3.14159); Exception handling throw The most common idiom is to create a new Error object and throw that. JS_Re
portError does this. Note that JavaScript exceptions are not the same thing as C++ exceptions. The JSAPI code also has to return false to signal failure to the caller. // JavaScript throw new Error("Failed to grow " + varietal + ": too many greenflies."); /* JSAPI */ JS_Re
portError(cx, "Failed to grow %s: too many greenflies.", varietal); return false; To internationalize your error messages, and to throw other error types, such as SyntaxError or TypeError, use JS_Re
portErrorNumber instead. JavaScript also sup
ports throwing any value at all, not just Error objects. Use JS_SetPendingException to throw an arbitrary JS::Value from C/C++. // JavaScript throw exc; /* ...
...This is usually the line of code that called your native function, so it's usually what you want. ...
JS_GetInstancePrivate
const JSClass *clasp, jsval *argv); // Obsolete since JSAPI 32 Name Type Description cx JSContext * A context. obj JS::Handle<JSObject*> The object for which to retrieve private data. clasp JSClass * Class against which to test the object. args JS::CallArgs * Optional argument, used for error re
porting. Added in SpiderMonkey 32 argv jsval * Optional argument vector, used for error re
porting. Obsolete since JSAPI 32 This must be one of the following: an argv pointer created by the JavaScript engine and passed to a JSNative callback; JS_ARGV(cx, vp) where vp is a pointer created by the engine and passed to a JSFastNative callback; or NULL. ...
...if it is, returns a pointer to the object's private data. Otherwise it returns NULL. Note that if obj is an instance of clasp, but there is no private data currently associated with the object, or the object cannot have private data, JS_GetInstancePrivate also returns NULL. ...
...ct, or the object cannot have private data, JS_GetInstancePrivate also returns NULL. If you pass a non-null argument vector, argv, to JS_GetInstancePrivate, and obj is not an instance of clasp, this function re
ports a class mismatch error before returning NULL. In this case, JS_GetInstancePrivate tests whether or not there is a function name associated with the argument vector, and if there is, re
ports the name in an error message using the JS_Re
portError function. ...
...tion re
ports a class mismatch error before returning NULL. In this case, JS_GetInstancePrivate tests whether or not there is a function name associated with the argument vector, and if there is, re
ports the name in an error message using the JS_Re
portError function. ...
SpiderMonkey 31
s new language and API features described in detail below. Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. The download url is outdated and SpiderMonkey not RELEASE alone! Get it here mozilla-esr31 You will find it in "Firefox Extended Sup
port Release 31" package on hg release Platform sup
port SpiderMonkey 31 is sup
ported on all the platforms where Firefox 31 runs. Compiling it requires a C++ compiler, and the JSAPI can only be used from C++ code. If you are compiling with Microsoft's Visual Studio, note that the minimum sup
ported version is MSVC10/2010: MSVC8/9 sup
port has been dropped. SpiderMonkey 31 includes a just-in-time co...
...tforms where Firefox 31 runs. Compiling it requires a C++ compiler, and the JSAPI can only be used from C++ code. If you are compiling with Microsoft's Visual Studio, note that the minimum sup
ported version is MSVC10/2010: MSVC8/9 sup
port has been dropped. SpiderMonkey 31 includes a just-in-time compiler (JIT) that compiles JavaScript to machine code, for a significant speed increase. It is sup
ported on x86, x86_64, and ARM architectures. On some other platforms (SPARC, MIPS), the JIT is provided but not sup
ported. On all other platforms the JIT is simply disabled; JavaScript code runs in an interpreter, as in previous versions. It's the same language, just not as fast. Migrating to SpiderMonkey 31 The first change most embedders will notice is that SpiderMonkey must now be initialized b...
...ed JS_Init method. After this method is called, normal JSAPI operations are permitted. When all JSAPI operation has completed, the corresponding JS_ShutDown method (currently non-mandatory, but highly recommended as it may become mandatory in the future) uninitializes SpiderMonkey, cleaning up memory and allocations performed by JS_Init. A major change to SpiderMonkey in 31 is that its APIs sup
port a moving garbage collector. This entailed changing the vast majority of the JSAPI from raw types, such as JS::Value or JS::Value*, to JS::Handle and JS::MutableHandle template types that encapsulate access to the provided value/string/object or its location. The JS::Handle<JS::Value> and JS::MutableHandle<JS::Value> classes have been specialized to implement the same interface as JS::Value, for...
...xposed to the public API. Known Issues Detail any known issues here... Future Direction ...insert details on future plans... SpiderMonkey embedders should be aware that Mozilla has no plans to keep the JSAPI, nor the JSDBGAPI stable for embedders. We have chosen to concentrate on performance and correctness as primary concerns instead. JS_THREADSAFE is going away, with future versions sup
porting only thread-safe builds A new debugging API is on the way to replace JSD. Release Notes Errata This is a list of changes which need to be made to the release notes ASAP. Feel free to fix any problems you spot -- this is a Wiki! Don't add anything here -- this is for after the release notes are completed. :-) ...
SpiderMonkey 38
d API features described in detail below. Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. -- Sep 17, 2015 The download url is outdated and SpiderMonkey not RELEASE alone! Get it here mozilla-esr38 You will find it in "Firefox Extended Sup
port Release 38" package on hg release Platform sup
port SpiderMonkey 38 is sup
ported on all the platforms where Firefox 38 runs. Compiling it requires a C++ compiler, and the JSAPI can only be used from C++ code. If you are compiling with Microsoft's Visual Studio, note that the minimum sup
ported version is MSVC10/2010. SpiderMonkey 38 includes a just-in-time compiler (JIT) that compiles JavaScr...
... On all other platforms the JIT is simply disabled; JavaScript code runs in an interpreter, as in previous versions. It's the same language, just not as fast. Migrating to SpiderMonkey 38 .... ...
... can only be used from C++ code. If you are compiling with Microsoft's Visual Studio, note that the minimum sup
ported version is MSVC10/2010. SpiderMonkey 38 includes a just-in-time compiler (JIT) that compiles JavaScript to machine code, for a significant speed increase. It is sup
ported on x86, x86_64, and ARM architectures. On some other platforms (SPARC, MIPS), the JIT is provided but not sup
ported. On all other platforms the JIT is simply disabled; JavaScript code runs in an interpreter, as in previous versions. It's the same language, just not as fast. Migrating to SpiderMonkey 38 .... XXX will need updating for actual new GC stuff at time! A major change to SpiderMonkey in 38 is that its APIs sup
port a moving garbage collector. This entailed changing the vast majority of the JSAP...
.../removed methods here... Known Issues Detail any known issues here... Future Direction ...insert details on future plans... SpiderMonkey embedders should be aware that Mozilla has no plans to keep the JSAPI, nor the JSDBGAPI, stable for embedders. We have chosen to concentrate on performance and correctness as primary concerns instead. JS_THREADSAFE is going away, with future versions sup
porting only thread-safe builds A new debugging API is on the way to replace JSD. Release Notes Errata This is a list of changes which need to be made to the release notes ASAP. Feel free to fix any problems you spot -- this is a Wiki! Don't add anything here -- this is for after the release notes are completed. :-) ...
SpiderMonkey 45
key releases. It also contains new language and API features described in detail below. Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. You may wish to make the bugs block bug 837921 (aliased as "sm.embedding"). -- Apr 14, 2016 Platform sup
port SpiderMonkey 45 is sup
ported on all platforms able to run Firefox 45. Compiling it requires a C++ compiler, and the JSAPI can only be used from C++ code. If you are compiling with Microsoft's Visual Studio, note the minimum sup
ported version is MSVC 2013. SpiderMonkey 45 includes a just-in-time compiler (JIT) that compiles JavaScript to machine code, for a significant speed increase. It is su...
... On remaining platforms the JIT is disabled; JavaScript code runs in an interpreter, as it has in previous versions. It's the same language, just not as fast. ...
... On remaining platforms the JIT is disabled; JavaScript code runs in an interpreter, as it has in previous versions. It's the same language, just not as fast. ...
...hat have retain their previous name, providing relatively unchanged functionality. Applications will require significant changes, but most changes will be automatically detected by the C/C++ compiler, making them easy to detect and updating the code a relatively straightforward job. Here is a list of the most significant changes: JS::NullPtr is obsolete. You should now use nullptr instead. (Sup
porting decltype(nullptr)). New JavaScript language features JavaScript 45 includes significant updates to its language features, yo. New C++ APIs JSAPI is a C++ exclusive API. Please note that SpiderMonkey reserves the JS:: namespace for itself for public ex
ports and the js:: namespace for internal use. JS_SetCurrentEmbedderTimeFunction (bug 1159507) JS_GetCurrentEmbedderTime (bug 1159507) ...
Components.interfaces
f the XPCOM interfaces -- that some component or another might or might not implement. It reflects only those interfaces which have been designated in their .idl description as scriptable, that is the interfaces which XPConnect is capable of reflecting into JavaScript. Properties of the Components.interfaces object are used where XPCOM methods expect a parameter of type nsID. This includes nsISup
ports.QueryInterface(), the optional parameter accepted by nsIJSCID.getService(), nsIJSCID.createInstance() when called from JavaScript, and nsIClassInfo.getInterfaces(). The properties of the Components.interfaces object can be enumerated using a for...in loop. Usage Accessing an interface object Properties of the Components.interfaces object are indexed by interface name. You can retrieve an int...
...D.getService(), nsIJSCID.createInstance() when called from JavaScript, and nsIClassInfo.getInterfaces(). The properties of the Components.interfaces object can be enumerated using a for...in loop. Usage Accessing an interface object Properties of the Components.interfaces object are indexed by interface name. ...
... and nsIClassInfo.getInterfaces(). The properties of the Components.interfaces object can be enumerated using a for...in loop. Usage Accessing an interface object Properties of the Components.interfaces object are indexed by interface name. You can retrieve an interface object using: var iface = Components.interfaces.nsISup
portsArray; This will return you the interface object for the nsISup
portsArray interface. ...
...rieve an interface object using: var iface = Components.interfaces.nsISup
portsArray; This will return you the interface object for the nsISup
portsArray interface. Accessing constants defined in an interface Interface descriptions (cf. XPIDL) may not only contain method declarations, but also constants. ...
mozIRegistry
Warning: The content of this article may be out of date. It appears to be a design document for something that never got implemented. Introduction The title of this document is completely misleading. It's not really about any "registry interface" so much as it's about how Mozilla sup
ports a more dynamic binding between interface clients and the code that actually provides the implementation of those interfaces. It happens that this objective requires storing information about which implementation to use in a place distinct from your source code. And it happens that we've chosen, up till now, to store that information in the "Netscape registry" file. Which explains how this information came to be associated with the notion of a "registry." Someday (I hope) this page will be pro...
...ponents in this document. Lastly, there's one component (labelled "mozRDFRegistry/nsIRDFDatabase") that potentially will emerge as an improved implementation of one of the mozIRegistry interfaces. I'll be discussing that implementation only briefly (mainly because I'm hoping I can pawn off the chore of implementing it to somebody else). There's another component that turns out to also be real im
portant when you go to hook up your code with other Mozilla components. That's the Service Manager. I'm just starting to understand the role it plays in this and it isn't really under my jurisdiction, so there's nothing about it here right now. In the future, I'll either add the information about it or at least put in a link to it's documentation. Higher-Level Application Components This box repre...
...out an appropriate implementation given some arbitrary desired properties. nsRepository This is basically the same as is provided today (see mozilla/xpcom/public/nsRepository.h). The primary change to this component is that we will modify it to utilize the new mozIRegistry interface versus the NSReg.h functions it calls today. In addition, it likely will have a couple of minor extensions: Sup
port for specifying the .reg file name on Initialize(). I think this might make it a little more flexible, thereby making XPCOM more general-purpose. Adding sup
port so that the underlying mozIRegistry implementation can be tailored by the initializer (client application). This is so that one can choose the basic libreg-based registry implementation versus a more advanced, e.g., RDF-based, one. nsR...
...tional components accessible via the 'net, etc. The contents of this RDF data base will be stored in a plain-text rdf/xml file so that it can easily be viewed edited. It will also facilitate building a browser-based application that will allow people to display and edit its contents. Original Document Information Author: Bill Law Last Updated Date: January 21, 1999 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
mozIStorageConnection
storage/public/mozIStorageConnection.idlScriptable This interface represents a database connection attached to a specific file or an in-memory database. It is the primary interface for interacting with a database, including creating prepared statements, executing SQL, and examining database errors. 1.0 68 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) For a general overview on how to use this interface, see Storage. Method overview void asyncClose([optional] in mozIStorageCompletionCallback aCallback); void beginTransaction(); void beginTransactionAs(in PRInt32 transactionType); mozIStorageStatement clone([optional] in boolean aReadOnly); ...
...sIFile The current database nsIFile. null if the database connection refers to an in-memory database. Read only. lastError long The last SQLite error code that occurred. Read only. Note: This is not reliable if you are using asynchronous statements or if you are using the connection on multiple threads. lastErrorString AUTF8String The English error string re
ported by the SQLite library for the last SQLite operation. Read only. Note: This is not reliable if you are using asynchronous statements or if you are using the connection on multiple threads. lastInsertRowID long long The row ID from the last SQL INSERT operation. Read only. Note: This is not reliable if you are using asynchronous statements or if you are using the connecti...
...on multiple threads. lastInsertRowID long long The row ID from the last SQL INSERT operation. Read only. Note: This is not reliable if you are using asynchronous statements or if you are using the connection on multiple threads. schemaVersion long The schema version of the database. This should not be used until the database is ready. The version will be re
ported as 0 if it is not set. transactionInProgress boolean Returns true if there is a transaction in progress on the database. Otherwise returns false. Read only. Constants Transaction execution time constants. Constant Value Description TRANSACTION_DEFERRED 0 No database lock is obtained until the first statement is run. TRANSACTION_IMM...
...icult when you are using the same connection on different threads, or are using a combination of asynchronous and synchronous statement execution. The best way to deal with this is to only execute your statements asynchronously using mozIStorageConnection.executeAsync(). This method will manage the transactions for you, so you don't have to worry about them. Note: The database engine does not sup
port nested transactions, so attempting to start a transaction when one is already active will throw an exception. void beginTransactionAs( in PRInt32 transactionType ); Parameters transactionType One of the transaction constants (mozIStorageConnection.TRANSACTION_DEFERRED, mozIStorageConnection.TRANSACTION_IMMEDIATE, mozIStorageConnection.TRANSACTION_EXCLUSIVE) clone() Clones a databas...
nsIAccessibleEditableText
accessible/public/nsIAccessibleEditableText.idlScriptable An interface for editing text of an accessible object. The operations it sup
ports includes setting text attributes and text contents while also replacing old text of an object with new text. It also includes and sup
port basic operations such as, inserting text, copying text, cutting text, pasting text and deleting text at the specified position. ...
...ditableText.idlScriptable An interface for editing text of an accessible object. The operations it sup
ports includes setting text attributes and text contents while also replacing old text of an object with new text. It also includes and sup
port basic operations such as, inserting text, copying text, cutting text, pasting text and deleting text at the specified position. ...
...Read only. Native code only! Methods copyText() Copies the text range into the clipboard. void copyText( in long startPos, in long endPos ); Parameters ...
...sented by this object. Exceptions thrown NS_ERROR_FAILURE Indicates the text cannot be pasted from the clipboard. setAttributes() Sets the attributes for the text between the two given indices. The old attributes are replaced by the new list of attributes. For example, sets font styles, such as italic, bold, and so on. void setAttributes( in long startPos, in long endPos, in nsISup
ports attributes ); Parameters startPos The start index of the text whose attributes are modified. endPos The end index of the text whose attributes are modified. attributes The set of attributes that replaces the old list of attributes of the specified text
portion. Exceptions thrown NS_ERROR_NOT_IMPLEMENTED Always. The method is not implemented. setTextContents() Replaces the text...
nsIAlertsService
toolkit/components/alerts/nsIAlertsService.idlScriptable This interface can be used to notify the user of something that does not require an immediate reaction. For example, it can be used to notify the user that their downloads are complete or that they have new mail. ...
... Note: Since Gecko 22, the notifications are provided by Firefox and have become platform-independent. ...
... (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19) By default a message is displayed in a small window that slides up from the bottom of the screen, holds there for a few seconds, then slides down. The specific appearance varies from platform to platform. Note: Prior Firefox 22, the alerts service was only sup
ported on Windows in Gecko 1.7, had no effect on Mac OS X in Gecko 1.8, but was fully sup
ported in Mac OS X in Gecko 1.9. Note: Since Gecko 22, the notifications are provided by Firefox and have become platform-independent. Implemented by: @mozilla.org/alerts-service;1 as a service: var alertsService = Components.classes["@mozilla.org/alerts-service;1"] .getService(Components.interfaces.nsIAlertsService); Method overview void showAlertNotification(in AS...
... Optional A name for the notification; this is not displayed in the alert. However, certain notification systems (such as Growl on Mac OS X) allow the user to disable alerts by name. This name is used in that configuration panel. On Android the name is hashed and used as a notification ID. dir Optional Bidi override for the title. Valid values are "auto", "ltr" or "rtl". Only available on sup
ported platforms. lang Optional Language of title and text of the alert. Only available on sup
ported platforms. data Optional The value of the cookie parameter passed to showAlertNotification. principal Optional The principal of the page that created the alert. Used for IPC security checks, and to determine whether the alert is actionable. inPrivateBrowsing Optional Controls the image loading...
nsIAnnotationService
To use this service, use: var annotationService = Components.classes["@mozilla.org/browser/annotation-service;1"] .getService(Components.interfaces.nsIAnnotationService); Note: The annotation service is not thread-safe. ...
...To use this service, use: var annotationService = Components.classes["@mozilla.org/browser/annotation-service;1"] .getService(Components.interfaces.nsIAnnotationService); Note: The annotation service is not thread-safe. ...
...IONS WILL GET DELETED WHEN THE PAGE IS REMOVED FROM HISTORY IF THE PAGE IS NOT BOOKMARKED. This means that if you create an annotation on an unvisited URI, it will get deleted when the browser shuts down. Otherwise, URIs can exist in history as annotations but the user has no way of knowing it, potentially violating their privacy expectations about actions such as Clear history. If there is an im
portant annotation that the user or extension wants to keep, you should add a bookmark for the page and use an EXPIRE_NEVER annotation. This will ensure the annotation exists until the item is removed by the user. setItemAnnotation() This method sets an annotation for given item, overwriting any previous annotation with the same URL/name. IT IS YOUR JOB TO NAMESPACE YOUR ANNOTATION NAMES. Use the f...
...IONS WILL GET DELETED WHEN THE PAGE IS REMOVED FROM HISTORY IF THE PAGE IS NOT BOOKMARKED. This means that if you create an annotation on an unvisited URI, it will get deleted when the browser shuts down. Otherwise, URIs can exist in history as annotations but the user has no way of knowing it, potentially violating their privacy expectations about actions such as Clear history. If there is an im
portant annotation that the user or extension wants to keep, you should add a bookmark for the page and use an EXPIRE_NEVER annotation. This will ensure the annotation exists until the item is removed by the user. setItemAnnotationString() This method sets an annotation for given item by taking a String as input value, overwriting any previous annotation with the same URL/name. IT IS YOUR JOB TO NA...
nsIApplicationCacheService
netwerk/base/public/nsIApplicationCacheService.idlScriptable This interface manages the set of application cache groups that manage offline resources for web applications. ...
... netwerk/base/public/nsIApplicationCacheService.idlScriptable This interface manages the set of application cache groups that manage offline resources for web applications. ...
...key The...
...ApplicationCache(in ACString group); void deactivateGroup(in ACString group); nsIApplicationCache getActiveCache(in ACString group); nsIApplicationCache getApplicationCache(in ACString clientID); void getGroups([optional] out unsigned long count, [array, size_is(count), retval] out string groupIDs); Methods cacheOp
portunistically() Flags the specified key as one that should be cached op
portunistically. Note: This method should propagate the entry to other application caches with the same op
portunistic namespace; however, this is not currently implemented. void cacheOp
portunistically( in nsIApplicationCache cache, in ACString key ); Parameters cache The cache in which the entry is currently cached. key The cache entry's key. chooseApplicationCache() Tries to find the best appl...
nsIAuthInformation
netwerk/base/public/nsIAuthInformation.idlScriptable A object that holds authentication information. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) The caller of nsIAuthPrompt2.promptUsernameAndPassword() or nsIAuthPrompt2.promptPasswordAsync() provides an object implementing this interface; the prompt implementation can then read the values here to prefill the dialog. After the user entered the authentication information, it should set the attributes of this object to indicate to the caller what was entered by the user. Attributes Attribute Type Description authenticationScheme AUTF8String The authentication scheme used for this request, if applicable. If the protocol f...
...can then read the values here to prefill the dialog. After the user entered the authentication information, it should set the attributes of this object to indicate to the caller what was entered by the user. Attributes Attribute Type Description authenticationScheme AUTF8String The authentication scheme used for this request, if applicable. If the protocol for this authentication does not sup
port schemes, this will be the empty string. Otherwise, this will be a string such as "basic" or "digest". This string will always be in lowercase. Read only. domain AString The initial value should be used to prefill the dialog or be shown in some other way to the user. On return, this parameter should contain the domain entered by the user. This attribute is only used if flags include #NEED_DOMAIN...
...return, this parameter should contain the domain entered by the user. This attribute is only used if flags include #NEED_DOMAIN. flags unsigned long Flags describing this dialog. A bitwise OR of the constants. It is possible that neither #AUTH_HOST nor #AUTH_PROXY are set. ...
...Otherwise, this is a human-readable string like "Secret files". Read only. username AString The initial value should be used to prefill the dialog or be shown in some other way to the user. On return, this parameter should contain the username entered by the user. This field can only be changed if the #ONLY_PASSWORD flag is not set. ...
nsIBadCertListener2
Method overview boolean notifyCertProblem(in nsIInterfaceRequestor socketInfo, in nsISSLStatus status, in AUTF8String targetSite); Methods notifyCertProblem() Called in case of a broken ssl status. ...
...Method overview boolean notifyCertProblem(in nsIInterfaceRequestor socketInfo, in nsISSLStatus status, in AUTF8String targetSite); Methods notifyCertProblem() Called in case of a broken ssl status. ...
...o, in nsISSLStatus status, in AUTF8String targetSite); Methods notifyCertProblem() Called in case of a broken ssl status. boolean notifyCertProblem( in nsIInterfaceRequestor socketInfo, in nsISSLStatus status, in AUTF8String targetSite ); Parameters socketInfo A network communication context that can be used to obtain more information about the active connection. This object usually sup
ports nsISSLSocketControl, nsITrans
portSecurityInfo, nsIIdentityInfo, nsISSLStatusProvider, nsIClientAuthUserDecision and possibly other interfaces. status The SSL status object that describes the problem(s). targetSite The Site name that was used to open the current connection. Return value The consumer shall return true if it wants to suppress the error message related to the bad cert (the connecti...
...dentityInfo, nsISSLStatusProvider, nsIClientAuthUserDecision and possibly other interfaces. status The SSL status object that describes the problem(s). targetSite The Site name that was used to open the current connection. Return value The consumer shall return true if it wants to suppress the error message related to the bad cert (the connection will still get canceled). See also nsISocketTrans
port ...
nsIBidiKeyboard
idget/public/nsIBidiKeyboard.idlScriptable This interface lets the application detect bidirectional writer users, and do some magic for them. ...
...n Indicates whether or not the system has at least one keyboard for each direction (left-to-right and right-to-left) installed. Read only. Note: This throws NS_ERROR_NOT_IMPLEMENTED if the widget layer doesn't provide this information. Currently, this is only implemented on Windows. Methods isLangRTL() Determines if the current keyboard language is right-to-left. (sup
ported on: win32, mac, gtk2) Note: Prior to Gecko 1.9 this method used a parameter 'out PRBool aIsRTL' to return the value. boolean isLangRTL(); Parameters None. Return value true if the current keyboard is right-to-left, false if it is not. Exceptions thrown NS_ERROR_FAILURE If no right-to-left keyboards are installed. setLangFromBidiLevel() Sets the keyboard language to left-to-right or r...
... gtk2) Note: Prior to Gecko 1.9 this method used a parameter 'out PRBool aIsRTL' to return the value. boolean isLangRTL(); Parameters None. Return value true if the current keyboard is right-to-left, false if it is not. Exceptions thrown NS_ERROR_FAILURE If no right-to-left keyboards are installed. setLangFromBidiLevel() Sets the keyboard language to left-to-right or right-to-left. (sup
ported on: win32) void setLangFromBidiLevel( in PRUint8 aLevel ); Parameters aLevel If odd set the keyboard to right-to-left, if even set left-to-right. Exceptions thrown NS_ERROR_FAILURE If no right-to-left keyboards are installed. Remarks Implementation Windows This implementation uses win32 API to get the language of the keyboard layout, and the direction of those languages. ...
... code is going to be on GTK+ later, and we will use GTK+ API instead. Both GTK+ and Gecko versions, check keysym's on keyboard layout to detect the direction of the layout. For GTK+ (>=2.10.1, >=2.12.0) and all Gecko versions, we check only the first shift-level of the layout, to fix the problem with Hebrew layouts. More info: bug 348724, bug 348724, and Gnome bug: 116626 Mac Only isLangRTL is sup
ported on this platform. bug 266551 See also Documentation for BiDi Mozilla ...
nsICacheEntryDescriptor
expirationTime); void setMetaDataElement(in string key, in string value); void visitMetaData(in nsICacheMetaDataVisitor visitor); Attributes Attribute Type Description accessGranted nsCacheAccessMode Get the access granted to this descriptor. See nsICache for the definitions of the access modes and a thorough description of their corresponding meanings. Read only. cacheElement nsISup
ports Get or set the cache data element. This will fail if the cache entry is stream based. The cache entry holds a strong reference to this object. The object will be released when the cache entry is destroyed. file nsIFile Get the disk file associated with the cache entry. Read only. predictedDataSize PRInt64 Stores the Content-Length specified in the HTTP header for this entry. Checked before w...
...he entry is destroyed. file nsIFile Get the disk file associated with the cache entry. Read only. predictedDataSize PRInt64 Stores the Content-Length specified in the HTTP header for this entry. Checked before we write to the cache entry, to prevent ever taking up space in the cache for an entry that we know up front is going to have to be evicted anyway. See bug 588507. securityInfo nsISup
ports Get or set security info on the cache entry for this descriptor. This fails if the storage policy is not STORE_IN_MEMORY. storagePolicy nsCacheStoragePolicy Get or set the storage policy of the cache entry. See nsICache for the definitions of the storage policies. Methods close() This method explicitly closes the descriptor (optional). void close(); Parameters None. doom() This method doom...
...turn value Returns the string value containing the meta data for the provided key. markValid() This method means that a writer must validate this cache object before any readers are given a descriptor to the object. void markValid(); Parameters None. openInputStream() This method opens blocking input stream to cache data. This will fail if the cache entry is not stream based. Use the stream trans
port service to asynchronously read this stream on a background thread. The returned stream may implement nsISeekableStream. nsIInputStream openInputStream( in unsigned long offset ); Parameters offset Read starting from this offset into the cached data. An offset beyond the end of the stream has undefined consequences. Return value Returns blocking, unbuffered input stream. openOutputStream() Th...
...Stream openInputStream( in unsigned long offset ); Parameters offset Read starting from this offset into the cached data. An offset beyond the end of the stream has undefined consequences. Return value Returns blocking, unbuffered input stream. openOutputStream() This method opens blocking output stream to cache data. This will fail if the cache entry is not stream based. Use the stream trans
port service to asynchronously write to this stream on a background thread. The returned stream may implement nsISeekableStream. If opening an output stream to existing cached data, the data will be truncated to the specified offset. nsIOutputStream openOutputStream( in unsigned long offset ); Parameters offset Write starting from this offset into the cached data. An offset beyond the end of the s...
nsIClassInfo
Read only. ...
...Read only. ...
...s. It has no meaning when returned from the flags attribute of a nsIClassInfo implementation. Obsolete since Gecko 2.0 Methods getHelperForLanguage() Get a language mapping specific helper object that may assist in using objects of this class in a specific lanaguage. For example, if asked for the helper for nsIProgrammingLanguage::JAVASCRIPT this might return an object that can be nsISup
ports.QueryInterface()'d into the nsIXPCScriptable interface to assist XPConnect in supplying JavaScript specific behavior to callers of the instance object. nsISup
ports getHelperForLanguage( in PRUint32 language ); Parameters language This parameter selects the language mapping specific helper object to be returned. nsIProgrammingLanguage defines language identifiers that may be passed for t...
...nguage This parameter selects the language mapping specific helper object to be returned. nsIProgrammingLanguage defines language identifiers that may be passed for this parameter. Return value Should return null if no helper available for given language. getInterfaces() This method returns an ordered list of interfaces IIDs that instances of the class promise to implement. Note that nsISup
ports is an implicit member of the implemented set of interfaces and need not be included. If this method is not sup
ported by an implementation, then it should return 0 for count and null for array. void getInterfaces( out PRUint32 count, [array, size_is(count), retval] out nsIIDPtr array ); Parameters count The length of the resulting array. array The resulting array of nsIIDPtr values.
nsICryptoHash
netwerk/base/public/nsICryptoHash.idlScriptable This interface can be used to compute a cryptographic hash function of some data. You can, for example, calculate the SHA256 hash of a file to determine if it contains the data you think it does. The hash algorithms sup
ported are MD2, MD5, SHA-1, SHA-256, SHA-384, and SHA-512. ...
... netwerk/base/public/nsICryptoHash.idlScriptable This interface can be used to compute a cryptographic hash function of some data. You can, for example, calculate the SHA256 hash of a file to determine if it contains the data you think it does. The hash algorithms sup
ported are MD2, MD5, SHA-1, SHA-256, SHA-384, and SHA-512. ...
...his method may be called multiple times with different algorithm types. Note: This method or " .. manch("initWithString") .. " must be called before any other method on this interface is called. void init( in unsigned long aAlgorithm ); Parameters aAlgorithm The hash algorithm to use. Must be one of the Hash Algorithms. Exceptions thrown NS_ERROR_INVALID_ARG Indicates that an unsup
ported algorithm type was passed initWithString() Initialize the hashing object. This method may be called multiple times with different algorithm types. Note: This method or " .. manch("init") .. " must be called before any other method on this interface is called. void initWithString( in ACString aAlgorithm ); Parameters aAlgorithm The hash algorithm type to be used as a string, such as...
... This method may be called multiple times with different algorithm types. Note: This method or " .. manch("init") .. " must be called before any other method on this interface is called. void initWithString( in ACString aAlgorithm ); Parameters aAlgorithm The hash algorithm type to be used as a string, such as "SHA256". Exceptions thrown NS_ERROR_INVALID_ARG Indicates that an unsup
ported algorithm type was passed update() Adds an array of data to be hashed to the object. See Computing the Hash of a String for an example of using this method. void update( [const, array, size_is(aLen)] in octet aData, in unsigned long aLen ); Parameters aData A buffer to calculate the hash over. aLen The length of the buffer aData. Exceptions thrown NS_ERROR_NOT_INITIALIZED ...
nsIDOMXPathEvaluator
dom/interfaces/xpath/nsIDOMXPathEvaluator.idlScriptable This interface is used to evaluate XPath expressions against a DOM node. Inherits from: nsISup
ports Last changed in Gecko 1.7 Implemented by: @mozilla.org/dom/xpath-evaluator;1. ...
... Note: Prior to Gecko 1.9, you could call this method on documents other than the one you planned to run the XPath against; starting with...
...ce(Components.interfaces.nsIDOMXPathEvaluator); Method overview nsIDOMXPathExpression createExpression(in DOMString expression, in nsIDOMXPathNSResolver resolver) nsIDOMXPathNSResolver createNSResolver(in nsIDOMNode nodeResolver); nsISup
ports evaluate(in DOMString expression, in nsIDOMNode contextNode, in nsIDOMXPathNSResolver resolver, in unsigned short type, in nsISup
ports result) Methods createExpression() Creates an nsIDOMXPathExpression which can then be used for (repeated) evaluations. Note: Prior to Gecko 1.9, you could call this method on documents other than the one you planned to run the XPath against; starting with Gecko 1.9, however, you must call it on the same document. nsIDOMXPathExpression createExpression( in DOMString expression, in...
...he XPath itself, so that they can be matched with the document. null is common for HTML documents or when no name space prefixes are used. nsIDOMXPathNSResolver createNSResolver( in nsIDOMNode nodeResolver ); Parameters nodeResolver The node to be used as a context for name space resolution. Return value A name space resolver. evaluate() Evaluate the specified XPath expression. nsISup
ports evaluate( in DOMString expression, in nsIDOMNode contextNode, in nsIDOMXPathNSResolver resolver, in unsigned short type, in nsISup
ports result ); Parameters expression A string representing the XPath to be evaluated. contextNode A DOM Node to evaluate the XPath expression against. To evaluate against a whole document, use the document.documentElement. resolver ...
nsIDictionary
Gecko 1.9.1 Inherits from: nsISummary Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Note: This interface was removed in Firefox 3.5; use Dict.jsm instead. See bug 668424 for further information. Method overview boolean hasKey(in string key); void getKeys(out PRUint32 count, [retval, array, size_is(count)] out string keys); nsISup
ports getValue(in string key); void setValue(in string key, in nsISup
ports value); nsISup
ports deleteValue(in string key); void clear(); Methods hasKey() Check if a given key is present in the dictionary. boolean hasKey( in string key ); Parameters key Key to check for. Return value true if present, false if absent. getKeys() Retrieve all keys in th...
...nt in the dictionary. boolean hasKey( in string key ); Parameters key Key to check for. Return value true if present, false if absent. getKeys() Retrieve all keys in the dictionary. void getKeys( out PRUint32 count, [retval, array, size_is(count)] out string keys ); Return value Array of all keys, unsorted. getValue() Find the value indicated by the key. ...
... Return value The removed value. If the key doesn't exist, NS_ERROR_FAILURE will be returned. ...
...y doesn't exist, NS_ERROR_FAILURE is returned. setValue() Add the key-value pair to the dictionary. If the key is already present, the new value replaces the old one. void setValue( in string key, in nsISup
ports value ); Parameters key The key by which the value can be accessed. value The value to store. deleteValue() Find the value indicated by the key. nsISup
ports deleteValue( in string key ); Parameters key The key indicating the pair to be removed. Return value The removed value. If the key doesn't exist, NS_ERROR_FAILURE will be returned. clear() Delete all key-value pairs from the dictionary. void clear(); Parameters None. ...
nsIDocumentLoader
uriloader/base/nsIDocumentLoader.idlScriptable This interface responsible for tracking groups of loads that belong together (images, external scripts, and so on.) and subdocuments (iframe, frame, and so on.). It is also responsible for sending nsIWebProgressListener notifications. Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Implemented by: @mozilla.org/docloaderservice;1. To create an instance, use: var documentLoader = Components.classes["@mozilla.org/docloaderservice;1"] .createInstance(Components.interfaces.nsIDocumentLoader); Method overview void clearParentDocLoader(); Obsolete since Gecko 1.8 void createDocumentLoader(out nsIDocumentLoader anInstance); Obsolete since Gecko 1.8 ...
... documentChannel nsIChannel Read only. ...
... documentChannel nsIChannel Read only. loadGroup nsILoadGroup Read only. Methods clearParentDocLoader() Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) void clearParentDocLoader(); Parameters None. ...
...rs aWebProgress aRequest aStatus aMessage Native code only!getContentViewerContainer Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. void getContentViewerContainer( in nsISup
ports aDocumentID, out nsIContentViewerContainer aResult ); Parameters aDocumentID aResult getLoadGroup() Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) nsILoadGroup getLoadGroup(); Parameters None. Return value isBusy() Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) boole...
nsIDragSession
Usually the target "frame" sets this so the native system can render the correct feedback. ...
...Usually the target "frame" sets this so the native system can render the correct feedback. ...
...Usually the target "frame" sets this so the native system can render the correct feedback. ...
...hods getData() Gets data from a drag and drop operation. Can be called while the drag is in process or after the drop has completed. void getData( in nsITransferable aTransferable, in unsigned long aItemIndex ); Parameters aTransferable The transferable for the data to be put into. aItemIndex Which of multiple drag items, zero-based. Must be less than numDropItems. isDataFlavorSup
ported() Checks to see if any of the native data on the clipboard matches a given data flavor. If numDropItems is greater than one, there is no indication as to which of the items matches the data flavor. boolean isDataFlavorSup
ported( in string aDataFlavor ); Parameters aDataFlavor A string representing the MIME type of the data to be matched, such as "text/unicode". Return value true if...
nsIFactory
xpcom/components/nsIFactory.idlScriptable This interface is a class factory that allows for the creation of nsISup
ports derived classes without specifying a concrete class type. Inherits from: nsISup
ports Last changed in Gecko 0.9.5 Method overview void createInstance(in nsISup
ports aOuter, in nsIIDRef iid, [retval, iid_is(iid)] out nsQIResult result); void lockFactory(in PRBool lock); Methods createInstance() Creates an instance of the class associated with this factory. Unlike getService, this returns a new instance each time it is called. ...
...This can be nsnull if no aggregation is requested. iid The IID of the interface being requested in the component which is being currently created. ...
...rs aOuter Pointer to a component that wishes to be aggregated in the resulting instance. This can be nsnull if no aggregation is requested. iid The IID of the interface being requested in the component which is being currently created. result Pointer to the newly created instance, if successful. Exceptions thrown NS_ERROR_NO_INTERFACE Indicates that the requested interface is not sup
ported. NS_ERROR_NO_AGGREGATION Indicates that aggregation is not sup
ported. lockFactory() This method provides the client a way to keep the component in memory until it is finished with it. Gecko 1.7 note As of Gecko 1.7, this method is unused. Most implementations do nothing interesting with this method. It exists primarily for binary compatibility with Microsoft COM's IClassFactory inter...
...osoft COM's IClassFactory interface. ...
nsILoginManager
Implemented by: @mozilla.org/login-manager;1. ...
... Note: Defaul...
...count The number of elements in the returned array. JavaScript callers can simply use the array's length property and supply a dummy argument for this parameter. logins An array of nsILoginInfo objects containing all the logins the Login Manager has on record. Example You can call this method from JavaScript like this: var logins = myLoginMgr.getAllLogins({}); getLoginSavingEnabled() Re
ports whether or not saving login information is enabled for a host. boolean getLoginSavingEnabled( in AString aHost ); Parameters aHost The hostname to check. This argument should be in the origin URL format, with no pathname. For example: "https://www.site.com". Return value true if login saving is enabled for the host, otherwise false. modifyLogin() Modifies an existing login by repla...
...nsILoginMetaInfo properties are unmodified). If newLoginData is a nsIPropertyBag, only the specified properties will be changed. The nsILoginMetaInfo properties of oldLogin can be changed in this manner. If the propertybag contains an item named "timesUsedIncrement", the login's timesUsed property will be incremented by the item's value. void modifyLogin( in nsILoginInfo oldLogin, in nsISup
ports newLoginData ); Parameters oldLogin The login to be modified. newLoginData The login information to replace the oldLogin with. This may be specified as either an nsILoginInfo or an nsIPropertyBag2 object. removeAllLogins() Removes all logins known by the Login Manager. This works without a need for the master password, if one is set. void removeAllLogins(); Parameters None. remov...
nsILoginManagerStorage
toolkit/components/passwordmgr/public/nsILoginManagerStorage.idlScriptable This interface is implemented by modules that wish to provide storage mechanisms for the Login Manager. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) For example, if you wish to provide operating system integration with a native password manager system, implementing and registering a storage module for the Login Manager is how you do it. See Creating a Login Manager storage module for details. Note: Extensions that simply want to access/store logins should use the Login Manager service and nsILoginManager interface instead. The Login Manager will handle selecting and using the correct nsILoginMananger...
...ns([optional] out unsigned long count, [retval, array, size_is(count)] out nsILoginInfo logins); void getAllLogins([optional] out unsigned long count, [retval, array, size_is(count)] out nsILoginInfo logins); boolean getLoginSavingEnabled(in AString aHost); void init(); void initWithFile(in nsIFile aInputFile, in nsIFile aOutputFile); void modifyLogin(in nsILoginInfo oldLogin, in nsISup
ports newLoginData); void removeAllLogins(); void removeLogin(in nsILoginInfo aLogin); void searchLogins(out unsigned long count, in nsIPropertyBag matchData, [retval, array, size_is(count)] out nsILoginInfo logins); void setLoginSavingEnabled(in AString aHost, in boolean isEnabled); Attributes Attribute Type Description uiBusy boolean true when a master password prompt is being shown...
...ay, size_is(count)] out nsILoginInfo logins ); Parameters count Optional Return in this parameter the number of logins returned in the logins array. logins Return in this parameter an array of all nsILoginInfo objects in the login store. This parameter must always be an array; if there are no logins in the login store, it must be an empty array, not null. getLoginSavingEnabled() Implement to re
port whether or not login saving has been disabled for a specific host. boolean getLoginSavingEnabled( in AString aHost ); Parameters aHost The hostname whose login saving status should be returned. This string will be in the origin URL format, without a pathname. For example, "http://mozilla.com". Return value Return true if login saving is enabled for the specified host; otherwise, return false...
...fy an existing login in the login store. If newLoginData is specified as an nsILoginInfo object, all of the old login's properties are changed to the values from the newLoginData parameter. If newLoginData is a nsIPropertyBag, only the properties specified in the nsIPropertyBag are changed in oldLogin and its corresponding nsILoginMetaInfo. void modifyLogin( in nsILoginInfo oldLogin, in nsISup
ports newLoginData ); Parameters oldLogin The login to be modified. newLoginData The login information to replace the oldLogin with. This may be specified as either an nsILoginInfo or an nsIPropertyBag2 object. removeAllLogins() Implement this method to remove all logins from the login store. This is called by the browser sanitization feature when the user asks to clear all stored passwords. The us...
nsIMsgSearchSession
e, and then call search(). ...
...ipt] nsMsgSearchType SetSearchParam(in nsMsgSearchType type, in voidPtr param); [noscript] void AddResultElement(in nsMsgResultElement element); boolean MatchHdr(in nsIMsgDBHdr aMsgHdr, in nsIMsgDatabase aDatabase); void addSearchHit(in nsIMsgDBHdr header, in nsIMsgFolder folder); Attributes Attribute Type Description searchTerms nsISup
portsArray Readonly: numSearchTerms unsigned long Readonly: runningAdapter nsIMsgSearchAdapter Readonly: searchParam voidPtr Not scriptable and readonly: searchType nsMsgSearchType Readonly: numResults long Readonly: window nsIMsgWindow Constants Name Value Description B...
... [noscript] boolean ScopeUsesCustomHeaders(in nsMsgSearchScopeValue scope, in voidPtr selection, in boolean forFilters); Parameters scope selection Could be a folder or server based on scope forFilters IsStringAttribute() Use this to...
...meters scope folder addDirectoryScopeTerm() void addDirectoryScopeTerm(in nsMsgSearchScopeValue scope); Parameters scope clearScopes() void clearScopes(); ScopeUsesCustomHeaders() Call this function everytime the scope changes! It informs the FE if the current scope sup
port custom header use. FEs should not display the custom header dialog if custom headers are not sup
ported. [noscript] boolean ScopeUsesCustomHeaders(in nsMsgSearchScopeValue scope, in voidPtr selection, in boolean forFilters); Parameters scope selection Could be a folder or server based on scope forFilters IsStringAttribute() Use this to determine if your attribute is a string attribute. boolean IsStringAttribute(in nsMsgSearchAttribV...
nsINavBookmarkObserver
toolkit/components/places/nsINavBookmarksService.idlScriptable This interface is an observer for bookmark changes. ...
...m was visited. Can be invoked only for TYPE_BOOKMARK items. Normally in bookmarks we use the last visit date, and normally the time will be a new visit that will be more recent, but this is not guaranteed. You should check to see if it is actually more recent before using this new time. See onItemChanged() method property = "cleartime" for when all visit dates are deleted for the URI. Note: The re
ported time is the time of the visit that was added, which may be well in the past since the visit time can be specified. This means that the visit the observer is told about may not be the most recent visit for that page. void onItemVisited( in long long aItemId, in long long aVisitId, in PRTime aTime, in unsigned long aTransitionType, in nsIURI aURI, in long long aParentId, in ACString...
...its parent. onSeparatorRemoved() Obsolete since Gecko 1.9 (Firefox 3) Notify this observer that a separator has been removed. void onSeparatorRemoved( in PRInt64 parent, in PRInt32 index ); Parameters parent The id of the separator's parent. index The separator's old index in its parent. Using onBeforeItemRemoved() in Gecko 1.9.1 If you wish to sup
port onBeforeItemRemoved() in applications based on Gecko 1.9.1, you must implement your observer's QueryInterface() method to match on both nsINavBookmarkObserver and nsINavBookmarkObserver_MOZILLA_1_9_1_ADDITIONS, as shown below. QueryInterface: function(iid) { if (iid.equals(Ci.nsINavBookmarkObserver) || iid.equals(Ci.nsINavBookmarkObserver_MOZILLA_1_9_1_ADDITIONS) || iid.equals(Ci.ns...
...eforeItemRemoved() in applications based on Gecko 1.9.1, you must implement your observer's QueryInterface() method to match on both nsINavBookmarkObserver and nsINavBookmarkObserver_MOZILLA_1_9_1_ADDITIONS, as shown below. QueryInterface: function(iid) { if (iid.equals(Ci.nsINavBookmarkObserver) || iid.equals(Ci.nsINavBookmarkObserver_MOZILLA_1_9_1_ADDITIONS) || iid.equals(Ci.nsISup
ports)) { return this; } throw Cr.NS_ERROR_NO_INTERFACE; } See also Places Manipulating bookmarks using Places nsINavBookmarksService ...
nsIObserverService
xpcom/ds/nsIObserverService.idlScriptable This interface provides methods to add, remove, notify, and enumerate observers of various notifications. Inherits from: nsISup
ports Last changed in Gecko 0.9.6 The XPCOM nsObserverService implements this interface to provide global notifications for a variety of subsystems. ...
...See nsIObserver for a JavaScript example. void addObserver( in nsIObserver anObserver, in string aTopic, in boolean ownsWeak ); Parameters anObserver...
... topic. See nsIObserver for a JavaScript example. void addObserver( in nsIObserver anObserver, in string aTopic, in boolean ownsWeak ); Parameters anObserver The nsIObserver object which will receive notifications. aTopic The notification topic or subject. ownsWeak If set to false, the nsIObserverService will hold a strong reference to anObserver. If set to true and anObserver sup
ports the nsISup
portsWeakReference interface, a weak reference will be held. Otherwise an error will be returned. (In most cases, you should use false.) enumerateObservers() Called to enumerate all observers registered for a particular topic. nsISimpleEnumerator enumerateObservers( in string aTopic ); Parameters aTopic The notification topic or subject. Return value Returns an enumerati...
...ll observers registered for a particular topic. nsISimpleEnumerator enumerateObservers( in string aTopic ); Parameters aTopic The notification topic or subject. Return value Returns an enumeration of all registered listeners. See nsISimpleEnumerator. notifyObservers() This method is called to notify all observers for a particular topic. See Example. void notifyObservers( in nsISup
ports aSubject, in string aTopic, in wstring someData ); Parameters aSubject A notification specific interface pointer. This usually corresponds to the source of the notification, but could be defined differently depending on the notification topic and may even be null. aTopic The notification topic. This string-valued key uniquely identifies the notification. This parameter must not be nu...
nsIPrintingPrompt
See nsIPrintingPromptService for all documentation. This service enables embedders to implement their own Print and Progress Dialogs. ...
... implement their own Print and Progress Dialogs. Each platform has a "base" or "backstop" implementation of the service. The service is automatically registered at start up. Historically, platform toolkits with native dialogs have implemented them in the GFX layer Usually they were displayed when a new DeviceContextSpec specific to that platform was created. Windows: The GFX layer no longer sup
ports default toolkit behavior for displaying the native Print Dialog. If an embedder implemented service returns any error code (other than NS_ERROR_ABORT) printing will terminate. Returning NS_OK assumes that the PrintSettings object was correctly filled in and if it does not have valid fields for printer name, and so on. it may also terminate. Defaults for platform service: showPrintDialog - d...
... that the PrintSettings object was correctly filled in and if it does not have valid fields for printer name, and so on. it may also terminate. Defaults for platform service: showPrintDialog - displays a native dialog showPageSetup() - displays a XUL dialog showProgress() - displays a XUL dialog Summary for Windows embedders: Stated once again: There is no "fallback" native platform sup
port in GFX for the displaying of the native print dialog. The current default implementation for Windows display a native print dialog but a XUL-based progress dialog. If you wish to have a native progress dialog on Windows you will have to create and register your own service. Note: The Windows version Mozilla implements this service which is automatically built and registered for you. You can use ...
...ou may stub out this service by having all the methods return NS_ERROR_NOT_IMPLEMENTED. You can then fly you own dialog and then properly fill in the PrintSettings object before calling nsIWebBrowserPrint's Print method. If you stub out this service you MUST set "printSilent" to true, if you do not, Printing will terminate and an error dialog will be displayed. Mac: The GFX layer still sup
ports default toolkit behavior for displaying the Print Dialog. If an embedder implemented service returns NS_ERROR_NOT_IMPLEMENTED for "showPrintDialog" The toolkit will display the native print dialog. Defaults for platform service: Mac OS X: showPrintDialog - displays a native dialog showPageSetup() - displays a native dialog showProgress() - not implemented (provided by OS) GTK: There ar...
nsIPushService
dom/interfaces/push/nsIPushService.idlScriptable A service for components to subscribe and receive push messages from remote servers. Inherits from: nsISup
ports Last changed in Gecko 46.0 (Firefox 46.0 / Thunderbird 46.0 / SeaMonkey 2.43) Push lets a remote server send payloads to a web site, add-on, or component running in the browser. nsIPushService sup
ports the Push API implementation in Firefox, and can be used directly from privileged code to create system subscriptions. Implemented by @mozilla.org/push/Service;1 as a service: const pushService = Components.classes["@mozilla.org/push/Service;1"] .getService(Components.interfaces.nsIPushService); Method overview void subscribe(in DOMString scope, in nsIPrincipal principal, in nsIP...
... subscription.endpoint; subscription.getKey("p256dh"); subscription.getKey("auth"); } ); getSubscription() Fetches an existing subscription. void getSubscription( in DOMString scope, in nsIPrincipal principal, in nsIPushSubscriptionCallback callback ); ...
...pe URL, as passed to nsIPushService.subscribe(). principal The subscription nsIPrincipal, as passed to nsIPushService.subscribe(). callback The callback to call with the fetched nsIPushSubscription. Example pushService.getSubscription( "chrome://my-module/push", scriptSecurityManager.getSystemPrincipal(), (code, subscription) => { if (!Components.isSuccessCode(code)) { Cu.re
portError("Error fetching subscription: " + code); return; } // `subscription == null` if the `(scope, principal)` pair doesn't have a // push subscription. Otherwise, it's an instance of `nsIPushSubscription`. } ); unsubscribe() Drops an existing push subscription. void unsubscribe( in DOMString scope, in nsIPrincipal principal, in nsIUnsubscribeResultCallback callback )...
... unique scope URL, as passed to nsIPushService.subscribe(). principal The subscription nsIPrincipal, as passed to nsIPushService.subscribe(). callback The callback to call when the nsIPushSubscription is dropped. Example pushService.unsubscribe( "chrome://my-module/push", scriptSecurityManager.getSystemPrincipal(), (code, ok) => { if (!Components.isSuccessCode(code)) { Cu.re
portError("Error unsubscribing: " + code); return; } // `ok === true` if the subscription was removed, or `false` if the // `(scope, principal)` pair didn't have a subscription. } ); Receiving Push Messages Subscriptions created from privileged code use XPCOM observer notifications instead of service worker events. You can use the global nsIObserverService to listen for these no...
nsIPushSubscription
Sending a POST request to this URL routes the message to the instance of Firefox that created the subscription. A subscription also has a public key and secret; these are used to encrypt message payloads. This interface resembles PushSubscription from the Push API. ...
...ime a message was sent to this subscription, in milliseconds since the epoch. quota long The number of remaining background messages for this subscription, or -1 if exempt. Methods getKey() Returns a byte array containing the key material for this subscription. The remote server can use these keys to encrypt and authenticate message payloads. The following key names are sup
ported: p256dh The ECDH public key, used as the input keying material in the HKDF invocation during encryption. auth The shared authentication secret, used as the salt in the HKDF invocation. void getKey( in DOMString name, [optional] out uint32_t keyLen, [array, size_is(keyLen), retval] out uint8_t key ); Parameters name The encryption key name. keyLen Th...
... key: String.fromCharCode.apply(null, btoa(subscription.getKey("p256dh"))), secret: String.fromCharCode.apply(null, btoa(subscription.getKey("auth"))), })); } pushService.subscribe( "chrome://my-module/push", ...
.../ Base64-encode the key and authentication secret. ...
nsISHistory
A handle to the session history object can be obtained from nsIWebNavigation. In a non-embedded situation, the owner of the session history component must create a instance of it and set it in the nsIWebNavigation object. Implemented by: @mozilla.org/browser/shistory;1. ...
...method can be traversed using nsISimpleEnumerator. To access individual history entries of the enumerator, perform the following steps: Call GetSHistoryEnumerator() to obtain handle the nsISimpleEnumerator object. Use nsISimpleEnumerator.GetNext() on the object returned by step #1 to obtain handle to the next object in the list. The object returned by this step is of type nsISup
ports. Perform a QueryInterface on the object returned by step #2 to nsISHEntry. Use nsISHEntry to access properties of each history entry. Read only. Methods addSHistoryListener() Called to register a listener for the session history component. Listeners are notified when pages are loaded or purged from history. Note: A listener object must implement nsISHistoryListener and n...
... Perform a QueryInterface on the object returned by step #2 to nsISHEntry. Use nsISHEntry to access properties of each history entry. Read only. Methods addSHistoryListener() Called to register a listener for the session history component. Listeners are notified when pages are loaded or purged from history. Note: A listener object must implement nsISHistoryListener and nsSup
portsWeakReference. void addSHistoryListener( in nsISHistoryListener aListener ); Parameters aListener Listener object to be notified for all page loads that initiate in session history. getEntryAtIndex() Called to obtain handle to the history entry at a given index. nsISHEntry getEntryAtIndex( in long index, in boolean modifyIndex ); Parameters index The index value whose e...
...is invalid or out of bounds with the size of history. NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA Purge was vetoed. reloadCurrentEntry() void reloadCurrentEntry(); Parameters None. removeSHistoryListener() Called to remove a listener for the session history component. Listeners are notified when pages are loaded from history. Note: A listener object must implement nsISHistoryListener and nsSup
portsWeakReference. void removeSHistoryListener( in nsISHistoryListener aListener ); Parameters aListener Listener object to be removed from session history. ...
nsITelemetry
toolkit/components/telemetry/nsITelemetry.idlScriptable A service to gather performance data that can be tracked over time to allow generating histograms. ...
...etService(Components.interfaces.nsITelemetry); Method overview jsval getHistogramById(in ACString id); jsval snapshotHistograms(in uint32_t aDataset, in boolean aSubsession, in boolean aClear); jsval getKeyedHistogramById(in ACString id); void captureStack(in ACString name); jsval snapshotCapturedStacks([optional] in boolean clear); nsISup
ports getLoadedModules(); jsval snapshotKeyedHistograms(in uint32_t aDataset, in boolean aSubsession, in boolean aClear); void setHistogramRecordingEnabled(in ACString id, in boolean enabled); void asyncFetchTelemetryData(in nsIFetchTelemetryDataCallback aCallback); double msSinceProcessStart(); void scalarAdd(in ACString aName, in jsval aValue); ...
...ean aClear); void registerEvents(in ACString aCategory, in jsval aEventData); void registerScalars(in ACString aCategoryName, in jsval aScalarData); void clearEvents(); test only Attributes Attribute Type Description canRecordBase boolean A flag indicating if Telemetry can record base data (FHR data). This is true if the FHR data re
porting service or the self-sup
port service is enabled. canRecordExtended boolean A flag indicating if Telemetry is allowed to record extended data. Returns false if the user has not opted into "extended Telemetry" on the Release channel, when the user has explicitly opted out of Telemetry on Nightly/Aurora/Beta or if manually set to false during tests. canRecordReleaseData ...
.... keys() - Returns an array with the string keys of the currently registered histograms. clear() - Clear out the registered histograms and keys. ...
nsIWeakReference
xpcom/base/nsIWeakReference.idlScriptable This interface represents a proxy for an XPCOM object. It allows a consumer to hold an indirect, non-owning reference to an XPCOM object. Inherits from: nsISup
ports Last changed in Gecko 0.9.9 An instance of nsIWeakReference is a proxy object that cooperates with its referent to give clients a non-owning, non-dangling reference. Clients own the nsIWeakReference instance. ...
... 0.9.9 An instance of nsIWeakReference is a proxy object that cooperates with its referent to give clients a non-owning, non-dangling reference. Clients own the nsIWeakReference instance. Method overview void QueryReferent( in nsIIDRef uuid, [iid_is(uuid), retval] out nsQIResult result ); Methods QueryReferent() This method queries an interface on the referent if it exists, and like nsISup
ports.QueryInterface(), produces an owning reference to the desired interface.")}} It is designed to look and act exactly like (a proxied) nsISup
ports.QueryInterface(). Do not hold on to the produced interface permanently; that would defeat the purpose of using a non-owning nsIWeakReference in the first place. void QueryReferent( in nsIIDRef uuid, [iid_is(uuid), retval] out nsQIResult result ); P...
...out nsQIResult result ); Parameters uuid The UUID of the requested interface. ...
...ameters uuid The UUID of the requested interface. ...
nsIWebPageDescriptor
Read only. ...
...Read only. ...
...Read only. ...
...ally syntax-highlighted (for XML/HTML documents) source of the original page. DISPLAY_NORMAL 0x0002 Just refetches the existing page. Note that if the descriptor is that of the source of another page, this keeps the source view, but uses the current syntax highlighting preference. Methods loadPage() Tells the object to load the page specified by the page descriptor. void loadPage( in nsISup
ports aPageDescriptor, in unsigned long aDisplayType ); Parameters aPageDescriptor The page descriptor for the page to load. aDisplayType The display type to use when displaying the loaded page; see Display type constants for possible values. ...
nsIXSLTProcessor
content/xslt/public/nsIXSLTProcessor.idlScriptable XSLT Processor Inherits from: nsISup
ports Last changed in Gecko 1.7 Implemented by: @mozilla.org/document-transformer;1?type=xslt. ...
... Gecko 1.7 Implemented by: @mozilla.org/document-transformer;1?type=xslt. ...
...void clearParameters(); Parameters None. getParameter() Gets a parameter if previously set by setParameter(). Returns null otherwise. nsIVariant getParameter( in DOMString namespaceURI, in DOMString localName ); Parameters namespaceURI The namespaceURI of the XSLT parameter. localName The local name of the XSLT parameter. Return value An nsIVariant containing the value of the parameter. im
portStylesheet() Im
ports the specified stylesheet into this XSLTProcessor for transformations. void im
portStylesheet( in nsIDOMNode style ); Parameters style The root-node of a XSLT stylesheet. This can be either a document node or an element node. If a document node then the document can contain either a XSLT stylesheet or a LRE stylesheet. If the argument is an element node it must be the xsl:st...
...eter doesn't exist in the stylesheet the parameter will be ignored. void setParameter( in DOMString namespaceURI, in DOMString localName, in nsIVariant value ); Parameters namespaceURI The namespaceURI of the XSLT parameter. localName The local name of the XSLT parameter. value The new value of the XSLT parameter. transformToDocument() Transforms the node source applying the stylesheet im
ported by im
portStylesheet(). nsIDOMDocument transformToDocument( in nsIDOMNode source ); Parameters source The node to be transformed. Return value An Document containing the result of the transformation. transformToFragment() Transforms the node source applying the stylesheet im
ported by im
portStylesheet(). The created fragment will be owned by the specified output document. nsIDOMDocumentFragm...
nsIXULTemplateBuilder
put. The addResult, removeResult, replaceResult and resultBindingChanged methods may be called by the query processor to indicate that the set of valid results has changed, such that a different query may match. If a different match would become active, the content for the existing match is removed and the content for the new match is generated. ...
...match is removed and the content for the new match is generated. A query processor is not required to provide any sup
port for updating results after they have been generated. See the Template Guide for more information about templates. /xul/templates/public/nsIXULTemplateBuilder.idlScriptable Please add a summary to this article. ...
...[noscript] void init(in nsIContent aElement); [noscript] void createContents(in nsIContent aElement, in boolean aForceCreation); void addListener(in nsIXULBuilderListener aListener); void removeListener(in nsIXULBuilderListener aListener); Attributes Attribute Type Description root nsIDOMElement Readonly: The root node in the DOM to which this builder is attached. datasource nsISup
ports The opaque datasource object that is used for the template. This object is created by the getDataSource method of the query processor. May be null if the datasource has not been loaded yet. Set this attribute to use a different datasource and rebuild the template. For an RDF datasource, this will be the same as the database. For XML this will be the nsIDOMNode for the datasource document or nod...
...nly: The query processor used to generate results. Methods rebuild() Force the template builder to rebuild its content. All existing content will be removed first. The query processor's done() method will be invoked during cleanup, followed by its initializeForBuilding() method when the content is to be regenerated. void rebuild(); Parameters None. refresh() Reloads any RDF datasources that sup
port nsIRDFRemoteDatasource. Note: This is a temporary hack so that remote-XUL authors can reload remote datasources. When RDF becomes remote-scriptable, this will no longer be necessary. void refresh(); Parameters None. addResult() Informs the template builder that a new result is available. The builder will add this result to the set of results. The query node that the new result applies to must be ...
nsIXULTemplateResult
The result may optionally be identified by an RDF resource. Generally, the result and its id will be able to uniquely identify a node in the source data, such as an RDF or XML node. ...
...xts, such as a database query, a result would represent a particular record. A result is expected to only be created by a query processor. Each result also contains a set of variable bindings. The value for a particular variable may be retrieved using the getBindingFor() and getBindingObjectFor() methods. Method overview AString getBindingFor(in nsIAtom aVar); nsISup
ports getBindingObjectFor(in nsIAtom aVar); void hasBeenRemoved(); void ruleMatched(in nsISup
ports aQuery, in nsIDOMNode aRuleNode); Attributes Attribute Type Description id AString ID of the result. The DOM element created for this result, if any, will have its id attribute set to this value. The id must b...
...ers aVar The variable to look up. Return value The value for the variable or a null string if it has no value. getBindingObjectFor() Get an object value for a variable such as ?name for this result. This method may return null for a variable, even if getBindingFor() returns a non-null value for the same variable. This method is provided as a convenience when sorting results. nsISup
ports getBindingObjectFor( in nsIAtom aVar ); Parameters aVar The variable to look up. Return value The value for the variable or null if it has no value. hasBeenRemoved() Indicate that the output for a result has been removed and that the result is no longer being used by the builder. void hasBeenRemoved(); Parameters None. ruleMatched() Indicate that a particular rule of a query ...
...put will be generated for it. Both the query as compiled by the query processor's nsIXULTemplateQueryProcessor.compileQuery() method and the XUL <rule> element are supplied. The query must always be one that was compiled by the query processor that created this result. The <rule> element must always be a child of the <query> element that was used to compile the query. void ruleMatched( in nsISup
ports aQuery, in nsIDOMNode aRuleNode ); Parameters aQuery The query that matched. aRuleNode The rule node that matched. See also nsIXULTemplateQueryProcessor ...
nsIZipReader
modules/libjar/nsIZipReader.idlScriptable This interface provides methods for reading compressed (zip) files. Inherits from: nsISup
ports Last changed in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) Implemented by: @mozilla.org/libjar/zip-reader;1. To create an instance, use: var zipReader = Components.classes["@mozilla.org/libjar/zip-reader;1"] .createInstance(Components.interfaces.nsIZipReader); About character sets and code pages Note: nsIZipReader has a code page problem; that is, in the ZIP specification, filenames are supposed to use 7-bit ASCII; however, most modern filesystems use 8 bit code pages, such as UTF-8. This can mismatch characters in the nsIZipReader API. Starting in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2...
....nsIZipReader); About character sets and code pages Note: nsIZipReader has a code page problem; that is, in the ZIP specification, filenames are supposed to use 7-bit ASCII; however, most modern filesystems use 8 bit code pages, such as UTF-8. This can mismatch characters in the nsIZipReader API. Starting in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), the nsIZipReader API sup
ports a limited 8 bit code page usage. All functions now pass the filenames (both in and out) as AUTF8String. So you can now read and extract what you wrote with nsIZipWriter. If you show filenames from the findEntries() result in the user interface, the character matching is only fine on UTF-8 ZIP archives. Method overview void close(); void extract(in AUTF8String zipEntry, in ...
...); Parameters aEntryName The single entity to check or null for checking all entries in the archive. Examples List contents of XPI and read file contents This example uses findEntries, getEntry, getInputStream, open, and close. It also uses nsIScriptableInputStream to read the stream returned by getInputStream. XPI files are ZIP files, just Firefox needs the extension to be XPI. Change "
PortableTester@jetpack.xpi" to the name of a XPI file in your extensions folder. Then you can copy and paste this code in scratchpad to run it. var zr = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance(Ci.nsIZipReader); Cu.im
port('resource://gre/modules/osfile.jsm'); Cu.im
port('resource://gre/modules/FileUtils.jsm'); var reusableStreamInstance = Cc['@mozilla.org/scriptablein...
... zr = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance(Ci.nsIZipReader); Cu.im
port('resource://gre/modules/osfile.jsm'); Cu.im
port('resource://gre/modules/FileUtils.jsm'); var reusableStreamInstance = Cc['@mozilla.org/scriptableinputstream;1'].createInstance(Ci.nsIScriptableInputStream); var pathToXpiToRead = OS.Path.join(OS.Constants.Path.profileDir, 'extensions', '
PortableTester@jetpack.xpi'); var nsiFileXpi = new FileUtils.File(pathToXpiToRead); //Services.ww.activeWindow.alert(pathToXpiToRead); try { zr.open(nsiFileXpi); //if file dne it throws here var entries = zr.findEntries('*'); //we use asterik because we want EVERYTHING listed out while (entries.hasMore()) { var entryPointer = entries.getNext(); //just a ...
Troubleshooting XPCOM components registration
Often the first time you create an XPCOM component, it may fail to register correctly. There are several common reasons that registration can fail: A component that is a binary (shared library) fails to load A JavaScript component has parsing errors The shared library loaded correctly, but registration was not successful Did Registration Succeed? It is im
portant to not misdiagnose the problem. You can be certain that a component has failed to register by going to the Error Console and evaluating Components.classes["contract-id"].name where contract-id is your contract ID. If the response is your contract ID instead of an error, the component was successfully registered and this is the wrong page. Load Failure of Binary Components On the Mozilla trunk (Firefox 3, XULRunner 1.
...omponents written in JavaScript to fail is that there are parsing errors. These parsing errors should show up in the Error Console if chrome errors are enabled. To learn more about enabling chrome errors, see "How can I see errors in my code" in the Extension FAQs. Registration Failure If the module is loading correctly but doesn't register its components, try adding calls to Components.utils.re
portError("Debug me!"); in NSGetModule() and other functions to try and find any errors. General hints You may need to delete compreg.dat in your profile folder to force re-registration. This should not occur if you uninstalled/installed your extension via the Extension Manager. When adding a component to a XULRunner application, change the BuildID in application.ini. If your component requires ...
...y firefox.exe (or equivalent) is in. In the bottom left corner, click Add Directory. Do not add any other directories; in particular, do not add your extension's (or XULRunner application's) components directory. After clicking OK in the top right, check for any missing dependencies using File -> Open -> firefox.exe (or equivalent). Also check that the function NSGetModule is ex
ported. You can also use the Profiling feature of Dependency Walker to view failed module loads while running your application. Open the Profile menu and select Start Profiling.... In the dialog that appears, you can provide command line parameters and click OK to start the application. You will see any modules that failed to load in the module list. Note: You should delete compreg.dat fro...
...ete compreg.dat from your profile before doing this. Note that even your version of MSVC may matter; your test machine may not have the C runtime libraries (msvcr70.dll / msvcp70.dll for MSVC 7.0, and similarly named files for 7.1 and 8.0) available. This even means that if you are using a component stub, the stub needs to be compiled using a version which the machine does sup
port; most likely this means MSVC 6.0. It may then be necessary for the stub to locate the newer runtime libraries for the other files it loads. If you compiled the component with MSVC 8.0 (2005) and are attempting to use it on a Windows XP machine or later, it will need a manifest embedded to find the runtime. Please refer to MSDN for details. If you have the option, you can manually copy these...
Frequently Asked Questions
For example, the assertion occurs when you convert the pointer to the object to a raw pointer to that interface, then assign the raw pointer to another nsCOMPtr for that interface. NS_PRECONDITION "You can't dereference a NULL nsCOMPtr with operator->()" NS_PRECONDITION "You can't dereference a NULL nsCOMPtr with operator*()" Other issues printf("%x...
...w XPCOM interface pointer declaring an nsCOMPtr to a forward-declared class not linking to XPCOM not including nsCOMPtr.h different settings of NSCAP_FEATURE_DEBUG_PTR_TYPES Runtime Errors NS_ASSERTION "QueryInterface needed" May be caused by a class that derives from a given interface, when you forgetting to also specify the interface name in the NS_IMPL_ISUP
PORTS / NS_IMPL_THREADSAFE_ISUP
PORTS macro. For example, the assertion occurs when you convert the pointer to the object to a raw pointer to that interface, then assign the raw pointer to another nsCOMPtr for that interface. NS_PRECONDITION "You can't dereference a NULL nsCOMPtr with operator->()" NS_PRECONDITION "You can't dereference a NULL nsCOMPtr with operator*()" Other issues printf("%x\n", mynsCOMPtr); can cause the...
... and link to it from here. make an nsCOMPtr leak (for a debug test)? call a getter that uses a raw XPCOM interface pointer as an `in/out' parameter? call a getter that fills in an nsIFoo*& parameter? call a getter that doesn't AddRef its result? Any XPCOM function that returns an interface pointer, i.e., a `getter', must have already AddRefed that pointer. If it didn't, you should probably re
port it as a bug. No matter which code pattern you use to solve this problem, you should comment it, e.g., // Warning: this getter doesn't AddRef() its result. If the getter returns the new pointer as its function result, no worries, General Does nsCOMPtr bloat the code? Are nsCOMPtrs fast? Can I use them in tight loops? Bibliography Web Resources nsCOMPtr.h, and nsCOMPtr.cpp are the source to...
...an I use them in tight loops? Bibliography Web Resources nsCOMPtr.h, and nsCOMPtr.cpp are the source to nsCOMPtr. You can examine the source to nsCOMPtr online using (the wonderful) LXR. Exploring this code is not an adventure for the faint of heart. Some COM Ownership Guidelines. Interface Pointers Considered Harmful by Don Box originally appeared in the September 1995 issue of "The C++ Re
port". COM Smart Pointers Even More Harmful by Don Box is a follow-up article that originally appeared in the February 1996 issue of "The C++ Re
port". Books Essential COM by Don Box. Effective COM by Don Box, et al. The C++ Programming Language (3rd Edition) by Bjarne Stroustrup. Effective C++ (2nd Edition): 50 Specific Ways to Improve Your Programs and Designs by Scott Meyers. More Effectiv...
Using nsIDirectoryService
at http://www.mozilla.org/projects/xpco...locations.html Background The way in which Mozilla components locate special files and directories has changed. In the past, this was done using nsIFileLocator. This component was a problem for embedding applications. Since it was a component and was loaded implicitly by many other components, it was difficult to customize. Customizing the locations is im
portant if, for example, your application already has a profile directory or other resource directories. You may wish that you could have Mozilla use these locations rather than requiring the same disk layout as SeaMonkey. In order to change these locations using nsIFileLocator and still be able to use the same components directory as an existing Mozilla installation, you had to make a component with ...
...ead of the profile service, thus saving some footprint. Customizing Locations Although you can change locations one at a time by using the nsIProperties interface of nsDirectoryService, you can also install your own nsIDirectoryServiceProvider to control them en masse. To do this for application-level locations, create a provider based on appfilelocprovider. This object has to implement the nsISup
ports and nsIDirectoryServiceProvider interfaces. It does not need to be a component - it can be a static lib, a source file in your project - whatever. Just construct it, pass it to NS_InitEmbedding, and it will be installed. If you are not using NS_InitEmbedding, you will have to construct it and register it yourself using nsIDirectoryService.registerProvider(). If you are registering it yourself it...
...rectoryServiceProvider interfaces. It does not need to be a component - it can be a static lib, a source file in your project - whatever. Just construct it, pass it to NS_InitEmbedding, and it will be installed. If you are not using NS_InitEmbedding, you will have to construct it and register it yourself using nsIDirectoryService.registerProvider(). If you are registering it yourself it is very im
portant to register it immediately after calling NS_InitXPCOM. There are things in the startup process that need these locations at a very early point - even before registering components. If you want to use mpfilelocprovider, or something like it, to provide one fixed profile, just construct it and call its Initialize method - it will register itself. Again, if you do this, do not initialize the prof...
..., or something like it, to provide one fixed profile, just construct it and call its Initialize method - it will register itself. Again, if you do this, do not initialize the profile service - it's either one or the other. Related Pages Code_snippets:File_I/O Original Document Information Authors: Conrad Carlen, Doug Turner Last Updated Date: September 26, 2000 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
XPCOM tasks
rhaps all routines) in "nsUnitConversion.h" probably belong in layout. P3 nsStringTokenizer probably belongs in the parser. 5.1 3rd party code that doesn't use any services from our tree should be below XPCOM; particularly, code XPCOM could exploit, e.g., expat Berkeley db Changes to APIs, Functionality, and Implementations The following items are listed (very) roughly in their order of im
portance, i.e., fixing observers is the first thing I want to do. P1 Various threading issues, e.g., Too many locks. See bug 13009. Not enough locks. See bug 5795, bug 12755, and bug 12755. P1 We would like to move to a scheme where no one writes QueryInterface, and we save code-space with a table driven implementation. A first step is moving all QI implementations to the table-like macros alrea...
...755, and bug 12755. P1 We would like to move to a scheme where no one writes QueryInterface, and we save code-space with a table driven implementation. A first step is moving all QI implementations to the table-like macros already in place (and some slight modifications to those macros). See bug 23737 Work is progressing on this. See in particular, the new NS_INTERFACE_MAP_... macros in "nsISup
portsUtils.h". P1 We need to use NS_GET_IID instead of NS_DEFINE_IID. See bug 25886. Work is progressing on this. P2 Classes that parallel Standard Library classes should have compatible APIs, i.e., nsDeque bug 18505 nsString nsAVLTree nsHashtable our various array classes In some cases, this might initially be provided by additional interfaces. In all cases, we want to transition the primar...
...re the idea of using a separate registry. 5.1 If the build hierarchy were fixed, the Registry could exploit expat and dbm. It could avoid implementing its own file format and io; and in many cases, possibly avoid calling into components for registration. In any case, the process of registration can, I think, be simplified. 5.1 Should we provide type-safe templatized containers, e.g., over nsISup
portsArray? 5.1 We want to provide some mechanism for user-specific components in a multi-user environment. 5.1 Fix the shutdown issues that complicate life for embedding applications. Things we need to evangelize We need to keep up-to-date documentation, samples, and have brown-bags to keep people informed. We've been doing this, but it should be in the plan. General XPCOM guidelines. See, e.g...
...be in the plan. General XPCOM guidelines. See, e.g., XPCOM Code FAQ, IDL Author's Guide, and Implementing QueryInterface. Writing and using components and modules. Building ownership models that work (see XPCOM ownership guidelines), using raw pointers, nsCOMPtr (see The nsCOMPtr User's Manual), nsIWeakReference (see nsIWeakReference), nsCWeakReference, and (across threads) proxies (see nsISup
ports proxies). Original Document Information Author(s): unknown Last Updated Date: May 8, 2003 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
nsCOMPtr versus RefPtr
des some explanation and advice on how to choose between them. General Rule of Thumb for nsCOMPtr versus RefPtr The general rule of thumb is to use nsCOMPtr<T> when T is an interface type, and RefPtr<T> when T is a concrete type. This basic rule derives from the fact that some of the nsCOMPtr<T> code is factored into the nsCOMPtr_base base class, which stores the underlying mRawPtr as an nsISup
ports*. (although, confusingly, debug builds don't work this way). This design saves some space in the binary (or at least it used to). Since nsCOMPtr stores the pointer as an nsISup
ports*, it must be possible to unambiguously cast from T* to nsISup
ports*. Many concrete classes inherit from nsISup
ports in more than one way, so they cannot be unambiguously cast to nsISup
ports*. Thus, these concrete cla...
... Since nsCOMPtr stores the pointer as an nsISup
ports*, it must be possible to unambiguously cast from T* to nsISup
ports*. Many concrete classes inherit from nsISup
ports in more than one way, so they cannot be unambiguously cast to nsISup
ports*. Thus, these concrete classes cannot be used with nsCOMPtr. While is possible to use nsCOMPtr<T> on concrete classes T that only singly inherit from nsISup
ports, it is best to avoid doing so. In the future, more base classes might be added to T that would then cause unrelated code to break, which would be very confusing. Hence, the interface versus concrete class rule of thumb: interfaces will never multiply inherit from nsISup
ports, so they can always use be used with nsCOMPtr without fear of breaking in the future. Concrete classes should only be used...
... only be used with RefPtr. nsCOMPtr<T> also requires that you can QueryInterface to type T. It does this so that it can assert that mRawPtr is a canonical T pointer (i.e., that mRawPtr->QueryInterface(T_IID) == mRawPtr). do_QueryInterface versus do_QueryObject The do_QueryInterface helper is only available when assigning to nsCOMPtr. It also requires that the argument singly inherit from nsISup
ports (since the type of the argument is nsISup
ports*). For other cases, there is do_QueryObject, which is essentially a more powerful form of do_QueryInterface. It differs from do_QueryInterface as follows: do_QueryObject inherits from nsCOMPtr_helper, so it can be assigned into both nsCOMPtr and RefPtr. The downside of this inheritance is that do_QueryObject requires an extra virtual call to oper...
...terface. It differs from do_QueryInterface as follows: do_QueryObject inherits from nsCOMPtr_helper, so it can be assigned into both nsCOMPtr and RefPtr. The downside of this inheritance is that do_QueryObject requires an extra virtual call to operator() in the helper method. do_QueryObject is templated on the argument type, so it's possible to pass in objects that multiply inherit from nsISup
ports. However, when the destination type is an XPCOM interface, it's probably better to static_cast to a class that unambiguously inherits from nsISup
ports and use do_QueryInterface in such cases. ...
wrappedJSObject
wrappedJSObject is a property sometimes available on XPConnect wrappers. When available, it lets you access the JavaScript object hidden by the wrapper. There are two kinds of XPConnect wrappers that sup
port the wrappedJSObject property: XPCNativeWrappers which are used to protect the chrome code working with content objects. See XPCNativeWrapper for detailed documentation. Regular XPConnect wrappers which you can encounter, for example, when using XPCOM components implemented in JS. This article focuses on the latter kind of wrappers, which hide any properties or methods on the component that are not part of the sup
ported interfaces as declared in xpidl. The rest of this article demonstrates what XPConnect wrappers do and how wrappedJSObject can be used to bypass them. Exampl...
...ent in Javascript for details on creating one. For simplicity we omit the component registration code. Suppose we register the component below with the @myself.com/my-component;1 contract. // constructor function HelloWorld() { }; HelloWorld.prototype = { hello: function() { return "Hello World!"; }, QueryInterface: function(aIID) { if (!aIID.equals(Components.interfaces.nsISup
ports) && !aIID.equals(Components.interfaces.nsIHelloWorld)) throw Components.results.NS_ERROR_NO_INTERFACE; return this; } }; XPConnect wrapping Now let's get a reference to our component. In this example we use getService, but as long as we get the reference from XPCOM, our component gets wrapped by XPConnect in the same way: var comp = Components.classes["@myself.com/my-comp...
...r comp = Components.classes["@myself.com/my-component;1"].getService(); If we try to call the hello() method we defined in our component implementation, we get: > comp.hello(); TypeError on line 1: comp.hello is not a function This happens because, as we mentioned earlier, comp is not the HelloWorld JS object itself, but an XPConnect wrapper around it: > dump(comp); [xpconnect wrapped nsISup
ports] The idea of these wrappers is to make the JavaScript-implemented XPCOM components look just like any other XPCOM component to the user. This also makes the public interface of the component clearer and provides protection for the component's internal data. Calling QueryInterface on the wrapper works, because it is defined in the nsISup
ports interface, and the wrapper knows the underlying obj...
...e wrappers is to make the JavaScript-implemented XPCOM components look just like any other XPCOM component to the user. This also makes the public interface of the component clearer and provides protection for the component's internal data. Calling QueryInterface on the wrapper works, because it is defined in the nsISup
ports interface, and the wrapper knows the underlying object implements nsISup
ports: > comp.QueryInterface(Components.interfaces.nsIHelloWorld); [xpconnect wrapped (nsISup
ports, nsIHelloWorld)] As you can see, the QueryInterface call also made the wrapper know about the other interface our component sup
ports. Assuming the nsIHelloWorld interface defines the hello method, we can now call it: > comp.hello() Hello World! While this behavior is nice for production code as it ...
Working with windows in chrome code
Components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getService(Components.interfaces.nsIWindowWatcher); watcher.openWindow(null, url, windowName, features, args); // In the window code var args = window.arguments[0].wrappedJSObject; This uses the wrappedJSObject trick. By passing args to openWindow xpconnect will automatically wrap it as a generic nsISup
ports. The opened window can then just get at the underlying JavaScript object using wrappedJSObject. Advanced data sharing The above code is useful when you need to pass data from one window to another or to a set of windows, but sometimes you just want to share a JavaScript variable in common between different windows. You could declare a local variable in each window along with corresponding sett...
...ync across windows, but fortunately, there's a better way. To declare a shared variable, we need to find a place that exists while the application is running and is easily accessible from the code in different chrome windows. There are actually a few such places. Using JavaScript code modules JavaScript code modules is a simple method for creating shared global singleton objects that can be im
ported into any other JavaScript scope. The im
porting scope will have access to the objects and data in the code module. Since the code module is cached, all scopes get the same instance of the code module and can share the data in the module. See Components.utils.im
port for more information. Pros: It's the "right way" Very simple to make and im
port. No need to build an XPCOM component.
... You can't use the window object, its members, like alert and open, and many other objects available from inside a window. ...
...urse, this doesn't matter if you just store data in the component. Learning to create XPCOM components takes time. There are several articles and books about creating XPCOM components online. Using FUEL Application object The FUEL library has been deprecated as of Firefox 41 The FUEL JavaScript library has a simple method for sharing data between windows. The Application object sup
ports a storage property which can be used to store data globally. This method is a simplified form of the XPCOM singleton method. Application.storage.set(keyname, data); var data = Application.storage.get(keyname, default); where: keyname is a string used to identify the data data is the data default is the data value to return if keyname does not exists Pros: Its the "righ...
Using COM from js-ctypes
del (COM), Automation Objects, ActiveX controls, and the .NET Framework. COM is C++ and it cannot be written directly with js-ctypes. This documentaion explains how to convert the COM C++ code into js-ctypes code. Basis and reference for this article Bugzilla :: Bug 738501 - Implement ability to create Windows shortcuts from javascript - Comment 4 Relavent topic Bugzilla :: Bug 505907 - Sup
port C++ calling from JSctypes Converting COM code to C code To convert COM code to js-ctypes, we need to write C++ VTable pointers in C. After that, we can pass a pointer . Speech Synthesis Example Let's start with following C++ code, which invokes Microsoft Speech API and says "Hello, Firefox!" with system default voice, then wait until the speaking done. #include <sapi.h> int main(void) { ...
...LONG* pulStreamNumber); void* SpeakStream; void* GetStatus; void* Skip; void* SetPriority; void* GetPriority; void* SetAlertBoundary; void* GetAlertBoundary; void* SetRate; void* GetRate; void* SetVolume; void* GetVolume; void* WaitUntilDone; void* SetSyncSpeakTimeout; void* GetSyncSpeakTimeout; void* SpeakCompleteEvent; void* IsUISup
ported; void* DisplayUI; /* end ISpVoice */ }; int main(void) { if (SUCCEEDED(CoInitialize(NULL))) { struct MyISpVoice* pVoice = NULL; HRESULT hr = CoCreateInstance(&CLSID_SpVoice, NULL, CLSCTX_ALL, &IID_ISpVoice, (void**)&pVoice); if (SUCCEEDED(hr)) { pVoice->lpVtbl->Speak(pVoice, L"Hello, Firefox!", SP...
...ere. COM types and functions Needs COM types (GUID) and functions (CoInitialize etc) description here. Converted js-ctypes code Here's converted code. This example uses busy loop and thus Firefox won't respond until the speaking is done. If this code were used in a production add-on, then to avoid Firefox locking up, run this code from a ChromeWorker. ...
... { 'GetAlertBoundary': ctypes.voidptr_t }, { 'SetRate': ctypes.voidptr_t }, { 'GetRate': ctypes.voidptr_t }, { 'SetVolume': ctypes.voidptr_t }, { 'GetVolume': ctypes.voidptr_t }, { 'WaitUntilDone': ctypes.voidptr_t }, { 'SetSyncSpeakTimeout': ctypes.voidptr_t }, { 'GetSyncSpeakTimeout': ctypes.voidptr_t }, { 'SpeakCompleteEvent': ctypes.voidptr_t }, { 'IsUISup
ported': ctypes.voidptr_t }, { 'DisplayUI': ctypes.voidptr_t } // end ISpVoice ]); // FUNCTIONS // http://msdn.microsoft.com/en-us/library/windows/desktop/ms695279%28v=vs.85%29.aspx let CoInitializeEx = lib.declare('CoInitializeEx', WINABI, HRESULT, // result LPVOID, // pvReserved DWORD // dwCoInit ); // http://msdn.microsoft.com/en-us/library/windows/desktop/ms68871...
Library
The Library object represents a native library loaded by the ctypes open() method. Its methods let you declare symbols ex
ported by the library, and to manage the library. Method overview close(); CData declare(name, [abi, ], returnType[, argType1, ...]); Methods close() Closes the library. You need to call this once you're done using the library. close(); Parameters None. declare() Declares an API from the native library, allowing it to be used from JavaScript. This can be used both for ex
ported data symbols and for functions. ...
...Methods close() Closes the library. You need to call this once you're done using the library. close(); Parameters None. declare() Declares an API from the native library, allowing it to be used from JavaScript. This can be used both for ex
ported data symbols and for functions. CData declare( name[, abi, returnType argType1, ...] ); Parameters name The name of the symbol ex
ported by the native library that is to be declared as usable from JavaScript abi The ABI used by the ex
ported function; this will be ctypes.default_abi for most libraries, except for Windows libraries, which will be ctypes.winapi_abi or ctypes.stdcall_abi. See ABI constants. You don't need to provide this for ex
ported data; it's only needed for function declarations. returnType The CType type ret...
...orted function; this will be ctypes.default_abi for most libraries, except for Windows libraries, which will be ctypes.winapi_abi or ctypes.stdcall_abi. See ABI constants. You don't need to provide this for ex
ported data; it's only needed for function declarations. returnType The CType type returned by the defined API, if it's a function. This parameter should not be provided if the API is an ex
ported data symbol. argType1...argTypeN Zero or more parameter CType may be specified for the parameters of the function being declared. These should not be provided if the API is an ex
ported data symbol rather than a function. Return value A FunctionType CData object representing the declared API. Exceptions thrown ctypes CType FunctionType ABI TypeError The return type was specified...
...Syntax Another use for ctypes.declare is to get non-function/non-methods from libraries. The syntax for this is seen in Firefox codebase here: //github.com/RealityRipple/UXP/blob/master/js/src/ctypes/Library.cpp?offset=0#271 This shows that we can also supply only two arguments to the declare function. The first being the same as in the above example, name, which is the name of the symbol to ex
port. And in place of the abi argument, we will pass in the type of this ex
port. For example, from the Objective-C library we can ex
port the symbol which holds the address to an external block. This would be done like this: var objc = ctypes.open(ctypes.libraryName('objc')); objc.declare('_NSConcreteGlobalBlock', ctypes.voidptr_t); See Also ...
js-ctypes reference
The ctypes object also provides numerous predefined types that correspond to primitives and common typedefs in C. Working with libraries To load a Library, use ctypes.open(). ...
...s To load a Library, use ctypes.open(). The Library object is used mostly to declare native functions provided by the library so that js-ctypes knows how to call them. See Library.declare() for instructions on how to declare these functions. Once you have finished working with a Library, call Library.close(). Calling conventions See ABI. Types and data To use js-ctypes effectively, it is im
portant to understand the different kinds of objects that the module provides. There are three major categories: Types These represent a type in C, and are thus represented by CType objects. These objects have two main purposes. First, they provide a concrete representation of different data types, allowing the programmer to describe the arguments and return type of a native function (see Library.de...
..., and are thus represented by CType objects. These objects have two main purposes. First, they provide a concrete representation of different data types, allowing the programmer to describe the arguments and return type of a native function (see Library.declare()). Second, they serve as constructors to create concrete instances of the given type, i.e. CData objects. Out of the box, js-ctypes sup
ports a number of predefined types. Type constructors These are functions that define new types, and thus return a CType object. These include ctypes.PointerType(type) and the .ptr property, which creates a new type describing a pointer to an existing type. ctypes.ArrayType(type, [length]) and the .array() method, which creates a new type describing an array of objects of an existing type. ctyp...
...bjects as functions. These distinctions are crucial, and understanding them will alleviate much of the confusion surrounding js-ctypes. Calling a Type Constructor will return a CType. Calling a CType will return a CData. You declare the arguments and return value of a native function with CType objects. You call a native function with CData objects. Other Features Error-handling js-ctypes sup
ports both errno (on all platforms) and GetLastError (on Windows platforms). Callbacks You can pass regular JavaScript functions as callbacks to native functions. See the Callbacks page for details. 64-Bit integer handling Because JavaScript Number objects can't directly represent every possible 64-bit integer value, js-ctypes provides new types for these. See Int64 and UInt64. ...
Plugin Roadmap for Firefox - Plugins
Plugins are a security and performance problem for Firefox users. NPAPI plugins are an obsolete technology, and Mozilla has been moving toward a Web which doesn't need plugins. The last remaining NPAPI plugin, Adobe Flash, has announced an end-of-life plan. To sup
port the transition away from Flash, Firefox is working with other browsers to progressively and carefully make Flash usage less common. Below is the roadmap of past and future sup
port for plugins in Firefox. Schedule June 2016 Starting with Firefox 47 in June 2016, all plugins other than Adobe Flash are click-to-activate. Users choose which sites are allowed to activate each plugin. In addition, the 64-bit Firefox for Windows only sup
ports the Flash plugin. March 2017 Starting with Firefox 52 in March 2017, plugins ot...
... August 2017 Starting with Firefox 55 in August 2017, users must choose which sites are allowed to activate the Flash plugin. Users will have the choice to remember the Flash setting per-site. This change will be rolled out progressively during August and September 2017. ...
... Schedule June 2016 Starting with Firefox 47 in June 2016, all plugins other than Adobe Flash are click-to-activate. Users choose which sites are allowed to activate each plugin. In addition, the 64-bit Firefox for Windows only sup
ports the Flash plugin. March 2017 Starting with Firefox 52 in March 2017, plugins other than Adobe Flash are no longer sup
ported in Firefox. Firefox Extended Sup
port Release 52 will continue to sup
port non-Flash plugins until early 2018. August 2017 Starting with Firefox 55 in August 2017, users must choose which sites are allowed to activate the Flash plugin. Users will have the choice to remember the Flash setting per-site. This change will be rolled out progressively during August and September 2017. In order to improve security and performance, Mozil...
...llowed to activate the Flash plugin. Users will have the choice to remember the Flash setting per-site. This change will be rolled out progressively during August and September 2017. In order to improve security and performance, Mozilla will maintain a list of sites which cannot use any plugins. September 2017 Starting with Firefox 56 in September 2017, Firefox for Android will remove all sup
port for plugins (bug 1381916). 2019 In September 2019, Firefox 69 will remove the "Always Activate" Flash option so we always ask for user permission before activating Flash on a website. 2020 In December 2020, Flash sup
port will be completely removed from consumer versions of Firefox. Adobe will stop shipping security updates for Flash at the end of 2020. See Also Mozilla Firefox October 2...
Plugins
Roadmap Highlights Since Firefox 52, plugins other than Flash are not loaded by Firefox. Starting in Firefox 55, users will be asked to choose which sites may use Flash content. ...
... Roadmap Highlights Since Firefox 52, plugins other than Flash are not loaded by Firefox. Starting in Firefox 55, users will be asked to choose which sites may use Flash content. ...
... Roadmap Highlights Since Firefox 52, plugins other than Flash are not loaded by Firefox. Starting in Firefox 55, users will be asked to choose which sites may use Flash content. This feature will be rolled out gradually to Firefox users. ...
...es may use Flash content. This feature will be rolled out gradually to Firefox users. Also From Firefox 55 onwards, Flash and other plugins can no longer be loaded from any URL scheme except for http:// and https:// (bug 1335475). See also Flash can now be loaded only from HTTP/HTTPS for more useful information. Starting with Firefox 56 in September 2017, Firefox for Android will remove all sup
port for plugins (bug 1381916). Tutorials and references The articles below are developer information about the developing for click-to-play, and plugin blocking. Flash Activation: Browser Comparison Each browser activates Flash slightly differently, which can be confusing for users and web authors. Plugin Blocking By Domain In order to improve security and performance for Firefox users, F...
Debugger.Source - Firefox Developer Tools
ce holding the source code from which it was produced. If a single piece of source code contains both top-level code and function definitions, perhaps with nested functions, then the Debugger.Script instances for those all refer to the same Debugger.Source instance. Each script indicates the substring of the overall source to which it corresponds. A Debugger.Source instance may represent only a
portion of a larger source document. For example, an HTML document can contain JavaScript in multiple <script> elements and event handler content attributes. In this case, there may be either a single Debugger.Source instance for the entire HTML document, with each Debugger.Script referring to its substring of the document; or there may be a separate Debugger.Source instance for each <script> element ...
...ly For a Debugger.Source instance representing the serialized text of a block of WebAssembly code, its properties provide the serialized text as a string. Currently only entire modules evaluated via new WebAssembly.Module are represented. SpiderMonkey constructs exactly one Debugger.Source for each underlying WebAssembly module per Debugger instance. Please note at the time of this writing, sup
port for WebAssembly is very preliminary. Many properties below return placeholder values. Convention For descriptions of properties and methods below, if the behavior of the property or method differs between the instance referring to JavaScript source or to a block of WebAssembly code, the text will be split into two sections, headed by "if the instance refers to JavaScript source" and "if the ins...
...L and followed by information tracking how the code was introduced into the system; the entire string is not a valid URL. For Function.prototype's script, this is null. Source may be loaded from a URL in the following ways: The URL may appear as the src attribute of a <script> element in markup text. The URL may be passed to the Worker web worker constructor, or the web worker im
portScripts function. The URL may be the name of a XPCOM JavaScript module or subscript. (Note that code passed to eval, the Function constructor, or a similar function isnot considered to be loaded from a URL; the url accessor on Debugger.Source instances for such sources should return undefined.) If the instance refers to WebAssembly code, the URL of the script that called new WebA...
...his source code was introduced into the system. This accessor returns one of the following values: "eval", for code passed to eval. "Function", for code passed to the Function constructor. "Function.prototype", for Function.prototype internally generated code. "Worker", for code loaded by calling the Web worker constructor--the worker's main script. "im
portScripts", for code by calling im
portScripts in a web worker. "eventHandler", for code assigned to DOM elements' event handler IDL attributes as a string. "scriptElement", for code belonging to <script> elements. "javascriptURL", for code presented in javascript: URLs. "setTimeout", for code passed to setTimeout as a string. "setInterval", for code passe...
Debugger - Firefox Developer Tools
e code coverage instrumentation. Changing this flag when any frame of the debuggee is currently active on the stack will produce an exception. Setting this to true enables code coverage instrumentation, which can be accessed via the Debugger.Script getOffsetsCoverage function. In some cases, the code coverage might expose information which pre-date the modification of this flag. Code coverage re
ports are monotone, thus one can take a snapshot when the Debugger is enabled, and output the difference. Setting this to false prevents this Debugger instance from requiring any code coverage instrumentation, but it does not guarantee that the instrumentation is not present. uncaughtExceptionHook Either null or a function that SpiderMonkey calls when a call to a debug event handler, breakpoin...
...tement inframe. This method should return a resumption value specifying how the debuggee's execution should proceed. onEnterFrame(frame) The stack frameframe is about to begin executing code. (Naturally,frame is currently the youngest visible frame.) This method should return a resumption value specifying how the debuggee's execution should proceed. SpiderMonkey only calls onEnterFrame to re
port visible, non-"debugger" frames. onExceptionUnwind(frame,value) The exceptionvalue has been thrown, and has propagated toframe;frame is the youngest remaining stack frame, and is a debuggee frame. This method should return a resumption value specifying how the debuggee's execution should proceed. If it returns undefined, the exception continues to propagate as normal: if control in frame is ...
...w exception. In those cases the old exception does not continue to propagate; it is discarded.) This handler is not called when unwinding a frame due to an over-recursion or out-of-memory exception. sourceHandler(ASuffusionOfYellow) This method is never called. If it is ever called, a contradiction has been proven, and the debugger is free to assume that everything is true. onError(frame,re
port) SpiderMonkey is about to re
port an error inframe.Re
port is an object describing the error, with the following properties: message The fully formatted error message. file If present, the source file name, URL, etc. (If this property is present, theline property will be too, and vice versa.) line If present, the source line number at which the error occurred. lineText If pres...
... and hence not a proper debuggee value, throw a TypeError instead. Static methods of the Debugger Object The functions described below are not called with a this value. isCompilableUnit(source) Given a string of source code, designated bysource, return false if the string might become a valid JavaScript statement with the addition of more lines. Otherwise return true. The intent is to sup
port interactive compilation - accumulate lines in a buffer until isCompilableUnit is true, then pass it to the compiler. Source Metadata Generated from file: js/src/doc/Debugger/Debugger.md Watermark: sha256:03b36132885e046a5f213130ba22b1139b473770f7324b842483c09ab7665f7c Changeset: e91b2c85aacd ...
Index - Firefox Developer Tools
de; in this mode, you can see your page presented in a 3D view in which nested blocks of HTML are increasingly "tall," projecting outward from the bottom of the page. This view makes it easy to visualize the nesting of your content. 3 Accessibility Inspector Accessibility, Accessibility inspector, DevTools, Guide, Tools The Accessibility Inspector provides a means to access im
portant information exposed to assistive technologies on the current page via the accessibility tree, allowing you to check what's missing or otherwise needs attention. This article takes you through the main features of the Accessibility Inspector and how to use it. 4 Color vision simulation Accessibility, Accessibility inspector, Color blindness, DevTools, Guide, Simulation, Tools ...
...ect a document. 8 DOM Inspector internals Code, Tools, internals, organisation, source There are three main facets to DOM Inspector. The one you are likely to be most familiar with is its inspector.xul-based primary UI. This is the two-pane inspector that appears when Ctrl+Shift+I (or Cmd+Shift+I) is pressed from one of the applications for which DOM Inspector has explicit sup
port (i.e., menuitems placed via overlay). 9 Introduction to DOM Inspector DOM_Inspector The DOM Inspector is a Mozilla extension that you can access from the Tools > Web Development menu in SeaMonkey, or by selecting the DOM Inspector menu item from the Tools menu in Firefox and Thunderbird, or by using Ctrl/Cmd+Shift+I in either application. DOM Inspector is standalone; it suppo...
...ault color unit: 34 Index Tools Found 158 pages: 35 JSON viewer Firefox includes a JSON viewer. If you open a JSON file in the browser, or view a remote URL with the Content-Type set to application/json, it is parsed and given syntax highlighting. Arrays and objects are shown collapsed, and you can expand them using the "+" icons. 36 Measure a
portion of the page Design, DevTools, Developer, Firefox, Layout, Measure, Measuring, Measuring Tool, Tools Using the Measuring Tool you can measure a specific area of a web page. 37 Memory DevTools, Firefox, Mozilla, Tools The Memory tool lets you take a snapshot of the current tab's memory heap. It then provides a number of views of the heap that can show you which obj...
... Working with iframes Debugging, DevTools, Developer Tools, Frames, Tools You can point the developer tools at a specific iframe within a document. 157 about:debugging Debugger, Remote debugging, about:debugging The about:debugging page provides a single place from which you can attach the Firefox Developer Tools to a number of debugging targets. At the moment it sup
ports three main sorts of targets: restartless add-ons, tabs, and workers. 158 about:debugging (before Firefox 68) The about:debugging page provides a single place from which you can attach the Firefox Developer Tools to a number of debugging targets. At the moment it sup
ports three main sorts of targets: restartless add-ons, tabs, and workers. ...
View Source - Firefox Developer Tools
Source", that behaves just like "View Page Source", except you only see the source for the selection. View MathML Source If you context-click while the mouse is over some MathML, you'll see a context menu item labeled "View MathML Source": click it to see the MathML source. Limitations of View Source There are limitations to what View Source does for you that you need to be aware of. ...
...ge Source", except you only see the source for the selection. View MathML Source If you context-click while the mouse is over some MathML, you'll see a context menu item labeled "View MathML Source": click it to see the MathML source. Limitations of View Source There are limitations to what View Source does for you that you need to be aware of. ...
...ror re
porter != validator View Source only re
ports parsing errors, not HTML validity errors. For example, putting a <div> element as a child of a <ul> element isn't a parse error, but it is not valid HTML. Therefore, this error will not be flagged in View Source. If you want to check that HTML is valid, you should use an HTML validator, such as the one offered by W3C. Not all parse errors are re
ported Even though all the re
ported errors are parse errors according to the HTML specification, not all parse errors are re
ported by View Source. Among the errors that don't get re
ported: Bytes that are illegal according to the document's encoding aren't marked as errors. Forbidden characters aren't re
ported as errors. Errors related to the end-of-file aren't re
ported. Tree builder errors rela...
... to the HTML specification, not all parse errors are re
ported by View Source. Among the errors that don't get re
ported: Bytes that are illegal according to the document's encoding aren't marked as errors. Forbidden characters aren't re
ported as errors. Errors related to the end-of-file aren't re
ported. Tree builder errors relating to text (as opposed to tags, comments, or doctypes) aren't re
ported. Parse errors related to xmlns attributes aren't re
ported. XML syntax highlighting View Source uses the HTML tokenizer when highlighting XML source. While the tokenizer has sup
port for processing instructions when highlighting XML source, that's the only XML-specific capability provided. Because of this, doctypes that have an internal subset are not highlighted correctly, and entity referen...
about:debugging - Firefox Developer Tools
Opening the about:debugging page There are two ways to open about:debugging: Type about:debugging in the Firefox URL bar. In the Tools > Web Developer menu, click Remote Debugging. When about:debugging opens, on the left-hand side, you'll see a sidebar with two options and information about your remote debugging setup: Setup Use the Setup tab to configure the connection to your remote device. ...
...on about temporary extensions you have loaded for debugging, extensions that are installed in Firefox, the tabs that you currently have open, and service workers running on Firefox. If your about:debugging page is different from the one displayed here, go to about:config, find and set the option devtools.aboutdebugging.new-enabled to true. Setup tab Connecting to a remote device Firefox sup
ports debugging over USB with Android devices, using the about:debugging page. Before you connect: Enable Developer settings on your Android device. Enable USB debugging in the Android Developer settings. Enable Remote Debugging via USB in the Advanced Settings in Firefox on the Android device. Connect the Android device to your computer using a USB cable. If your device doesn't appear in the...
...op. You can also reload the page by clicking the Reload button next to the URL bar, and (starting 79), navigate backward or forward in the browsing history with the Back and Forward buttons. Connecting over the Network You can connect to a Firefox Debug server on your network, or on your debugging machine using the Network Location settings of the about:debugging page. Enter the location and
port on which the debugger server is running. When you do, it is added to the Network locations list along with the devices, as shown below: This Firefox The This Firefox tab combines the features of Extensions, Tabs, and Workers into a single tab with the following sections: Temporary Extensions Displays a list of the extensions that you have loaded using the Load Temporary Add-on button. Ex...
... Note that about:debugging is not enabled by default in Firefox ESR. To enable it, open the Configuration Editor (about:config) and set devtools.aboutdebugging.new-enabled to true. If you used a higher version of Firefox prior to installing Firefox ESR, you will be prompted to create a new user profile, in order to protect your user data. For mo...
Background Tasks API - Web APIs
de, and your main JavaScript code may run right inside this thread along with all of this. Certainly most if not all code that is capable of making changes to the DOM is running in the main thread, since it's common for user interface changes to only be available to the main thread. Because event handling and screen updates are two of the most obvious ways users notice performance issues, it's im
portant for your code to be a good citizen of the Web and help to prevent stalls in the execution of the event loop. In the past, there's been no way to do this reliably other than by writing code that's as efficient as possible and by offloading as much work as possible to workers. Window.requestIdleCallback() makes it possible to become actively engaged in helping to ensure that the browser's event ...
...ed to. Using timeouts can ensure that your code runs in a timely manner, but it can also allow you to cause lag or animation stutters by mandating that the browser call you when there's not enough time left for you to run without disrupting performance. Falling back to setTimeout Because the Background Tasks API is fairly new, your code may need to be able to work on browsers that don't yet sup
port it. You can do so with a simple shim that uses setTimeout() as a fallback option. This isn't a polyfill, since it's not functionally identical; setTimeout() doesn't let you make use of idle periods, but instead runs your code when possible, leaving us to do the best we can to avoid causing the user to experience performance lag. window.requestIdleCallback = window.requestIdleCallback || function...
...e than 50 milliseconds of run time per pass. The implementation of our shim for cancelIdleCallback() is much simpler: window.cancelIdleCallback = window.cancelIdleCallback || function(id) { clearTimeout(id); } If cancelIdleCallback() isn't defined, this creates one which simply passes the specified callback ID through to clearTimeout(). Now your code will work even on browsers that don't sup
port the Background Tasks API, albeit not as efficiently. Interfaces The Background Tasks API adds only one new interface: IdleDeadline An object of this type is passed to the idle callback to provide an estimate of how long the idle period is expected to last, as well as whether or not the callback is running because its timeout period has expired. The Window interface is also augmented by th...
... will be used to store a DocumentFragment that's generated by our logging functions to create content to append to the log when the next animation frame is rendered. statusRefreshScheduled is used to track whether or not we've already scheduled an update of the status display box for the upcoming frame, so that we only do it once per frame The shim to function even if idle callbacks aren't sup
ported. Already discussed above, so it's hidden here to save space in the article. window.requestIdleCallback = window.requestIdleCallback || function(handler) { let startTime = Date.now(); return setTimeout(function() { handler({ didTimeout: false, timeRemaining: function() { return Math.max(0, 50.0 - (Date.now() - startTime)); } }); }, 1); }; window.cancelI...
CSSRule - Web APIs
ties common to all rules, while properties unique to specific rule types are specified in the more specialized interfaces for those rules' respective types. References to a CSSRule may be obtained by looking at a CSSStyleSheet's cssRules list. Properties common to all CSSRule instances CSSRule.cssText Represents the textual representation of the rule, e.g. "h1,h2 { font-size: 16pt }" or "@im
port 'url'". To access or modify parts of the rule (e.g. the value of "font-size" in the example) use the properties on the specialized interface for the rule's type. CSSRule.parentRule Read only Returns the containing rule, otherwise null. E.g. if this rule is a style rule inside an @media block, the parent rule would be that CSSMediaRule. CSSRule.parentStyleSheet Read only Returns the CSSStyle...
...th a CSSRule's type property to discern the rule type (and therefore, which specialized interface it implements). The relationships between these constants and the interfaces are: Type Value Rule-specific interface Comments and examples CSSRule.STYLE_RULE 1 CSSStyleRule The most common kind of rule: selector { prop1: val1; prop2: val2; } CSSRule.IM
PORT_RULE 3 CSSIm
portRule An @im
port rule. (Until the documentation is completed, see the interface definition in the Mozilla source code: nsIDOMCSSIm
portRule.) CSSRule.MEDIA_RULE 4 CSSMediaRule CSSRule.FONT_FACE_RULE 5 CSSFontFaceRule CSSRule.PAGE_RULE 6 CSSPageRule CSSRule.KEYFRAMES_RULE 7 CSSKeyframesRule ...
... 6 CSSPageRule CSSRule.KEYFRAMES_RULE 7 CSSKeyframesRule CSSRule.KEYFRAME_RULE 8 CSSKeyframeRule Reserved for future use 9 Should be used to define color profiles in the future CSSRule.NAMESPACE_RULE 10 CSSNamespaceRule CSSRule.COUNTER_STYLE_RULE 11 CSSCounterStyleRule CSSRule.SUP
PORTS_RULE 12 CSSSup
portsRule CSSRule.DOCUMENT_RULE 13 CSSDocumentRule CSSRule.FONT_FEATURE_VALUES_RULE 14 CSSFontFeatureValuesRule CSSRule.VIEW
PORT_RULE 15 CSSView
portRule CSSRule.REGION_STYLE_RULE 16 CSSRegionStyleRule CSSRule.UNKNOWN_RULE 0 CSSUnknownRule CSSRule.CHARSET_RULE ...
...The definition of 'CSSRule' in that specification. Working Draft Added value FONT_FEATURE_VALUES_RULE. CSS Counter Styles Level 3The definition of 'CSSRule' in that specification. Candidate Recommendation Added value COUNTER_STYLE_RULE. CSS Conditional Rules Module Level 3The definition of 'CSSRule' in that specification. Candidate Recommendation Added value SUP
PORTS_RULE. (DOCUMENT_RULE has been pushed to CSS Conditional Rules Level 4) Document Object Model (DOM) Level 2 Style SpecificationThe definition of 'CSSRule' in that specification. Obsolete Initial definition. ...
console - Web APIs
Dodge Charger . The object is: ({str:"Some text", id:5}) Using string substitutions When passing a string to one of the console object's methods that accepts a string (such as log()), you may use these substitution strings: %o or %O Outputs a JavaScript object. Clicking the object name opens more information about it in the inspector. %d or %i Outputs an integer. ...
...ese substitution strings: %o or %O Outputs a JavaScript object. Clicking the object name opens more information about it in the inspector. %d or %i Outputs an integer. Number formatting is sup
ported, for example console.log("Foo %.2d", 1.1) will output the number as two significant figures with a leading 0: Foo 01 %s Outputs a string. %f Outputs a floating-point value. Formatting is sup
ported, for example console.log("Foo %.2f", 1.1) will output the number to 2 decimal places: Foo 1.10 Note: Precision formatting doesn't work in Chrome Each of these pulls the next argument after the format string off the parameter list. For example: for (var i=0; i<5; i++) { console.log("Hello, %s. You've called me %d times.", "Bob", i+1); } The output looks like this: [13:14:13.481] Hell...
...nsole.timeLog("answer time"); alert("Do a bunch of other stuff..."); console.timeEnd("answer time"); Will log the time needed by the user to dismiss the alert box, log the time to the console, wait for the user to dismiss the second alert, and then log the ending time to the console: Notice that the timer's name is displayed both when the timer is started and when it's stopped. Note: It's im
portant to note that if you're using this to log the timing for network traffic, the timer will re
port the total time for the transaction, while the time listed in the network panel is just the amount of time required for the header. If you have response body logging enabled, the time listed for the response header and body combined should match what you see in the console output. Stack traces The c...
...u're using this to log the timing for network traffic, the timer will re
port the total time for the transaction, while the time listed in the network panel is just the amount of time required for the header. If you have response body logging enabled, the time listed for the response header and body combined should match what you see in the console output. Stack traces The console object also sup
ports outputting a stack trace; this will show you the call path taken to reach the point at which you call console.trace(). Given code like this: function foo() { function bar() { console.trace(); } bar(); } foo(); The output in the console looks something like this: Specifications Specification Status Comment Console API Living Standard Initial def...
Document.adoptNode() - Web APIs
Document.adoptNode() transfers a node from another document into the method's document. The adopted node and its subtree is removed from its original document (if any), and its ownerDocument is changed to the current document. The node can then be inserted into the current document. Syntax const im
portedNode = document.adoptNode(externalNode); Parameters externalNode The node from another document to be adopted. ...
...cument into the method's document. The adopted node and its subtree is removed from its original document (if any), and its ownerDocument is changed to the current document. The node can then be inserted into the current document. Syntax const im
portedNode = document.adoptNode(externalNode); Parameters externalNode The node from another document to be adopted. Return value The copied im
portedNode in the scope of the im
porting document. After calling this method, im
portedNode and externalNode are the same object. ...
...changed to the current document. The node can then be inserted into the current document. Syntax const im
portedNode = document.adoptNode(externalNode); Parameters externalNode The node from another document to be adopted. Return value The copied im
portedNode in the scope of the im
porting document. After calling this method, im
portedNode and externalNode are the same object. ...
... Best Practice: Although Firefox doesn't currently enforce this rule, we encourage you to follow this rule for improved future compatibility. For more on the Node.ownerDocument issues, see the W3C DOM FAQ. Specifications Specification Status Comment DOMThe definition of 'document.adoptNode' in that specification. ...
Introduction to the DOM - Web APIs
ng HTML tables, and so forth). This documentation provides an object-by-object reference to the DOM. The modern DOM is built using multiple APIs that work together. The core DOM defines the objects that fundamentally describe a document and the objects within it. This is expanded upon as needed by other APIs that add new features and capabilities to the DOM. For example, the HTML DOM API adds sup
port for representing HTML documents to the core DOM. DOM and JavaScript The short example above, like nearly all of the examples in this reference, is JavaScript. That is to say, it's written in JavaScript, but it uses the DOM to access the document and its elements. The DOM is not a programming language, but without it, the JavaScript language wouldn't have any model or notion of web pages, HTML d...
...uation: API = DOM + JavaScript The DOM was designed to be independent of any particular programming language, making the structural representation of the document available from a single, consistent API. Though we focus exclusively on JavaScript in this reference documentation, implementations of the DOM can be built for any language, as this Python example demonstrates: # Python DOM example im
port xml.dom.minidom as m doc = m.parse(r"C:\Projects\Py\chap1.xml") doc.nodeName # DOM property of document object p_list = doc.getElementsByTagName("para") For more information on what technologies are involved in writing JavaScript on the web, see JavaScript technologies overview. Accessing the DOM You don't have to do anything special to begin using the DOM. Different browsers have different i...
...milar one to test the DOM interfaces you are interested in and see how they work on the browser platform. You can update the contents of the test() function as needed, create more buttons, or add elements as necessary. ...
... you some idea of how interfaces can be grouped together for testing. Figure 0.1 Sample DOM Test Page In this example, the drop-down menus dynamically update such DOM--accessible aspects of the web page as its background color (bgColor), the color of the hyperlinks (aLink), and color of the text (text). However, you design your test pages, testing the interfaces as you read about them is an im
portant part of learning how to use the DOM effectively. ...
Element.getBoundingClientRect() - Web APIs
The element's size is equal to its width/height + padding + border-width in the case that the standard box model is being used, or width/height only if box-sizing: border-box has been set on it. Syntax domRect = element.getBoundingClientRect(); Value The returned value is a DOMRect object which is the union of the rectangles returned by getClientRects() for the element, i.e., the CSS border-boxes associated with the element. ...
...e union of the rectangles returned by getClientRects() for the element, i.e., the CSS border-boxes associated with the element. The result is the smallest rectangle which contains the entire element, with read-only left, top, right, bottom, x, y, width, and height properties describing the overall border-box in pixels. Properties other than width and height are relative to the top-left of the view
port. ...
...ther than width and height are relative to the top-left of the view
port. Empty border-boxes are completely ignored. If all the element's border-boxes are empty, then a rectangle is returned with a width and height of zero and where the top and left are the top-left of the border-box for the first CSS box (in content order) for the element. The amount of scrolling that has been done of the view
port area (or any other scrollable element) is taken into account when computing the bounding rectangle. This means that the rectangle's boundary edges (top, right, bottom, left) change their values every time the scrolling position changes (because their values are relative to the view
port and not absolute). If you need the bounding rectangle relative to the top-left corner of the document, just add...
...) { if(typeof rect[key] !== 'function') { let para = document.createElement('p'); para.textContent = `${ key } : ${ rect[key] }`; document.body.appendChild(para); } } Notice how the width/height are equal to the equal to its width/height + padding. Also note how the values of x/left, y/top, right, and bottom are equal to the absolute distance from the relevant edge of the view
port to that side of the element, in each case. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Element.getBoundingClientRect()' in that specification. Working Draft Initial definition Notes The returned DOMRect object can be modified in modern browsers. This was not true with older versions which effectivel...
Element.matches() - Web APIs
irds = document.getElementsByTagName('li'); for (var i = 0; i < birds.length; i++) { if (birds[i].matches('.endangered')) { console.log('The ' + birds[i].textContent + ' is endangered!'); } } </script> This will log "The Philippine eagle is endangered!" to the console, since the element has indeed a class attribute with value endangered. ...
...irds.length; i++) { if (birds[i].matches('.endangered')) { console.log('The ' + birds[i].textContent + ' is endangered!'); } } </script> This will log "The Philippine eagle is endangered!" to the console, since the element has indeed a class attribute with value endangered. ...
... if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; } Specification Specification Status Comment DOMThe definition of 'Element.prototype.m...
...ototype.webkitMatchesSelector || function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = matches.length; while (--i >= 0 && matches.item(i) !== this) {} return i > -1; }; } However, given the practicality of sup
porting older browsers, the following should suffice for most (if not all) practical cases (i.e. IE9+ sup
port). if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; } Specification Specification Status Comment DOMThe definition of 'Element.prototype.matches' in that specification. Living Standard Initial definition ...
Element.msZoomTo() - Web APIs
args[in] Type: MSZoomToOptions contentX[in]: The x-coordinate of the content that is the target of the scroll/zoom. If no value is specified, defaults to the current centerpoint of visible content, horizontally. contentY[in]: The y-coordinate of the content that is the target of the scroll/zoom. If no value is specified, defaults to the current centerpoint of visible content, vertically. view
portX[in]: The alignment point of the view
port. The scroll/zoom operation attempts to align this point with the contentX point. center: Default. Aligns the horizontal center of the view
port to the element's contentX value. left: Aligns the left-most point of the view
port to the element's contentX value. right: Aligns the right-most point of the view
port to the element's contentX value. integer: ...
...he scroll/zoom operation attempts to align this point with the contentX point. center: Default. Aligns the horizontal center of the view
port to the element's contentX value. left: Aligns the left-most point of the view
port to the element's contentX value. right: Aligns the right-most point of the view
port to the element's contentX value. integer: Aligns the specified x-coordinate of the view
port to the element's contentX value. view
portY[in]: The alignment point of the view
port. The scroll/zoom operation attempts to align this point with the contentY point. middle: Default. ...
...e element's contentX value. right: Aligns the right-most point of the view
port to the element's contentX value. integer: Aligns the specified x-coordinate of the view
port to the element's contentX value. view
portY[in]: The alignment point of the view
port. The scroll/zoom operation attempts to align this point with the contentY point. middle: Default. Aligns the vertical center of the view
port to the element's contentY value. top: Aligns the top-most point of the view
port to the element's contentY value. bottom: Aligns the bottom-most point of the view
port to the element's contentY value. integer: Aligns the specified y-coordinate of the view
port to the element's contentY value. scaleFactor[in]: Floating-point. The scale factor (msContentZoomFactor) to zoom to. If no value is sp...
...his method has no scrolling effect on non-scrollable elements and no zooming effect on non-zoomable elements (e.g., elements with "-ms-content-zooming: none"). ...
ExtendableMessageEvent() - Web APIs
being created. init Optional An initialisation object, which should contain the following parameters: data: The event's data -- this can be any data type. origin: A DOMString that defines the origin of the corresponding service worker's environment settings object. lastEventId: A DOMString that defines the last event ID of the event source. ...
... An initialisation object, which should contain the following parameters: data: The event's data -- this can be any data type. origin: A DOMString that defines the origin of the corresponding service worker's environment settings object. lastEventId: A DOMString that defines the last event ID of the event source. source: The Client, ServiceWorker or Message
Port that sent the message. ...
...ld contain the following parameters: data: The event's data -- this can be any data type. origin: A DOMString that defines the origin of the corresponding service worker's environment settings object. lastEventId: A DOMString that defines the last event ID of the event source. source: The Client, ServiceWorker or Message
Port that sent the message.
ports: An array containing the Message
Port objects connected to the channel sending the message. ...
...onding service worker's environment settings object. lastEventId: A DOMString that defines the last event ID of the event source. source: The Client, ServiceWorker or Message
Port that sent the message.
ports: An array containing the Message
Port objects connected to the channel sending the message. Examples var init = { data : 'hello message', source : Message
PortReference,
ports : Message
PortListReference } var myEME = new ExtendableMessageEvent('message', init); Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableMessageEvent()' in that specification. Working Draft Initial definition. ...
FederatedCredential.protocol - Web APIs
ibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...omeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetprotocol ExperimentalChrome Full sup
port 51Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port YesSafari ? WebView Android Full sup
port 51Chrome Android Full sup
port 51Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ...
... YesSafari ? WebView Android Full sup
port 51Chrome Android Full sup
port 51Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full sup
port 5.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
FederatedCredential.provider - Web APIs
ibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...omeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetprovider ExperimentalChrome Full sup
port 51Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port YesSafari ? WebView Android Full sup
port 51Chrome Android Full sup
port 51Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ...
... YesSafari ? WebView Android Full sup
port 51Chrome Android Full sup
port 51Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full sup
port 5.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
HTMLAnchorElement - Web APIs
er than displayed in the browser. The value represent the proposed name of the file. If the name is not a valid filename of the underlying OS, browser will adapt it. HTMLHyperlinkElementUtils.hash Is a USVString representing the fragment identifier, including the leading hash mark ('#'), if any, in the referenced URL. HTMLHyperlinkElementUtils.host Is a USVString representing the hostname and
port (if it's not the default
port) in the referenced URL. HTMLHyperlinkElementUtils.hostname Is a USVString representing the hostname in the referenced URL. HTMLHyperlinkElementUtils.href Is a USVString that is the result of parsing the href HTML attribute relative to the document, containing a valid URL of a linked resource. HTMLAnchorElement.hreflang Is a DOMString that reflects the hreflang ...
...nked resource. HTMLAnchorElement.media Is a DOMString that reflects the media HTML attribute, indicating the intended media for the linked resource. HTMLHyperlinkElementUtils.password Is a USVString containing the password specified before the domain name. HTMLHyperlinkElementUtils.origin Read only Returns a USVString containing the origin of the URL, that is its scheme, its domain and its
port. HTMLHyperlinkElementUtils.pathname Is a USVString representing the path name component, if any, of the referenced URL. HTMLHyperlinkElementUtils.
port Is a USVString representing the
port component, if any, of the referenced URL. HTMLHyperlinkElementUtils.protocol Is a USVString representing the protocol component, including trailing colon (':'), of the referenced URL. HTMLAnchorElement.re...
...rom HTML5 on, but were defined on HTMLAnchorElement in DOM Level 2 HTML and earlier specifications. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLAnchorElement' in that specification. Living Standard The following property has been added: download. Technically, the URL-related properties, media, host, hostname, pathname,
port, protocol, search, and hash, have been moved to the HTMLHyperlinkElementUtils mixin, and HTMLAnchorElement implements this mixin. HTML5The definition of 'HTMLAnchorElement' in that specification. Recommendation The methods blur() and focus(), as well as the properties tabindex and accessKey, are now defined on HTMLElement. The following properties are now obsolete: charset, coo...
...ements this mixin. HTML5The definition of 'HTMLAnchorElement' in that specification. Recommendation The methods blur() and focus(), as well as the properties tabindex and accessKey, are now defined on HTMLElement. The following properties are now obsolete: charset, coords, name, rev, and shape. The following properties have been added: hash, host, hostname, media, pathname,
port, protocol, relList, search, and text. Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLAnchorElement' in that specification. Obsolete No change from Document Object Model (DOM) Level 1 Specification. Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLAnchorElement' in that specification. Obsolete Initial definition. ...
HTMLAreaElement - Web APIs
rather than displayed in the browser. The value represent the proposed name of the file. If the name is not a valid filename of the underlying OS, browser will adapt it. HTMLHyperlinkElementUtils.hash Is a USVString containing the fragment identifier (including the leading hash mark (#)), if any, in the referenced URL. HTMLHyperlinkElementUtils.host Is a USVString containing the hostname and
port (if it's not the default
port) in the referenced URL. HTMLHyperlinkElementUtils.hostname Is a USVString containing the hostname in the referenced URL. HTMLHyperlinkElementUtils.href Is a USVString containing that reflects the href HTML attribute, containing a valid URL of a linked resource. HTMLAreaElement.hreflang Is a DOMString containing that reflects the hreflang HTML attribute, indicat...
...icating target media of the linked resource. HTMLAreaElement.noHref Is a Boolean flag indicating if the area is inactive (true) or active (false). HTMLHyperlinkElementUtils.password Is a USVString containing the password specified before the domain name. HTMLHyperlinkElementUtils.origin Read only Returns a USVString containing the origin of the URL, that is its scheme, its domain and its
port. HTMLHyperlinkElementUtils.pathname Is a USVString containing the path name component, if any, of the referenced URL. HTMLHyperlinkElementUtils.
port Is a USVString containing the
port component, if any, of the referenced URL. HTMLHyperlinkElementUtils.protocol Is a USVString containing the protocol component (including trailing colon ':'), of the referenced URL. HTMLAreaElement.referrerPol...
... whole URL of the script executed in the Worker. It is a synonym for HTMLHyperlinkElementUtils.href. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLAreaElement' in that specification. Living Standard The following property has been added: download. Technically, the URL-related properties, media, host, hostname, pathname,
port, protocol, search, and hash, have been moving to the HTMLHyperlinkElementUtils mixin, and HTMLAreaElement implements this mixin. HTML5The definition of 'HTMLAreaElement' in that specification. Recommendation Technically, the properties tabindex and accesskey are now defined on HTMLElement. The following property is now obsolete: nohref. The following properties have been ad...
...lementUtils mixin, and HTMLAreaElement implements this mixin. HTML5The definition of 'HTMLAreaElement' in that specification. Recommendation Technically, the properties tabindex and accesskey are now defined on HTMLElement. The following property is now obsolete: nohref. The following properties have been added: rel, relList, media, hreflang, type, host, hostname, pathname,
port, protocol, search, and hash. Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLAreaElement' in that specification. Obsolete No change from Document Object Model (DOM) Level 1 Specification. Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLAreaElement' in that specification. Obsolete Initial definition ...
HTMLIFrameElement.csp - Web APIs
ompatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
.... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...leChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetcsp ExperimentalChrome Full sup
port 61Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 48Safari ? WebView Android Full sup
port 61Chrome Android Full sup
port 61Firefox Android ? Opera Android Full sup
port 45Safari iOS ? Samsung Inter...
...ri ? WebView Android Full sup
port 61Chrome Android Full sup
port 61Firefox Android ? Opera Android Full sup
port 45Safari iOS ? Samsung Internet Android Full sup
port 8.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
HTMLImageElement.loading - Web APIs
This helps to optimize the loading of the document's contents by postponing loading the image until it's expected to be needed, rather than immediately during the initial page load. ...
...default behavior, eager tells the browser to load the image as soon as the <img> element is processed. lazy Tells the user agent to hold off on loading the image until the browser estimates that it will be needed imminently. For instance, if the user is scrolling through the document, a value of lazy will cause the image to only be loaded shortly before it will appear in the window's visual view
port. Usage notes Timing of the load event The load event is fired when the document has been fully processed. When images are loaded eagerly (which is the default), every image in the document must be fetched before the load event can fire. By specifying the value lazy for loading, you prevent the image from delaying the load attribute by the amount of time it takes to request, fetch, and proces...
...y processed. When images are loaded eagerly (which is the default), every image in the document must be fetched before the load event can fire. By specifying the value lazy for loading, you prevent the image from delaying the load attribute by the amount of time it takes to request, fetch, and process the image. Images whose loading attribute is set to lazy but are located within the visual view
port immediately upon initial page load are loaded as soon as the layout is known, but their loads do not delay the firing of the load event. In other words, these images aren't loaded immediately when processing the <img> element, but are still loaded as part of the initial page load. They justt don't affect the timing of the load event. That means that when load fires, it's possible that any lazy-l...
... loaded as soon as the layout is known, but their loads do not delay the firing of the load event. In other words, these images aren't loaded immediately when processing the <img> element, but are still loaded as part of the initial page load. They justt don't affect the timing of the load event. That means that when load fires, it's possible that any lazy-loaded images located in the visual view
port may not yet be visible. Preventing element shift during image lazy loads When an image whose loading has been delayed by the loading attribute being set to lazy is finally loaded, the browser will determine the final size of the <img> element based on the style and intrinsic size of the image, then reflow the document as needed to update the positions of elements based on any size change made t...
HTMLMediaElement.srcObject - Web APIs
The srcObject property of the HTMLMediaElement interface sets or returns the object which serves as the source of the media associated with the HTMLMediaElement. The object can be a MediaStream, a MediaSource, a Blob, or a File (which inherits from Blob). Note: As of March 2020, only Safari sup
ports setting objects other than MediaStream. Until other browsers catch up, for MediaSource, Blob and File, consider falling back to creating a URL with URL.createObjectURL() and assign it to HTMLMediaElement.src. See below for an example. Syntax var sourceObject = HTMLMediaElement.srcObject; HTMLMediaElement.srcObject = sourceObject; Value A MediaStream, MediaSource, Blob, or File object (though see the compatibility table for what is actually sup
ported). Usage notes Older versions of the M...
... to a newly-created <video> element. const mediaStream = await navigator.mediaDevices.getUserMedia({video: true}); const video = document.createElement('video'); video.srcObject = mediaStream; In this example, a new MediaSource is assigned to a newly-created <video> element. const mediaSource = new MediaSource(); const video = document.createElement('video'); video.srcObject = mediaSource; Sup
porting fallback to the src property The examples below sup
port older browser versions that require you to create an object URL and assign it to src if srcObject isn't sup
ported. First, a MediaStream from a camera is assigned to a newly-created <video> element, with fallback for older browsers. const mediaStream = await navigator.mediaDevices.getUserMedia({video: true}); const video = document.crea...
...ces.getUserMedia({video: true}); const video = document.createElement('video'); if ('srcObject' in video) { video.srcObject = mediaStream; } else { // Avoid using this in new browsers, as it is going away. ...
...er browsers and browsers that don't yet sup
port assignment of MediaSource directly. const mediaSource = new MediaSource(); const video = document.createElement('video'); // Older browsers may not have srcObject if ('srcObject' in video) { try { video.srcObject = mediaSource; } catch (err) { if (err.name != "TypeError") { throw err; } // Even if they do, they may only sup
port MediaStream video.src = URL.createObjectURL(mediaSource); } } else { video.src = URL.createObjectURL(mediaSource); } Specifications Specification Status Comment HTML Living StandardThe definition of 'srcObject' in that specification. Living Standard Initial definition. ...
HTMLScriptElement - Web APIs
chronously as soon as it downloads. If the async attribute is absent but the defer attribute is present, then the script is executed when the page has finished parsing. If neither attribute is present, then the script is fetched and executed immediately, blocking further parsing of the page. The defer attribute may be specified with the async attribute, so legacy browsers that only sup
port defer (and not async) fall back to the defer behavior instead of the default blocking behavior. Note: The exact processing details for these attributes are complex, involving many different aspects of HTML, and therefore are scattered throughout the specification. These algorithms describe the core ideas, but they rely on the parsing rules for <script> start and end tags in HTML, in foreign co...
...r nodes like comments) in tree order. On setting, it acts the same way as the textContent IDL attribute. Note: When inserted using the document.write() method, <script> elements execute (typically synchronously), but when inserted using innerHTML or outerHTML, they do not execute at all. HTMLScriptElement.noModule Is a Boolean that if true, stops the script's execution in browsers that sup
port ES2015 modules -- used to run fallback scripts in older browsers that do not sup
port JavaScript modules. HTMLScriptElement.referrerPolicy Is a DOMString that reflects the referrerpolicy HTML attribute indicating which referrer to use when fetching the script, and fetches done by that script. Methods No specific methods; inherits methods from its parent, HTMLElement. Examples Dynamically i...
...These scripts will be asynchronously executed. For more details, see the defer and async properties. ...
...These scripts will be asynchronously executed. For more details, see the defer and async properties. ...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
ublic, and the expected amount of code that would be handled by JavaScript was relatively low at that time. As time passed, of course, we know that computers have evolved into powerful multi-core systems, and JavaScript has become one of the most prolifically-used languages in the computing world. A vast number of the most popular applications are based at least in part on JavaScript code. To sup
port this, it was necessary to find ways to allow for projects to escape the limitations of a single-threaded language. Starting with the addition of timeouts and intervals as part of the Web API (setTimeout() and setInterval()), the JavaScript environment provided by Web browsers has gradually advanced to include powerful features that enable scheduling of tasks, multi-threaded application developme...
...ent provided by Web browsers has gradually advanced to include powerful features that enable scheduling of tasks, multi-threaded application development, and so forth. To understand where queueMicrotask() comes into play here, it's helpful to understand how the JavaScript runtime operates when scheduling and running code. JavaScript execution contexts Note: The details here are generally not im
portant to most JavaScript programmers. This information is provided as a basis for why microtasks are useful and how they function; if you don't care, you can skip this and come back later if you find that you need to. When a fragment of JavaScript code runs, it runs inside an execution context. There are three types of code that create a new execution context: The global context is the executio...
...d, sharing the same event loop, as the user interface of the web browser itself. This is the main thread, and in addition to running your site's main code body, it handles receiving and dispatching user and other events, rendering and painting web content, and so forth. The event loop, then, drives everything that happens in the browser as it pertains to the interaction with the user, but more im
portantly for our purposes here, it is responsible for the scheduling and execution of every piece of code that runs within its thread. There are three types of event loop: Window event loop The window event loop is the one that drives all of the windows sharing a similar origin (though there are further limits to this as described elsewhere in this article XXXX ????). Worker event loop A worke...
...pending on how they're implemented. Tasks vs microtasks A task is any JavaScript scheduled to be run by the standard mechanisms such as initially starting to execute a program, an event triggering a callback, and so forth. Other than by using events, you can enqueue a task by using setTimeout() or setInterval(). The difference between the task queue and the microtask queue is simple but very im
portant: When executing tasks from the task queue, the runtime executes each task that is in the queue at the moment a new iteration of the event loop begins. Tasks added to the queue after the iteration begins will not run until the next iteration. Each time a task exits, and the execution context stack is empty, each microtask in the microtask queue is executed, one after another. The difference...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
empty, but before returning control to the event loop being used by the user agent to drive the script's execution environment. This event loop may be either the browser's main event loop or the event loop driving a web worker. This lets the given function run without the risk of interfering with another script's execution, yet also ensures that the microtask runs before the user agent has the op
portunity to react to actions taken by the microtask. JavaScript promises and the Mutation Observer API both use the microtask queue to run their callbacks, but there are other times when the ability to defer work until the current event loop pass is wrapping up. In order to allow microtasks to be used by third-party libraries, frameworks, and polyfills, the queueMicrotask() method is exposed on the ...
...ft in the queue, even if more keep getting added. Warning: Since microtasks can themselves enqueue more microtasks, and the event loop continues processing microtasks until the queue is empty, there's a real risk of getting the event loop endlessly processing microtasks. Be cautious with how you go about recursively adding microtasks. Using microtasks Before getting farther into this, it's im
portant to note again that most developers won't use microtasks much, if at all. They're a highly specialized feature of modern browser-based JavaScript development, allowing you to schedule code to jump in front of other things in the long set of things waiting to happen on the user's computer. Abusing this capability will lead to performance problems. Enqueueing microtasks As such, you should typi...
...st (such as by creating a promise that resolves immediately), the addition of the queueMicrotask() method adds a standard way to introduce a microtask safely and without tricks. By introducing queueMicrotask(), the quirks that arise when sneaking in using promises to create microtasks can be avoided. For instance, when using promises to create microtasks, exceptions thrown by the callback are re
ported as rejected promises rather than being re
ported as standard exceptions. Also, creating and destroying promises takes additional overhead both in terms of time and memory that a function which properly enqueues microtasks avoids. Simply pass the JavaScript Function to call while the context is handling microtasks into the queueMicrotask() method, which is exposed on the global context as define...
... queue gets processed before the task queue on which the timeout callback is located. Remembering that tasks and microtasks are kept on separate queues, and that microtasks run first will help keep this straight. Microtask from a function This example expands slightly on the previous one by adding a function that does some work. This function uses queueMicrotask() to schedule a microtask. The im
portant thing to take away from this one is that the microtask isn't processed when the function exits, but when the main program exits. HTML <pre id="log"> </pre> JavaScript The code below is used to log the output. let logElem = document.getElementById("log"); let log = s => logElem.innerHTML += s + "<br>"; The main program code follows. The doWork() function here calls queueMicrotask(), y...
Dragging and Dropping Multiple Items - Web APIs
These are methods that mirror the types property as well as the getData(), setData() and clearData() methods, however, they take an additional argument that specifies the index of the item to retrieve, modify or remove. The drag processing described in this document use the DataTransfer interface. ...
...multiple files or bookmarks. In this case, add the appropriate formats for each item. Although not required, you should always add the same formats for each item. The ensures that receiving drop targets can expect consistent data. To check if multiple files are being dragged, check the mozItemCount property. It will be set to the number of items being dragged. If a particular drop target only sup
ports dropping a single item, it could either reject the dragged items or it could just use just the first item. To reject the items, either don't cancel the dragover event, or set the effectAllowed property to none. You may wish to do both in case another listener has already cancelled the event. To just take the first item being dropped, use the getData() method as with a single item. This is conve...
...ject the dragged items or it could just use just the first item. To reject the items, either don't cancel the dragover event, or set the effectAllowed property to none. You may wish to do both in case another listener has already cancelled the event. To just take the first item being dropped, use the getData() method as with a single item. This is convenient as drop targets which only need to sup
port a single item do not need to do anything extra. However, use the mozGetDataAt() method to retrieve a specific item from the data transfer. The following example retrieves a set of files being dragged and adds them to an array. function onDrop(event) { var files = []; var dt = event.dataTransfer; for (var i = 0; i < dt.mozItemCount; i++) files.push(dt.mozGetDataAt("application/x-moz-fi...
...es property is equivalent to retrieving the list of types for the item at index 0. var types = event.dataTransfer.mozTypesAt(1); Dragging Non-String Data The additional methods described above are also not restricted to string data; you can specify any type of data. For example, files are dragged using the application/x-moz-file type stored as nsIFile objects. As the setData() method only sup
ports strings, it cannot be used to specify files for dragging in this manner. Instead the mozSetDataAt() method must be used. dt.mozSetDataAt("application/x-moz-file", file, 0); By using this method, you can file objects, although you do not necessarily need to sup
port multiple items. Thus, you should pass 0 as the index. Similarly, you will need to retrieve the file object or objects using the m...
HTML Drag and Drop API - Web APIs
ranslucent representation of the draggable elements follows the pointer during the drag operation. For web sites, extensions, and XUL applications, you can customize which elements can become draggable, the type of feedback the draggable elements produce, and the droppable elements. This overview of HTML Drag and Drop includes a description of the interfaces, basic steps to add drag-and-drop sup
port to an application, and an interoperability summary of the interfaces. Drag Events HTML drag-and-drop uses the DOM event model and drag events inherited from mouse events. A typical drag operation begins when a user selects a draggable element, drags the element to a droppable element, and then releases the dragged element. During drag operations, several event types are fired, and some events ...
...er objects include the drag event's state, such as the type of drag being done (like copy or move), the drag's data (one or more items), and the MIME type of each drag item. DataTransfer objects also have methods to add or remove items to the drag's data. The DragEvent and DataTransfer interfaces should be the only ones needed to add HTML Drag and Drop capabilities to an application. (Firefox sup
ports some Gecko-specific extensions to the DataTransfer object, but those extensions will only work on Firefox.) Each DataTransfer object contains an items property, which is a list of DataTransferItem objects. A DataTransferItem object represents a single drag item, each with a kind property (either string or file) and a type property for the data item's MIME type. The DataTransferItem object also ...
...bject has methods to add a drag item to the list, remove a drag item from the list, and clear the list of all drag items. A key difference between the DataTransfer and DataTransferItem interfaces is that the former uses the synchronous getData() method to access a drag item's data, but the latter instead uses the asynchronous getAsString() method. Note: DragEvent and DataTransfer are broadly sup
ported on desktop browsers. However, the DataTransferItem and DataTransferItemList interfaces have limited browser sup
port. See Interoperability for more information about drag-and-drop interoperability. Gecko-specific interfaces Mozilla and Firefox sup
port some features not in the standard drag-and-drop model. These are convenience functions to help with dragging multiple items or non-string data (...
...rty to determine if the drag operation succeeded or not. For more information about handling the end of a drag operation, see: Finishing a Drag Interoperability As can be seen in the DataTransferItem interface's Browser Compatibility table, drag-and-drop interoperability is relatively broad among desktop browsers (except the DataTransferItem and DataTransferItemList interfaces have less sup
port). This data also indicates drag-and-drop sup
port among mobile browsers is very low. Examples and demos Copying and moving elements with the DataTransfer interface Copying and moving elements with the DataTransferListItem interface Dragging and dropping files (Firefox only): http://jsfiddle.net/9C2EF/ Dragging and dropping files (All browsers): https://jsbin.com/hiqasek/ A parking proje...
Ajax navigation example - Web APIs
age) { oPageInfo.url = filterURL(sPage, null); } oReq.open("get", filterURL(oPageInfo.url, "json"), true); oReq.send(); oLoadingBox.parentNode || document.body.appendChild(oLoadingBox); } function requestPage (sURL) { if (history.pushState) { bUpdateURL = true; getPage(sURL); } else { /* Ajax navigation is not sup
ported */ location.assign(sURL); } } function processLink () { if (this.className === sAjaxClass) { requestPage(this.href); return false; } return true; } function init () { oPageInfo.title = document.title; history.replaceState(oPageInfo, oPageInfo.title, oPageInfo.url); for (var oLink, nIdx ...
...ml */ { 100: "Continue", 101: "Switching Protocols", 102: "Processing", 200: "OK", 201: "Created", 202: "Accepted", 203: "Non-Authoritative Information", 204: "No Content", 205: "Reset Content", 206: "Partial Content", 207: "Multi-Status", 208: "Already Re
ported", 226: "IM Used", 300: "Multiple Choices", 301: "Moved Permanently", 302: "Found", 303: "See Other", 304: "Not Modified", 305: "Use Proxy", 306: "Reserved", 307: "Temporary Redirect", 308: "Permanent Redirect", 400: "Bad Request", 401: "Unauthorized", ...
... 405: "Method Not Allowed", 406: "Not Acceptable", 407: "Proxy Authentication Required", 408: "Request Timeout", 409: "Conflict", 410: "Gone", 411: "Length Required", 412: "Precondition Failed", 413: "Request Entity Too Large", 414: "Request-URI Too Long", 415: "Unsup
ported Media Type", 416: "Requested Range Not Satisfiable", 417: "Expectation Failed", 422: "Unprocessable Entity", 423: "Locked", 424: "Failed Dependency", 425: "Unassigned", 426: "Upgrade Required", 427: "Unassigned", 428: "Precondition Required", 429: "Too Many Requests", ...
...Unassigned", 428: "Precondition Required", 429: "Too Many Requests", 430: "Unassigned", 431: "Request Header Fields Too Large", 500: "Internal Server Error", 501: "Not Implemented", 502: "Bad Gateway", 503: "Service Unavailable", 504: "Gateway Timeout", 505: "HTTP Version Not Sup
ported", 506: "Variant Also Negotiates (Experimental)", 507: "Insufficient Storage", 508: "Loop Detected", 509: "Unassigned", 510: "Not Extended", 511: "Network Authentication Required" }; var oReq, bIsLoading = false, bUpdateURL = false; oLoadingBox.id = "ajax-loader"; oCover.onclick = abortReq; ...
Location - Web APIs
Changes done on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively. ...
...on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively. ...
...n.href Is a stringifier that returns a USVString containing the entire URL. If changed, the associated document navigates to the new page. It can be set from a different origin than the associated document. Location.protocol Is a USVString containing the protocol scheme of the URL, including the final ':'. Location.host Is a USVString containing the host, that is the hostname, a ':', and the
port of the URL. Location.hostname Is a USVString containing the domain of the URL. Location.
port Is a USVString containing the
port number of the URL. Location.pathname Is a USVString containing an initial '/' followed by the path of the URL. Location.search Is a USVString containing a '?' followed by the parameters or "querystring" of the URL. Modern browsers provide URLSearchParams and URL.
... Living Standard ...
MediaCapabilities.decodingInfo() - Web APIs
The MediaCapabilities.decodingInfo() method, part of the Media Capabilities API, returns a promise with the tested media configuration's mediaCapabilitiesInfo; this contains the three Boolean properties sup
ported, smooth, and powerefficient, which describe whether decoding the media described would be sup
ported, smooth, and powerefficient. ...
....decodingInfo(MediaDecodingConfiguration) Parameters MediaDecodingConfiguration A valid MediaDecodingConfiguration dictionary containing a valid media decoding type of file or media-source and a valid media configuration: either an AudioConfiguration or a VideoConfiguration. ...
...e media configuration to be tested const mediaConfig = { type : 'file', // or 'media-source' audio : { contentType : "audio/ogg", // valid content type channels : 2, // audio channels used by the track bitrate : 132700, // number of bits used to encode 1s of audio samplerate : 5200 // number of audio samples making up that 1s. ...
... content type channels : 2, // audio channels used by the track bitrate : 132700, // number of bits used to encode 1s of audio samplerate : 5200 // number of audio samples making up that 1s. }, }; // check sup
port and performance navigator.mediaCapabilities.decodingInfo(mediaConfig).then(result => { console.log('This configuration is ' + (result.sup
ported ? '' : 'not ') + 'sup
ported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powerEfficient ? '' : 'not ') + 'power efficient.') }); Specifications Specification Status Comment Media CapabilitiesThe definition of 'decodingInfo()' in that specification. Draft Initial definition ...
MediaCapabilities.encodingInfo() - Web APIs
The MediaCapabilities.encodingInfo() method, part of the MediaCapabilities interface of the Media Capabilities API, returns a promise with the tested media configuration's MediaCapabilitiesInfo; this contains the three Boolean properties sup
ported, smooth, and powerefficient, which describe how compatible the device is with the type of media. ...
...fo(mediaEncodingConfiguration) Parameters mediaEncodingConfiguration A valid MediaEncodingConfiguration dictionary containing a valid media encoding type of record or transmission and a valid media configuration: either an AudioConfiguration or VideoConfiguration dictionary. Return value A Promise fulfilling with a MediaCapabilitiesInfo interface containing three Boolean attributes: sup
ported smooth powerEfficient Exceptions A TypeError is raised if the MediaConfiguration passed to the encodingInfo() method is invalid, either because the type is not video or audio, the contentType is not a valid codec MIME type, or any other error in the media configuration passed to the method, including omitting any of the media encoding configuration elements. Example //Create m...
...t mediaConfig = { type : 'record', // or 'transmission' video : { contentType : "video/webm;codecs=vp8.0", // valid content type width : 1920, // width of the video height : 1080, // height of the video bitrate : 120000, // number of bits used to encode 1s of video framerate : 48 // number of frames making up that 1s. ...
...idth : 1920, // width of the video height : 1080, // height of the video bitrate : 120000, // number of bits used to encode 1s of video framerate : 48 // number of frames making up that 1s. } }; // check sup
port and performance navigator.mediaCapabilities.encodingInfo(mediaConfig).then(result => { console.log('This configuration is ' + (result.sup
ported ? '' : 'not ') + 'sup
ported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powerEfficient ? '' : 'not ') + 'power efficient.') }); Specifications Specification Status Comment Media CapabilitiesThe definition of 'encodingInfo()' in that specification. Draft Initial definition ...
MediaDevices.getUserMedia() - Web APIs
es cannot be used at this time. This will happen if the browsing context is insecure (that is, the page was loaded using HTTP rather than HTTPS). It also happens if the user has specified that the current browsing instance is not permitted access to the device, the user has denied access for the current session, or the user has denied all access to user media devices globally. On browsers that sup
port managing media permissions with Feature Policy, this error is returned if Feature Policy is not configured to allow access to the input source(s). Older versions of the specification used SecurityError for this instead; SecurityError has taken on a new meaning. NotFoundError No media tracks of the type specified were found that satisfy the given constraints. NotReadableError Although the u...
...rainedError, and has a constraint property whose string value is the name of a constraint which was impossible to meet, and a message property containing a human-readable string explaining the problem. Because this error can occur even when the user has not yet granted permission to use the underlying device, it can potentially be used as a fingerprinting surface. SecurityError User media sup
port is disabled on the Document on which getUserMedia() was called. The mechanism by which user media sup
port is enabled and disabled is left up to the individual user agent. TypeError The list of constraints specified is empty, or has all constraints set to false. This can also happen if you try to call getUserMedia() in an insecure context, since navigator.mediaDevices is undefined in an insecure...
... to very specific requirements for user notification and permission management. First, getUserMedia() must always get user permission before opening any media gathering input such as a webcam or microphone. Browsers may offer a once-per-domain permission feature, but they must ask at least the first time, and the user must specifically grant ongoing permission if they choose to do so. Of equal im
portance are the rules around notification. Browsers are required to display an indicator that shows that a camera or microphone is in use, above and beyond any hardware indicator that may exist. They must also show an indicator that permission has been granted to use a device for input, even if the device is not actively recording at the moment. For example in Firefox, the URL bar displays a pulsing...
... once muting is over. Security There are a number of ways security management and controls in a user agent can cause getUserMedia() to return a security-related error. Note: The security model for getUserMedia() is still somewhat in flux. The originally-designed security mechanism is in the process of being replaced with Feature Policy, so various browsers have different levels of security sup
port, using different mechanisms. You should test your code carefully on a variety of devices and browsers to be sure it is as broadly compatible as possible Feature Policy The Feature Policy security management feature of HTTP is in the process of being introduced into browsers, with sup
port available to some extent in many browsers (though not always enabled by default, as in Firefox). getUserMed...
MediaDevices - Web APIs
its parent interface, EventTarget. Events devicechange Fired when a media input or output device is attached to or removed from the user's computer. Also available via the ondevicechange property. Methods Inherits methods from its parent interface, EventTarget. enumerateDevices() Obtains an array of information about the media input and output devices available on the system. ...
... when a media input or output device is attached to or removed from the user's computer. Also available via the ondevicechange property. Methods Inherits methods from its parent interface, EventTarget. enumerateDevices() Obtains an array of information about the media input and output devices available on the system. ...
... the user's computer. Also available via the ondevicechange property. Methods Inherits methods from its parent interface, EventTarget. enumerateDevices() Obtains an array of information about the media input and output devices available on the system. getSup
portedConstraints() Returns an object conforming to MediaTrackSup
portedConstraints indicating which constrainable properties are sup
ported on the MediaStreamTrack interface. See Capabilities and constraints in Media Capture and Streams API (Media Stream) to learn more about constraints and how to use them. getDisplayMedia() Prompts the user to select a display or
portion of a display (such as a window) to capture as a MediaStream for sharing or recording purposes. Returns a promise that resolves to a MediaStream. getUserMedia()...
...cks[0].label); stream.onremovetrack = function() { console.log('Stream ended'); }; window.stream = stream; // make variable available to browser console video.srcObject = stream; }) .catch(function(error) { if (error.name === 'ConstraintNotSatisfiedError') { errorMsg('The resolution ' + constraints.video.width.exact + 'x' + constraints.video.height.exact + ' px is not sup
ported by your device.'); } else if (error.name === 'PermissionDeniedError') { errorMsg('Permissions have not been granted to use your camera and ' + 'microphone, you need to allow the page access to your devices in ' + 'order for the demo to work.'); } errorMsg('getUserMedia error: ' + error.name, error); }); function errorMsg(msg, error) { errorElement.innerHTML += '<p>' + m...
MediaKeyMessageEvent() - Web APIs
is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...o the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...Safari on iOSSamsung InternetMediaKeyMessageEvent() constructor ExperimentalChrome Full sup
port 42Edge Full sup
port <=18Firefox ? IE ? Opera ? Safari ? WebView Android No sup
port NoChrome Android Full sup
port 42Firefox Android ? Opera Android ? Safari iOS ? ...
... ? Safari ? WebView Android No sup
port NoChrome Android Full sup
port 42Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full sup
port 4.0Legend Full sup
port Full sup
port No sup
port No sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
MediaKeyStatusMap.entries() - Web APIs
tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetentries ExperimentalChrome Full sup
port 42Edge Full sup
port 16Firefox ? IE ? Opera Full sup
port 29Safari ? WebView Android Full sup
port 43Chrome Android Full sup
port 42Firefox Android ? Opera Android Full sup
port 29Safari iOS ? Samsung Inter...
...ri ? WebView Android Full sup
port 43Chrome Android Full sup
port 42Firefox Android ? Opera Android Full sup
port 29Safari iOS ? Samsung Internet Android Full sup
port 4.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
MediaKeyStatusMap.forEach() - Web APIs
tibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetforEach ExperimentalChrome Full sup
port 42Edge Full sup
port 13Firefox ? IE ? Opera Full sup
port 29Safari ? WebView Android Full sup
port 43Chrome Android Full sup
port 42Firefox Android ? Opera Android Full sup
port 29Safari iOS ? Samsung Inter...
...ri ? WebView Android Full sup
port 43Chrome Android Full sup
port 42Firefox Android ? Opera Android Full sup
port 29Safari iOS ? Samsung Internet Android Full sup
port 4.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
MediaKeyStatusMap.keys() - Web APIs
mpatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetkeys ExperimentalChrome Full sup
port 42Edge Full sup
port 16Firefox ? IE ? Opera Full sup
port 29Safari ? WebView Android Full sup
port 43Chrome Android Full sup
port 42Firefox Android ? Opera Android Full sup
port 29Safari iOS ? Samsung Inter...
...ri ? WebView Android Full sup
port 43Chrome Android Full sup
port 42Firefox Android ? Opera Android Full sup
port 29Safari iOS ? Samsung Internet Android Full sup
port 4.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
MediaKeyStatusMap.values() - Web APIs
atibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...f you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...eChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetvalues ExperimentalChrome Full sup
port 42Edge Full sup
port 16Firefox ? IE ? Opera Full sup
port 29Safari ? WebView Android Full sup
port 43Chrome Android Full sup
port 42Firefox Android ? Opera Android Full sup
port 29Safari iOS ? Samsung Inter...
...ri ? WebView Android Full sup
port 43Chrome Android Full sup
port 42Firefox Android ? Opera Android Full sup
port 29Safari iOS ? Samsung Internet Android Full sup
port 4.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
MediaQueryList - Web APIs
You can create a MediaQueryList by calling matchMedia() on the window object. The resulting object handles sending notifications to listeners when the media query state changes (i.e. when the media query test starts or stops evaluating to true). This is very useful for adaptive design, since this makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, and allows you to programmatically make changes to a document based on media query status. ...
...nge notification callbacks (which should have previously been added using addEventListener()). Events The following events are delivered to MediaQueryList objects: change Sent to the MediaQueryList when the result of running the media query against the document changes. For example, if the media query is (min-width: 400px), the change event is fired any time the width of the document's view
port changes such that its width moves across the 400px boundary in either direction. Also available using the onchange event handler property. Examples This simple example creates a MediaQueryList and then sets up a listener to detect when the media query status changes, running a custom function when it does to change the appearence of the page. var para = document.querySelector('p'); var mql =...
...g the onchange event handler property. Examples This simple example creates a MediaQueryList and then sets up a listener to detect when the media query status changes, running a custom function when it does to change the appearence of the page. ...
...om function when it does to change the appearence of the page. var para = document.querySelector('p'); var mql = window.matchMedia('(max-width: 600px)'); function screenTest(e) { if (e.matches) { /* the view
port is 600 pixels wide or less */ para.textContent = 'This is a narrow screen -- less than 600px wide.'; document.body.style.backgroundColor = 'red'; } else { /* the view
port is more than than 600 pixels wide */ para.textContent = 'This is a wide screen -- more than 600px wide.'; document.body.style.backgroundColor = 'blue'; } } mql.addEventListener('change', screenTest); Note: You can find this example on GitHub (see the source code, and also see it running live). You can find other examples on the individual property and method pages. Specifications ...
MediaRecorder - Web APIs
gument with a value in milliseconds. If this is specified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chunk. MediaRecorder.stop() Stops recording, at which point a dataavailable event containing the final Blob of saved data is fired. No more recording occurs. Static methods MediaRecorder.isTypeSup
ported() A static method which returns a Boolean value indicating if the given MIME media type is sup
ported by the current user agent. Event handlers MediaRecorder.ondataavailable Called to handle the dataavailable event, which is periodically triggered each time timeslice milliseconds of media have been recorded (or when the entire media has been recorded, if timeslice wasn't specified). The ...
... triggered each time timeslice milliseconds of media have been recorded (or when the entire media has been recorded, if timeslice wasn't specified). The event, of type BlobEvent, contains the recorded media in its data property. You can then collect and act upon that recorded media data using this event handler. MediaRecorder.onerror An EventHandler called to handle the error event, including re
porting errors that arise with media recording. These are fatal errors that stop recording. The received event is based on the MediaRecorderErrorEvent interface, whose error property contains a DOMException that describes the actual error that occurred. MediaRecorder.onpause An EventHandler called to handle the pause event, which occurs when media recording is paused. MediaRecorder.onresume An Eve...
...le the stop event, which occurs when media recording ends, either when the MediaStream ends -- or after the MediaRecorder.stop() method is called. Events Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface. ...
... method is called. Events Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface. error Fired when an error occurs: for example because recording wasn't allowed or was attempted using an unsup
ported codec. Also available via the onerror property. ...
Using the MediaStream Recording API - Web APIs
ve, or grab the source code on GitHub. CSS goodies The HTML is pretty simple in this app, so we won't go through it here; there are a couple of slightly more interesting bits of CSS worth mentioning, however, so we'll discuss them below. If you are not interested in CSS and want to get straight to the JavaScript, skip to the Basic app setup section. Keeping the interface constrained to the view
port, regardless of device height, with calc() The calc() function is one of those useful little utility features that's cropped up in CSS that doesn't look like much initially, but soon starts to make you think "Wow, why didn't we have this before? Why was CSS2 layout so awkward?" It allows you do a calculation to determine the computed value of a CSS unit, mixing different units in the process. Fo...
... here, but it's a bit overkill for such a simple layout. Instead, the problem was solved by making the third container's height equal to 100% of the parent height, minus the heights and padding of the other two: .sound-clips { box-shadow: inset 0 3px 4px rgba(0,0,0,0.7); background-color: rgba(0,0,0,0.1); height: calc(100% - 240px - 0.7rem); overflow: scroll; } Note: calc() has good sup
port across modern browsers too, even going back to Internet Explorer 9. Checkbox hack for showing/hiding This is fairly well documented already, but we thought we'd give a mention to the checkbox hack, which abuses the fact that you can click on the <label> of a checkbox to toggle it checked/unchecked. In Web Dictaphone this powers the Information screen, which is shown/hidden by clicking the ques...
...tons, and the <article> that will contain the generated audio players: const record = document.querySelector('.record'); const stop = document.querySelector('.stop'); const soundClips = document.querySelector('.sound-clips'); Finally for this section, we set up the basic getUserMedia structure: if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { console.log('getUserMedia sup
ported.'); navigator.mediaDevices.getUserMedia ( // constraints - only audio needed for this app { audio: true }) // Success callback .then(function(stream) { }) // Error callback .catch(function(err) { console.log('The following getUserMedia error occured: ' + err); } ); } else { console.log('getUserMedia not sup
port...
... { audio: true }) // Success callback .then(function(stream) { }) // Error callback .catch(function(err) { console.log('The following getUserMedia error occured: ' + err); } ); } else { console.log('getUserMedia not sup
ported on your browser!'); } The whole thing is wrapped in a test that checks whether getUserMedia is sup
ported before running anything else. Next, we call getUserMedia() and inside it define: The constraints: Only audio is to be captured for our dictaphone. The success callback: This code is run once the getUserMedia call has been completed successfully. The error/failure callback: The code is run if the getUserMedia call fails for whatever reason. Note: All of the code below is placed inside th...
MediaTrackSettings - Web APIs
s object and set using applyConstraints(), and will adhere to the default constraints for any properties whose constraints haven't been changed, or whose customized constraints couldn't be matched. To learn more about how constraints and settings work, see Capabilities, constraints, and settings. Properties Some or all of the following will be included in the object, either because it's not sup
ported by the browser or because it's not available due to context. For example, because RTP doesn't provide some of these values during negotiation of a WebRTC connection, a track associated with a RTCPeerConnection will not include certain values, such as facingMode or groupId. Properties of all media tracks deviceId A DOMString indicating the current value of the deviceId property. The device ...
...ndicating the current value of the sampleSize property, specifying the linear size, in bits, of each audio sample. CD-quality audio, for example, is 16-bit, so this value would be 16 in that case. volume A double-precision floating point value indicating the current value of the volume property, specifying the volume level of the track. This value will be between 0.0 (silent) to 1.0 (maximum sup
ported volume). Properties of video tracks aspectRatio A double-precision floating point value indicating the current value of the aspectRatio property, specified precisely to 10 decimal places. This is the width of the image in pixels divided by its height in pixels. Common values include 1.3333333333 (for the classic television 4:3 "standard" aspect ratio, also used on tablets such as Apple's ...
...d), 1.7777777778 (for the 16:9 high-definition widescreen aspect ratio), and 1.6 (for the 16:10 aspect ratio common among widescreen computers and tablets). facingMode A DOMString indicating the current value of the facingMode property, specifying the direction the camera is facing. The value will be one of: "user" A camera facing the user (commonly known as a "selfie cam"), used for self-
portraiture and video calling. "environment" A camera facing away from the user (when the user is looking at the screen). This is typically the highest quality camera on the device, used for general photography. "left" A camera facing toward the environment to the user's left. "right" A camera facing toward the environment to the user's right. frameRate A double-precision floating po...
... "none" The track has the resolution offered by the camera, its driver or the OS. "crop-and-scale" The track's resolution might be the result of the user agent using cropping or downscaling from a higher camera resolution. Properties of shared screen tracks Tracks containing video shared from a user's screen (regardless of whether the screen data comes from the entire screen or a
portion of a screen, like a window or tab) are generally treated like video tracks, with the exception that they also sup
port the following added settings: cursor A DOMString which indicates whether or not the mouse cursor is being included in the generated stream and under what conditions. Possible values are: always The mouse is always visible in the video content of the {domxref("Media...
Navigator.requestMediaKeySystemAccess() - Web APIs
The Navigator.requestMediaKeySystemAccess() method returns a Promise which delivers a MediaKeySystemAccess object that can be used to access a particular media key system, which can in turn be used to create keys for decrypting a media stream. This method is part of the Encrypted Media Extensions API, which brings sup
port for encrypted media and DRM-protected video to the web. This method may have user-visible effects such as asking for permission to access one or more system resources. Consider that when deciding when to call requestMediaKeySystemAccess(); you don't want those requests to happen at inconvenient times. As a general rule, this function should be called only when it's about time to create and use a MediaKeys object by calling the returned MediaKeySystemAccess object's createMe...
... Consider that when deciding when to call requestMediaKeySystemAccess(); you don't want those requests to happen at inconvenient times. As a general rule, this function should be called only when it's about time to create and use a MediaKeys object by calling the returned MediaKeySystemAccess object's createMediaKeys() method. Syntax Promise = Navigator.requestMediaKeySystemAccess(keySystem, sup
portedConfigurations); Parameters keySystem A DOMString identifying the key system. For example com.example.somesystem or org.w3.clearkey. sup
portedConfigurations A non-empty Array of MediaKeySystemConfiguration objects. The first element with a satisfiable configuration will be used. Return value A Promise that, when resolved, delivers a MediaKeySystemAccess object to your fulfillment handl...
...ration objects. The first element with a satisfiable configuration will be used. Return value A Promise that, when resolved, delivers a MediaKeySystemAccess object to your fulfillment handler function. ...
...o your fulfillment handler function. The fulfillment handler receives as input just one parameter: mediaKeySystemAccess A MediaKeySystemAccess object representing the media key system configuration described by keySystem and sup
portedConfigurations Exceptions In case of an error, the returned Promise is rejected with a DOMException whose name indicates what kind of error occurred. NotSup
portedError Either the specified keySystem isn't sup
ported by the platform or the browser, or none of the configurations specified by sup
portedConfigurations can be satisfied (if, for example, none of the codecs specified in contentType are available). TypeError Either keySystem is an empty string or the sup
portedConfigurations array is empty. Specifications Specification Status C...
performance.clearResourceTimings() - Web APIs
s available in Web Workers. Syntax performance.clearResourceTimings(); Arguments void Return value none This method has no return value. ...
...o return value. ...
...Performance data buffer cleared"); else console.log("... Pe...
...Performance data buffer cleared"); else console.log("... ...
PerformanceEntry.duration - Web APIs
o return a duration of 0. Note: if the performance entry has an entryType of "resource" (i.e. the entry is a PerformanceResourceTiming object), this property returns the difference between the PerformanceEntry.responseEnd and PerformanceEntry.startTime timestamps. Example The following example shows the use of the duration property. ...
...i.e. the entry is a PerformanceResourceTiming object), this property returns the difference between the PerformanceEntry.responseEnd and PerformanceEntry.startTime timestamps. Example The following example shows the use of the duration property. function run_PerformanceEntry() { log("PerformanceEntry sup
port ..."); if (performance.mark === undefined) { log("... ...
...es() to iterate through the each entry var p = performance.getEntries(); for (var i=0; i < p.length; i++) { log("Entry[" + i + "]"); check_PerformanceEntry(p[i]); } } function check_PerformanceEntry(obj) { var properties = ["name", "entryType", "startTime", "duration"]; var methods = ["toJSON"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in obj; if (sup
ported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not sup
ported"); } for (var i=0; i < methods.length; i++) { // check each method var sup
ported = typeof obj[methods[i]] == "function"; if (sup
ported) { var js = obj[methods[i]](); log("..." + methods[i] + "() = " + J...
...i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not sup
ported"); } for (var i=0; i < methods.length; i++) { // check each method var sup
ported = typeof obj[methods[i]] == "function"; if (sup
ported) { var js = obj[methods[i]](); log("..." + methods[i] + "() = " + JSON.stringify(js)); } else { log("..." + methods[i] + " = Not sup
ported"); } } } Specifications Specification Status Comment Performance Timeline Level 2The definition of 'duration' in that specification. Candidate Recommendation Performance TimelineThe definition of 'duration' in that specification. Recommendation Initial definition. ...
PerformanceEntry.name - Web APIs
calling performance.mark(). DOMString PerformanceMeasure measure name used when the measure was created by calling performance.measure(). DOMString PerformancePaintTiming paint Either 'first-paint' or 'first-contentful-paint'. Example The following example shows the use of the name property. ...
...sed when the measure was created by calling performance.measure(). DOMString PerformancePaintTiming paint Either 'first-paint' or 'first-contentful-paint'. Example The following example shows the use of the name property. function run_PerformanceEntry() { log("PerformanceEntry sup
port ..."); if (performance.mark === undefined) { log("... ...
...es() to iterate through the each entry var p = performance.getEntries(); for (var i=0; i < p.length; i++) { log("Entry[" + i + "]"); check_PerformanceEntry(p[i]); } } function check_PerformanceEntry(obj) { var properties = ["name", "entryType", "startTime", "duration"]; var methods = ["toJSON"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in obj; if (sup
ported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not sup
ported"); } for (var i=0; i < methods.length; i++) { // check each method var sup
ported = typeof obj[methods[i]] == "function"; if (sup
ported) { var js = obj[methods[i]](); log("..." + methods[i] + "() = " + J...
...i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not sup
ported"); } for (var i=0; i < methods.length; i++) { // check each method var sup
ported = typeof obj[methods[i]] == "function"; if (sup
ported) { var js = obj[methods[i]](); log("..." + methods[i] + "() = " + JSON.stringify(js)); } else { log("..." + methods[i] + " = Not sup
ported"); } } } Specifications Specification Status Comment Performance Timeline Level 2The definition of 'name' in that specification. Candidate Recommendation Performance TimelineThe definition of 'name' in that specification. Recommendation Initial definition. ...
PerformanceEntry.startTime - Web APIs
meStamp representing the first timestamp when the performance entry was created. Note: if the performance entry has an entryType of "resource" (i.e. the entry is a PerformanceResourceTiming object), this property returns the PerformanceEntry.fetchStart timestamp. Example The following example shows the use of the startTime property. ...
... the performance entry has an entryType of "resource" (i.e. the entry is a PerformanceResourceTiming object), this property returns the PerformanceEntry.fetchStart timestamp. Example The following example shows the use of the startTime property. function run_PerformanceEntry() { log("PerformanceEntry sup
port ..."); if (performance.mark === undefined) { log("... ...
...es() to iterate through the each entry var p = performance.getEntries(); for (var i=0; i < p.length; i++) { log("Entry[" + i + "]"); check_PerformanceEntry(p[i]); } } function check_PerformanceEntry(obj) { var properties = ["name", "entryType", "startTime", "duration"]; var methods = ["toJSON"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in obj; if (sup
ported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not sup
ported"); } for (var i=0; i < methods.length; i++) { // check each method var sup
ported = typeof obj[methods[i]] == "function"; if (sup
ported) { var js = obj[methods[i]](); log("..." + methods[i] + "() = " + J...
...i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not sup
ported"); } for (var i=0; i < methods.length; i++) { // check each method var sup
ported = typeof obj[methods[i]] == "function"; if (sup
ported) { var js = obj[methods[i]](); log("..." + methods[i] + "() = " + JSON.stringify(js)); } else { log("..." + methods[i] + " = Not sup
ported"); } } } Specifications Specification Status Comment Performance Timeline Level 2The definition of 'startTime' in that specification. Candidate Recommendation Performance TimelineThe definition of 'startTime' in that specification. Recommendation Initial definition. ...
PerformanceEntry.toJSON() - Web APIs
returns a JSON representation of the performance entry object. Note: This feature is available in Web Workers. Syntax json = perfEntry.toJSON(); Arguments None Return value json A JSON object that is the serialization of the PerformanceEntry object. Example The following example shows the use of the toJSON() method. ...
...lable in Web Workers. Syntax json = perfEntry.toJSON(); Arguments None Return value json A JSON object that is the serialization of the PerformanceEntry object. Example The following example shows the use of the toJSON() method. function run_PerformanceEntry() { log("PerformanceEntry sup
port ..."); if (performance.mark === undefined) { log("... ...
...es() to iterate through the each entry var p = performance.getEntries(); for (var i=0; i < p.length; i++) { log("Entry[" + i + "]"); check_PerformanceEntry(p[i]); } } function check_PerformanceEntry(obj) { var properties = ["name", "entryType", "startTime", "duration"]; var methods = ["toJSON"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in obj; if (sup
ported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not sup
ported"); } for (var i=0; i < methods.length; i++) { // check each method var sup
ported = typeof obj[methods[i]] == "function"; if (sup
ported) { var js = obj[methods[i]](); log("..." + methods[i] + "() = " + J...
... Candidate Recommendation Initial definition of toJSON() method. ...
PerformanceResourceTiming.connectEnd - Web APIs
Note: This feature is available in Web Workers. Syntax resource.connectEnd; Return value A DOMHighResTimeStamp representing the time after a connection is established. ...
... Can...
... Candidate Recommendation Initial definition. ...
... "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'connectEnd' in that specification. Candidate Recommendation Initial definition. ...
PerformanceResourceTiming.requestStart - Web APIs
There is no end property for requestStart. Note: This feature is available in Web Workers. ...
... C...
... Candidate Recommendation Initial definition. ...
... "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'requestStart' in that specification. Candidate Recommendation Initial definition. ...
PhotoCapabilities.fillLightMode - Web APIs
ty table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...geFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetfillLightMode ExperimentalChrome Full sup
port 59Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 46Safari ? WebView Android Full sup
port 59Chrome Android Full sup
port 59Firefox Android ? Opera Android Full sup
port 43Safari iOS ? Samsung Inter...
...ri ? WebView Android Full sup
port 59Chrome Android Full sup
port 59Firefox Android ? Opera Android Full sup
port 43Safari iOS ? Samsung Internet Android Full sup
port 7.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
PhotoCapabilities.redEyeReduction - Web APIs
table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ike to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...FirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetredEyeReduction ExperimentalChrome Full sup
port 59Edge Full sup
port <=79Firefox ? IE ? Opera Full sup
port 46Safari ? WebView Android Full sup
port 59Chrome Android Full sup
port 59Firefox Android ? Opera Android Full sup
port 43Safari iOS ? Samsung Inter...
...ri ? WebView Android Full sup
port 59Chrome Android Full sup
port 59Firefox Android ? Opera Android Full sup
port 43Safari iOS ? Samsung Internet Android Full sup
port 7.0Legend Full sup
port Full sup
port Compatibility unknown Compatibility unknownExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. ...
RTCIceCandidate.protocol - Web APIs
The RTCIceCandidate interface's read-only protocol property is a string which indicates whether the candidate uses UDP or TCP as its trans
port protocol. protocol is null by default if not specified properly in the SDP, but this is an error condition and will result in a thrown exception when you call RTCPeerConnection.addIceCandidate(). The protocol property's value is set when the RTCIceCandidate() constructor is used. The value is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var protocol = RTCIceCandidate.protocol; Value A DOMString which indicates what network protocol the candidate uses, UDP or TCP. ...
...he RTCIceCandidate() constructor is used. The value is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var protocol = RTCIceCandidate.protocol; Value A DOMString which indicates what network protocol the candidate uses, UDP or TCP. ...
...; Value A DOMString which indicates what network protocol the candidate uses, UDP or TCP. These values are defined by the enumerated type RTCIceProtocol: tcp The candidate, if selected, would use TCP as the trans
port protocol for its data. The tcpType property provides additional information about the kind of TCP candidate represented by the object. udp The candidate will use the UDP trans
port protocol for its data. This is the preferred protocol for media interactions because of its better performance profile. Note: If protocol is null -- and protocol is sup
ported by the user agent -- passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. Usage notes Here's an example candidate a-line from an ICE transaction: a=candidate:4234997325 1 udp 204...
... Example This code snippet examines the value of protocol to decide if it should look at the value of tcpType to see if it's a simultaneous-open (S-O) candidate. ...
RTCIceCandidatePairStats.selected - Web APIs
not the candidate pair described by the object is the one currently being used to communicate with the remote peer. Syntax isSelected = icpStats.selected; Value A Firefox-specific Boolean value which is true if the candidate pair described by this object is the one currently in use. ...
...cribed by the object is the one currently being used to communicate with the remote peer. Syntax isSelected = icpStats.selected; Value A Firefox-specific Boolean value which is true if the candidate pair described by this object is the one currently in use. In any other browser, you can determine the selected candidate pair by looking for a stats object of type trans
port, which is an RTCTrans
portStats object. ...
... = icpStats.selected; Value A Firefox-specific Boolean value which is true if the candidate pair described by this object is the one currently in use. In any other browser, you can determine the selected candidate pair by looking for a stats object of type trans
port, which is an RTCTrans
portStats object. That object's selectedCandidatePairId property indicates whether or not the specified trans
port is the one being used. Example The function shown in this example identifies the currently-selected candidate pair from a statistics re
port by first iterating over each re
port, looking for a trans
port re
port; when one is found, that trans
port's selectedCandidatePairId is used to get the RTCIceCandidatePair describing the connection. If that fails, then the second section iterates over the repo...
...t trans
port's selectedCandidatePairId is used to get the RTCIceCandidatePair describing the connection. If that fails, then the second section iterates over the re
ports, looking for a candidate-pair record whose Firefox-specific selected property is true. This candidate pair is then returned as the currently-selected one. function getCurrentCandidatePair(statsResults) { statsResults.forEach(re
port => { if (re
port.type === "trans
port") { currentPair = statsResults.get(re
port.selectedCandidatePairId); } }); if (!currentPair) { statsResults.forEach(re
port => { if (re
port.type === "candidate-pair" && re
port.selected) { currentPair = re
port; } }); } return currentPair; } Specifications Not part of any specification. This property is unique ...
RTCRtpCapabilities - Web APIs
ribe the capabilities of an RTCRtpSender or RTCRtpReceiver in response to a call to the RTCRtpSender.getCapabilities() or RTCRtpReceiver.getCapabilities() static functions, both of which return an array of RTCRtpCapabilities objects. An RTCRtpCapabilities object contains an array of objects conforming to RTCRtpCodecCapability (each describing the capabilities of one codec) and an array of the sup
ported RTP header extensions for that codec. Properties codecs An array of RTCRtpCodecCapability objects, each describing one of the codecs sup
ported by the RTCRtpSender or RTCRtpReceiver. There are some special entries in this array, described below in the section The codecs array. headerExtensions An array of objects conforming to the RTCRtpHeaderExtensionCapability dictionary. Each object co...
...eaderExtensionCapability dictionary. Each object contains a single DOMString, uri, specifying the URI of the header extension, as described in RFC 5285. Description The codecs array The codecs array is an array of objects conforming to the dictionary RTCRtpCodecCapability. Each of these objects describes a single codec and its basic capabilities. Its properties are: The browser will only re
port distinct capability combinations separately. If two sets of capabilities can be described as one, they will be. That means that, for instance, if there are two entries for the H.264 codec (as identified by the mimeType being "video/H264"), there are other values in the capabilities objects indicating how they're different in some way. The MIME type strings used by RTP differ from those used els...
...s identified by the mimeType being "video/H264"), there are other values in the capabilities objects indicating how they're different in some way. The MIME type strings used by RTP differ from those used elsewhere. See RFC 3555, section 4 for the complete IANA registry of these types. There are three special entries that should always be present, representing underlying components of the trans
port. Those components are: RED (REDundant Audio Data) The media type of an RED entry may vary due to there being several versions of it, but it will end with red, such as video/red or video/fwdred. The base RED standard can be found in RFC 2198. There may be multiple entries for RED if different forms are sup
ported; each will have a unique media type in that case. FEC (Forward Error Correction) ...
...rted; each will have a unique media type in that case. FEC (Forward Error Correction) An FEC component handles error correction data; its media type may also vary due to there being advanced versions of the standard available, but it will always end with fec. One possible value is video/ulpfec (a generic error connection model). There may also be multiple FEC entries if more than one form is sup
ported. RTX (Retransmission) This component is responsible for retransmission of data; it's media type should be video/rtx. There will only be one entry for RTX, and it will not have an sdpFmtpLine property. Don't be surprised to see these show up ijn the list; be prepared to ignore them if you're only interested in the actual codecs used for the media itself. Specifications Specificati...
SVGDocument - Web APIs
Opera Android ? Safari iOS ? Samsung Internet Android ? ...
... ? Safari iOS ? Samsung Internet Android ? ...
...iOS ? Samsung Internet Android ? ...
... Samsung Internet Android ? ...
SVGMarkerElement - Web APIs
Opera Android ? Safari iOS ? Samsung Internet Android ? ...
... ? Safari iOS ? Samsung Internet Android ? ...
...iOS ? Samsung Internet Android ? ...
... Samsung Internet Android ? ...
SVGPathSeg - Web APIs
Opera Android ? Safari iOS ? Samsung Internet Android ? ...
... ? Safari iOS ? Samsung Internet Android ? ...
...iOS ? Samsung Internet Android ? ...
... Samsung Internet Android ? ...
SVGPathSegList - Web APIs
Opera Android ? Safari iOS ? Samsung Internet Android ? ...
... ? Safari iOS ? Samsung Internet Android ? ...
...iOS ? Samsung Internet Android ? ...
... Samsung Internet Android ? ...
SVGPointList - Web APIs
Opera Android ? Safari iOS ? Samsung Internet Android ? ...
... ? Safari iOS ? Samsung Internet Android ? ...
...iOS ? Samsung Internet Android ? ...
... Samsung Internet Android ? ...
ServiceWorkerContainer - Web APIs
The ServiceWorkerContainer interface of the Service Worker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. Most im
portantly, it exposes the ServiceWorkerContainer.register() method used to register service workers, and the ServiceWorkerContainer.controller property used to determine whether or not the current page is actively controlled. Properties ServiceWorkerContainer.controller Read only Returns a ServiceWorker object if its state is activated (the same object returned by ServiceWorkerRegistration.active). This property returns null during a force-refresh request (Shift + refresh) or if there is...
...cument's associated ServiceWorkerRegistration acquires a new active worker. Also available via the ServiceWorkerContainer.oncontrollerchange property. error Fired whenever an error occurs in the associated service workers. Also available via the ServiceWorkerContainer.onerror property. message Occurs when incoming messages are received by the ServiceWorkerContainer object (e.g. via a Message
Port.postMessage() call.) Also available via the ServiceWorkerContainer.onmessage property. Methods ServiceWorkerContainer.register() Creates or updates a ServiceWorkerRegistration for the given scriptURL. ServiceWorkerContainer.getRegistration() Gets a ServiceWorkerRegistration object whose scope matches the provided document URL. The method returns a Promise that resolves to a ServiceWork...
...o an array of ServiceWorkerRegistration. ServiceWorkerContainer.startMessages() explicitly starts the flow of messages being dispatched from a service worker to pages under its control (e.g. sent via Client.postMessage()). This can be used to react to sent messages earlier, even before that page's content has finished loading. Examples The example below first checks to see if the browser sup
ports service workers. If sup
ported, the code registers the service worker and determines if the page is actively controlled by the service worker. If it isn't, it prompts the user to reload the page so the service worker can take control. The code also re
ports any registration failures. if ('serviceWorker' in navigator) { // Register a service worker hosted at the root of the // site using the d...
... console.log('This page is currently controlled by:', navigator.serviceWorker.controller); } // Then, register a handler to detect when a new or // updated service worker takes control. navigator.serviceWorker.oncontrollerchange = function() { console.log('This page is now controlled by:', navigator.serviceWorker.controller); }; } else { console.log('Service workers are not sup
ported.'); } Specifications Specification Status Comment Service WorkersThe definition of 'ServiceWorkerContainer' in that specification. Working Draft Initial definition. ...
SubtleCrypto.deriveBits() - Web APIs
s arguments the base key, the derivation algorithm to use, and the length of the bit string to derive. It returns a Promise which will be fulfilled with an ArrayBuffer containing the derived bits. This method is very similar to SubtleCrypto.deriveKey(), except that deriveKey() returns a CryptoKey object rather than an ArrayBuffer. Essentially deriveKey() is composed of deriveBits() followed by im
portKey(). This function sup
ports the same derivation algorithms as deriveKey(): ECDH, HKDF, and PBKDF2. See Sup
ported algorithms for some more detail on these algorithms. Syntax const result = crypto.subtle.deriveBits( algorithm, baseKey, length ); Parameters algorithm is an object defining the derivation algorithm to use. To use ECDH, pass an EcdhKeyDeriveParams object. ...
...o use ECDH, pass an EcdhKeyDeriveParams object. To use HKDF, pass an HkdfParams object. To use PBKDF2, pass a Pbkdf2Params object. baseKey is a CryptoKey representing the input to the derivation algorithm. If algorithm is ECDH, this will be the ECDH private key. Otherwise it will be the initial key material for the derivation function: for example, for PBKDF2 it might be a password, im
ported as a CryptoKey using SubtleCrypto.im
portKey(). length is a number representing the number of bits to derive. Return value result is a Promise that fulfills with an ArrayBuffer containing the derived bits. Exceptions The promise is rejected when one of the following exceptions are encountered: InvalidAccessError Raised when the base key is not a key for the requested derivation algo...
...e number of bits to derive. Return value result is a Promise that fulfills with an ArrayBuffer containing the derived bits. Exceptions The promise is rejected when one of the following exceptions are encountered: InvalidAccessError Raised when the base key is not a key for the requested derivation algorithm or if the CryptoKey.usages value of that key doesn't contain deriveKey. NotSup
ported Raised when trying to use an algorithm that is either unknown or isn't suitable for derivation, or if the algorithm requested for the derived key doesn't define a key length. Sup
ported algorithms See the Sup
ported algorithms section of the deriveKey() documentation. Examples Note: You can try the working examples on GitHub. ECDH In this example Alice and Bob each generate an ECDH key ...
...ple we ask the user for a password, then use it to derive some bits using PBKDF2. See the complete code on GitHub. let salt; /* Get some key material to use as input to the deriveBits method. The key material is a password supplied by the user. */ function getKeyMaterial() { const password = window.prompt("Enter your password"); const enc = new TextEncoder(); return window.crypto.subtle.im
portKey( "raw", enc.encode(password), {name: "PBKDF2"}, false, ["deriveBits", "deriveKey"] ); } /* Derive some bits from a password supplied by the user. */ async function getDerivedBits() { const keyMaterial = await getKeyMaterial(); salt = window.crypto.getRandomValues(new Uint8Array(16)); const derivedBits = await window.crypto.subtle.deriveBits( { "name": "PB...
TextRange - Web APIs
IE Only This property is IE specific. Although it is well sup
ported by IE, most other browsers no longer sup
port this property. This property should only be used as one of the solutions when you need to be compatible with lower versions of IE, rather than relying on it completely in cross browser scripts. A TextRange object represents a fragment of text in a document, similar to the standard defined Range interface. This object is used to represent a specific piece of text in the document. For example, when you hold down the mouse to select the content on the page, you create a typical TextRange. ...
...similar to the standard defined Range interface. This object is used to represent a specific piece of text in the document. For example, when you hold down the mouse to select the content on the page, you create a typical TextRange. It is implemented in IE, then a TextRange object can be created by Element.createTextRange() or Document.selection.createRange(). Note that this interface is not sup
ported in non IE browsers. Alternative Selection and Range interfaces can be used. Properties TextRange.boundingHeightRead only Returns the height of the rectangle bound to the TextRange object. TextRange.boundingLeftRead only Returns the distance between the left edge of the rectangle that binds the TextRange object and the left edge that completely contains the TextRange object. TextRa...
...lIntoView in the lower version of IE. TextRange.select() Select the current range (i.e. the blue selection seen by the user). TextRange.setEndPoint() Sets the end point of the current range based on the bounds of other TextRange. Example The following example is valid under IE9. The example gets the TextRange through document.selection, and sets the specified element to be selected. IE9 sup
ports the standard alternative Range. var range = document.selection.createRange(); var element = document.getElementById("test"); range.moveToElementText(element); range.select(); // Selected "SomeTextToBeSelected" <!DOCTYPE html> <html> <head> <title>TextRange Example</title> </head> <body> <p id="test">SomeTextToBeSelected</p> </body> </html> Notes Use TextRange to Operate the Selection V...
...its function in most cases). It's easy to get confused. Generally, if the script only needs to be compatible with the latest browser, the standard interface is the best choice; however, the current website still wants to be compatible with IE8 or below browsers. Therefore, the best way is to deal with both at the same time, that is, try to use TextRange mode when the standard interface is not sup
ported, but do not regard it as the only choice. ...
URL - Web APIs
nstruct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL. You normally create a new URL object by specifying the URL as a string when calling its constructor, or by providing a relative URL and a base URL. You can then easily read the parsed components of the URL or make changes to the URL. If a browser doesn't yet sup
port the URL() constructor, you can access a URL object using the Window interface's Window.URL property. Be sure to check to see if any of your target browsers require this to be prefixed. Note: This feature is available in Web Workers. Constructor new URL() Creates and returns a URL object referencing the URL specified using an absolute URL string, or a relative URL string and a base URL strin...
.... Note: This feature is available in Web Workers. Constructor new URL() Creates and returns a URL object referencing the URL specified using an absolute URL string, or a relative URL string and a base URL string. Properties hash A USVString containing a '#' followed by the fragment identifier of the URL. host A USVString containing the domain (that is the hostname) followed by (if a
port was specified) a ':' and the
port of the URL. hostname A USVString containing the domain of the URL. href A stringifier that returns a USVString containing the whole URL. origin Read only Returns a USVString containing the origin of the URL, that is its scheme, its domain and its
port. password A USVString containing the password specified before the domain name. pathname A USVString c...
... protocol A USVString containing the protocol scheme of the URL, including the final ':'. ...
... protocol A USVString containing the protocol scheme of the URL, including the final ':'. ...
WebGL constants - Web APIs
SCISSOR_BOX 0x0C10 Returns an Int32Array with four elements for the current scissor box dimensions. COLOR_CLEAR_VALUE 0x0C22 COLOR_WRITEMASK 0x0C23 UNPACK_ALIGNMENT 0x0CF5 PACK_ALIGNMENT 0x0D05 MAX_TEXTURE_SIZE 0x...
... SCISSOR_BOX 0x0C10 Returns an Int32Array with four elements for the current scissor box dimensions. COLOR_CLEAR_VALUE 0x0C22 COLOR_WRITEMASK 0x0C23 UNPACK_ALIGNMENT 0x0CF5 PACK_ALIGNMENT 0x0D05 MAX_TEXTURE_SIZE 0x0D33 MAX_VIEW
PORT_DIMS 0x0D3A SUBPIXEL_BITS 0...
...t32Array with four elements for the current view
port dimensions. SCISSOR_BOX 0x0C10 Returns an Int32Array with four elements for the current scissor box dimensions. ...
... Constant name Value Description UNPACK_FLIP_Y_WEBGL 0x9240 UNP...
Using WebGL extensions - Web APIs
In that case, their name can be prefixed by the vendor prefix (MOZ_, WEBKIT_, etc.) or the extension is only available once a browser preference has been toggled. ...
...In that case, their name can be prefixed by the vendor prefix (MOZ_, WEBKIT_, etc.) or the extension is only available once a browser preference has been toggled. ...
... optimize for virtual reality. EXT_: Extensions that mirror other OpenGL ES or OpenGL API extensions. WEBGL_: Extensions that are WebGL-specific and intended to be compatible with multiple web browsers. It should also be used for extensions which originated with the OpenGL ES or OpenGL APIs, but whose behavior has been significantly altered. Querying available extensions The WebGL context sup
ports querying what extensions are available. var available_extensions = gl.getSup
portedExtensions(); The WebGLRenderingContext.getSup
portedExtensions() method returns an array of strings, one for each sup
ported extension. Extension list The current extensions are: ANGLE_instanced_arrays EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query EXT_float...
... Extension objects If an extension defines specific symbols or functions that are not available in the core specification of WebGL, they will be available on the extension object returned by the call to gl.getExtension(). ...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
This article introduces WebRTC perfect negotiation, describing how it works and why it's the recommended way to negotiate a WebRTC connection between peers, and provides sample code to demonstrate the technique. After the first deployments of WebRTC-capable browsers, it was realized that parts of the negotiation process were more complicated than they needed to be for typical use cases. ...
... first peer to connect to the signaling server, or you could do something more elaborate like having the peers exchange random numbers and assigning the polite role to the winner. However you make the determination, once these roles are assigned to the two peers, they can then work together to manage signaling in a way that doesn't deadlock and doesn't require a lot of extra code to manage. An im
portant thing to keep in mind is this: the roles of caller and callee can switch during perfect negotiation. If the polite peer is the caller and it sends an offer but there's a collision with the impolite peer, the polite peer drops its offer and instead replies to the offer it has received from the impolite peer. By doing so, the polite peer has switched from being the caller to the callee! Impleme...
...e, it will be always be an offer, because the negotiationneeded event is only fired in stable state. We set a Boolean variable, makingOffer to true to mark that we're preparing an offer. To avoid races, we'll use this value later instead of the signaling state to determine whether or not an offer is being processed because the value of signalingState changes asynchronously, introducing a glare op
portunity. Once the offer has been created, set and sent (or an error occurs), makingOffer gets set back to false. Handling incoming ICE candidates Next, we need to handle the RTCPeerConnection event icecandidate, which is how the local ICE layer passes candidates to us for delivery to the remote peer over the signaling channel. pc.onicecandidate = ({candidate}) => signaler.send({candidate}); Thi...
...= () => { if (pc.iceConnectionState === "failed") { pc.restartIce(); } }; With this improved technique, instead of directly calling onnegotiationneeded with options to trigger ICE restart, the failed ICE connection state simply calls restartIce(). restartIce() tells the ICE layer to automatically add the iceRestart flag to the next ICE message sent. Problem solved! Rollback no longer sup
ported in the pranswer state The last of the API changes that stand out is that you can no longer roll back when in either of the have-remote-pranswer or the have-local-pranswer states. Fortunately, when using perfect negotiation there's no need to do this anyway, since the situations that cause this are caught and prevented before rolling these back ever becomes necessary. Thus, attempting to trigg...
Lifetime of a WebRTC session - Web APIs
hat something had to be done before we ran out of addresses to use, so they started working on designing a new 64-bit addressing system. But they realized that it would take longer to complete the transition than 32-bit addresses would last, so other smart people came up with a way to let multiple computers share the same 32-bit IP address. Network Address Translation (NAT) is a standard which sup
ports this address sharing by handling routing of data inbound and outbound to and from devices on a LAN, all of which are sharing a single WAN (global) IP address. The problem for users is that each individual computer on the Internet no longer necessarily has a unique IP address, and, in fact, each device's IP address may change not only if they move from one network to another, but if their networ...
...look up her address and include it on the package, or she'll wind up wondering why you forgot her birthday again. This is where signaling comes in. Signaling Signaling is the process of sending control information between two devices to determine the communication protocols, channels, media codecs and formats, and method of data transfer, as well as any required routing information. The most im
portant thing to know about the signaling process for WebRTC: it is not defined in the specification. Why, you may wonder, is something fundamental to the process of establishing a WebRTC connection left out of the specification? The answer is simple: since the two devices have no way to directly contact each other, and the specification can't predict every possible use case for WebRTC, it makes more...
...th, until the WebRTC peer connection is open. It'd be very high latency but it could be done. Information exchanged during signaling There are three basic types of information that need to be exchanged during signaling: Control messages used to set up, open, and close the communication channel, and to handle errors. Information needed in order to set up the connection: the IP addressing and
port information needed for the peers to be able to talk to one another. Media capability negotiation: what codecs and media data formats can the peers understand? These need to be agreed upon before the WebRTC session can begin. Only once signaling has been successfully completed can the true process of opening the WebRTC peer connection begin. It's worth noting that the signaling server does not...
...ICE agent may choose to perform ICE restart. This is a process by which the network connection is renegotiated, exactly the same way the initial ICE negotiation is performed, with one exception: media continues to flow across the original network connection until the new one is up and running. Then media shifts to the new network connection and the old one is closed. Note: Different browsers sup
port ICE restart under different sets of conditions. Not all browsers will perform ICE restart due to network congestion, for example. If you need to change the configuration of the connection in some way (such as changing to a different set of ICE servers), you can do so before restarting ICE by calling RTCPeerConnection.setConfiguration() with an updated RTCConfiguration dictionary before restarti...
Lighting a WebXR setting - Web APIs
expensive it becomes. Increased shadow detail, volumetric light (that is, lighting that you can see in the air, such as sunbeams or the beams of spotlights in the sky), and other lighting effects can add realism and beauty to your scene, but caution needs to be taken to ensure the scene doesn't overwhelm the GPU. Computing the color of a lighted pixel Although some graphics libraries include sup
port for light source objects and automatically calculate and apply lighting effect for you, WebGL does not. Fortunately, lighting isn't overly difficult to apply in your own vertex and fragment shaders. For each polygon in the scene, the vertex shader program determines the vertices' colors, and then the fragment shader generates each pixel in the polygon by combining the appropriate texel from the ...
... surrounding the viewer. This involves the collection of data that may come from various sensors (including the accelerometer and compass, if available), cameras, and potentially others. Other data is collected using the Geolocation API, and then all this data is put through algorithms and machine learning engines to generate the estimated lighting information. At present, WebXR doesn't offer sup
port for lighting estimation. However, a specification is currently being drafted under the auspices of the W3C. You can learn all about the proposed API and a fair amount about the concept of lighting estimation in the explainer documnent that's included in the specification's GitHub repository. In essence, lighting estimation collects this information about the light sources and the shape and orien...
...that script can be used to correlate lighting information and how it changes over time to attempt to determine a spatial relationship between the devices; this could in theory indicate that the devices are in the same general area, for example. How browsers mitigate these issues In order to help mitigate these risks, browsers are required by the WebXR Lighting Estimation API specification to re
port lighting information that is fudged somewhat from the true value. There are many ways this could be done. Spherical harmonics precision Browsers can mitigate the risk of fingerprinting by reducing the precision of spherical harmonics. When performing real-time rendering--as is the case with any virtual or augmented reality application--spherical harmonic lighting is used to simplify and acceler...
... risk of fingerprinting by reducing the precision of spherical harmonics. When performing real-time rendering--as is the case with any virtual or augmented reality application--spherical harmonic lighting is used to simplify and accelerate the process of generating highly realistic shadows and shading. By altering the accuracy of these functions, the browser makes the data less consistent, and, im
portantly, makes the data generated by two computers differ, even in the same setting. Decoupling orientation from lighting In an AR application that uses geolocation to determine orientation and potentially position information, avoiding having that information directly correlate to the state of the lighting is another way browsers can protect users from fingerprinting attacks. By simply ensuring t...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
and unbounded spaces Sometimes when your primary experience uses an unbounded space, you may have a need to temporarily transition the user's experience to a bounded space. For instance, it may be easier to implement the interactions with the objects in a single room in a house by switching to a bounded space representing the single room. This might make it easier to do things like implement sup
port for customizing the walls, placing furniture on the floor, and so forth. In cases like this, where you need to begin tracking using a different reference space than the one you've been using, you can use a combination of getViewerPose() and some matrix computations to transition everything in your scene to be based at the new reference frame's origin. Because getViewerPose() is only available i...
...ivity between the headset and the user's device, the XR layer will continue to return poses, but those poses' emulatedPosition property will be true, indicating that the computation of the pose is based on a guess of the current position of the user. Some XR hardware uses algorithms to compute the estimated position of the user based on the movement currently ongoing, while other hardware will re
port no movement at all, but with emulatedPosition set to true. In either case, you may wish to adjust your rendering to compensate for the loss, depending on your specific needs. <<<--- more text and example about how to handle rendering during lost tracking --->>> When tracking resumes You can detect when tracking has resumed after being lost when the user position jumps while at the same time th...
...ng lost tracking --->>> When tracking resumes You can detect when tracking has resumed after being lost when the user position jumps while at the same time the value of emulatedPosition changes from true to false. How you handle this depends on your application. If your app provides a way for the user to move through the virtual world without physically moving in the real world (a so-called tele
portation mechanic), you can simply accept the new position and continue, allowing the jump from your previously-assumed position to be immediately corrected with the new position. On the other hand, if your app involves the user physically moving in real space to move around through your virtual world, simply adopting the new tracking position and jumping there can be unsettling to the user, and sho...
...ately corrected with the new position. On the other hand, if your app involves the user physically moving in real space to move around through your virtual world, simply adopting the new tracking position and jumping there can be unsettling to the user, and should be avoided if possible. Instead, use the difference between the current position and the new tracking position to compute the new tele
portation offset; that is, a transform applied to everything to adapt the position and orientation data from WebXR to your needs. You can do this by creating a new reference space that incorporates into its effective origin the distance the viewer's position jumped since the previous frame, using the XRReferenceSpace method getOffsetReferenceSpace(). <<<--- needs an example --->>> The reset event ...
Web Authentication API - Web APIs
d get() receive a very large random number called a challenge from the server and they return the challenge signed by the private key back to the server. This proves to the server that a user is in possession of the private key required for authentication without revealing any secrets over the network. In order to understand how the create() and get() methods fit into the bigger picture, it is im
portant to understand that they sit between two components that are outside the browser: Server - the Web Authentication API is intended to register new credentials on a server (also referred to as a service or a relying party) and later use those same credentials on that same server to authenticate a user. Authenticator - the credentials are created and stored in a device called an authenticator.
...y critical that the challenge be a buffer of random information (at least 16 bytes) and it MUST be generated on the server in order to ensure the security of the registration process. Browser Calls authenticatorMakeCredential() on Authenticator - Internally, the browser will validate the parameters and fill in any defaults, which become the AuthenticatorResponse.clientDataJSON. One of the most im
portant parameters is the origin, which is recorded as part of the clientData so that the origin can be verified by the server later. The parameters to the create() call are passed to the authenticator, along with a SHA-256 hash of the clientDataJSON (only a hash is sent because the link to the authenticator may be a low-bandwidth NFC or Bluetooth link and the authenticator is just going to sign over ...
... critical that the challenge be a buffer of random information (at least 16 bytes) and it MUST be generated on the server in order to ensure the security of the authentication process. Browser Calls authenticatorGetCredential() on Authenticator - Internally, the browser will validate the parameters and fill in any defaults, which become the AuthenticatorResponse.clientDataJSON. One of the most im
portant parameters is the origin, which recorded as part of the clientData so that the origin can be verified by the server later. The parameters to the get() call are passed to the authenticator, along with a SHA-256 hash of the clientDataJSON (only a hash is sent because the link to the authenticator may be a low-bandwidth NFC or Bluetooth link and the authenticator is just going to sign over the ha...
... ]).buffer }, }; // register / create a new credential navigator.credentials.create(createCredentialDefaultArgs) .then((cred) => { console.log("NEW CREDENTIAL", cred); // normally the credential IDs available for an account would come from a server // but we can just copy them from above... ...
Window.innerHeight - Web APIs
The property is read only and has no default value. ...
...The property is read only and has no default value. ...
...The property is read only and has no default value. To change the width of the window, call one of its resize methods, such as resizeTo() or resizeBy(). ...
...minus its horizontal scroll bar and any borders, use the root <html> element's clientHeight() property instead. Both innerHeight and innerWidth are available on any window or any object that behaves like a window, such as a tab or frame. Example Assuming a frameset var intFrameHeight = window.innerHeight; // or var intFrameHeight = self.innerHeight; // will return the height of the frame view
port within the frameset var intFramesetHeight = parent.innerHeight; // will return the height of the view
port of the closest frameset var intOuterFramesetHeight = top.innerHeight; // will return the height of the view
port of the outermost frameset FIXME: link to an interactive demo here To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the outer height of a win...
Window: resize event - Web APIs
r, resize events are only fired on the window object (i.e. returned by document.defaultView). Only handlers registered on the window object will receive resize events. There is a proposal to allow all elements to be notified of resize changes. See Resize Observer to read the draft document, and GitHub issues to read the on-going discussions. Examples Window size logger The following example re
ports the window size each time it is resized. Bear in mind that since the example is running in an <iframe>, you'll need to actually get the <iframe> to resize before you see an effect. <p>Resize the browser window to fire the <code>resize</code> event.</p> <p>Window height: <span id="height"></span></p> <p>Window width: <span id="width"></span></p> const heightOutput = document.querySelector('#hei...
...ample is running in an <iframe>, you'll need to actually get the <iframe> to resize before you see an effect. ...
... Obsolete CSS Object Model (CSSOM) View ModuleThe defi...
...t = document.querySelector('#height'); const widthOutput = document.querySelector('#width'); function re
portWindowSize() { heightOutput.textContent = window.innerHeight; widthOutput.textContent = window.innerWidth; } window.onresize = re
portWindowSize; addEventListener equivalent You could set up the event handler using the addEventListener() method: window.addEventListener('resize', re
portWindowSize); Specifications Specification Status Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'resize' in that specification. Obsolete CSS Object Model (CSSOM) View ModuleThe definition of 'resize' in that specification. Working Draft ...
Window.screenLeft - Web APIs
Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. In this example we are using screenLeft/screenTop plus Window.requestAnimationFrame() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved. ...
... if(!window.screenLeft) { window.screenLeft = window.screenX; window.screenTop = window.screenY; } Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.screenLeft' in that specification. Working Draft Initial definition.
Window.screenTop - Web APIs
Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... if(!window.screenLeft) { window.screenLeft = window.screenX; window.screenTop = window.screenY; } Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.screenTop' in that specification. Working Draft Initial definition. ...
Window.screenX - Web APIs
Examples In our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. In this example we are using Window.screenLeft/Window.screenTop plus Window.requestAnimationFrame() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved. ...
...2) + 35, 50, degToRad(0), degToRad(360), false); ctx.fill(); pElem.textContent = 'Window.screenLeft: ' + window.screenLeft + ', Window.screenTop: ' + window.screenTop; window.requestAnimationFrame(positionElem); } window.requestAnimationFrame(positionElem); These work in exactly the same way as screenX/screenY. Also in the code we include a snippet that detects whether screenLeft is sup
ported, and if not, polyfills in screenLeft/screenTop using screenX/screenY. if(!window.screenLeft) { window.screenLeft = window.screenX; window.screenTop = window.screenY; } Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.screenX' in that specification. Working Draft Initial definition. ...
Window.screenY - Web APIs
Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. In this example we are using Window.screenLeft/Window.screenTop plus Window.requestAnimationFrame() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved. ...
...2) + 35, 50, degToRad(0), degToRad(360), false); ctx.fill(); pElem.textContent = 'Window.screenLeft: ' + window.screenLeft + ', Window.screenTop: ' + window.screenTop; window.requestAnimationFrame(positionElem); } window.requestAnimationFrame(positionElem); These work in exactly the same way as screenX/screenY. Also in the code we include a snippet that detects whether screenLeft is sup
ported, and if not, polyfills in screenLeft/screenTop using screenX/screenY. if(!window.screenLeft) { window.screenLeft = window.screenX; window.screenTop = window.screenY; } Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.screenY' in that specification. Working Draft Initial definition. ...
Synchronous and asynchronous requests - Web APIs
In general, however, asynchronous requests should be preferred to synchronous requests for performance reasons. Synchronous requests block the execution of code which causes "freezing" on the screen and an unresponsive user experience. Asynchronous request If you use an asynchronous XMLHttpRequest, you receive a callback when the data has been received. This lets the browser continue to work as normal while your request is being handled. Example: send a file to the console log This is the simplest usage of asynchronous XMLHttpRequest. ...
... } }; xhr.open("GET", url, true); xhr.timeout = timeout; xhr.send(null); } Notice the addition of code to handle the "timeout" event by setting the ontimeout handler. Usage: function showMessage (message) { console.log(message + this.responseText); } loadFile("message.txt", 2000, showMessage, "New message!\n"); Here, we're specifying a timeout of 2000 ms. Note: Sup
port for timeout was added in Gecko 12.0. Synchronous request Note: Starting with Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27), Blink 39.0, and Edge 13, synchronous requests on the main thread have been deprecated due to their negative impact on the user experience. Synchronous XHR requests often cause hangs on the web. But developers typically don't notice the problem because the...
...or examples and details. Adapting Sync XHR use cases to the Beacon API There are some cases in which the synchronous usage of XMLHttpRequest is not replaceable, like during the unload, beforeunload, and pagehide events. You should consider using the fetch() API with the keepalive flag. When fetch with keepalive isn't available, you can consider using the navigator.sendBeacon() API, which can sup
port these use cases while typically delivering a good UX. The following example shows theoretical analytics code that attempts to submit data to a server by using a synchronous XMLHttpRequest in an unload handler. This results in the unloading of the page to be delayed. window.addEventListener('unload', logData, false); function logData() { var client = new XMLHttpRequest(); client.open("P...
...ad', logData, false); function logData() { var client = new XMLHttpRequest(); client.open("POST", "/log", false); // third parameter indicates sync xhr. :( client.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); client.send(analyticsData); } Using the sendBeacon() method, the data will be transmitted asynchronously to the web server when the User Agent has had an op
portunity to do so, without delaying the unload or affecting the performance of the next navigation. The following example shows a theoretical analytics code pattern that submits data to a server by using the sendBeacon() method. window.addEventListener('unload', logData, false); function logData() { navigator.sendBeacon("/log", analyticsData); } ...
XRSession.cancelAnimationFrame() - Web APIs
ame. Syntax xrSession.cancelAnimationFrame(handle); Parameters handle The unique value returned by the call to requestAnimationFrame() that previously scheduled the animation callback. Return value None. Usage notes This function has no effect if the specified handle cannot be found. Example In the example below we see code which starts up a WebXR session if immersive VR mode is sup
ported. Once started, the session schedules its first frame to be rendered by calling requestAnimationFrame(). The pauseXR() function shown at the bottom can be called to suspend the WebVR session, in essence, by canceling any pending animation frame callback. Since each frame callback schedules the next one, removing the callback terminates updating of the WebXR scene. const XR = navigator.xr; let...
... calling requestAnimationFrame(). The pauseXR() function shown at the bottom can be called to suspend the WebVR session, in essence, by canceling any pending animation frame callback. Since each frame callback schedules the next one, removing the callback terminates updating of the WebXR scene. ...
...e pauseXR() function shown at the bottom can be called to suspend the WebVR session, in essence, by canceling any pending animation frame callback. Since each frame callback schedules the next one, removing the callback terminates updating of the WebXR scene. ...
... at the bottom can be called to suspend the WebVR session, in essence, by canceling any pending animation frame callback. Since each frame callback schedules the next one, removing the callback terminates updating of the WebXR scene. ...
XRSessionMode - Web APIs
ode enumerated type defines the string values used to identify the possible kinds of session mode that can be used. Values immersive-ar The session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend the content together. Im
portant: The immersive-ar mode is defined by the WebXR Augmented Reality Module, which is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected...
...f the hardware requires it. inline The output is presented inline within the context of an element in a standard HTML document, rather than occupying the full visual space. Inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. Inline sessions don't require special hardware and should be avalable on any user agent offering WebXR API sup
port. ...
...HTML document, rather than occupying the full visual space. Inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. Inline sessions don't require special hardware and should be avalable on any user agent offering WebXR API sup
port. ...
...sions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. Inline sessions don't require special hardware and should be avalable on any user agent offering WebXR API sup
port. Usage notes The XRSessionMode type indicates the values that can be specified when calling XR.isSessionSup
ported() to determine whether or not the specified session type is sup
ported and available to be used, and by requestSession() to attempt to open a new WebXR session. The immersive-ar mode sup
ports all the same features and reference spaces that immersive-vr does, since both are immersive sessions. Browsers may sup
port either or both of these modes, but if WebXR is available, the inline mode is always sup
ported. Specifications Specification Status Comm...
XRSystem - Web APIs
With that XRSession in hand, you can use it to interact with the Augmented Reality (AR) or Virtual Reality (VR) device. Properties While XRSystem directly offers no properties, it does inherit properties from its parent interface, EventTarget. Methods In addition to inheriting methods from its parent interface, EventTarget, the XRSystem interface includes the following methods: isSessionSup
ported() Returns a promise which resolves to true if the browser sup
ports the given XRSessionMode. Resolves to false if the specified mode isn't sup
ported. requestSession() Returns a promise that resolves to a new XRSession with the specified XRSessionMode. Events devicechange Sent when the set of available XR devices has changed. Also available using the ondevicechange event handler. ...
... Events devicechange Sent when the set of available XR devices has changed. Also available using the ondevicechange event handler. Usage notes Thsi interface was previously known as simply XR in earlier versions of the specification; if you see references to XR in code or documentation, simply replace that with XRSystem. ...
...sage notes Thsi interface was previously known as simply XR in earlier versions of the specification; if you see references to XR in code or documentation, simply replace that with XRSystem. Examples The following example shows how to use both isSessionSup
ported() and requestSession(). if (navigator.xr) { immersiveButton.addEventListener("click", onButtonClicked); navigator.xr.isSessionSup
ported('immersive-vr') .then((isSup
ported) => { if (isSup
ported) { immersiveButton.disabled = false; } else { immersiveButton.disabled = true; }); } function onButtonClicked() { if (!xrSession) { navigator.xr.requestSession('immersive-vr') .then(() => { // onSessionStarted() not shown for reasons of brevity and clarity. onSessionStarted(xrSession); })...
...> xrSession = null); } } This code starts by checking to see if WebXR is available by looking for the navigator.xr property. If it's found, we know WebXR is present, so we proceed by establishing a handler for the button which the user can click to toggle immersive VR mode on and off. However, we don't yet know if the desired immersive mode is available. To determine this, we call isSessionSup
ported(), passing it the desired session option before enabling the button, immersiveButton, which the user can then use to switch to immersive mode only if immersive VR mode is available. If immersive VR isn't available, the button is disabled to prevent its use. The onButtonClicked() function checks to see if there's already a session running. If there isn't, we use requestSession() to start one an...
XRWebGLLayer - Web APIs
The XRWebGLLayer interface of the WebXR Device API provides a linkage between the WebXR device (or simulated XR device, in the case of an inline session) and a WebGL context used to render the scene for display on the device. In particular, it provides access to the WebGL framebuffer and view
port to ease access to the context. Although XRWebGLLayer is currently the only type of framebuffer layer sup
ported by WebGL, it's entirely possible that future updates to the WebXR specification may allow for other layer types and corresponding image sources. Constructor new XRWebGLLayer() Creates and returns a new XRWebGLLayer object for use by the specified XRSession, using a particular WebGLRenderingContext or WebGL2RenderingContext as the destination context. Properties antialias...
...cation may allow for other layer types and corresponding image sources. Constructor new XRWebGLLayer() Creates and returns a new XRWebGLLayer object for use by the specified XRSession, using a particular WebGLRenderingContext or WebGL2RenderingContext as the destination context. Properties antialias Read only A Boolean value indicating whether or not the WebGL context's framebuffer sup
ports anti-aliasing. The specific type of anti-aliasing is determined by the user agent. framebuffer Read only Returns a WebGLFramebuffer suitable for passing into the bindFrameBuffer() method. framebufferWidth Read only Returns the width of the XRWebGLLayer's framebuffer. framebufferHeight Read only Returns the height of the layer's framebuffer. ignoreDepthValues Read only A Boolean which...
...g into the bindFrameBuffer() method. framebufferWidth Read only Returns the width of the XRWebGLLayer's framebuffer. framebufferHeight Read only Returns the height of the layer's framebuffer. ignoreDepthValues Read only A Boolean which Indicates whether or not the WebXR compositor should make use of the contents of the layer's depth buffer while compositing the scene. Methods getView
port() Returns a new XRView
port instance representing the position, width, and height to which the WebGL context's view
port must be set to contain drawing to the area of the framebuffer designated for the specified view's contents. In this way, for example, the rendering of the left eye's point of view and of the right eye's point of view are each placed into the correct parts of the framebuffer. S...
...bXR implementations, there will never be more than two entries in this list: one describing the position and viewing angle of the left eye and another doing the same for the right. let pose = xrFrame.getViewerPose(xrReferenceSpace); if (pose) { let glLayer = xrSession.renderState.baseLayer; gl.bindFrameBuffer(gl.FRAMEBUFFER, glLayer.Framebffer); for (let view of pose.views) { let view
port = glLayer.getView
port(view); gl.view
port(view
port.x, view
port.y, view
port.width, view
port.height); /* Render the view */ } } Specifications Specification Status Comment WebXR Device APIThe definition of 'XRWebGLLayer' in that specification. Working Draft Initial definition. ...
XSLTProcessor - Web APIs
An XSLTProcessor applies an XSLT stylesheet transformation to an XML document to produce a new XML document as output. It has methods to load the XSLT stylesheet, to manipulate <xsl:param> parameter values, and to apply the transformation to documents. Syntax The constructor has no parameters. new XSLTProcessor() Methods [Throws] void XSLTProcessor.im
portStylesheet(Node styleSheet) Im
ports the XSLT stylesheet. ...
...ssor.im
portStylesheet(Node styleSheet) Im
ports the XSLT stylesheet. If the given node is a document node, you can pass in a full XSL Transform or a literal result element transform; otherwise, it must be an <xsl:stylesheet> or <xsl:transform> element. [Throws] DocumentFragment XSLTProcessor.transformToFragment(Node source, Document owner) Transforms the node source by applying the stylesheet im
ported using the XSLTProcessor.im
portStylesheet() function. The owner document of the resulting document fragment is the owner node. [Throws] Document XSLTProcessor.transformToDocument(Node source) Transforms the node source applying the stylesheet given im
porting using the XSLTProcessor.im
portStylesheet() function. The resultant object depends on the output method of the stylesheet: ...
...(Sets the value of an <xsl:param>.) A null value for namespaceURI is treated the same as an empty string. [Throws] any XSLTProcessor.getParameter(String namespaceURI, String localName) Gets the value of a parameter from the XSLT stylesheet. A null value for namespaceURI is treated the same as an empty string. [Throws] void XSLTProcessor.removeParameter(String namespaceURI, String localName)...
... and not exposed to Web content: [ChromeOnly] attribute unsigned long XSLTProcessor.flags Flags that tweak the behavior of the processor. Not reset by calling XSLTProcessor.reset(). Default value: 0 Possible values are: Name Value Effect (None) 0 None DISABLE_ALL_LOADS 1 Disable loading external documents (via e.g. <xsl:im
port> and document()) Examples Basic example Advanced example Additional example Specifications Not part of any specification. This is a proprietary interface that originated in Gecko. Gecko IDL XSLTProcessor.webidl nsIXSLTProcessor.idl ...
Using the status role - Accessibility
When the role is added to an element, the browser will send out an accessible status event to assistive technology products which can then notify the user about it. ...
...Braille display to render the status. Possible effects on user agents and assistive technology When the status role is added to an element, or such an element becomes visible, the user agent should do the following: Expose the element as having a status role in the operating system's accessibility API. Fire an accessible status event using the operating system's accessibility API if it sup
ports it. Assistive technology products should listen for such an event and notify the user accordingly: Screen readers may provide a special key to announce the current status, and this should present the contents of any status live region. These should be announced when the user is idle, unless aria-live="assertive" has been set and in which case the user may be interrupted. Screen magnifiers...
...hows how the status role is added directly into the html source code. ...
...tml source code. ...
ARIA: switch role - Accessibility
="switch">Speaker power</label> Description The ARIA switch role is identical to the checkbox role, except instead of being "checked" or "unchecked", it is either "on" and "off." Like the checkbox role, the aria-checked attribute is required. The two possible values are true and false. Unlike a <checkbox> or role="checkbox", there is no indeterminate or mixed state. The switch role does not sup
port the value mixed for the aria-checked attribute; assigning a value of mixed to a switch instead sets the value to false. Assistive technologies may choose to represent switch widgets with a specialized presentation to reflect the notion of an on/off switch. Since a switch is an interactive control, it must be focusable and keyboard accessible. If the role is applied to a non-focusable element, u...
...of the aria-checked attribute dynamically when the switch is toggled. Associated ARIA roles, states, and properties aria-checked attribute The aria-checked attribute is required when using the switch role, as it represents the current state of the widget that the switch role is applied to. A value of true represents the "on" state; false represents the "off" state; a value of mixed is not sup
ported by the switch role, and is treated as false. The default value is false. aria-readonly attribute The aria-readonly attribute is sup
ported by the switch role. It indicates whether the widget's state is editable by the user. A value of false means that the user can change the widget's state; a value of true means that the user cannot change the widget's state. The default value is false. Requ...
...r vice versa. Possible effects on user agents and assistive technology When the switch role is added to an element, the user agent handles it like this: The element is exposed to the system's accessibility infrastructure as having the switch role. When the aria-checked attribute's value changes, an accessible event is fired using the system's accessibility API if one is available and it sup
ports the switch role. All elements that are descendants of an element with the switch role applied to it are automatically assigned role presentation. This prevents elements that are used to construct the switch from being interacted with individually by assistive technologies. Text in these elements remains visible to the user agent and may be read or otherwise delivered to the user, unless it's e...
... to it are automatically assigned role presentation. This prevents elements that are used to construct the switch from being interacted with individually by assistive technologies. Text in these elements remains visible to the user agent and may be read or otherwise delivered to the user, unless it's expressly hidden using display: none or aria-hidden="true". The assistive technology, if it sup
ports the switch role, responds by doing the following: Screen readers should announce the element as a switch, optionally providing instructions as to how to activate the switch. There are varying opinions on how assistive technologies should handle this role; the above is a suggested practice and may differ from other sources. Examples The following examples should help you understand how t...
ARIA: button role - Accessibility
button. The value of aria-pressed describes the state of the button. The values include aria-pressed="false" when a button is not currently pressed, aria-pressed="true" to indicate a button is currently pressed, and aria-pressed="mixed" if the button is considered to be partially pressed. If the attribute is omitted or set to its default value of aria-pressed="undefined", the element does not sup
port being pressed. aria-expanded If the button controls a grouping of other elements, the aria-expanded state indicates whether the controlled grouping is currently expanded or collapsed. If the button has aria-expanded="false" set, the grouping is not currently expanded; If the button has aria-expanded="true" set, it is currently expanded; if the button has aria-expanded="undefined" set or the at...
...om true to false and back again. HTML <button type="button" onclick="handleBtnClick()" onKeyDown="handleBtnKeyDown()"> Mute Audio </button> <span role="button" tabindex="0" aria-pressed="false" onclick="handleBtnClick(event)" onKeyDown="handleBtnKeyDown(event)"> Mute Audio </span> <audio id="audio" src="https://udn.realityripple.com/samples/41/191d072707.mp3"> Your browser does not sup
port the <code>audio</code> element. </audio> CSS button, [role="button"] { padding: 3px; border: 2px solid transparent; } button:active, button:focus, [role="button"][aria-pressed="true"] { border: 2px solid #000; } JavaScript function handleBtnClick(event) { toggleButton(event.target); } function handleBtnKeyDown(event) { // Check to see if space or enter were pressed if (...
...rder: 2px solid transparent; } button:active, button:focus, [role="button"][aria-pressed="true"] { border: 2px solid #000; } JavaScript function handleBtnClick(event) { toggleButton(event.target); } function handleBtnKeyDown(event) { // Check to see if space or enter were pressed if (event.key === " " || event.key === "Enter" || event.key === "Spacebar") { // "Spacebar" for IE11 sup
port // Prevent the default action to stop scrolling when space is pressed event.preventDefault(); toggleButton(event.target); } } function toggleButton(element) { var audio = document.getElementById('audio'); // Check to see if the button is pressed var pressed = (element.getAttribute("aria-pressed") === "true"); // Change aria-pressed to the opposite state element.setAttribu...
... helps assistive technology users understand the function of the element. However, a better solution is to adjust the visual design so it matches the function and ARIA role. Where possible, it is recommended to use native HTML buttons (<button>, <input type="button">, <input type="submit">, <input type="reset"> and <input type="image">) rather than the button role, as native HTML buttons are sup
ported by all user agents and assistive technology and provide keyboard and focus requirements by default, without need for additional customization. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'button' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'button' in that spe...
ARIA: listbox role - Accessibility
sed to select all items, and Ctrl+A could be used as a shortcut key for this. When the listbox role is added to an element, or such an element becomes visible, screen readers announce the label and role of the listbox when it gets focus. If an option or item is focused within the list, it gets announced next, followed by an indication of the item's position with the list if the screen reader sup
ports this. As focus moves within the list, the screen reader announces the relevant items. Associated ARIA roles, states, and properties Associated Roles option One or more nested options are required. All selected options have aria-selected set to true. All options that are not selected have aria-selected set to false. If an option is not selectable, omit the aria-selected. list A section c...
...he list that is selected. Down Arrow: Moves focus to the next option. Optionally, in a single-select listbox, selection may also move with focus. Up Arrow: Moves focus to the previous option. Optionally, in a single-select listbox, selection may also move with focus. Home (Optional): Moves focus to first option. Optionally, in a single-select listbox, selection may also move with focus. Sup
porting this key is strongly recommended for lists with more than five options. End (Optional): Moves focus to last option. Optionally, in a single-select listbox, selection may also move with focus. Sup
porting this key is strongly recommended for lists with more than five options. Type-ahead is recommended for all listboxes, especially those with more than seven options: Type a character: focus...
...ommended for all listboxes, especially those with more than seven options: Type a character: focus moves to the next item with a name that starts with the typed character. Type multiple characters in rapid succession: focus moves to the next item with a name that starts with the string of characters typed. Multiple Selection: Authors may implement either of two interaction models to sup
port multiple selection: a recommended model that does not require the user to hold a modifier key, such as Shift or Control, while navigating the list or an alternative model that does require modifier keys to be held while navigating in order to avoid losing selection states. Recommended selection model -- holding modifier keys is not necessary: Space: changes the selection state of the fo...
...d reason to expand the listbox, the combobox role may be more appropriate. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA listbox role' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'Listbox Role' in that specification. Working Draft Screen reader sup
port TBD ...
Alerts - Accessibility
looks for an element with id "alert", and if found, removes that from the document object model. Next, the function creates a div element to hold the alert text. It gets an ID of "alert". And it gets a role set of "alert". This is actually ARIA-inspired, even though it doesn't say "aria" in the attribute name. This is because that role is based on the XHTML Role Attribute Module that was simply
ported to HTML for simplicity. The text is added to the div element, and the div element is added to the document. The moment this happens, Firefox will fire an "alert" event to assistive technologies when this div appears. Most screen readers will pick this one up automatically and speak it. This is similar to the Notification Bar in Firefox that prompts you whether you want to save a password. The...
...event handler. We need to change the two inputs for e-mail and name for this: <input name="name" id="name" aria-required="true" onblur="checkValidity('name', ' ', 'Invalid name entered!');"/> <br /> <input name="email" id="email" aria-required="true" onblur="checkValidity('email', '@', 'Invalid e-mail address');"/> Testing the example If you use Firefox 3 and a currently-sup
ported screen reader, try the following: Enter only your first name as the name. When tabbing, you'll hear an alert that tells you you've entered an invalid name. You can then shift-tab back and correct the error. Enter an e-mail address without the "@" symbol. When tabbing out of this field, you should hear a warning that says you didn't enter a valid e-mail address. In both cases, when returni...
... alert that tells you you've entered an invalid name. You can then shift-tab back and correct the error. Enter an e-mail address without the "@" symbol. When tabbing out of this field, you should hear a warning that says you didn't enter a valid e-mail address. In both cases, when returning focus to the field in question, your screen reader should tell you that this field is invalid. ...
...he error. Enter an e-mail address without the "@" symbol. When tabbing out of this field, you should hear a warning that says you didn't enter a valid e-mail address. In both cases, when returning focus to the field in question, your screen reader should tell you that this field is invalid. JAWS 9 sup
ports this, but JAWS 8 does not, so this may not work in all versions of the screen readers sup
ported. A few questions that you might have Q. Why did you put both "(required)" in the label text and the aria-required attribute on some of the inputs? A. If this were a real live form, and the site was being visited by a browser that does not yet sup
port ARIA, we'd still want to give an indication that this is a required field. Q. Why don't you set focus back to the invalid field automaticall...
Perceivable - Accessibility
c. Image alt text. Content images should have text available that clearly describes the image's contents, which can be programmatically associated with it (e.g., alt text), or otherwise is easy to associate (e.g., describes it and is sat right next to it). This should mean that the full meaning can still be inferred even if you can't see the image. Lists. If the order of list items is im
portant, use an ordered list (<ol>). The whole of HTML: A good basis for accessibility is packed with information about this, but you should particularly refer to Good semantics, UI controls, and Text alternatives. 1.3.2 Meaningful content sequence (A) A sensible, logical reading order should be easy to determine for any content, even if it is visually presented in an u...
...aphs), with CSS being used to create any unusual layout styles, irrespective of the markup. Again, refer to HTML: A good basis for accessibility. 1.3.3 Sensory characteristics (A) Instructions for operating controls or understanding content do not rely on a single sense. This may prove inaccessible to people with a disability related to that sense, or a device that does not sup
port that sense. So, for example: "Click the round button to continue" The button should be clearly labelled so that it is obvious that it is the button you need to press. If there are multiple buttons, make sure they are all clearly labelled to distinguish their function. "Listen to the audio instructions for guidance" This is obviously problematic--audio will be inaccessi...
...to the audio instructions for guidance" This is obviously problematic--audio will be inaccessible to those with hearing impairments, whereas text can be read, but also spoken by a screenreader if required. "Swipe from the right hand side of the screen to reveal the menu" Some users might not be able to swipe the screen, either due to disability or because their device does not sup
port touch. An alternative should be provided, such as a keyboard shortcut or button that can be activated by keyboard or other means. Note: Conveying instructions solely by color is related, but covered in a different guideline -- 1.4.1. 1.3.4 Orientation (AA) added in 2.1 Content does not restrict its view and operation to a single display orientation, such as...
...touch. An alternative should be provided, such as a keyboard shortcut or button that can be activated by keyboard or other means. Note: Conveying instructions solely by color is related, but covered in a different guideline -- 1.4.1. 1.3.4 Orientation (AA) added in 2.1 Content does not restrict its view and operation to a single display orientation, such as
portrait or landscape, unless a specific display orientation is essential. Understanding Orientation 1.3.5 Identify Input Purpose (AA) added in 2.1 Follow the list of 53 input fields to programmatically identify the purpose of a field. Understanding Identify Input Purpose 1.3.6 Identify Purpose (AAA) added in 2.1 In content implemented using markup l...
:focus-visible - CSS: Cascading Style Sheets
The :focus-visible pseudo-class applies while an element matches the :focus pseudo-class and the UA (User Agent) determines via heuristics that the focus should be made evident on the element. (Many browsers show a "focus ring" by default in this case.) This selector is useful to provide a different focus indicator based on the user's input modality (mouse vs. keyboard). Note that Firefox sup
ports similar functionality through an older, prefixed pseudo-class -- :-moz-focusring. Syntax :focus-visible Examples Basic example In this example, the :focus-visible selector uses the UA's behavior to determine when to match. Compare what happens when you click on the different controls with a mouse, versus when you tab through them using a keyboard. Note the difference in behavior from elements...
... such as a custom element button, can use :focus-visible to selectively apply a focus indicator only on keyboard-focus. This matches the native focus behavior for controls like <button>. ...
... Accessibility concerns Low vision Make sure the visual focus indicator ...
... Accessibility concerns Low vision Make sure the visual focus indicator can be seen by people with low vision. ...
size - CSS: Cascading Style Sheets
the @page at-rule, defines the size and orientation of the box which is used to represent a page. Most of the time, this size corresponds to the target size of the printed page if applicable. Size may either be defined with a "scalable" keyword (in this case the page will fill the available dimensions) or with absolute dimensions. Syntax /* Keyword values for scalable size */ size: auto; size:
portrait; size: landscape; /* <length> values */ /* 1 value: height = width */ size: 6in; /* 2 values: width then height */ size: 4in 6in; /* Keyword values for absolute size */ size: A4; size: B5; size: JIS-B4; size: letter; /* Mixing size and orientation */ size: A4
portrait; Values auto The user agent decides the size of the page. In most cases, the dimensions and orientation of the targe...
...the longest side of the box is vertical). This is the default orientation. <length> Any length value (see <length>). ...
...the longest side of the box is vertical). This is the default orientation. <length> Any length value (see <length>). The first value corresponds to the width of the page box and the second one corresponds to its height. If only one value is provided, it is used for both width and height. ...
...is a equivalent to the dimensions of legal papers in North America i.e. 8.5in x 14in. ledger This keyword is a equivalent to the dimensions of ledger pages in North America i.e. 11in x 17in. Formal definition Related at-rule@pageInitial valueautoComputed valueas specified, but with relative lengths converted into absolute lengths Formal syntax <length>{1,2} | auto | [ <page-size> | [
portrait | landscape ] ] Examples Specifying size and orientation @page { size: 4in 6in landscape; } Nesting inside a @media rule @media print { @page { size: 50mm 150mm; } } Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of 'size' in that specification. Working Draft Initial definition ...
max-height - CSS: Cascading Style Sheets
The max-height CSS descriptor specifies the maximum height of the view
port of a document defined via the @view
port at-rule. The height will initially be set as close as possible to the initial view
port height considering the maximum height constraint. Syntax /* Keyword value */ max-height: auto; /* <length> values */ max-height: 400px; max-height: 50em; max-height: 20cm; /* <percentage> value */ max-height: 75%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial view
port at zoom factor 1.0 for vertical lengths. Must be non-negative. ...
...eight: 50em; max-height: 20cm; /* <percentage> value */ max-height: 75%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial view
port at zoom factor 1.0 for vertical lengths. Must be non-negative. ...
...%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial view
port at zoom factor 1.0 for vertical lengths. Must be non-negative. ...
...tage value relative to the height of the initial view
port at zoom factor 1.0 for vertical lengths. Must be non-negative. Formal definition Related at-rule@view
portInitial valueautoPercentagesrefer to the height of the initial view
portComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, auto Formal syntax <view
port-length>where <view
port-length> = auto | <length-percentage>where <length-percentage> = <length> | <percentage> Examples Setting view
port max height in pixels @view
port { max-height: 600px; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"max-height" descriptor' in that specification. Working Draft Initial definition ...
max-width - CSS: Cascading Style Sheets
The max-width CSS descriptor specifies the maximum width of the view
port of a document defined via the @view
port at-rule. By default, the width is set as close as possible to the initial view
port considering the maximum width constraint. Syntax /* Keyword value */ max-width: auto; /* <length> values */ max-width: 600px; max-width: 80em; max-width: 15cm; /* <percentage> value */ max-width: 75%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width of the initial view
port at zoom factor 1.0 for horizontal lengths. Must be non-negative. ...
...width: 80em; max-width: 15cm; /* <percentage> value */ max-width: 75%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width of the initial view
port at zoom factor 1.0 for horizontal lengths. Must be non-negative. ...
...; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width of the initial view
port at zoom factor 1.0 for horizontal lengths. Must be non-negative. ...
...tage value relative to the width of the initial view
port at zoom factor 1.0 for horizontal lengths. Must be non-negative. Formal definition Related at-rule@view
portInitial valueautoPercentagesrefer to the width of the initial view
portComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, auto Formal syntax <view
port-length>where <view
port-length> = auto | <length-percentage>where <length-percentage> = <length> | <percentage> Examples Setting view
port max width in pixels @view
port { max-width: 600px; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"max-width" descriptor' in that specification. Working Draft Initial definition ...
min-height - CSS: Cascading Style Sheets
The min-height CSS descriptor specifies the minimum height of the view
port of a document defined via the @view
port at-rule. The height will initially be set as close as possible to the initial view
port height considering the minimum height constraint. Syntax /* Keyword value */ min-height: auto; /* <length> values */ min-height: 120px; min-height: 20em; min-height: 10cm; /* <percentage> value */ min-height: 25%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial view
port at zoom factor 1.0 for vertical lengths. Must be non-negative. ...
...eight: 20em; min-height: 10cm; /* <percentage> value */ min-height: 25%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial view
port at zoom factor 1.0 for vertical lengths. Must be non-negative. ...
...%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial view
port at zoom factor 1.0 for vertical lengths. Must be non-negative. ...
...tage value relative to the height of the initial view
port at zoom factor 1.0 for vertical lengths. Must be non-negative. Formal definition Related at-rule@view
portInitial valueautoPercentagesrefer to the height of the initial view
portComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, auto Formal syntax <view
port-length>where <view
port-length> = auto | <length-percentage>where <length-percentage> = <length> | <percentage> Examples Setting view
port min height in pixels @view
port { min-height: 200px; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"min-height" descriptor' in that specification. Working Draft Initial definition ...
min-width - CSS: Cascading Style Sheets
The min-width CSS descriptor specifies the minimum width of the view
port of a document defined via @view
port. By default, min-width is set as close as possible to the initial view
port considering the minimum width constraint. Syntax /* Keyword value */ min-width: auto; /* <length> values */ min-width: 320px; min-width: 40em; min-width: 5cm; /* <percentage> value */ min-width: 25%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial view
port at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. ...
...rcentage> value */ min-width: 25%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial view
port at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. ...
... calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial view
port at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. ...
...eight of the initial view
port at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. Formal definition Related at-rule@view
portInitial valueautoPercentagesrefer to the width of the initial view
portComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, auto Formal syntax <view
port-length>where <view
port-length> = auto | <length-percentage>where <length-percentage> = <length> | <percentage> Examples Setting view
port min width in pixels @view
port { min-width: 200px; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"min-width" descriptor' in that specification. Working Draft Initial definition ...
At-rules - CSS: Cascading Style Sheets
d includes everything up to the next semicolon, ';' (U+003B SEMICOLON), or the next CSS block, whichever comes first. /* General structure */ @IDENTIFIER (RULE); /* Example: tells browser to use UTF-8 character set */ @charset "utf-8"; There are several at-rules, designated by their identifiers, each with a different syntax: @charset -- Defines the character set used by the style sheet. @im
port -- Tells the CSS engine to include an external style sheet. @namespace -- Tells the CSS engine that all its content must be considered prefixed with an XML namespace. Nested at-rules -- A subset of nested statements, which can be used as a statement of a style sheet as well as inside of conditional group rules: @media -- A conditional group rule that will apply its content if the device m...
...e -- Tells the CSS engine that all its content must be considered prefixed with an XML namespace. Nested at-rules -- A subset of nested statements, which can be used as a statement of a style sheet as well as inside of conditional group rules: @media -- A conditional group rule that will apply its content if the device meets the criteria of the condition defined using a media query. @sup
ports -- A conditional group rule that will apply its content if the browser meets the criteria of the given condition. @document -- A conditional group rule that will apply its content if the document in which the style sheet is applied meets the criteria of the given condition. (deferred to Level 4 of CSS Spec) @page -- Describes the aspect of layout changes that will be applied when printin...
... the document in which the style sheet is applied meets the criteria of the given condition. (deferred to Level 4 of CSS Spec) @page -- Describes the aspect of layout changes that will be applied when printing the document. @font-face -- Describes the aspect of an external font to be downloaded. @keyframes -- Describes the aspect of intermediate steps in a CSS animation sequence. @view
port -- Describes the aspects of the view
port for small screen devices. (currently at the Working Draft stage) @counter-style -- Defines specific counter styles that are not part of the predefined set of styles. (at the Candidate Recommendation stage, but only implemented in Gecko as of writing) @font-feature-values (plus @swash, @ornaments, @annotation, @stylistic, @styleset and @character-va...
...an include nested statements--either rulesets or nested at-rules. Furthermore, they all convey a common semantic meaning--they all link some type of condition, which at any time evaluates to either true or false. If the condition evaluates to true, then all of the statements within the group will be applied. Conditional group rules are defined in CSS Conditionals Level 3 and are: @media, @sup
ports, @document. (deferred to Level 4 of CSS Spec) Since each conditional group may also contain nested statements, there may be an unspecified amount of nesting. Specifications Specification Status Comment CSS Conditional Rules Module Level 3 Candidate Recommendation Initial definition Compatibility StandardThe definition of 'CSS At-rules' in that specifi...
Using URL values for the cursor property - CSS: Cascading Style Sheets
Gecko 1.8 sup
ports URL values for the CSS cursor property on Windows and Linux. Mac sup
port was added in Gecko 2 (Firefox 4). This allows specifying arbitrary images as mouse cursors -- any image format sup
ported by Gecko can be used. Syntax The basic (CSS 2.1) syntax for this property is: cursor: [ <url> , ]* <keyword> This means that zero or more URLs may be specified (comma-separated), which must be followed by one of the keywords defined in the CSS specification, such as auto or pointer. For example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; This will first try loading foo.cur. ...
...ch must be followed by one of the keywords defined in the CSS specification, such as auto or pointer. For example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; This will first try loading foo.cur. If that file does not exist or is not valid for some other reason, bar.gif is tried, and if that can't be used either, auto will be used. Sup
port for the CSS 3 syntax for cursor values got added in Gecko 1.8 (Firefox 1.5): cursor: [ <uri> [ <x> <y> ]? , ]* <keyword> It allows specifying the coordinates of the cursor's hotspot, which will be clamped to the boundaries of the cursor image. If none are specified, the coordinates of the hotspot are read from the file itself (for CUR and XBM files) or are set to the top left corner of the ima...
...: auto; cursor: url(cursor1.png) 4 12, auto; } .bar { cursor: pointer; cursor: url(cursor2.png) 2 2, pointer; } /* Falls back onto 'auto' and 'pointer' in IE, but must be set separately */ The first number is the x-coordinate, and the second number is the y-coordinate. The example will set the hotspot to be the pixel at (4,12) from the top left (0,0). Limitations All image formats sup
ported by Gecko can be used. This means that you can use PNG, GIF, JPG, BMP, CUR, etc. images. ANI is not sup
ported. An animated PNG or GIF will not create an animated cursor. Note: Starting with Gecko 2.0, Gecko also sup
ports the SVG image format for cursors. However, the SVG image must contain a length-valued (not percentage-valued) height and width on its root SVG node. JavaScript, CSS animation,...
...n animated cursor, for example. In Gecko (Firefox) the limit of the cursor size is 128x128px. Larger cursor images are ignored. However, you should limit yourself to the size 32x32 for maximum compatibility with operating systems and platforms. (Due to a bug in Gecko 1.9.2-1.9.2.6, Firefox 3.6-3.6.6 on Windows limits to 32x32px. This is fixed in later versions.) Translucent cursors are not sup
ported on Windows releases earlier than XP. This is a limitation of the operating system. Transparency works on all platforms. URL values as cursors are sup
ported in Windows, OS/2, and Linux (when using GTK+ 2.4 or better) releases of Mozilla. Mac OS X sup
port was added with Gecko 2 (Firefox 4). ...
Color picker tool - CSS: Cascading Style Sheets
er-box; box-sizing: border-box; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } /** * Resize Handle */ .resize-handle { width: 10px; height: 10px; background: url('https://mdn.mozillademos.org/files/6083/resize.png') center center no-repeat; position: absolute; bottom: 0; right: 0; } [data-resize='both']:hover { cursor: nw-resize !im
portant; } [data-resize='width']:hover { cursor: w-resize !im
portant; } [data-resize='height']:hover { cursor: n-resize !im
portant; } [data-hidden='true'] { display: none; } [data-collapsed='true'] { height: 0 !im
portant; } .block { display: table; } /** * Container */ #container { width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; d...
...ound-position: left 35px top 60%; text-align: right; border: 3px dashed rgb(221, 221, 221); border-radius: 15px; position: absolute; top: 50px; left: 20%; } #canvas[data-tutorial='drop']:after { content: "adjust, change or modify"; width: 40%; font-size: 24px; position: absolute; top: 130px; left: 32%; z-index: 2; } #canvas [data-tutorial='dblclick'] { background-color: #999 !im
portant; } #canvas [data-tutorial='dblclick']:before { content: "double click to activate"; width: 80px; color: #FFF; position: absolute; top: 10%; left: 20%; z-index: 2; } #canvas .sample { width: 100px; height: 100px; min-width: 20px; min-height: 20px; position: absolute; border: 1px solid rgba(255, 255, 255, 0.3); } #canvas .sample:hover { cursor: move; } #canvas .sample[data-acti...
...position: absolute; border: 1px solid rgba(255, 255, 255, 0.3); } #canvas .sample:hover { cursor: move; } #canvas .sample[data-active='true']:after { content: ""; position: absolute; background: url('https://mdn.mozillademos.org/files/6065/arrow.png') center no-repeat; width: 100%; height: 12px; top: -12px; z-index: 2; } #canvas .sample:hover > * { cursor: pointer; display: block !im
portant; } #canvas .sample .resize-handle { display: none; } #canvas .sample .pick { width: 10px; height: 10px; margin: 5px; background: url('https://mdn.mozillademos.org/files/6079/pick.png') center no-repeat; position: absolute; top: 0; left: 0; display: none; } #canvas .sample .delete { width: 10px; height: 10px; margin: 5px; background: url('https://mdn.mozillademos.org/files/6069/...
...(); var init = function init() { UIColorPicker.init(); InputSliderManager.init(); ColorInfo.init(); ColorPalette.init(); ColorPickerSamples.init(); CanvasSamples.init(); Tool.init(); }; return { init : init }; })(); This tool makes it easy to create, adjust, and experiment with custom colors for the web. It also makes it easy to convert between various color formats sup
ported by CSS, including: HEXA colors, RGB (Red/Green/Blue) and HSL (Hue/Saturation/Lightness). Control over the alpha channel is also sup
ported on RGB (rgba) and HSL (hsla) formats. As you adjust the parameters that define the color, it gets displayed in all three standard Web CSS formats. In addition, based on the currently-selected color, a palette for HSL and HSV, as well as alpha, is generated. ...
Basic concepts of flexbox - CSS: Cascading Style Sheets
main axis will run from the top of the page to the bottom -- in the block direction. The cross axis The cross axis runs perpendicular to the main axis, therefore if your flex-direction (main axis) is set to row or row-reverse the cross axis runs down the columns. If your main axis is column or column-reverse then the cross axis runs along the rows. Understanding which axis is which is im
portant when we start to look at aligning and justifying flex items; flexbox features properties that align and justify content along one axis or the other. Start and end lines Another vital area of understanding is how flexbox makes no assumption about the writing mode of the document. In the past, CSS was heavily weighted towards horizontal and left-to-right writing modes. Modern layout methods en...
...s overview, and you can gain a fuller understanding in the guide Controlling Ratios of Flex Items on the Main Axis. Before we can make sense of these properties we need to consider the concept of available space. What we are doing when we change the value of these flex properties is to change the way that available space is distributed amongst our items. This concept of available space is also im
portant when we come to look at aligning items. If we have three 100 pixel-wide items in a container which is 500 pixels wide, then the space we need to lay out our items is 300 pixels. This leaves 200 pixels of available space. If we don't change the initial values then flexbox will put that space after the last item. If we instead would like the items to grow and fill the space, then we need to ...
...en we just declare display: flex on the parent to create flex items, the items all move into a row and take only as much space as they need to display their contents. The flex-grow property With the flex-grow property set to a positive integer, flex items can grow along the main axis from their flex-basis. This will cause the item to stretch and take up any available space on that axis, or a pro
portion of the available space if other items are allowed to grow too. If we gave all of our items in the example above a flex-grow value of 1 then the available space in the flex container would be equally shared between our items and they would stretch to fill the container on the main axis. The flex-grow property can be used to distribute space in pro
portion. If we give our first item a flex-grow...
...the item will be taken into account while working out the actual amount of shrinkage that will happen, which means that flex-shrink has the potential to appear less consistent than flex-grow in behavior. We'll therefore take a more detailed look at how this algorithm works in the article Controlling Ratios of items along the main axis. Note that these values for flex-grow and flex-shrink are pro
portions. Typically if we had all of our items set to flex: 1 1 200px and then wanted one item to grow at twice the rate, we would set that item to flex: 2 1 200px. However you could use flex: 10 1 200px and flex: 20 1 200px if you wanted. Shorthand values for the flex properties You will very rarely see the flex-grow, flex-shrink, and flex-basis properties used individually; instead they are combi...
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
that they can be used in all layout methods -- this will ultimately include flexbox. Until browsers implement the gap properties for flexbox, margins have to be used to create gaps between items. Writing Modes In the Basic concepts of flexbox article, I explained that flexbox is writing mode aware. Writing modes are fully detailed in the CSS Writing Modes specification, which details how CSS sup
ports the various different writing modes that exist internationally. We need to be aware of how this will impact our flex layouts as writing mode changes the direction that blocks are laid out in our document. Understanding block and inline directions is key to new layout methods. It is worth noting that we might want to change the writing mode of our document for reasons other than publishing conte...
..., which serve to change the direction that blocks are laid out on the page, to match the direction that blocks lay out when content is formatted in that particular writing mode. You can change the live example below to these modes in order to see what happens to the flex layout. horizontal-tb vertical-rl vertical-lr sideways-rl sideways-lr Note that sideways-rl and sideways-lr have sup
port only in Firefox currently. There are also some known issues with regard to writing-mode and flexbox. You can see more information on browser sup
port in the MDN documentation for writing-mode. However if you are planning on using writing modes in your layout, carefully testing the results is advisable -- not least because it would be easy to make things hard to read! Note that you would not norma...
...t is happening. Re-apply display: flex and the collapsing does not happen. This is because the items no longer have a float applied, as they have been transformed into flex items. Flexbox and Grid Layout CSS Grid Layout and Flexbox generally act in the same way with regards to overwriting other methods. You might however want to use flexbox as a fallback for grid layout, as there is better sup
port for flexbox in older browsers. This approach works very well. If a flex item becomes a grid item, then the flex properties that may have been assigned to the child elements will be ignored. You can use the Box Alignment properties across both layout methods, so using flexbox as a fallback for grid layout can work very well. Flex and grid -- what's the difference? A common question is to ask wh...
...orrect behavior according to the specification, see display: contents. Also, having removed the box you cannot then use it to -- for example -- add a background colour behind the nested sub children. If you remove display: contents in this live example you will see that the direct child we are removing has an orange background colour. This also disappears when the box disappears. Browser sup
port for display:contents is limited and required for this demo to work. Firefox sup
ports display: contents already, and the value is being implemented in Chrome. Once there is better browser sup
port this feature will be very useful in circumstances where you need the markup for semantic reasons but do not want to display the box that it would generate by default. ...
OpenType font features guide - CSS: Cascading Style Sheets
onts This is sometimes the trickiest thing to work out if you don't have any documentation that came with the fonts (many type designers and foundries will provide sample pages and CSS just for this very reason). But there are some sites that make it easier to figure out. You can visit wakamaifondue.com, drop your font file on the circle where instructed and in a few moments you'll have a full re
port on all the capabilities and features of your font. Axis-praxis.org also offers a similar capability, with the ability to click on the features to turn them on or off in a given text block. Why you would use them? Given that these features take a bit of work to discover and use, it may seem a fair question to ask why one would bother to use them. The answer lies in the specific features that wil...
...ded in fonts: 'Lining' figures are all the same height and on the same baseline. 'Oldstyle' figures are mixed height and designed to have the appearance of ascenders and descenders like other lower case letters. These are designed to be used inline with copy so the numerals visually blend with the surrounding glyphs in a similar fashion to small caps. There is also the notion of spacing. ...
...be used inline with copy so the numerals visually blend with the surrounding glyphs in a similar fashion to small caps. There is also the notion of spacing. Pro
portional spacing is the normal setting, whereas tabular spacing lines up numerals evenly regardless of character width, making it more appropriate for lining up tables of numbers in financial tables. There are two types of fractions sup
ported through this property: Diagonal slashed fractions. Vertically stacked fractions. Ordinals are also sup
ported (such as '1st' or '3rd'), as is a slashed zero if present in the font. Lining and Oldstyle figures Fractions, ordinals, and slashed zero East Asian (font-variant-east-asian) This allows access to various alternate forms of glyphs within a font. The example below shows a str...
...operties, with font-feature-settings as the fallback. ...
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
ll apply to the start of that dimension, the second to the end. If you only use one value it is applied to both. In a horizontal writing mode this CSS would apply a 5px margin to the top of the box and a 10px margin to the bottom. .box { margin-block: 5px 10px; } Note: The shorthand properties margin-inline and margin-block shipped in Firefox 66. As these are new properties check browser sup
port before using. Padding examples The mapped padding properties of padding-inline-start, padding-inline-end, padding-block-start, and padding-inline-end can be used instead of their physical counterparts. In the example below I have two boxes, one of which is using physical padding properties and the other logical padding properties. With a writing-mode of horizontal-tb, both boxes should appear...
...ng-block -- which allow you to set the padding of the two inline, and two block dimensions, respectively. In a horizontal writing-mode this CSS would apply 5px of padding to the top of the box and 10px of padding to the bottom: .box { padding-block: 5px 10px; } Note: The shorthand properties padding-inline and padding-block shipped in Firefox 66. As these are new properties check browser sup
port before using. Border examples The border properties are the main reason that Logical Properties and Values seems to have so many properties, as we have the longhands for the color, width, and style of the border on each side of a box, along with the shorthand to set all three at once for each side. As with margin and padding we have a mapped version of each physical property. The demo below u...
...dimension. The below code, in a horizontal writing mode, would give you a 2px green solid border on the top and bottom of the box, and a 4px dotted purple border on the left and right. .box { border-block: 2px solid green; border-inline-width: 4px; border-inline-style: dotted; border-inline-color: rebeccapurple; } Note: these two value shorthands shipped in Firefox 66, check browser sup
port before using as other browsers may not have implemented them yet. Flow relative border-radius properties The specification has fairly recently added flow-relative values for the border-radius longhands. These have not yet been implemented by any browser. The below example, in a horizontal writing-mode, would set the top-right border radius to 1em, the bottom-right to 0, the bottom-left to 20px...
... ...
Grid wrapper - CSS: Cascading Style Sheets
d minmax() function to define the grid track sizes in the grid-template-columns property. For the central columns with a maximum width we can set a minimum value of 0 or greater and a maximum value that specifies the maximum size the column tracks will grow to. Using a numeric unit (pixels, ems, rems) will create a fixed maximum size for the central wrapper, whereas using percentage values or view
port units will mean this wrapper grows or shrinks in response to its context. The outer two columns have a maximum size of 1fr, meaning that they will each expand to fill the remaining available space in the grid container. Useful fallbacks or alternative methods When using this recipe at page level it can be useful to set a max-width along with left and right auto margins to center the content ho...
...xpand to fill the remaining available space in the grid container. ...
...remaining available space in the grid container. ...
...t auto margins to center the content horizontally: .grid { max-width: 1200px; margin: 0 auto; // horizontally centers the container } /* Remove the max-width and margins if the browser sup
ports Grid */ @sup
ports (display: grid) { .grid { display: grid; /* Other grid code goes here */ max-width: none; margin: 0; } } To "break out" a full-width item to the edge of the view
port you can then use this trick (courtesy of Una Kravets): .item { width: 100vw; margin-left: 50%; transform: translate3d(-50%, 0, 0); } This gives a good approximation of the layout, only without the benefit of being able to align items easily on an exact grid. Accessibility concerns Although Grid enables us to position items anwhere (within reason), it is im
portant when placing items usin...
Sticky footers - CSS: Cascading Style Sheets
The recipe Download this example Note: In this example and the following one we are using a wrapper set to min-height: 100% in order that our live example works. ...
... The recipe Download this example Note: In this example and the following one we are using a wrapper set to min-height: 100% in order that our live example works. ...
... The recipe Download this example Note: In this example and the following one we are using a wrapper set to min-height: 100% in order that our live example works. ...
...h three rows, one row for each part of our layout. Grid auto-placement will place our items in source order and so the header goes into the first auto sized track, the main content into the 1fr track and the footer into the final auto sized track. The 1fr track will take up all available space and so grows to fill the gap. Alternate method If you need compatibility with browsers that do not sup
port Grid Layout you can also use Flexbox to create a sticky footer. The flexbox example starts out in the same way, but we use display:flex rather than display:grid on the .wrapper; we also set flex-direction to column. Then we set our main content to flex-grow: 1 and the other two elements to flex-shrink: 0 -- this prevents them from shrinking smaller when content fills the main area. ...
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
constant, such as 16:9, 4:3, 2.39:1, 1:1, and so forth), the rendered size preserves that ratio. If the image specifies a size, and the size isn't modified by constrain or cover, that specified size wins. If none of the above cases are met, the image is rendered at the same size as the background area. It's worth noting that the sizing algorithm only cares about the image's dimensions and pro
portions, or lack thereof. An SVG image with fixed dimensions will be treated just like a raster image of the same size. Source image examples Before diving in to look at the results of using different kinds of source images and seeing how they look when used with background-size, it would be helpful to look at a few example source images that have different dimensions and sizing settings. In each ...
...mples Before diving in to look at the results of using different kinds of source images and seeing how they look when used with background-size, it would be helpful to look at a few example source images that have different dimensions and sizing settings. In each case, we show what the source image looks like rendered in a 150x150 box, and provide a link to the SVG source. ...
...ng different kinds of source images and seeing how they look when used with background-size, it would be helpful to look at a few example source images that have different dimensions and sizing settings. In each case, we show what the source image looks like rendered in a 150x150 box, and provide a link to the SVG source. Dimensionless and pro
portionless This image is both dimensionless and pro
portionless. It doesn't care what size it is, nor does it care about remaining at a particular aspect ratio. This would make a good gradient desktop background that would work regardless of your screen size and its aspect ratio. SVG source One specified dimension and pro
portionless This image specifies a width of 100 pixels but no height or intrinsic ratio. This is, basically, a thin strip of wal...
...height or intrinsic ratio. This is, basically, a thin strip of wallpaper that could be stretched across the entire height of a block. SVG source One specified dimension with intrinsic ratio This image specifies a 100 pixel height but no width. It also specifies an intrinsic aspect ratio of 3:4. This ensures that its width:height ratio is always 3:4, unless it's deliberately scaled to a dispro
portionate size (that is, by explicitly specifying both width and height that aren't of that ratio). This is very much like specifying a specific width and height, since once you have one dimension and a ratio, the other dimension is implied, but it's still a useful example. SVG source No width or height with intrinsic ratio This image doesn't specify either a width or a height; instead, it spec...
Linear-gradient Generator - CSS: Cascading Style Sheets
: 1px solid #3490D2; border-color: #208B20; background: #666; background-color: #EEF1F5; color: #000; position: absolute; top: 100%; left: 0; z-index: 100; overflow: hidden; transition: all 0.3s; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-dropdown-list:hover { overflow: auto; } .ui-dropdown-list[data-hidden='true'] { height: 0 !im
portant; opacity: 0; visibility: hidden; } .ui-dropdown[data-position='left'] .ui-dropdown-list { left: -100%; top: 0; } .ui-dropdown[data-position='right'] .ui-dropdown-list { left: 100%; top: 0; } .ui-dropdown-list > div { width: 80%; height: 1.6em; margin: 0.3em 0; padding: 0.3em 10%; line-height: 1.6em; } .ui-dropdown-list > div:hover { background: #3490D2; color:#FFF; border-rad...
...I", Arial, Helvetica, sans-serif; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } body[data-dragging="true"] { } /** * Resize Handle */ .resize-handle { width: 10px; height: 10px; background: url("images/resize.png") center center no-repeat; position: absolute; bottom: 0; right: 0; } [data-resize='both']:hover { cursor: nw-resize !im
portant; } [data-resize='width']:hover { cursor: w-resize !im
portant; } [data-resize='height']:hover { cursor: n-resize !im
portant; } /** * Main Container */ #container { width: 1000px; height: 100%; display: table; margin: 0 auto; } #gradient-container { width: 450px; height: 250px; min-width: 8px; min-height: 8px; margin: 100px auto; border: 1px solid #DDD; position: relative; }...
... .property > * { float: left; } #controls .property .name { width: 90px; padding: 0px 10px 0px 0px; text-align: right; line-height: 150%; } /* Button */ #controls .button { height: 24px; padding: 0 10px; background-color: #379B4A; border-radius: 3px; font-size: 14px; color: #FFF; display: inline; float: left; } #controls .button[data-state='disabled'] { background-color: #CCC !im
portant; color: #777 !im
portant; } #controls .button[data-state='disabled']:hover { background-color: #CCC !im
portant; cursor: default !im
portant; } #controls .button:hover { cursor: pointer; background-color: #208B20; } /* Active Point */ .ui-input-slider { height: 24px; line-height: 20px; } #delete-point { margin: 0 58px 0 0; float: right !im
portant; } #controls .ui-color-picker[data...
...
portant; } #controls .ui-color-picker[data-topic="picker"] { margin: 20px 0 0 0; } #controls .ui-input-slider[data-topic="axis-rotation"] { } #controls .ui-dropdown { width: 130px; height: 24px; } #controls .ui-dropdown-select { line-height: 24px; } #controls .ui-dropdown-list { height: 66px; line-height: 2.5em; overflow: hidden; } #delete-axis { margin: 0 38px 0 0; float: right !im
portant; } /* Tool controls */ #tool-section .property .name { width: 150px; } #canvas-bg { width: 16px; height: 16px; margin: 5px; background: url("images/toggle-background.png") center right no-repeat; } #canvas-bg:hover { cursor: pointer; } #canvas-bg[data-alpha='false'] { background-position: center left; } #canvas-bg[data-alpha='true'] { background-position: center right; } /* Orde...
Visual formatting model - CSS: Cascading Style Sheets
ion applies equally to continuous and paged media. In the visual formatting model, each element in the document tree generates zero or more boxes according to the box model. The layout of these boxes is governed by: Box dimensions and type. Positioning scheme (normal flow, float, and absolute positioning). Relationships between elements in the document tree. External information (e.g., view
port size, intrinsic dimensions of images, etc.). Much of the information about the visual formatting model is defined in CSS2, however, various level 3 specifications have added to this information. When reading specifications you will often find references to the model as defined in CSS2, so an understanding of the model and the terms used to describe it in CSS2 is valuable when reading other layo...
...ation. When reading specifications you will often find references to the model as defined in CSS2, so an understanding of the model and the terms used to describe it in CSS2 is valuable when reading other layout specifications. In this document we define the model and introduce some of the related terms and concepts, linking to more specific pages on MDN for further details. ...
...you will often find references to the model as defined in CSS2, so an understanding of the model and the terms used to describe it in CSS2 is valuable when reading other layout specifications. In this document we define the model and introduce some of the related terms and concepts, linking to more specific pages on MDN for further details. The role of the view
port In continuous media, the view
port is the viewing area of the browser window. User agents can change the layout of the page when the view
port size changes -- for example, if you resize your window, or change the orientation of a mobile device. If the view
port is smaller than the size of the document then the user agent needs to offer a way to scroll to the parts of the document that are not displayed. We most often see this as sc...
...according to the normal flow, then taken out of the flow and positioned, typically to the left or right. Content may flow along the side of a float. Find out more about floats. Absolute positioning In the absolute positioning model (which also includes fixed positioning), a box is removed from the normal flow entirely and assigned a position with respect to a containing block (which is the view
port in the case of fixed positioning). An element is called out of flow if it is floated, absolutely positioned, or is the root element. An element is called in-flow if it is not out of the flow. Read about CSS Positioned Layout. Formatting contexts and the display property Boxes can be described as having an outer display type, which is block or inline. This outer display type refers to how the ...
<image> - CSS: Cascading Style Sheets
und positioning area list-style-image The size of a 1em character border-image-source The size of the element's border image area cursor The browser-defined size matching the usual cursor size on the client's system mask-image ? shape-outside ? mask-border-source ? symbols for @counter-style At risk feature. If sup
ported, the browser-defined size matching the usual cursor size on the client's system content for a pseudo-element (::after/::before) A 300px x 150px rectangle The concrete object size is calculated using the following algorithm: If the specified size defines both the width and the height, these values are used as the concrete object size. If the specified size defines only the...
... height, the concrete object size is calculated so that it matches the intrinsic aspect ratio of the image but without exceeding the default object size in any dimension. If the image has no intrinsic aspect ratio, the intrinsic aspect ratio of the object it applies to is used; if this object has none, the missing width or height are taken from the default object size. Note: Not all browsers sup
port every type of image on every property. See the browser compatibility section for details. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is im
portant primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to und...
...If language is rtl, the image will be horizontally flipped. */ cross-fade(20% url(twenty.png), url(eighty.png)) /* cross faded images, with twenty being 20% opaque and eighty being 80% opaque. */ image-set('test.jpg' 1x, 'test-2x.jpg' 2x) /* ...
...nty.png), url(eighty.png)) /* cross faded images, with twenty being 20% opaque and eighty being 80% opaque. */ image-set('test.jpg' 1x, 'test-2x.jpg' 2x) /* a selection of images with varying resolutions */ Invalid images nourl.jpg /* An image file must be defined using the url() function. */ url(re
port.pdf) /* A file pointed to by the url() function must be an image. */ element(#fakeid) /* An element ID must be an existing ID on the page. */ image(z.jpg#xy=0,0) /* The spatial fragment must be written in the format of xywh=#,#,#,# */ image-set('cat.jpg' 1x, 'dog.jpg' 1x) /* every image in an image set must have a different resolutions */ Specifications Specification Stat...
list-style-type - CSS: Cascading Style Sheets
added by initial zeros E.g. 01, 02, 03, ... 98, 99 lower-roman Lowercase roman numerals E.g. i, ii, iii, iv, v... upper-roman Uppercase roman numerals E.g. I, II, III, IV, V... lower-greek Lowercase classical Greek alpha, beta, gamma... E.g. ?, ?, ?... lower-alpha lower-latin Lowercase ASCII letters E.g. a, b, c, ... z lower-latin is unsup
ported in IE7 and earlier See Browser compatibility section. upper-alpha upper-latin Uppercase ASCII letters E.g. A, B, C, ... Z upper-latin is unsup
ported in IE7 and earlier arabic-indic -moz-arabic-indic Example armenian Traditional Armenian numbering (ayb/ayp, ben/pen, gim/keem... bengali -moz-bengali Example cambodian * Example I...
... E.g. ????????? upper-armenian * Example disclosure-open Symbol indicating that a disclosure widget such as <details> is opened. disclosure-closed Symbol indicating that a disclosure widget, like <details> is closed. Non-standard extensions A few more predefined types are provided by Mozilla (Firefox), Blink (Chrome and Opera) and WebKit (Safari) to sup
port list types in other languages. See the compatibility table to check which browsers sup
ports which extension. -moz-ethiopic-halehame Example -moz-ethiopic-halehame-am Example ethiopic-halehame-ti-er -moz-ethiopic-halehame-ti-er Example ethiopic-halehame-ti-et -moz-ethiopic-halehame-ti-et Example hangul -moz-hangul Example Example Example ...
... </ol> CSS ol.normal { list-style-type: upper-alpha; } /* or use the shortcut "list-style": */ ol.shortcut { list-style: upper-alpha; } Result Specifications Specification Status Comment CSS Counter Styles Level 3The definition of 'list-style-type' in that specification. Candidate Recommendation Redefines CSS2.1 counters. Extends the syntax to sup
port @counter-style rules. Defines using @counter-style the usual style types: hebrew, cjk-ideographic, hiragana, hiragana-iroha, katakana, katakana-iroha, japanese-formal, japanese-informal, simp-chinese-formal, trad-chinese-formal, simp-chinese-formal, trad-chinese-formal,korean-hangul-formal, korean-hanja-informal, korean-hanja-formal, cjk-decimal, ethiopic-numeric, disclosure-open and disclosu...
..., trad-chinese-formal, simp-chinese-formal, trad-chinese-formal,korean-hangul-formal, korean-hanja-informal, korean-hanja-formal, cjk-decimal, ethiopic-numeric, disclosure-open and disclosure-closed. Extends <counter-style> with the symbols() functional notation. CSS Lists Module Level 3The definition of 'list-style-type' in that specification. Working Draft Modify syntax to sup
port for identifiers used in @counter-style rules to keywords. Sup
port for a simple <string>. CSS Level 2 (Revision 1)The definition of 'list-style-type' in that specification. Recommendation Initial definition ...
scroll-padding-block-start - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... /* Keyword values */ scroll-padding-block-start: auto; /* <length> values */ scroll-padding-block-start: 10px; scroll-padding-block-start: 1em; scroll-padding-block-start: 10%; /* Global values */ scroll-padding-block-start: inherit; scroll-padding-block-start: initial; scroll-padding-block-start: unset; Values <length-percentage> An inwards offset from the block start edge of the scroll
port, as a valid length or a percentage. auto The offset is determind by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scroll
portComputed valueas specifiedAnimation typeby computed val...
scroll-padding-inline-end - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... Syntax /* Keyword values */ scroll-padding-inline-end: auto; /* <length> values */ scroll-padding-inline-end: 10px; scroll-padding-inline-end: 1em; scroll-padding-inline-end: 10%; /* Global values */ scroll-padding-inline-end: inherit; scroll-padding-inline-end: initial; scroll-padding-inline-end: unset; Values <length-percentage> An inwards offset from the inline end edge of the scroll
port, as a valid length or a percentage. auto The offset is determind by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scroll
portComputed valueas specifiedAnimation typeby computed valu...
scroll-padding-inline-start - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...word values */ scroll-padding-inline-start: auto; /* <length> values */ scroll-padding-inline-start: 10px; scroll-padding-inline-start: 1em; scroll-padding-inline-start: 10%; /* Global values */ scroll-padding-inline-start: inherit; scroll-padding-inline-start: initial; scroll-padding-inline-start: unset; Values <length-percentage> An inwards offset from the inline start edge of the scroll
port, as a valid length or a percentage. auto The offset is determind by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scroll
portComputed valueas specifiedAnimation typeby computed val...
Writing Web Audio API code that works in every browser - Developer guides
de it in your page, you can write in "modern Web Audio API" style, and do things such as: var audioContext = new AudioContext(); everywhere, including Chrome/ium, Opera, Safari, and ---of course!--- Firefox. Also, if new methods such as start are not detected in some nodes, the library will also alias them to their old names. Thus, start is mapped to noteOn, stop to noteOff, and so on. If you're
porting moderately "old" code (say, a year old) it's possible that it uses some methods that AudioContext-MonkeyPatch doesn't alias, because it helps you to write code in the new style. For example, the way to create instances of GainNode used to be var gain = audioContext.createGainNode(); but nowadays it is just var gain = audioContext.createGain(); Since the old method names are not present in Fi...
... but nowadays it is just var gain = audioContext.createGain(); Since the old method names are not present in Firefox, existing code may crash with something like createGainNode is not a function, and you now know why. There's a section in the spec that lists the old names and their updated equivalences; be sure to check it out and change your code accordingly. ...
...our code accordingly. You can also check this article on
porting which covers more cases and has many code samples. Things that are not ready yet Second, ensure that your project doesn't use node types that are not implemented yet in Firefox: MediaStreamAudioSourceNode, MediaElementAudioSourceNode and OscillatorNode. If it's using, for example, OscillatorNode, you will have to wait until it is sup
ported, or maybe, if you're really eager, hack in some replacement using ScriptProcessorNode, which allows you to write a node with callbacks that get called periodically, so that your JavaScript code generates or processes audio. The node parameters you use must also be sup
ported in Firefox too. If they aren't, you might be able to change them into something "acceptable" for the time being, and count...
...allbacks that get called periodically, so that your JavaScript code generates or processes audio. The node parameters you use must also be sup
ported in Firefox too. If they aren't, you might be able to change them into something "acceptable" for the time being, and count on the talented audio developers to implement those very soon. For example, up until a couple of days ago PannerNode did not sup
port the default HRTF panning model yet, and attempting to use a PannerNode with that configuration simply resulted in silence or a mono output coming out from that node, depending on the build you used. Today the sup
port is already present in Nightly, but not quite yet in Aurora. In the meantime, you can explicitly specify 'equalpower' instead: var panner = new audioContext.PannerNode(); panner.panni...
Event developer guide - Developer guides
ides several ways to get notified of DOM events. Two common styles are: the generalized addEventListener() and a set of specific on-event handlers.Media eventsVarious events are sent when handling media that are embedded in HTML documents using the <audio> and <video> elements; this section lists them and provides some helpful information about using them.Mouse gesture eventsGecko 1.9.1 added sup
port for several Mozilla-specific DOM events used to handle mouse gestures. These are special movements that can be made with a mouse or trackpad and can be interpreted to perform specific tasks.Mutation eventsMutation events provide a mechanism for a web page or an extension to get notified about changes made to the DOM. Use Mutation Observers instead if possible. Orientation and motion data expl...
...e mouse gestures. These are special movements that can be made with a mouse or trackpad and can be interpreted to perform specific tasks.Mutation eventsMutation events provide a mechanism for a web page or an extension to get notified about changes made to the DOM. Use Mutation Observers instead if possible. Orientation and motion data explainedWhen using orientation and motion events, it's im
portant to understand what the values you're given by the browser mean. This article provides details about the coordinate systems at play and how you use them.Overview of Events and HandlersEvents and event handling provide a core technique in JavaScript for reacting to incidents occurring when a browser accesses a web page, including events from preparing a web page for display, from interacting wit...
... ...
... ...
Separate sites for mobile and desktop - Developer guides
m.example.com. In a nutshell, this technique uses server-side logic to solve all three goals of mobile web development at once -- if the user's browser looks like it's on a phone, you serve them mobile content, formatted for their phone and optimized for speed. Conceptually simple, this is the easiest option to add to an existing site, especially if you are using a CMS or Web application that sup
ports templates. Since only the mobile-specific content, styles, and scripts are sent to mobile users, this method also provides for the best performance out of any of the other options presented here. Finally, it also allows for completely different user experiences on desktop and mobile -- they're two different sites, after all! The bad Unfortunately, this approach is not without its drawbacks. For ...
...s. If you are using a CMS, it is possible to arrange your site templates in a way that minimizes this duplication. However any time that there is a difference between the mobile and desktop templates, there is a potential source of complication in your code. Similarly, this increases the implementation time of any new site features, since you must now code two sets of front-end logic. Even more im
portant than that, though, is the fact that user-agent detection is inherently flawed, and anything but future-proof. Every time a new browser comes out, you must adjust your algorithm to accommodate it. And false positives are particularly scary -- it could be embarrassing to serve desktop users your mobile site accidentally. When it is right to choose this option Firstly, if your target audience inc...
...positives are particularly scary -- it could be embarrassing to serve desktop users your mobile site accidentally. When it is right to choose this option Firstly, if your target audience includes users on older or low-end feature phones, it is worth noting that you may need to employ this strategy to some degree no matter what. This is because the default browsers on some feature-phones do not sup
port the same markup that you would use to code a website targeted at the desktop, but instead understand formats like XHTML-MP or the older WML. This factor aside, there is one case where this strategy really shines over other methods. If the functionality you would like to provide to your users on mobile devices is extremely different from that on a desktop, then using separate sites is simply likel...
... you cannot, for whatever reason, modify your existing desktop site, and need to have a 100% separate mobile site. Though it's not ideal, at least you have this option. Examples Most of the major Web applications you see in the wild have chosen this path, including Facebook, YouTube, Digg, and Flickr. In fact, Mozilla picked this strategy for the mobile versions of addons.mozilla.org (AMO) and sup
port.mozilla.org (SUMO). If you'd like to see the source code behind an example of this approach in action, feel free to check out the github repository for AMO or SUMO. Approaches to mobile Web development See the following articles for background and other approaches to developing for mobile platforms. What is mobile-friendliness? Responsive design A hybrid approach Original document info...
Writing forward-compatible websites - Developer guides
It's not always possible to follow all of these, but following as many of them as possible will help future-proof your website. ...
...e guidelines. Sniffing Sniff for specific features If you plan to use some feature, use object-detection to sniff for that exact feature, if possible. As a simple example, don't assume that any browser in which "filter" in body.style tests true must be Microsoft Internet Explorer and therefore e.g. will have a window.event object available in event handlers. Don't assume that browsers with sup
port for a given DOM feature must also have some other, especially nonstandard, DOM feature. Or, conversely, that they don't have sup
port for some other feature (e.g., don't assume that a browser that sup
ports onload on script elements will never sup
port onreadystatechange on them). As browsers converge behavior, they both add features and remove them. They also fix bugs. All three of these have happ...
... available. A good example, for a browser vendor using the -vnd CSS prefix that has shipped an unprefixed implementation of the make-it-pretty property, with a behavior for the value "sometimes" that differs from the prefixed version: <style> .pretty-element { -vnd-make-it-pretty: sometimes; make-it-pretty: sometimes; } </style> The order of the declarations in the rule above is im
portant: the unprefixed one needs to come last. Don't use unprefixed versions of CSS properties or APIs until at least one browser sup
ports them Until there's decently widespread sup
port of the unprefixed version of something, its behavior can still change in unexpected ways. Most especially, don't use the unprefixed version if no browser actually sup
ports it. You can't assume that the syntax of th...
... to ensure this, but even if your website doesn't validate entirely you should make sure all your > characters are present. Missing those can lead to unexpected situations due to a following tag name being treated as an attribute on a previous tag. This can work for a bit, then break if a specification attaches a meaning to that attribute. Here's an example that works in browsers without HTML5 sup
port but breaks in a browser sup
porting HTML5: <form action="http://www.example.com"> <input type="submit" value="Submit the form" </form> due to the missing > on the input tag. Don't leave experiments that didn't work in your code If you try using a CSS property to do something you want, but it has no effect, remove it. It might start doing something you don't expect in the future ...
DASH Adaptive Streaming for HTML 5 Video - HTML: Hypertext Markup Language
Dynamic Adaptive Streaming over HTTP (DASH) is an adaptive streaming protocol. This means that it allows for a video stream to switch between bit rates on the basis of network performance, in order to keep a video playing. Browser Sup
port Firefox 21 includes an implementation of DASH for HTML5 WebM video which is turned off by default. It can be enabled via "about:config" and the "media.dash.enabled" preference. Firefox 23 removed sup
port for DASH for HTML5 WebM video. It will be replaced by an implementation of the Media Source Extensions API which will allow sup
port for DASH via Javascript libraries such as dash.js. See bug 778617 for details. Using DASH - Server Side First you'll need to convert your WebM video to a DASH manifest with the accompanying video files in various bi...
... 1. Use your existing WebM file to create one audio file and multiple video files. ...
...re given; you should have one for each file. The -adaptation_sets argument assigns them into adaptation sets; for example, this creates one set (0) that contains the streams 0, 1, 2 and 3 (the videos), and another set (1) that contains only stream 4, the audio stream. Put the manifest and the associated video files on your web server or CDN. DASH works via HTTP, so as long as your HTTP server sup
ports byte range requests, and it's set up to serve .mpd files with mimetype="application/dash+xml", then you're all set. Using DASH - Client Side You'll want to modify your web page to point to the DASH manifest first, instead of directly to a particular video file: <video> <source src="movie.mpd"> <source src="movie.webm"> Your browser does not sup
port the video tag. </video> That's it! If...
... requests, and it's set up to serve .mpd files with mimetype="application/dash+xml", then you're all set. Using DASH - Client Side You'll want to modify your web page to point to the DASH manifest first, instead of directly to a particular video file: <video> <source src="movie.mpd"> <source src="movie.webm"> Your browser does not sup
port the video tag. </video> That's it! If DASH is sup
ported by the browser, your video will now stream adaptively. Links WebM DASH Specification at The WebM Project DASH Industry Forum WebM project description of how to create DASH files with FFMPEG ...
<a>: The Anchor element - HTML: Hypertext Markup Language
otes: download only works for same-origin URLs, or the blob: and data: schemes. If Content-Disposition has a different filename than download, the header takes priority. (If Content-Disposition: inline, Firefox prefers the header while Chrome prefers download.) href The URL that the hyperlink points to. Links are not restricted to HTTP-based URLs -- they can use any URL scheme sup
ported by browsers: Sections of a page with fragment URLs Pieces of media files with media fragments Telephone numbers with tel: URLs Email addresses with mailto: URLs While web browsers may not sup
port other URL schemes, web sites can with registerProtocolHandler() hreflang Hints at the human language of the linked URL. No built-in functionality. Allowed values are the same as the ...
...navigating with the aid of screen reading technology, or with cognitive concerns may be confused when a new tab, window, or application opens unexpectedly. Older screen-reading software may not even announce the behavior. ...
...screen reading technology, or with cognitive concerns may be confused when a new tab, window, or application opens unexpectedly. Older screen-reading software may not even announce the behavior. ...
...lank" href="https://www.wikipedia.org"> Wikipedia (opens in new tab) </a> Link to a non-HTML resource <a href="2017-annual-re
port.ppt"> 2017 Annual Re
port (PowerPoint) </a> If an icon is used to signify link behavior, make sure it has alt text: <a target="_blank" href="https://www.wikipedia.org"> Wikipedia <img alt="(opens in new tab)" src="newtab.svg"> </a> <a href="2017-annual-re
port.ppt"> 2017 Annual Re
port <img alt="(PowerPoint file)" src="ppt-icon.svg"> </a> WebAIM: Links and Hypertext - Hypertext Links MDN / Understanding WCAG, Guideline 3.2 G200: Opening new windows and tabs from a link only when necessary G201: Giving users advanced warning when opening a new window Skip links A skip link is a link placed as early as possible in <body> content that points t...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
Permitted ARIA roles No role permitted DOM interface HTMLDetailsElement Attributes This element includes the global attributes. open This Boolean attribute indicates whether or not the details -- that is, the contents of the <details> element -- are currently visible. The default, false, means the details are not visible. Events In addition to the usual events sup
ported by HTML elements, the <details> element sup
ports the toggle event, which is dispatched to the <details> element whenever its state changes between open and closed. It is sent after the state is changed, although if the state changes multiple times before the browser can dispatch the event, the events are coalesced so that only one is sent. You can use an event listener for the toggle event to ...
...ls> <summary>System Requirements</summary> <p>Requires a computer running an operating system. The computer must have some memory and ideally some kind of long-term storage. ...
...p>Requires a computer running an operating system. The computer must have some memory and ideally some kind of long-term storage. An input device as well as some form of output device is recommended.</p> </details> Result Customizing the disclosure widget The disclosure triangle itself can be customized, although this is not as broadly sup
ported. There are variations in how browsers sup
port this customization due to experimental implementations as the element was standardized, so we'll have to use multiple approaches for a while. The <summary> element sup
ports the list-style shorthand property and its longhand properties, such as list-style-type, to change the disclosure triangle to whatever you choose (usually with list-style-image). For example, we can remove the disclosure widge...
... as the element was standardized, so we'll have to use multiple approaches for a while. The <summary> element sup
ports the list-style shorthand property and its longhand properties, such as list-style-type, to change the disclosure triangle to whatever you choose (usually with list-style-image). For example, we can remove the disclosure widget icon by setting list-style: none. Chrome doesn't sup
port this yet, however, so we also need to use its non-standard ::-webkit-details-marker pseudo-element to customize the appearance in that browser. CSS details { font: 16px "Open Sans", Calibri, sans-serif; width: 620px; } details > summary { padding: 2px 6px; width: 15em; background-color: #ddd; border: none; box-shadow: 3px 3px 4px black; cursor: pointer; list-style: none; } d...
<element>: The Custom Element element (Obsolete) - HTML: Hypertext Markup Language
ibute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...owser-compat-data and send us a pull request. ...
... ? Edge ? Firefox No sup
port NoIE No sup
port NoOpera ? Safari ? WebView Android ? Chrome Android ? Firefox Android No sup
port NoOpera Android ? Safari iOS ? Samsung Internet Android ? ...
...afari ? WebView Android ? Chrome Android ? Firefox Android No sup
port NoOpera Android ? Safari iOS ? Samsung Internet Android ? Legend No sup
port No sup
port Compatibility unknown Compatibility unknownNon-standard. Expect poor cross-browser sup
port.Non-standard. Expect poor cross-browser sup
port.Deprecated. Not for use in new websites.Deprecated. Not for use in new websites. See also Web components: <content>, <shadow>, <slot>, and <t...
<input type="hidden"> - HTML: Hypertext Markup Language
and there is no way to make it visible in the page's content. Note: There is a live example below the following line of code -- if it is working correctly, you should see nothing! <input id="prodId" name="prodId" type="hidden" value="xm234jq"> Value A DOMString representing the value of the hidden data you want to pass back to the server. Events None. Sup
ported Common Attributes autocomplete IDL attributes value Methods None. Note: The input and change events do not apply to this input type. Hidden inputs cannot be focused even using JavaScript (e.g. hiddenInput.focus()). Value The <input> element's value attribute holds a DOMString that contains the hidden data you want to include when the form is submitted to th...
...his input type. Hidden inputs cannot be focused even using JavaScript (e.g. hiddenInput.focus()). Value The <input> element's value attribute holds a DOMString that contains the hidden data you want to include when the form is submitted to the server. This specifically can't be edited or seen by the user via the user interface, although you could edit the value via browser developer tools. Im
portant: While the value isn't displayed to the user in the page's content, it is visible--and can be edited--using any browser's developer tools or "View Source" functionality. Do not rely on hidden inputs as a form of security. Additional attributes In addition to the attributes common to all <input> elements, hidden inputs offer the following attributes: Attribute Description ...
...ontent, it is visible--and can be edited--using any browser's developer tools or "View Source" functionality. Do not rely on hidden inputs as a form of security. Additional attributes In addition to the attributes common to all <input> elements, hidden inputs offer the following attributes: Attribute Description name Like all input types, the name of the input to re
port when submitting the form; the special value _charset_ causes the hidden input's value to be re
ported as the character encoding used to submit the form name This is actually one of the common attributes, but it has a special meaning available for hidden inputs. Normally, the name attribute functions on hidden inputs just like on any other input. However, when the form is submitted, a hidde...
... Using hidden inputs As mentioned above, hidden inputs can be used anywhere that you want to include data the user can't see or edit along with the form when it's submitted to the server. Let's look at some examples that illustrate its use. ...
<input type="image"> - HTML: Hypertext Markup Language
submit buttons that take the form of an image rather than text. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Value None -- the value attribute should not be specified. Events None. Sup
ported common attributes alt, src, width, height, formaction, formenctype, formmethod, formnovalidate, formtarget IDL attributes None. Methods None. Value <input type="image"> elements do not accept value attributes. The path to the image to be displayed is specified in the src attribute. Additional attributes In addition to the attributes shared by all <input> ele...
...rc, width, height, formaction, formenctype, formmethod, formnovalidate, formtarget IDL attributes None. Methods None. Value <input type="image"> elements do not accept value attributes. The path to the image to be displayed is specified in the src attribute. ...
...t be shown (due to error, a user agent that cannot or is configured not to show images, or if the user is using a screen reading device). If provided, it must be a non-empty string appropriate as a label for the button. For example, if you have a graphical button that shows an image with an icon and/or image text "Login Now", you should also set the alt attribute to something like Login Now. Im
portant: While the alt attribute is technically optional, you should always include one to maximize the usability of your content. Functionally, the <input type="image"> alt attribute works just like the alt attribute on <img> elements. formaction A string indicating the URL to which to submit the data. This takes precedence over the action attribute on the <form> element that owns the <input>. T...
...pe or the form's enctype attribute. This URL is then sent to the server using an HTTP get request. This method works well for simple forms that contain only ASCII characters and have no side effects. This is the default value. post The form's data is included in the body of the request that is sent to the URL given by the formaction or action attribute using an HTTP post request. This method sup
ports complex data and file attachments. dialog This method is used to indicate that the button simply closes the dialog with which the input is associated, and does not transmit the form data at all. This attribute is also available on <input type="submit"> and <button> elements. formnovalidate A Boolean attribute which, if present, specifies that the form should not be validated before submiss...
<mark>: The Mark Text element - HTML: Hypertext Markup Language
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. ...
... Attributes This element only includes the global attributes. Usage notes Typical use cases for <mark> include: When used in a quotation (<q>) or block quote (<blockquote>), it generally indicates text which is of special interest but is not marked in the original source material, or material which needs special scrutiny even though the original author didn't think it was of particular im
portance. Think of this like using a highlighter pen in a book to mark passages that you find of interest. Otherwise, <mark> indicates a
portion of the document's content which is likely to be relevant to the user's current activity. This might be used, for example, to indicate the words that matched a search operation. Don't use <mark> for syntax highlighting purposes; instead, use the <span> eleme...
...o the user's current activity. This might be used, for example, to indicate the words that matched a search operation. Don't use <mark> for syntax highlighting purposes; instead, use the <span> element with appropriate CSS applied to it. Don't confuse <mark> with the <strong> element; <mark> is used to denote content which has a degree of relevance, while <strong> indicates spans of text of im
portance. Examples Marking text of interest In this first example, a <mark> element is used to mark some text within a quote which is of particular interest to the user. <blockquote> It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire. During the battle, <mark>Rebel spies managed to steal secret plans</m...
...k::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } mark::before { content: " [highlight start] "; } mark::after { content: " [highlight end] "; } Some people who use screen readers deliberately disable announcing content that creates extra verbosity. Because of this, it is im
portant to not abuse this technique and only apply it in situations where not knowing content has been highlighted would adversely affect understanding. Short note on making your mark (more accessible) | The Paciello Group Tweaking Text Level Styles | Adrian Roselli Specifications Specification Status Comment HTML Living StandardThe definition of '<mark>' in that spe...
<noframes>: The Frame Fallback element - HTML: Hypertext Markup Language
The obsolete HTML No Frames or frame fallback element, <noframes>, provides content to be presented in browsers that don't sup
port (or have disabled sup
port for) the <frame> element. Although most commonly-used browsers sup
port frames, there are exceptions, including certain special-use browsers including some mobile browsers, as well as text-mode browsers. A <noframes> element can contain any HTML elements that are allowed within the body of an HTML document, with the exception of the <frameset> and <frame> elements, since using frames when they aren't sup
ported doesn't make sense. ...
...l-use browsers including some mobile browsers, as well as text-mode browsers. A <noframes> element can contain any HTML elements that are allowed within the body of an HTML document, with the exception of the <frameset> and <frame> elements, since using frames when they aren't sup
ported doesn't make sense. <noframes> can be used to present a message explaining that the user's browser doesn't sup
port frames, but ideally should be used to present an alternate form of the site that doesn't use frames but still offers the same or similar functionality. In HTML 5 and later, <noframes> is obsolete and shouldn't be used, since the <frame> and <frameset> elements are also obsolete. When frames are needed at all, they should be presented using the <iframe> element. Attributes Like all other HTML...
... be used to present an alternate form of the site that doesn't use frames but still offers the same or similar functionality. In HTML 5 and later, <noframes> is obsolete and shouldn't be used, since the <frame> and <frameset> elements are also obsolete. When frames are needed at all, they should be presented using the <iframe> element. Attributes Like all other HTML elements, this element sup
ports the global attributes. It has no other attributes available. Example In this example, we see a frameset with two frames. In addition, <noframes> is used to present an explanatory message if the user agent doesn't sup
port frames. <frameset cols="50%,50%"> <frame src="https://developer.mozilla.org/en/HTML/Element/frameset" /> <frame src="https://developer.mozilla.org/en/HTML/Element/frame" ...
...available. Example In this example, we see a frameset with two frames. In addition, <noframes> is used to present an explanatory message if the user agent doesn't sup
port frames. <frameset cols="50%,50%"> <frame src="https://developer.mozilla.org/en/HTML/Element/frameset" /> <frame src="https://developer.mozilla.org/en/HTML/Element/frame" /> <noframes><p>It seems your browser does not sup
port frames or is configured to not allow them.</p></noframes> </frameset> Specifications Specification Status Comment HTML5The definition of 'noframes' in that specification. Recommendation HTML 4.01 SpecificationThe definition of '<noframes>' in that specification. Recommendation ...
<picture>: The Picture element - HTML: Hypertext Markup Language
The selected image is then presented in the space occupied by the <img> element. ...
... It provides a fallback in case none of the offered <source> elements are able to provide a usable image. Common use cases for <picture>: Art direction. Cropping or modifying images for different media conditions (for example, loading a simpler version of an image which has too many details, on smaller displays). Offering alternative image formats, for cases where certain formats are not sup
ported. Saving bandwidth and speeding page load times by loading the most appropriate image for the viewer's display. If providing higher-density versions of an image for high-DPI (Retina) display, use srcset on the <img> element instead. This lets browsers opt for lower-density versions in data-saving modes, and you don't have to write explicit media conditions. Content categories Flo...
...PI (Retina) display, use srcset on the <img> element instead. This lets browsers opt for lower-density versions in data-saving modes, and you don't have to write explicit media conditions. Content categories Flow content, phrasing content, embedded content Permitted content Zero or more <source> elements, followed by one <img> element, optionally intermixed with script-sup
porting elements. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that allows embedded content. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLPictureElement Attributes This element includes only global attributes. Usage notes You can...
... x (such as 2x) to serve a high-res image for high-DPI screens. <picture> <source srcset="logo-768.png 768w, logo-768-1.5x.png 1.5x"> <source srcset="logo-480.png, logo-480-2x.png 2x"> <img src="logo-320.png" alt="logo"> </picture> The type attribute The type attribute specifies a MIME type for the resource URL(s) in the <source> element's srcset attribute. If the user agent does not sup
port the given type, the <source> element is skipped. <picture> <source srcset="logo.webp" type="image/webp"> <img src="logo.png" alt="logo"> </picture> Specifications Specification Status Comment HTML Living StandardThe definition of '<picture>' in that specification. Living Standard Initial definition ...
<template>: The Content Template element - HTML: Hypertext Markup Language
Script. Think of a template as a content fragment that is being stored for subsequent use in the document. While the parser does process the contents of the <template> element while loading the page, it does so only to ensure that those contents are valid; the element's contents are not rendered, however. Content categories Metadata content, flow content, phrasing content, script-sup
porting element Permitted content No restrictions Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts metadata content, phrasing content, or script-sup
porting elements. Also allowed as a child of a <colgroup> element that does not have a span attribute. Implicit ARIA role No corresponding role ...
... Attributes This element only includes the global attributes. However, the HTMLTemplateElement has a content property, which is a read-only DocumentFragment containing the DOM subtree which the template represents. Note that directly using the value of the content could lead to unexpected behavior, see Avoiding DocumentFragment pitfall section below. Examples First we start with the HTML
portion of the example. <table id="producttable"> <thead> <tr> <td>UPC_Code</td> <td>Product_Name</td> </tr> </thead> <tbody> <!-- existing data could optionally be included here --> </tbody> </table> <template id="productrow"> <tr> <td class="record"></td> <td></td> </tr> </template> First, we have a table into which we will later insert content using J...
..., we have a table into which we will later insert content using JavaScript code. Then comes the template, which describes the structure of an HTML fragment representing a single table row. Now that the table has been created and the template defined, we use JavaScript to insert rows into the table, with each row being constructed using the template as its basis. // Test to see if the browser sup
ports the HTML template element by checking // for the presence of the template element's content attribute. if ('content' in document.createElement('template')) { // Instantiate the table with the existing HTML tbody // and the row with the template var tbody = document.querySelector("tbody"); var template = document.querySelector('#productrow'); // Clone the new row and insert ...
...} The result is the original HTML table, with two new rows appended to it via JavaScript: table { background: #000; } table td { background: #fff; } Avoiding DocumentFragment pitfall A DocumentFragment is not a valid target for various events, as such it is often preferable to clone or refer to the elements within it. Consider the following HTML and JavaScript: HTML <div id="co...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes Unimplemented (see bug 2212). If this attribute is not set, the left value is assumed. Note: Do not use this attribute as it is obsolete (not sup
ported) in the latest standard. To achieve the same effect as the left, center, right or justify values, use the CSS text-align property on it. To achieve the same effect as the char value, in CSS3, you can use the value of the char as the value of the text-align property Unimplemented. bgcolor This attribute defines the background color of each cell of the column. It is one of the...
...nd-color, on the relevant <td> or <th> elements. char Deprecated since HTML4Obsolete since HTML5 This attribute is used to set the character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values. If align is not set to char, this attribute is ignored. Note: Do not use this attribute as it is obsolete (and not sup
ported) in the latest standard. To achieve the same effect as the char, in CSS3, you can use the character set using the char attribute as the value of the text-align property Unimplemented. charoff Deprecated since HTML4Obsolete since HTML5 This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. Note:...
... the char, in CSS3, you can use the character set using the char attribute as the value of the text-align property Unimplemented. charoff Deprecated since HTML4Obsolete since HTML5 This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. Note: Do not use this attribute as it is obsolete (and not sup
ported) in the latest standard. valign Deprecated since HTML4Obsolete since HTML5 This attribute specifies the vertical alignment of the text within each row of cells of the table header. Possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them.
...racters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. Note: Do not use this attribute as it is obsolete (and not sup
ported) in the latest standard: instead set the CSS vertical-align property on it. Examples Please see the <table> page for examples on <tfoot>. Specifications Specification Status Comment HTML Living StandardThe definition of 'tfoot element' in that specification. Living Standard HTML5The definition of 'tfoot element' in that specification. Recomm...
<thead>: The Table Head element - HTML: Hypertext Markup Language
to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes Unimplemented (see bug 2212). If this attribute is not set, the left value is assumed. Note: Do not use this attribute as it is obsolete (not sup
ported) in the latest standard. To achieve the same effect as the left, center, right or justify values, use the CSS text-align property on it. To achieve the same effect as the char value, in CSS3, you can use the value of the char as the value of the text-align property Unimplemented. bgcolor This attribute defines the background color of each cell of the column. It is one of the...
...S property background-color, on the relevant <td> or <th> elements. char in HTML 4, in HTML5 This attribute is used to set the character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values. If align is not set to char, this attribute is ignored. Note: Do not use this attribute as it is obsolete (and not sup
ported) in the latest standard. To achieve the same effect as the char, in CSS3, you can use the character set using the char attribute as the value of the text-align property Unimplemented. charoff in HTML 4, in HTML5 This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. Note: Do not use this at...
... the same effect as the char, in CSS3, you can use the character set using the char attribute as the value of the text-align property Unimplemented. charoff in HTML 4, in HTML5 This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. Note: Do not use this attribute as it is obsolete (and not sup
ported) in the latest standard. valign in HTML 4, in HTML5 This attribute specifies the vertical alignment of the text within each row of cells of the table header. Possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. If characters are ...
... characters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; top, which will put the text as close to the top of the cell as it is possible. Note: Do not use this attribute as it is obsolete (and not sup
ported) in the latest standard: instead set the CSS vertical-align property on it. Examples See <table> for examples on <thead>. Specifications Specification Status Comment HTML Living StandardThe definition of 'thead element' in that specification. Living Standard HTML5The definition of 'thead element' in that specification. Recommendation ...
<tr>: The Table Row element - HTML: Hypertext Markup Language
hed using a mix of <td> (data cell) and <th> (header cell) elements. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. To provide additional control over how cells fit into (or span across) columns, both <th> and <td> sup
port the colspan attribute, which lets you specify how many columns wide the cell should be, with the default being 1. Similarly, you can use the rowspan attribute on cells to indicate they should span more than one table row. This can take a little practice to get right when building your tables. We have some examples below, but for more examples and an in-depth tutorial, see the HTML tables series ...
...Align each cell in the row on a specific character (such that each row in the column that is configured this way will horizontally align its cells on that character). This uses the char and charoff to establish the alignment character (typically "." or "," when aligning numerical data) and the number of characters that should follow the alignment character. This alignment type was never widely sup
ported. If no value is expressly set for align, the parent node's value is inherited. Instead of using the obsolete align attribute, you should instead use the CSS text-align property to establish left, center, right, or justify alignment for the row's cells. To apply character-based alignment, set the CSS text-align property to the alignment character (such as "." or ","). bgcolorObso...
...alues for currencies that use hundredths of a unit (such as the dollar, which is divided into 100 cents), you would typically specify a value of 2, so that in tandem with char being set to ".", the values in a column would be cleanly aligned on the decimal points, with the number of cents properly displayed to the right of the decimal point. This attribute is obsolete, and was never widely sup
ported anyway. valignObsolete since HTML5 A DOMString specifying the vertical alignment of the text within each cell in the row. Possible values for this attribute are: baseline Aligns each cell's content text as closely as possible to the bottom of the cell, handling alignment of different fonts and font sizes by aligning the characters along the baseline of the font(s) used in the ...
...fy the balances Finally, since it's standard practice to right-justify currency values in tables, let's do that here. tbody > tr > td:last-of-type { text-align:right; } This just sets the CSS text-align property for the last <td> in each body row to "right". Technical summary Content categories None Permitted content Zero or more <td> and/or <th> elements; script-sup
porting elements (<script> and <template>) are also allowed Tag omission Start tag is mandatory. End tag may be omitted if the <tr> element is immediately followed by a <tr> element, or if the row is the last element in its parent table group (<thead>, <tbody> or <tfoot>) element Permitted parents <table> (only if the table has no child <tbody> element, and even then only after...
Microformats - HTML: Hypertext Markup Language
Summary Microformats (sometimes abbreviated uF) are standards used to embed semantics & structured data in HTML, and provide an API to be used by search engines, aggregators, and other tools. These minimal patterns of HTML are used for marking up entities that range from fundamental to domain-specific information, such as people, organizations, events, and locations. Microformats use sup
porting vocabularies to describe objects and name-value pairs to assign values to their properties. The properties are carried in class attributes that can be added to any HTML element, while the data values re-use HTML element content and semantic attributes. Microformats2 is an update to microformats that provides a simpler way of annotating HTML structured syntax & vocabularies than previous approac...
...s. The properties are carried in class attributes that can be added to any HTML element, while the data values re-use HTML element content and semantic attributes. Microformats2 is an update to microformats that provides a simpler way of annotating HTML structured syntax & vocabularies than previous approaches of using RDFa and microdata which require learning new attributes. Microformats are sup
ported by all major search engines. Search engines benefit greatly from direct access to this structured data because it allows them to understand the information on web pages and provide more relevant results to users. In addition to being machine-readable, their format is designed to be easily read by humans. To create a microformats object, h-* class names are used in the class attribute. To ad...
..."dt-start" datetime="2019-06-29T09:00:00-07:00">June 29, 2019 at 9:00am (-0700)</time><br>through <time class="dt-end" datetime="2019-06-30T18:00:00-07:00">June 30, 2019 at 6:00pm (-0700)</time><br> <div class="p-location h-card"> <div> <span class="p-name">Mozilla</span> </div> <div> <span class="p-street-address">1120 NW Couch St</span>, <span class="p-locality">
Portland</span>, <span class="p-region">Oregon</span>, <span class="p-country">US</span> </div> <data class="p-latitude" value="45.52345"></data> <data class="p-longitude" value="-122.682677"></data> </div> <div class="e-content">Come join us </div> <div> <span class="p-author h-card"><a class="u-url p-name" href="https://aaronparecki.com">Aaron Pareck...
...019-05-25T18:00:00-07:00" ], "content": [ { "html": "Come join us", "value": "Come join us", "lang": "en" } ], "location": [ { "type": [ "h-card" ], "properties": { "name": [ "Mozilla" ], p-street-address: [ "1120 NW Couch St" ] "locality": [ "
Portland" ], "region": [ "Oregon" ], "country": [ "US" ], "latitude": [ "45.52345" ], "longitude": [ "-122.682677" ] }, "lang": "en", "value": "Mozilla" } ] }, "lang": "en" } ], ...
HTML: Hypertext Markup Language
HTML. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Beginner's tutorials Our HTML Learning Area features multiple modules that teach HTML from the ground up -- no previous knowledge required. Introduction to HTML This module sets the stage, getting you used to im
portant concepts and syntax such as looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a web page. Multimedia and embedding This module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular da...
... in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a webpage in an understandable, accessible way can be a challenge. This module covers basic table markup, along with more complex features such as implementing captions and summaries. HTML forms Forms are a very im
portant part of the Web -- these provide much of the functionality you need for interacting with websites, e.g. registering and logging in, sending feedback, buying products, and more. This module gets you started with creating the client-side/front-end parts of forms. Use HTML to solve common problems Provides links to sections of content explaining how to use HTML to solve very common problems whe...
...or videos, emphasizing content, creating a basic form, etc. Advanced topics CORS enabled image The crossorigin attribute, in combination with an appropriate CORS header, allows images defined by the <img> element to be loaded from foreign origins and used in a <canvas> element as if they were being loaded from the current origin. CORS settings attributes Some HTML elements that provide sup
port for CORS, such as <img> or <video>, have a crossorigin attribute (crossOrigin property), which lets you configure the CORS requests for the element's fetched data. Preloading content with rel="preload" The preload value of the <link> element's rel attribute allows you to write declarative fetch requests in your HTML <head>, specifying resources that your pages will need very soon after loading,...
...y creating a "block." Link types In HTML, various link types can be used to establish and define the relationship between two documents. Link elements that types can be set on include <a>, <area> and <link>. Guide to media types and formats on the web The <audio> and <video> elements allow you to play audio and video media natively within your content without the need for external software sup
port. HTML content categories HTML is comprised of several kinds of content, each of which is allowed to be used in certain contexts and is disallowed in others. Similarly, each has a set of other content categories they can contain and elements that can or can't be used in them. This is a guide to these categories. Quirks mode and standards mode Historical information on quirks mode and standards...
Common MIME types - HTTP
Here is a list of MIME types, associated by type of documents, ordered by their common extensions. Two primary MIME types are im
portant for the role of default types: text/plain is the default value for textual files. A textual file should be human-readable and must not contain binary data. application/octet-stream is the default value for all other cases. An unknown file type should use this type. Browsers pay a particular care when manipulating these files, attempting to safeguard the user to prevent dangerous behaviors. IANA is the official registry of MIME media types and maintains a list of all the official MIME types. ...
...nd must not contain binary data. application/octet-stream is the default value for all other cases. An unknown file type should use this type. Browsers pay a particular care when manipulating these files, attempting to safeguard the user to prevent dangerous behaviors. IANA is the official registry of MIME media types and maintains a list of all the official MIME types. ...
...ds OpenDocument spreadsheet document application/vnd.oasis.opendocument.spreadsheet .odt OpenDocument text document application/vnd.oasis.opendocument.text .oga OGG audio audio/ogg .ogv OGG video video/ogg .ogx OGG application/ogg .opus Opus audio audio/opus .otf OpenType font font/otf .png
Portable Network Graphics image/png .pdf Adobe
Portable Document Format (PDF) application/pdf .php Hypertext Preprocessor (Personal Home Page) application/x-httpd-php .ppt Microsoft PowerPoint application/vnd.ms-powerpoint .pptx Microsoft PowerPoint (OpenXML) application/vnd.openxmlformats-officedocument.presentationml.presentation ...
... (RTF) application/rtf .sh Bourne shell script application/x-sh .svg Scalable Vector Graphics (SVG) image/svg+xml .swf Small web format (SWF) or Adobe Flash document application/x-shockwave-flash .tar Tape Archive (TAR) application/x-tar .tif .tiff Tagged Image File Format (TIFF) image/tiff .ts MPEG trans
port stream video/mp2t .ttf TrueType Font font/ttf .txt Text, (generally ASCII or ISO 8859-n) text/plain .vsd Microsoft Visio application/vnd.visio .wav Waveform Audio Format audio/wav .weba WEBM audio audio/webm .webm WEBM video video/webm .webp WEBP image image/webp .woff Web Open ...
Access-Control-Allow-Headers - HTTP
-Headers to indicate which HTTP headers can be used during the actual request. This header is required if the request has an Access-Control-Request-Headers header. Header type Response header Forbidden header name no Syntax Access-Control-Allow-Headers: <header-name>[, <header-name>]* Access-Control-Allow-Headers: * Directives <header-name> The name of a sup
ported request header. The header may list any number of headers, separated by commas. * (wildcard) The value "*" only counts as a special wildcard value for requests without credentials (requests without HTTP cookies or HTTP authentication information). In requests with credentials, it is treated as the literal header name "*" without special semantics. Note that the Authorization header can't be w...
...ials, it is treated as the literal header name "*" without special semantics. Note that the Authorization header can't be wildcarded and always needs to be listed explicitly. Examples A custom header Here's an example of what an Access-Control-Allow-Headers header might look like. It indicates that in addition to the CORS-safelisted request headers, a custom header named X-Custom-Header is sup
ported by CORS requests to the server. Access-Control-Allow-Headers: X-Custom-Header Multiple headers This example shows Access-Control-Allow-Headers when it specifies sup
port for multiple headers. Access-Control-Allow-Headers: X-Custom-Header, Upgrade-Insecure-Requests Bypassing additional restrictions Although CORS-safelisted request headers are always allowed and don't usually need to be list...
... Specifications Specification Status Comment FetchThe definition of 'Access-Control-Allow-Hea...
...lows CORS requests to use the DELETE method, it responds with an Access-Control-Allow-Methods response header, which lists DELETE along with the other methods it sup
ports: HTTP/1.1 200 OK Content-Length: 0 Connection: keep-alive Access-Control-Allow-Origin: https://foo.bar.org Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE Access-Control-Max-Age: 86400 If the requested method isn't sup
ported, the server will respond with an error. Specifications Specification Status Comment FetchThe definition of 'Access-Control-Allow-Headers' in that specification. Living Standard Initial definition. ...
CSP: child-src - HTTP
directive is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the child-src policy: Content-Security-Policy: child-src <source>; Content-Security-Policy: child-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event hand...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
CSP: connect-src - HTTP
tive is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the connect-src policy: Content-Security-Policy: connect-src <source>; Content-Security-Policy: connect-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
CSP: font-src - HTTP
his directive is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the font-src policy: Content-Security-Policy: font-src <source>; Content-Security-Policy: font-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event hand...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
CSP: frame-ancestors - HTTP
The HTTP Content-Security-Policy (CSP) frame-ancestors directive specifies valid parents that may embed a page using <frame>, <iframe>, <object>, <embed>, or <applet>. Setting this directive to 'none' is similar to X-Frame-Options: deny (which is also sup
ported in older browsers). CSP version 2 Directive type Navigation directive default-src fallback No. Not setting this allows anything. This directive is not sup
ported in the <meta> element. Syntax One or more sources can be set for the frame-ancestors policy: Content-Security-Policy: frame-ancestors <source>; Content-Security-Policy: frame-ancestors <source> <source>; Sources <source> can be one of the following: The frame-ancestors directive's syntax is similar to a source list of...
...ce> can be one of the following: The frame-ancestors directive's syntax is similar to a source list of other directives (e.g. default-src), but doesn't allow 'unsafe-eval' or 'unsafe-inline' for example. It will also not fall back to a default-src setting. Only the sources listed below are allowed: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number, separated by spaces. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Single quotes surrounding the host are not allowed. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the...
... https://store.example.com: Matches all attempts to access store.example.com using https:. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. Examples Content-Security-Policy: frame-ancestors 'none'; Content-Security-Policy: frame-ancesto...
CSP: frame-src - HTTP
for the child-src directive (which falls back to the default-src directive). Syntax One or more sources can be allowed for the frame-src policy: Content-Security-Policy: frame-src <source>; Content-Security-Policy: frame-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event hand...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
CSP: manifest-src - HTTP
e is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the manifest-src policy: Content-Security-Policy: manifest-src <source>; Content-Security-Policy: manifest-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event hand...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
CSP: media-src - HTTP
directive is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the media-src policy: Content-Security-Policy: media-src <source>; Content-Security-Policy: media-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event hand...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
CSP: object-src - HTTP
rective is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the object-src policy: Content-Security-Policy: object-src <source>; Content-Security-Policy: object-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event hand...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
CSP: prefetch-src - HTTP
e is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the prefetch-src policy: Content-Security-Policy: prefetch-src <source>; Content-Security-Policy: prefetch-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handl...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
CSP: worker-src - HTTP
hild-src directive. Edge 17 skips the script-src directive (bug). Syntax One or more sources can be allowed for the worker-src policy: Content-Security-Policy: worker-src <source>; Content-Security-Policy: worker-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or
port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the
port number, indicating that all legal
ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access...
... https://store.example.com: Matches all attempts to access store.example.com using https:. *.example.com: Matches all attempts to load from any subdomain of example.com using the current protocol. ...
... inject arbitrary data: URIs. Use this sparingly and definitely not for scripts. mediastream: Allows mediastream: URIs to be used as a content source. blob: Allows blob: URIs to be used as a content source. filesystem: Allows filesystem: URIs to be used as a content source. 'self' Refers to the origin from which the protected document is being served, including the same URL scheme and
port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event hand...
...ipts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. Specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce sup
port. '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two
portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading...
HTTP range requests - HTTP
You can check this by issuing a HEAD request with cURL, for example. curl -I http://i.imgur.com/z4d4kWk.jpg HTTP/1.1 200 OK ... Accept-Ranges: bytes Content-Length: 146515 In this response, Accept-Ranges: bytes indicates that bytes can be used as unit to define a range. Here the Content-Length header is also useful as it indicates the full size of the image to retrieve. ...
...quest with cURL, for example. curl -I http://i.imgur.com/z4d4kWk.jpg HTTP/1.1 200 OK ... Accept-Ranges: bytes Content-Length: 146515 In this response, Accept-Ranges: bytes indicates that bytes can be used as unit to define a range. Here the Content-Length header is also useful as it indicates the full size of the image to retrieve. ...
...Accept-Ranges: bytes Content-Length: 146515 In this response, Accept-Ranges: bytes indicates that bytes can be used as unit to define a range. Here the Content-Length header is also useful as it indicates the full size of the image to retrieve. If sites omit the Accept-Ranges header, they likely don't sup
port partial requests. Some sites also explicitly send "none" as a value, indicating no sup
port. In some apps, download managers disable their pause buttons in that case. curl -I https://www.youtube.com/watch?v=EwTZ2xpQwpA HTTP/1.1 200 OK ... Accept-Ranges: none Requesting a specific range from a server If the server sup
ports range requests, you can issue such a request by using the Range header. It indicates the part(s) of a document that the server should return. Single part ranges ...
...rking with range requests: In case of a successful range request, the 206 Partial Content status is sent back from a server. In case of a range request that is out of bounds (none of the range values overlap the extent of the resource, i.e first-byte-pos of all ranges is greater than the resource length), the server responds with a 416 Requested Range Not Satisfiable status. In case of no sup
port of range requests, the 200 OK status is sent back from a server. Comparison to chunked Transfer-Encoding The Transfer-Encoding header allows chunked encoding, which is useful when larger amounts of data are sent to the client and the total size of the response is not known until the request has been fully processed. The server sends data to the client straight away without buffering the respon...
A typical HTTP session - HTTP
In client-server protocols, like HTTP, sessions consist of three phases: The client establishes a TCP connection (or the appropriate connection if the trans
port layer is not TCP). The client sends its request, and waits for the answer. The server processes the request, sending back its answer, providing a status code and appropriate data. As of HTTP/1.1, the connection is no longer closed after completing the third phase, and the client is now granted a further request: this means the second and third phases can now be performed any number of times. Establishing a connection In client-server protocols, it is the client which establishes the connection. Opening a connection in HTTP means initiating a connection in the underlying trans
port layer, usually this is TCP. With TCP the defa...
...mpleting the third phase, and the client is now granted a further request: this means the second and third phases can now be performed any number of times. Establishing a connection In client-server protocols, it is the client which establishes the connection. Opening a connection in HTTP means initiating a connection in the underlying trans
port layer, usually this is TCP. With TCP the default
port, for an HTTP server on a computer, is
port 80. Other
ports can also be used, like 8000 or 8080. The URL of a page to fetch contains both the domain name, and the
port number, though the latter can be omitted if it is 80. See Identifying resources on the Web for more details. Note: The client-server model does not allow the server to send data to the client without an explicit request for it. To ...
...e final block is a data block, which contains the optional data. ...
...(contains a site-customized page helping the user to find the missing resource) Response status codes HTTP response status codes indicate if a specific HTTP request has been successfully completed. Respo...
HTTP response status codes - HTTP
esource with the new ones. 205 Reset Content Tells the user-agent to reset the document which sent this request. 206 Partial Content This response code is used when the Range header is sent from the client to request only part of a resource. 207 Multi-Status (WebDAV) Conveys information about multiple resources, for situations where multiple status codes might be appropriate. 208 Already Re
ported (WebDAV) Used inside a <dav:propstat> response element to avoid repeatedly enumerating the internal members of multiple bindings to the same collection. 226 IM Used (HTTP Delta encoding) The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance. Redirection messages 30...
...erver requires it. 412 Precondition Failed The client has indicated preconditions in its headers which the server does not meet. 413 Payload Too Large Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field. 414 URI Too Long The URI requested by the client is longer than the server is willing to interpret. 415 Unsup
ported Media Type The media format of the requested data is not sup
ported by the server, so the server is rejecting the request. 416 Range Not Satisfiable The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data. 417 Expectation Failed This response code means the expectation indicated by the Expect ...
... may be resubmitted after reducing the size of the request header fields. 451 Unavailable For Legal Reasons The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government. Server error responses 500 Internal Server Error The server has encountered a situation it doesn't know how to handle. 501 Not Implemented The request method is not sup
ported by the server and cannot be handled. The only methods that servers are required to sup
port (and therefore that must not return this code) are GET and HEAD. 502 Bad Gateway This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response. 503 Service Unavailable The server is not ready to handle the request. Common ...
...possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached. 504 Gateway Timeout This error response is given when the server is acting as a gateway and cannot get a response in time. 505 HTTP Version Not Sup
ported The HTTP version used in the request is not sup
ported by the server. 506 Variant Also Negotiates The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process. 507 Insufficient Storage (WebDAV) The method could not be performed on the resource ...
Control flow and error handling - JavaScript
This chapter provides an overview of these statements. The JavaScript reference contains exhaustive details about the statements in this chapter. The semicolon (;) character is used to separate statements in JavaScript code. Any JavaScript expression is also a statement. See Expressions and operators for complete information about expressions. Block statement The most basic statement is a block statement, which is used to group statements. ...
...formation about expressions. Block statement The most basic statement is a block statement, which is used to group statements. The block is delimited by a pair of curly brackets: { statement_1; statement_2; ? statement_n; } Example Block statements are commonly used with control flow statements (if, for, while). while (x < 10) { x++; } Here, { x++; } is the block statement. Im
portant: JavaScript before ECMAScript2015 (6th edition) does not have block scope! In older JavaScript, variables introduced within a block are scoped to the containing function or script, and the effects of setting them persist beyond the block itself. In other words, block statements do not define a scope. "Standalone" blocks in JavaScript can produce completely different results from what they wo...
...ock is in the same scope as the var x statement before the block. (In C or Java, the equivalent code would have outputted 1.) Since ECMAScript2015, the let and const variable declarations are block-scoped. See the let and const reference pages for more information. Conditional statements A conditional statement is a set of commands that executes if a specified condition is true. JavaScript sup
ports two conditional statements: if...else and switch. if...else statement Use the if statement to execute a statement if a logical condition is true. Use the optional else clause to execute a statement if the condition is false. An if statement looks like this: if (condition) { statement_1; } else { statement_2; } Here, the condition can be any expression that evaluates to true or false. (S...
...le.error() rather than console.log() is advised for debugging. It formats the message as an error, and adds it to the list of error messages generated by the page. The finally block The finally block contains statements to be executed after the try and catch blocks execute. Additionally, the finally block executes before the code that follows the try...catch...finally statement. It is also im
portant to note that the finally block will execute whether or not an exception is thrown. If an exception is thrown, however, the statements in the finally block execute even if no catch block handles the exception that was thrown. You can use the finally block to make your script fail gracefully when an exception occurs. For example, you may need to release a resource that your script has tied up. ...
Introduction - JavaScript
ntally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript. ...
...Functions can be properties of objects, executing as loosely typed methods. JavaScript is a very free-form language compared to Java. You do not have to declare all variables, classes, and methods. ...
...pt is standardized at Ecma International -- the European association for standardizing information and communication systems (ECMA was formerly an acronym for the European Computer Manufacturers Association) to deliver a standardized, international programming language based on JavaScript. This standardized version of JavaScript, called ECMAScript, behaves the same way in all applications that sup
port the standard. Companies can use the open standard language to develop their implementation of JavaScript. The ECMAScript standard is documented in the ECMA-262 specification. See New in JavaScript to learn more about different versions of JavaScript and ECMAScript specification editions. The ECMA-262 standard is also approved by the ISO (International Organization for Standardization) as ISO-162...
...y in Firefox, or V8 in Chrome). The ECMAScript document is not intended to help script programmers. Use the JavaScript documentation for information when writing scripts. The ECMAScript specification uses terminology and syntax that may be unfamiliar to a JavaScript programmer. Although the description of the language may differ in ECMAScript, the language itself remains the same. JavaScript sup
ports all functionality outlined in the ECMAScript specification. The JavaScript documentation describes aspects of the language that are appropriate for a JavaScript programmer. Getting started with JavaScript Getting started with JavaScript is easy: all you need is a modern Web browser. This guide includes some JavaScript features which are only currently available in the latest versions of Firef...
Date.prototype.toLocaleString() - JavaScript
le, a formatted string in the default locale and with default options is returned. ...
...et date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0)); // toLocaleString() without arguments depends on the // implementation, the default locale, and the default time zone console.log(date.toLocaleString()); // -> "12/11/2012, 7:00:00 PM" if run in en-US locale with time zone America/Los_Angeles Checking for sup
port for locales and options arguments The locales and options arguments are not sup
ported in all browsers yet. ...
...tring() without arguments depends on the // implementation, the default locale, and the default time zone console.log(date.toLocaleString()); // -> "12/11/2012, 7:00:00 PM" if run in en-US locale with time zone America/Los_Angeles Checking for sup
port for locales and options arguments The locales and options arguments are not sup
ported in all browsers yet. To check whether an implementation sup
ports them already, you can use the requirement that illegal language tags are rejected with a RangeError exception: function toLocaleStringSup
portsLocales() { try { new Date().toLocaleString('i'); } catch (e) { return e instanceof RangeError; } return false; } Using locales This example shows some of the variations in localized date and time formats. In order to get the format of ...
...0:00" // Arabic in most Arabic speaking countries uses real Arabic digits console.log(date.toLocaleString('ar-EG')); // -> "???/???/???? ?:??:?? ...
Function.prototype.bind() - JavaScript
// Yes, it does work with `new (funcA.bind(thisArg, args))` if (!Function.prototype.bind) (function(){ var ArrayPrototypeSlice = Array.prototype.slice; Function.prototype.bind = function(otherThis) { if (typeof this !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function throw new TypeError('Function.prototype.bind - what is ...
...l implementation relies on Array.prototype.slice(), Array.prototype.concat(), Function.prototype.call() and Function.prototype.apply(), built-in methods to have their original values. The partial implementation creates functions that do not have immutable "poison pill" caller and arguments properties that throw a TypeError upon get, set, or deletion. (This could be added if the implementation sup
ports Object.defineProperty, or partially implemented [without throw-on-delete behavior] if the implementation sup
ports the __defineGetter__ and __defineSetter__ extensions.) The partial implementation creates functions that have a prototype property. (Proper bound functions have none.) The partial implementation creates bound functions whose length property does not agree with that mandated by ECMA...
...uct new instances created by the target function. When a bound function is used to construct a value, the provided this is ignored. ...
...thing special to create a bound function to be called plainly, even if you would rather require the bound function to only be called using new. // Example can be run directly in your JavaScript console // ...continued from above // Can still be called as a normal function // (although usually this is undesired) YAxisPoint(13); `${emptyObj.x},${emptyObj.y}`; // > '0,13' If you wish to sup
port the use of a bound function only using new, or only by calling it, the target function must enforce that restriction. Creating shortcuts bind() is also helpful in cases where you want to create a shortcut to a function which requires a specific this value. Take Array.prototype.slice(), for example, which you want to use for converting an array-like object to a real array. You could create a sh...
Promise - JavaScript
a "settled" state will cause both instances of .then() to be invoked. const promiseA = new Promise(myExecutorFunc); const promiseB = promiseA.then(handleFulfilled1, handleRejected1); const promiseC = promiseA.then(handleFulfilled2, handleRejected2); An action can be assigned to an already "settled" promise. In that case the action (if appropriate) will be performed at the first asynchronous op
portunity. Note that promises are guaranteed to be asynchronous. Therefore, an action for an already "settled" promise will occur only after the stack has cleared and a clock-tick has passed. The effect is much like that of setTimeout(action,10). const promiseA = new Promise( (resolutionFunc,rejectionFunc) => { resolutionFunc(777); }); // At this point, "promiseA" is already settled. promiseA.the...
...Func(777); }); // At this point, "promiseA" is already settled. promiseA.then( (val) => console.log("asynchronous logging has val:",val) ); console.log("immediate logging"); // produces output in this order: // immediate logging // asynchronous logging has val: 777 Constructor Promise() Creates a new Promise object. The constructor is primarily used to wrap functions that do not already sup
port promises. Static methods Promise.all(iterable) Wait for all promises to be resolved, or for any to be rejected. If the returned promise resolves, it is resolved with an aggregating array of the values from the resolved promises ,in the same order as defined in the iterable of multiple promises. If it rejects, it is rejected with the reason from the first promise in the iterable that was r...
...) By clicking the button several times in a short amount of time, you'll even see the different promises being fulfilled one after another. Loading an image with XHR Another simple example using Promise and XMLHttpRequest to load an image is available at the MD...
...e made (Sync code terminated)'); } if ("Promise" in window) { let btn = document.getElementById("btn"); btn.addEventListener("click",testPromise); } else { log = document.getElementById('log'); log.innerHTML = "Live example not available as your browser doesn't sup
port the <code>Promise<code> interface."; } This example is started by clicking the button. (You need a browser that sup
ports Promise. ) By clicking the button several times in a short amount of time, you'll even see the different promises being fulfilled one after another. Loading an image with XHR Another simple example using Promise and XMLHttpRequest to load an image is available at the MDN GitHub js-examples repository. You can also see it in action. Each step is commented and allows you to follow the Promise...
TypedArray.prototype.slice() - JavaScript
This method has the same algorithm as Array.prototype.slice(). TypedArray is one of the typed array types here. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax typedarray.slice([begin[, end]]) Parameters begin Optional Zero-based index at which to begin extraction. A negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. If begin is undefined, slice begins from index 0. ...
... other typed array is not affected. Polyfill Since there is no global object with the name TypedArray, polyfilling must be done on an "as needed" basis. ...
...there is no global object with the name TypedArray, polyfilling must be done on an "as needed" basis. ...
....defineProperty(Uint8Array.prototype, 'slice', { value: function (begin, end) { return new Uint8Array(Array.prototype.slice.call(this, begin, end)); } }); } If you need to sup
port truly obsolete JavaScript engines that don't sup
port Object.defineProperty, it's best not to polyfill Array.prototype methods at all, as you can't make them non-enumerable. Examples Return a
portion of an existing typed array const uint8 = new Uint8Array([1,2,3]); uint8.slice(1); // Uint8Array [ 2, 3 ] uint8.slice(2); // Uint8Array [ 3 ] uint8.slice(-2); // Uint8Array [ 2, 3 ] uint8.slice(0,1); // Uint8Array [ 1 ] Specifications Specification ECMAScript (ECMA-262)The definition of '%TypedArray%.prototype.slice' in that specification. ...
Web media technologies
o a destination such as an <audio> element, a media stream, or to disk. WebRTC WebRTC (Web Real-Time Communication) makes it possible to stream live audio and video, as well as transfer arbitrary data, between two peers over the Internet, without requiring an intermediary. Guides Overview of media technology on the web A general look at the open Web technologies and APIs that provide sup
port for audio and video playback, manipulation, and recording. If you're not sure which API you should use, this is the place to start. Using audio and video in HTML A guide to using the HTML <audio> and <video> elements. Accessibility guide for media in web design In this guide, we cover ways web designers and developers can create content that is accessible to people with different capabilities...
...lements to captions to tagging media for screen readers. Guide to media types and formats on the web A guide to the file types and codecs available for images, audio, and video media on the web. This includes recommendations for what formats to use for what kinds of content, best practices including how to provide fallbacks and how to prioritize media types, and also includes general browser sup
port information for each media container and codec. Streaming audio and video A guide which covers how to stream audio and video, as well as techniques and technologies you can take advantage of to ensure the best possible quality and/or performance of your streams. Autoplay guide for media and Web Audio APIs Unexpected automatic playback of media or audio can be an unwelcome surprise to users. W...
...users control over this, many browsers now provide forms of autoplay blocking. This article is a guide to autoplay, with tips on when and how to use it and how to work with browsers to handle autoplay blocking gracefully. Positional audio in a 3D environment In 3D environments, which may either be 3D scenes rendered to the screen or a mixed reality experience experienced using a headset, it's im
portant for audio to be performed so that it sounds like it's coming from the direction of its source. This guide covers how to accomplish this. Playing video in a 3D environment In this guide, we examine how to play video into a 3D scene. This technique can be used in both standard WebGL applications presented on a flat computer screen, or in a WebXR-generated virtual or augmented reality environme...
...for video playback or camera capture so that you can capture and manipulate video frames. WebGL WebGL provides an OpenGL ES compatible API on top of the existing Canvas API, making it possible to do powerful 3D graphics on the Web. Through a canvas, this can be used to add 3D imagery to media content. WebXR WebXR, which has replaced the now-obsolete WebVR API, is a technology that provides sup
port for creating virtual reality (VR) and augmented reality (AR) content. The mixed reality content can then be displayed on the device's screen or using goggles or a headset. ...
Performance Monitoring: RUM vs synthetic monitoring - Web Performance
In this article we define and compare these two performance monitoring approaches. Synthetic Monitoring Synthetic monitoring involves monitoring the performance of a page in a 'laboratory' environment, typically with automation tooling in a consistent as possible environment. Synthetic Monitoring involves deploying scripts to simulate the path an end user might take through a web application, re
porting back the performance the simulator experiences. The traffic measured is not of your actual users, but rather synthetically generated traffic collecting data on page performance. An example of synthetic monitoring is WebPageTest.org. It is done in a controlled environment where variable like geography, network, device, browser, and cached status are predetermined. It provides waterfall charts ...
...et and asset requests generated by all third party scripts, such as ads and analytic services. Controlling for environmental variables is helpful in understanding where performance bottlenecks have been occurring and identifying the source of any performance issues. For example, but it isn't reflective of the actual experience of users, especially the long tail. Synthetic monitoring can be an im
portant component of regression testing and production site monitoring. Test the site at every stage of development and regularly in production. Changes from baseline performance as part of continuous integration should fail a push. If an issue arises in production, synthetic monitoring can provide insight, helping identify, isolate, and resolve problems before they negatively user experience. Real U...
... continuous integration should fail a push. If an issue arises in production, synthetic monitoring can provide insight, helping identify, isolate, and resolve problems before they negatively user experience. Real User Monitoring Real User Monitoring or RUM measures the performance of a page from real users' machines. Generally, a third party script injects a script on each page to measure and re
port back on page load data for every request made. This technique monitors an application's actual user interactions. In real user monitoring, the browsers of real users re
port back performance metrics experienced. RUM helps identify how an application is being used, including the geographic distribution of users and the impact of that distribution on the end user experience. Unlike Synthetic monit...
...nthetic monitoring, RUM captures the performance of actual users regardless of device, browser, network or geographic location. As users interact with an application, all performance timings are captured, regardless of what actions are taken or pages viewed. RUM monitors actual use cases, not the synthetic, assumed use cases predefined by an engineer, PM, or marketing team. This is particularly im
portant for large sites or complex apps, where the functionality or content is constantly changing, and where the population accessing the application may differ greatly in life experiences from those creating it. By leveraging RUM, a business can better understand its users and identify the areas on its site that require the most attention. Moreover, RUM can help to understand the geographic or chan...
Introduction to progressive web apps - Progressive web apps (PWAs)
ere is no connectivity. This is achieved using a combination of technologies: Service Workers to control page requests (for example storing them offline), the Cache API for storing responses to network requests offline (very useful for storing site assets), and client-side data storage technologies such as Web Storage and IndexedDB to store application data offline. Progressive enhancement supp
port Modern web apps can be developed to provide an excellent experience to fully capable browsers, and an acceptable (although not quite as shiny) experience to less capable browsers. We've been doing this for years with best practices such as progressive enhancement. By using progressive enhancement, PWAs are cross-browser. This means developers should take into account the differences in impleme...
...apps can now do this too, using new technologies such as Service Workers for controlling pages, the Web Push API for sending updates straight from server to app via a service worker, and the Notifications API for generating system notifications to help engage users when they're not actively using their web browser. Responsiveness Responsive web apps use technologies like media queries and view
port to make sure that their UIs will fit any form factor: desktop, mobile, tablet, or whatever comes next. Safety The web platform provides a secure delivery mechanism that prevents snooping while simultaneously ensuring that content hasn't been tampered with, as long as you take advantage of HTTPS and develop your apps with security in mind. It's also easy for users to ensure that they're insta...
... also easy for users to ensure that they're installing the right app, because its URL will match your site's domain. This is very different from apps in app stores, which may have a number of similarly-named apps, some of which may even be based on your own site, which only adds to the confusion. Web apps eliminate that confusion and ensure that users get the best possible experience. Browser sup
port As mentioned before, PWAs don't depend on a single API, but rather using various technologies to achieve the goal of delivering the best web experience possible. The key ingredient required for PWAs is service worker sup
port. Thankfully service workers are now sup
ported on all major browsers on desktop and mobile. Other features such as Web App Manifest, Push Notifications, and Add to Home S...
... depend on a single API, but rather using various technologies to achieve the goal of delivering the best web experience possible. The key ingredient required for PWAs is service worker sup
port. Thankfully service workers are now sup
ported on all major browsers on desktop and mobile. Other features such as Web App Manifest, Push Notifications, and Add to Home Screen functionality have wide sup
port too. Currently, Safari has limited sup
port for Web App Manifest and Add to Home Screen and no sup
port for web push notifications. However, other major browsers sup
port all these features. Above all you should follow the progressive enhancement rule: use technologies that enhance the appearance and utility of your app when they're available, but still offer the basic functionality of your app whe...
Progressive loading - Progressive web apps (PWAs)
Previous Overview: Progressive web apps In previous articles we covered APIs that help us make our js13kPWA example a Progressive Web App: Service Workers, Web Manifests, Notifications and Push. In this article we will go even further and improve the performance of the app by progressively loading its resources. First meaningful paint It's im
portant to deliver something meaningful to the user as soon as possible -- the longer they wait for the page to load, the bigger the chance they will leave before waiting for everything to finish. We should be able to show them at least the basic view of the page they want to see, with placeholders in the places more content will eventually be loaded. This could be achieved by progressive loading -- also known as Lazy loading. This is ...
...-- it loads the images after rendering the HTML structure, and applies a nice transition effect in the process. The problem is that it still loads all the images at once, even though the user will only see the first two or three upon page load. This problem can be solved with the new Intersection Observer API -- using this we can ensure that images will be loaded only when they appear in the view
port. Intersection Observer This is a progressive enhancement to the previously working example -- Intersection Observer will load target images only when the user scrolls down, causing them to display in the view
port. Here's what the relevant code looks like: if('IntersectionObserver' in window) { const observer = new IntersectionObserver((items, observer) => { items.forEach((item) => { ...
...We can iterate over each case and react accordingly -- when an image is visible, we load the correct image and stop observing it as we no longer need to observe it. Let's reiterate our earlier mention o...
...); } }); }); imagesToLoad.forEach((img) => { observer.observe(img); }); } else { imagesToLoad.forEach((img) => { loadImages(img); }); } If the IntersectionObserver object is sup
ported, the app creates a new instance of it. The function passed as a parameter is handling the case when one or more items are intersecting with the observer (i.e. is appearing inside the view
port). We can iterate over each case and react accordingly -- when an image is visible, we load the correct image and stop observing it as we no longer need to observe it. Let's reiterate our earlier mention of progressive enhancement -- the code is written so that the app will work whether Intersection Observer is sup
ported or not. If it's not, we just load the images using the more basic approach c...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
d than notifications -- we need to subscribe to a server that will then send the data back to the app. The app's Service Worker will receive data from the push server, which can then be shown using the notifications system, or another mechanism if desired. The technology is still at a very early stage -- some working examples use the Google Cloud Messaging platform, but are being rewritten to sup
port VAPID (Voluntary Application Identification), which offers an extra layer of security for your app. You can examine the Service Workers Cookbook examples, try to set up a push messaging server using Firebase, or build your own server (using Node.js for example). As mentioned before, to be able to receive push messages, you have to have a service worker, the basics of which are already explained ...
... return the subscription object and move to the subscription part. If not, we initialize a new subscription: const response = await fetch('./vapidPublicKey'); const vapidPublicKey = await response.text(); const convertedVapidKey = urlBase64ToUint8Array(vapidPublicKey); The app fetches the server's public key and converts the response to text; then it needs to be converted to a Uint8Array (to sup
port Chrome). To learn more about VAPID keys you can read the Sending VAPID identified WebPush Notifications via Mozilla's Push Service blog post. The app can now use the PushManager to subscribe the new user. There are two options passed to the PushManager.subscribe() method -- the first is userVisibleOnly: true, which means all the notifications sent to the user will be visible to them, and the sec...
...APID_PUBLIC_KEY || !process.env.VAPID_PRIVATE_KEY) { console.log("You must set the VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY "+ "environment variables. ...
...erateVAPIDKeys()); return; } webPush.setVapidDetails( 'https://serviceworke.rs/', process.env.VAPID_PUBLIC_KEY, process.env.VAPID_PRIVATE_KEY ); Next, a module defines and ex
ports all the routes an app needs to handle: getting the VAPID public key, registering, and then sending notifications. You can see the variables from the index.js file being used: payload, delay and ttl. ...
Graphic design for responsive sites - Progressive web apps (PWAs)
those graphics and layouts need to adapt to different displays! This is why we have included an entire docs section covering each of these topics (the one you are currently in, and app layout.) In addition, these days there are so many more technologies to choose from than your humble BMPs, JPGs, GIFs and PNGs. But what should you choose? This really depends on what target devices you have to sup
port, how complex the graphics need to be, and how much interactivity your graphics require. Serving images selectively via CSS In general, you will use mostly the same graphical assets for different layouts in a responsive design, but you may well include slightly different ones dependant on context. For example, if your desktop layout includes a large header graphic and several programmatic graphi...
...rovide smaller assets to suit the smaller screen better. This is because in general mobile devices will have less processing power and bandwidth available, so you want to reduce the processing and downloads. In addition, mobile devices have smaller screen sizes, so it makes sense to reduce visual clutter on a mobile layout. CSS media queries allow us to serve different CSS rules dependant on view
port dimensions, and you should consider using mobile first media queries where possible. This means that the default layout before any media queries are encountered in the CSS is the small screen/mobile layout, not the wide screen/desktop layout. So when the page is loaded on a mobile device, the mobile will only download the mobile assets, and not the desktop resource assets. Making HTML <img>s res...
...lable such as font awesome. Interactive images If your images need to feature some level of interactivity, such as links, other clickable areas, or animation, there are a number of options available. CSS As well as adding programmatic graphical effects to links (and anywhere else you might want them), CSS3 also allows you to write declarative animations and transitions. These may not be sup
ported in older browsers like IE6-8, but they generally degrade gracefully, are fairly easy to write, and become much more flexible and powerful when combined with JavaScript and other technologies. JavaScript JavaScript has functions that enable developers to create animations, and any other type of interactivity you want. It is very powerful when combined with other technologies, although its comp...
...evelopers. SVG SVG, just like HTML/CSS, can be manipulated via JavaScript. So adding interactivity is not difficult. You can also add links direcly into SVG and can create animations using SMIL (Synchronized Multimedia Intergration Language). WebGL/Canvas You can create a canvas to draw interactive graphics on using the HTML <canvas> element, then use the Canvas API to create shapes, lines, im
port image files, create text, do compositing operations, and much more. Standard JavaScript can then be used to animate the image output, etc. You can create 2D imagery using the regular 2D canvas context, or 3D imagery using the more nascent WebGL API. Canvas is very powerful, but it needs to be used with caution. It is good for the visuals of games and complex data visualisions, but for standard u...
Responsive Navigation Patterns - Progressive web apps (PWAs)
Pattern 1: Top toggle menu In this pattern, as the screen width is reduced, the top navigation items rearrange until there is not enough space. At that point, some items move from the top navigation to a drop-down menu. In the smallest screen, all navigation items live in a toggle menu, and the user has to tap to expand the toggle menu. ...
... enough space. At that point, some items move from the top navigation to a drop-down menu. In the smallest screen, all navigation items live in a toggle menu, and the user has to tap to expand the toggle menu. You could rank the item priorities to ensure the most im
portant items always appear in the top navigation. ...
...igation menu in the smallest screen size one more step is needed to access the hidden navigation items Pattern 2: Expandable bottom menu Similar to the first pattern, the top navigation items rearrange for smaller widths until there is not enough space. At that point, some items move from the top navigation to a drop-down menu. ...
...ould rank the item priorities to ensure the most im
portant items always appear in the top navigation. In the smallest screen, several items stay on the bottom of the screen, and the rest of the items are hidden. The user can flip the menu open and select from the rest of the navigation items. You could select the items that remain on the bottom. ...
stroke-linejoin - SVG: Scalable Vector Graphics
--> <path d="M9,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="arcs" /> <!-- the following pink lines highlight th...
...1 2,3.5" stroke="black" fill="none" stroke-linejoin="bevel" /> <!-- Bottom left path: Effect of the "miter-clip" value with fallback to "miter" if not sup
ported. --> <path d="M3,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="miter-clip" /> <!-- Bottom right path: Effect of the "arcs" value with fallback to "miter" if not sup
ported. --> <path d="M9,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="arcs" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="highlight"> <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink"...
... The arcs value indicates that an arcs corner is to be used to join path segments. The arcs shape is formed by extending the outer edges of the stroke at the join point with arcs that have the same curvature as the outer edges at the join point. Example html,body,svg { height:100% } <svg viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"...
... The miter-clip value indicates that a sharp corner is to be used to join path segments. The corner is formed by extending the outer edges of the stroke at the tangents of the path segments until they intersect. If the stroke-miterlimit is exceeded, the miter is clipped at a distance equal to half the stroke-miterlimit value multiplied by the ...
Namespaces crash course - SVG: Scalable Vector Graphics
Take some time to understand namespaces now and it will save you all sorts of headaches in the future. Background It has been a long standing goal of the W3C to make it possible for different types of XML based content to be mixed together in the same XML file. ...
...Take some time to understand namespaces now and it will save you all sorts of headaches in the future. Background It has been a long standing goal of the W3C to make it possible for different types of XML based content to be mixed together in the same XML file. ...
...once on a root element. The declaration defines the default namespace, so the user agent knows that all the <svg> element's descendants also belong to the same namespace. User agents check to see if they recognize the namespace name to determine if they know how to handle the markup. Note that namespace names are just strings, so the fact that the SVG namespace name also looks like a URI isn't im
portant. URIs are commonly used because they are unique, the intention is not to "link" somewhere. (In fact URIs are used so frequently that the term "namespace URI" is commonly used instead of "namespace name".) Redeclaring the default namespace So if all the descendants of the root element are also defined to be in the default namespace, how do you mix in content from another namespace? Easy. You ...
...cripts for namespaced XML such as SVG, read on. The DOM Level 1 recommendation was created before the original Namespaces in XML recommendation was released; therefore, DOM1 isn't namespace aware. This causes problems for namespaced XML such as SVG. To resolve these problems, DOM Level 2 Core added namespace aware equivalents of all the applicable DOM Level 1 methods. When scripting SVG, it is im
portant to use the namespace aware methods. The table below lists the DOM1 methods that shouldn't be used in SVG, along with their equivalent DOM2 counterparts that should be used instead. DOM1 (don't use) DOM2 (use these instead!) createAttribute createAttributeNS createElement createElementNS getAttributeNode getAttributeNodeNS getAttribute ...
SVG fonts - SVG: Scalable Vector Graphics
<< PreviousNext >> When SVG was specified, sup
port for web fonts was not widespread in browsers. Since accessing the correct font file is however crucial for rendering text correctly, a font description technology was added to SVG to provide this ability. It was not meant for compatibility with other formats like PostScript or OTF, but rather as a simple means of embedding glyph information into SVG when rendered. SVG Fonts are currently sup
ported only in Safari and Android Browser. Internet Explorer hasn't considered implementing this, the functionality has been removed from Chrome 38 (and Opera 25) and Firefox has postponed its implementation indefinitely to concentrate on WOFF. ...
... The base for defining an SVG font is the <font> element. Defining a font There are some ingredients required for embedding a font in SVG. Let's show an example declaration (the one from the specification), and explain the details. ...
...ompared to the path definitions of the single glyphs. The value 1000 sets a reasonable value to work with. There are several accompanying attributes that help further define the basic glyph-box layout. The <font-face> element is the SVG equivalent of the CSS @font-face declaration. It defines basic properties of the final font such as weight, style, etc. In the example above the first and most im
portant to be defined is font-family, the value of which can then be referenced in CSS and SVG font-family properties. The font-weight and font-style attributes have the same purpose as the equivalent descriptors in CSS. All following attributes are rendering instructions for the font layout engine, for example, how much of the glyphs' overall heights are ascenders. Its child, the <font-face-src> ele...
...ack mechanisms. It also shows how glyphs are created: By simply adding any graphical SVG content inside. You can use literally any other SVG elements in here, even <filter>, <a> or <script>. For simple glyphs, however, you can simply add a d attribute -- this defines a shape for the glyph exactly like how standard SVG paths work. The actual glyphs are then defined by <glyph> elements. The most im
portant attribute is unicode. It defines the unicode codepoint represented by this glyph. If you also specify the lang attribute on a glyph, you can further restrict it to certain languages (represented by xml:lang on the target) exclusively. Again, you can use arbitrary SVG to define the glyph, which allows for great effects in sup
porting user agents. There are two further elements that can be defin...
Tutorials
ive Commons. For complete beginners to the Web Getting started with the Web Getting started with the Web is a concise series introducing you to the practicalities of web development. You'll set up the tools you need to construct a simple webpage and publish your own simple code. HTML Tutorials Introductory level Introduction to HTML This module sets the stage, getting you used to im
portant concepts and syntax, looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a webpage. MDN HTML element reference A comprehensive reference for HTML elements, and how the different browsers sup
port them. Creating a Simple Web Page with HTML An HTML guide for beginners that includes explanations of common tags, including HTML5 tags. Also includes ...
...g the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a webpage in an understandable, accessible way can be a challenge. This module covers basic table markup, along with more complex features such as implementing captions and summaries. Advanced level HTML forms Forms are a very im
portant part of the Web -- these provide much of the functionality you need for interacting with websites, e.g. registering and logging in, sending feedback, buying products, and more. This module gets you started with creating the client-side parts of forms. Tips for authoring fast-loading HTML pages Optimize web pages to provide a more responsive site for visitors and reduce the load on your ...
...stom fonts to your page, and styling lists and links. Common CSS Questions Common questions and answers for beginners. Intermediate level CSS layout At this point we've already looked at CSS fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. Now it's time to look at how to place your boxes in the right place in relation to the view
port, and one another. We have covered the necessary prerequisites so can now dive deep into CSS layout, looking at different display settings, traditional layout methods involving float and positioning, and new fangled layout tools like flexbox. CSS reference Complete reference to CSS, with details on sup
port by Firefox and other browsers. Fluid Grids Design layouts that fluidly resize with ...
...um, an internet radio station, and a blog. Intermediate level Introducing JavaScript objects In JavaScript, most things are objects, from core JavaScript features like strings and arrays to the browser APIs built on top of JavaScript. You can even create your own objects to encapsulate related functions and variables into efficient packages. The object-oriented nature of JavaScript is im
portant to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've provided this module to help you. Here we teach object theory and syntax in detail, look at how to create your own objects, and explain what JSON data is and how to work with it. Client-side web APIs When writing client-side JavaScript for websites or applications, you w...
Using templates and slots - Web Components
exible template that can then be used to populate the shadow DOM of a web component. The truth about templates When you have to reuse the same markup structures repeatedly on a web page, it makes sense to use some kind of a template rather than repeating the same structure over and over again. This was possible before, but it is made a lot easier by the HTML <template> element (which is well-sup
ported in modern browsers). This element and its contents are not rendered in the DOM, but it can still be referenced using JavaScript. Let's look at a trivial quick example: <template id="my-paragraph"> <p>My paragraph</p> </template> This won't appear in your page until you grab a reference to it with JavaScript and then append it to the DOM, using something like the following: let template = ...
...ed inside the custom element. This wouldn't work if we just appended it to the standard DOM. So for example: <template id="my-paragraph"> <style> p { color: white; background-color: #666; padding: 5px; } </style> <p>My paragraph</p> </template> Now we can use it by just adding it to our HTML document: <my-paragraph></my-paragraph> Note: Templates are well-sup
ported in browsers; the Shadow DOM API is sup
ported by default in Firefox (version 63 onwards), Chrome, Opera, Safari, and Edge (starting with version 79). Adding flexibility with slots So far so good, but the element isn't very flexible. We can only display one bit of text inside it, meaning that at the moment it is even less useful than a regular paragraph! We can make it possible to display diff...
..., and Edge (starting with version 79). Adding flexibility with slots So far so good, but the element isn't very flexible. We can only display one bit of text inside it, meaning that at the moment it is even less useful than a regular paragraph! We can make it possible to display different text in each element instance in a nice declarative way using the <slot> element. This has more limited sup
port than <template>, available since Chrome 53, Opera 40, Safari 10, Firefox 59, and Edge 79. Slots are identified by their name attribute, and allow you to define placeholders in your template that can be filled with any markup fragment you want when the element is used in the markup. So, if we want to add a slot into our trivial example, we could update our template's paragraph element like this:...
...laceholders in your template that can be filled with any markup fragment you want when the element is used in the markup. So, if we want to add a slot into our trivial example, we could update our template's paragraph element like this: <p><slot name="my-text">My default text</slot></p> If the slot's content isn't defined when the element is included in the markup, or if the browser doesn't sup
port slots, <my-paragraph> just contains the fallback content "My default text". To define the slot's content, we include an HTML structure inside the <my-paragraph> element with a slot attribute whose value is equal to the name of the slot we want it to fill. As before, this can be anything you like, for example: <my-paragraph> <span slot="my-text">Let's have some different text!</span> </my-par...
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
processor looks at all ancestors of the current node and the current node itself, stopping when it reaches a match for the from attribute, if there is one. For each node in this list that matches the count attribute, the processor counts how many preceding matching siblings it has, and adds one for the node itself. If no match is found, the sequence will be an empty list. any (Not sup
ported at this time.) Numbers all matching nodes, regardless of level, sequentially. The ancestor, self, and preceding axes are all considered. The processor starts at the current node and proceeds in reverse document order, stopping if it reaches a match to any from attribute. If no match to the count attribute is found, the sequence will be an empty list. This level is not sup
ported at this time. ...
... over. The sequence begins with the first descendant of the node that matches the from attribute. value Applies a given format to a number. This is a quick way to format a user-supplied number (as opposed to a node sequence number) in any of the standard <xsl:number> formats. format Defines the format of the generated number: format="1" 1 2 3 . . . ...
... letter-value Disambiguates between numbering sequences that use letters. Some languages have more than one numbering system that use letters. ...
...ve the value "alphabetic" or "traditional". The default is "alphabetic". grouping-separator Specifies what character should be used as the group (e.g. thousands) separator. The default is the comma (,). grouping-size Indicates the number of digits that make up a numeric group. The default value is "3". Type Instruction, appears within a template. Defined XSLT, section 7.7 Gecko sup
port Partial sup
port. See comments above. ...
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
Both PIs can contain "pseudo attributes" the same way that the xml-stylesheet PI does. The following document passes the two parameters "color" and "size" to the stylesheet "style.xsl". ...
...Both PIs can contain "pseudo attributes" the same way that the xml-stylesheet PI does. The following document passes the two parameters "color" and "size" to the stylesheet "style.xsl". ...
...tax in xml-stylesheet. Both the xslt-param and the xslt-param-namespace PIs must appear in the prolog of the document, i.e. before the first element tag. All PIs in the prolog must be honored, both ones occurring before and onces occurring after any xml-stylesheet PIs. If there are multiple xml-stylesheet PIs the parameters apply to all stylesheets as a consequence of that all stylesheets are im
ported into a single stylesheet per the XSLT spec.reference? Note that multiple xml-stylesheet XSLT PIs are not sup
ported in Firefox currently. xslt-param The xslt-param PI sup
ports 4 attributes: name The local-name part of the parameter name. No syntax checking is done on the attribute, however if it is not a valid NCName it will never match any parameter in the stylesheet. namespace The na...
... NCName, the PI is ignored. If namespace is missing, the PI is ignored. If namespace is empty, the prefix mapping is removed. Examples Set the parameter 'books' to a nodeset containing all <book> elements in the 'http://www.example.org/myNamespace' namespace: <?xslt-param-namespace prefix="my" namespace="http://www.example.org/myNamespace"?> <?xslt-param name="books" select="//my:book"?> Sup
ported versions Sup
ported as of Firefox 2.0.0.1. The value attribute is sup
ported in Firefox 2, but the select attribute crashes for some expressions in the 2.0 release. Possible future developments Should we allow any XSLT functions in the expression? document() seems useful, but it seems tricky to maintain the invariant that generate-id() should produce the same string for the same document. Wha...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
This document describes the JavaScript interface in Mozilla 1.2 and up to the XSLT Processing Engine (TransforMiiX). Creating an XSLTProcessor To start, you need to create an XSLTProcessor object: var processor = new XSLTProcessor(); Specifying the stylesheet Before you can use it, you must im
port a stylesheet with the XSLTProcessor.im
portStylesheet() method. It has a single parameter, which is the DOM Node of the XSLT stylesheet to im
port. Note: The im
port is live, meaning that if you alter the stylesheet DOM after im
porting it, this will be reflected in the processing. Rather than modifying the DOM it is recommended to use stylesheet parameters which are usually easier and can give better performance. var testTransform = document.implementation.createDocument("", "test", nu...
... easier and can give better performance. var testTransform = document.implementation.createDocument("", "test", null); // just an example to get a transform into a script as a DOM // XMLDocument.load is asynchronous, so all processing happens in the // onload handler testTransform.addEventListener("load", onload, false); testTransform.load("test-transform.xml"); function onload() { processor.im
portStylesheet(testTransform); } XSLTProcessor.im
portStylesheet() requires one argument, a DOM Node. If that node is a document node, you can pass in a full XSL Transform or a literal result element transform, otherwise it must be an xsl:stylesheet or xsl:transform element. Transforming the document You can use the XSLTProcessor.transformToDocument() or XSLTProcessor.transformToFragment() methods ...
...rocessor.im
portStylesheet() requires one argument, a DOM Node. If that node is a document node, you can pass in a full XSL Transform or a literal result element transform, otherwise it must be an xsl:stylesheet or xsl:transform element. Transforming the document You can use the XSLTProcessor.transformToDocument() or XSLTProcessor.transformToFragment() methods to transform a document using the im
ported XSLT stylesheet. transformToDocument XSLTProcessor.transformToDocument() takes one argument, the source node to transform, and returns a new Document with the results of the transformation: var newDocument = processor.transformToDocument(domToBeTransformed); The resultant object depends on the output method of the stylesheet: html - HTMLDocument xml - XMLDocument text - XMLDocument wi...
...ent is itself an HTMLDocument, or if the output method of the stylesheet is HTML. It will not produce an HTML DOM objects if only the toplevel element of the result is <html> as XSLTProcessor.transformToFragment() is rarely used to create this element. If you want to override this, you can set the output method normally in the standard way. transforming HTML Unfortunately it is currently not sup
ported to transform HTML nodes using XSLT. Some things work if you use lower case node-names in patterns and expressions, and treat the nodes as if they are in the null namespace, however this is not very well tested so it might not work in all situations. It is also possible that this will change in a future release. Transforming XHTML should work as expected though. Setting parameters You can con...
Communicating using "postMessage" - Archive of obsolete content
Handling Message Events in the Content Script To send a message from a content script, you use the postMessage function of the global self object: self.postMessage(contentScriptMessage); This takes a single parameter, the message payload, which may be any JSON-serializable value. ...
... case 'mouseover': console.log('mouseover: ' + message.element); break; case 'mouseout': console.log('mouseout: ' + message.element); break; } }); } }); Implementing the same add-on with user-defined events is shorter and more readable: var pageModScript = "window.addEventListener('mouseover', function(event) {" + " self.
port.emit('mouseover', event.target.toString());" + "}, false);" + "window.addEventListener('mouseout', function(event) {" + " self.
port.emit('mouseout', event.target.toString());" + "}, false);"; var pageMod = require('sdk/page-mod').PageMod({ include: ['*'], contentScript: pageModScript, onAttach: function(worker...
...r', event.target.toString());" + "}, false);" + "window.addEventListener('mouseout', function(event) {" + " self.
port.emit('mouseout', event.target.toString());" + "}, false);"; var pageMod = require('sdk/page-mod').PageMod({ include: ['*'], contentScript: pageModScript, onAttach: function(worker) { worker.
port.on('mouseover', function(message) { console.log('mouseover :' + message); }); worker.
port.on('mouseout', function(message) { console.log('mouseout :' + message); }); } }); ...
Working with Events - Archive of obsolete content
Objects emit events on state changes that might be of interest to add-on code, such as browser windows opening, pages loading, network requests completing, and mouse clicks. By registering a listener function to an event emitter an add-on can receive notifications of these events. We talk about content scripts in more detail in the Working with Content Scripts guide. Additionally, if you're using content scripts to interact with web content, you can define your own events and use them to communicate between the main add-on code and the content scripts. In this case one end of the conversation emits the events, and the other end listens to them. ...
...ed with its documentation. listener: the listener itself. This is a function which will be called whenever the event occurs. The arguments that will be passed to the listener are specific to an event type and are documented with the event emitter. For example, the following add-on registers a listener with the tabs module to listen for the ready event, and logs a string to the console re
porting the event: var tabs = require("sdk/tabs"); tabs.on("ready", function () { console.log("tab loaded"); }); It is not possible to enumerate the set of listeners for a given event. The value of this in the listener function is the object that emitted the event. Listening to all events You can pass the wildcard "*" as the type argument. If you do this, the listener will be called for any e...
... panel.show({ position: button }); } This wildcard feature does not yet work for the tabs or windows modules. Adding Listeners in Constructors Event emitters may be modules, as is the case for the ready event above, or they may be objects returned by constructors. In the latter case the options object passed to the constructor typically defines properties whose names are the names of sup
ported event types prefixed with "on": for example, "onOpen", "onReady" and so on. Then in the constructor you can assign a listener function to this property as an alternative to calling the object's on() method. For example: the ActionButton object emits an event when the button is clicked. The following add-on creates a button and assigns a listener to the onClick property of the options object s...
passwords - Archive of obsolete content
HTML Form Credential If a web service uses HTML forms to authenticate its users, then the corresponding credential is an HTML Form credential. It contains the following properties: username The username. password The password. url The URL for the web service which requires the credential. You should omit anything after the hostname and (optional)
port. formSubmitURL The value of the form's "action" attribute. You should omit anything after the hostname and (optional)
port. If the form doesn't contain an "action" attribute, this property should match the url property. usernameField The value of the "name" attribute for the form's username field. passwordField The value of the "name" attribute for the form's p...
... HTTP Authentication Credential These are used to authenticate the user to a web site which uses HTTP Authentication, as detailed in RFC 2617. They contain the following properties: username The username. password The password. url The URL for the web service which requires the credential. You should omit an...
...ted. HTTP Authentication Credential These are used to authenticate the user to a web site which uses HTTP Authentication, as detailed in RFC 2617. They contain the following properties: username The username. password The password. url The URL for the web service which requires the credential. You should omit anything after the hostname and (optional)
port. realm The WWW-Authenticate response header sent by the server may include a "realm" field as detailed in RFC 2617. If it does, this property contains the value for the "realm" field. Otherwise, it is omitted. The realm is displayed in Firefox's Password Manager, under "Site", in brackets after the URL. So: if a web server at http://www.example.com requested authe...
private-browsing - Archive of obsolete content
ows, so they will need to use the private-browsing module to check whether objects are private, so as to avoid storing data derived from such objects. Additionally, add-ons that use low-level modules such as window/utils may see private browser windows with certain functions, even if they have not explicitly opted into private browsing. Respecting private browsing The private-browsing module ex
ports a single function isPrivate() that takes an object, which may be a BrowserWindow, tab, or worker, as an argument. It returns true only if the object is: a private window, or a tab belonging to a private window, or a worker that's associated with a document hosted in a private window any window, tab, or worker if the browser has been configured to never remember history (Options->Privacy->H...
....title); } else { console.log("not storing, private data"); } }); Here's an add-on that uses a page-mod to log the content of pages loaded by the user, unless the page is private. ...
...For example, the "Downloads" window might want to display all do...
simple-storage - Archive of obsolete content
It's a normal JavaScript object, and you can treat it as you would any other. ...
...The easiest solution to this problem is to use the --profile option to jpm with a path to a profile - not just a profile name. You may also need to include the --no-copy option to prevent Firefox from copying the profile to a temporarry directory each time it starts. jpm run --no-copy --profile path/to/profile/dir If you specify a non-existent profile, the same will be created, don't worry. Im
portant: If you use this method, you must end your debugging session by quitting Firefox normally, not by cancelling the shell command. If you don't close Firefox normally, then simple storage will not be notified that the session is finished, and will not write your data to the backing store. Accessing storage from the console In the Add-on Debugger, you can access your add-on's simple-storage pro...
...and. If you don't close Firefox normally, then simple storage will not be notified that the session is finished, and will not write your data to the backing store. Accessing storage from the console In the Add-on Debugger, you can access your add-on's simple-storage programmatically from the console using the following: loader.modules['resource://gre/modules/commonjs/sdk/simple-storage.js'].ex
ports.storage Clarification from Mozilla needed: Writing the above line in Add-on Debugger console results in "ReferenceError: loader is not defined". Constructing arrays Be careful to construct array objects conditionally in your code, or you may zero them each time the construction code runs. For example, this add-on tries to store the URLs of pages the user visits: var ss = require("sdk/simpl...
windows - Archive of obsolete content
mmon window events such as open and close Private windows If your add-on has not opted into private browsing, then you won't see any private browser windows. Private browser windows won't appear in the browserWindows property, you won't receive any window events, and you won't be able to open private windows. To learn more about private windows, how to opt into private browsing, and how to sup
port private browsing, refer to the documentation for the private-browsing module. Converting to chrome windows To convert from the BrowserWindow objects used in this API to the chrome window objects used in the window/utils API, use the viewFor() function ex
ported by the viewFor module. To convert back the other way, from a chrome window to a BrowserWindow object, use the modelFor() function, expo...
...action button API, which is only available from Firefox 29 onwards. Parameters options : object Required options: Name Type url string String URL to be opened in the new window. This is a required property. isPrivate boolean Boolean which will determine whether the new window should be private or not. If your add-on does not sup
port private browsing this will have no effect. See the private-browsing documentation for more information. Optional options: Name Type onOpen function A callback function that is called when the window has opened. This does not mean that the URL content has loaded, only that the window itself is fully functional and its properties can be accessed.
...nactive window is made active. Arguments Window : Listeners are passed the window object that has become active. deactivate Event emitted when the active window is made inactive. Arguments Window : Listeners are passed the window object that has become inactive. BrowserWindow A BrowserWindow instance represents a single open window. They can be retrieved from the browserWindows property ex
ported by this module. var windows = require("sdk/windows").browserWindows; //Print how many tabs the current window has console.log("The active window has " + windows.activeWindow.tabs.length + " tabs."); // Print the title of all browser windows for (let window of windows) { console.log(window.title); } // close the active window windows.activeWindow.close(function() { ...
content/worker - Archive of obsolete content
The Worker is similar to the web worker interface defined by the W3C. But unlike "web workers," these workers run in the same process as web content and browser chrome, so code within workers can block the UI. Globals Constructors Worker(options) Creates a content worker. ...
...listed below. Methods postMessage(data) Asynchronously emits "message" events in the enclosed worker, where content script was loaded. Parameters data : number,string,JSON The data to send. Must be stringifiable to JSON. destroy() Destroy the worker by removing the content script from the page and removing all registered listeners. A detach event is fired just before removal. Properties
port Object that allows you to: send customized messages to the worker using the
port.emit function receive events from the worker using the
port.on function url The URL of the content. tab If this worker is attached to a content document, returns the related tab. Events message This event allows the content worker to receive messages from its associated content scripts. Calling the self.
...unloaded or the worker's destroy() method is called. ...
system/child_process - Archive of obsolete content
Experimental An implementation of the node.js child_process API. This module enables you to execute a child program in a new process. Since it emulates the node.js child_process API, it's not documented separately here. However, there are a few differences to be aware of: you need to require() the module using require("sdk/system/child_process") fork() is not sup
ported gid and uid are not sup
ported in node.js, spawn() and exec() inherit the environment variables from the parent process, by default. The SDK versions don't: so when you specify a command you must pass in a complete path to the command or use the env option to set up the child process environment. child.stdin has no write() method (see example below for writing to child process stdin) Examples Adaption of node's doc...
...ild process' stdin Because the SDK implementation does not include a write() method for child processes, you must use the "raw" emit event. ...
...rocesses, you must use the "raw" emit event. ...
Getting started (cfx) - Archive of obsolete content
ed the add-on and are ready to distribute it, you'll need to package it as an XPI file. This is the installable file format for Firefox add-ons. You can distribute XPI files yourself or publish them to https://addons.mozilla.org so other users can download and install them. To build an XPI, just execute the command cfx xpi from the add-on's directory: cfx xpi You should see a message like: Ex
porting extension to my-addon.xpi. To test that this worked, try installing the XPI file in your own Firefox installation. You can do this by pressing the Ctrl+O key combination (Cmd+O on Mac) from within Firefox, or selecting the "Open" item from Firefox's "File" menu. This will bring up a file selection dialog; navigate to the "my-addon.xpi" file, open it and follow the prompts to install the add-...
...: cfx run -o This instructs cfx to use the local copies of the SDK modules, not the ones in Firefox. Developing without cfx run Because cfx run restarts the browser each time you invoke it, it can be a little cumbersome if you are making frequent changes to an add-on. An alternative development model is to use the Extension Auto-Installer add-on: this listens for new XPI files on a specified
port and installs them automatically. That way you can test new changes without needing to restart the browser: make a change to your add-on run cfx xpi post the add-on to the
port specified You could even automate this workflow with a simple script. For example: while true ; do cfx xpi ; wget --post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ; done Note that the logging level defined ...
...p 5 ; done Note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using cfx run. This means that if you want to see output from console.log() messages, you'll have to tweak a setting. See the documentation on logging levels for the details on this. ...
Downloading Files - Archive of obsolete content
ng methods of downloading files may not work as expected after Firefox 26, and should no longer be used. Please use Downloads.jsm instead. Downloading files To download a file, create an instance of nsIWebBrowserPersist and call its nsIWebBrowserPersist.saveURI() method, passing it a URL to download and an nsIFile instance representing the local file name/path. ...
...ags = persist.PERSIST_FLAGS_FROM_CACHE | persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES; persist.saveURI(uriToSave, null, null, null, "", targetFile, privacy); If you don't need detailed progress information, you might be happier with nsIDownloader. ...
...BrowserPersist instance to an object that implements nsIAuthPrompt. Normally, nsIAuthPrompt expects a prompt to be displayed so the user can enter credentials, but you can return a username and password credentials directly without prompting the user. If you want to open a login prompt, you can use the default prompt by calling the window watcher's getNewAuthPrompter() method. Components.utils.im
port("resource://gre/modules/PrivateBrowsingUtils.jsm"); const WebBrowserPersist = Components.Constructor("@mozilla.org/embedding/browser/nsWebBrowserPersist;1", "nsIWebBrowserPersist"); var persist = WebBrowserPersist(); // Obtain the privacy context of the browser window that the URL // we are downloading comes from. If, and only if, the URL is not...
Examples and demos from articles - Archive of obsolete content
ts in order to standardize and simplify the instantiation of them. Here is a possible and minimalist example of such abstraction, which for this reason we named MiniDaemon. [article] Image preview before upload [html] The FileReader.prototype.readAsDataURL() method is useful, for example, to get a preview of an image before uploading it. [article] Note: The FileReader() constructor was not sup
ported by Internet Explorer for versions before 10. For a full compatibility code, see also our crossbrowser possible solution for image preview. Determine if an element has been totally scrolled [html] This example shows how to determine whether a user has completely scrolled an element or not. [article] CSS Pure-CSS dropdown menu [html] With the :hover pseudo-class you can create complex c...
...ulate an editable <select> through a fieldset of radioboxes and textboxes. [article] Expandable elements [html] This example shows how it is possible to show/hide classes of elements in pure CSS. In this demo there is also an example of a "toggle button" rendered through a <label> element. [article] Code snippets and tutorials JavaScript Complete cookies reader/writer with full unicode sup
port This little framework consists of a complete cookies reader/writer with unicode sup
port. XML to JSON conversion snippets (JXON) JXON (lossless JavaScript XML Object Notation) is a generic name by which is defined the representation of JavaScript Objects using XML. There are no real standards for this conversion, but some conventions begin to appear on the web. Autogrowing <textarea> This exa...
...des a working (minimalist) example of a pure-AJAX web site composed only of three pages. Do something if current document has changed since last visit Here is a possible example of how to show an alert message when current document changes. Do something if an external page has changed since last visit Here is a possible example of how to show an alert message when an external page changes. Im
port scripts Here is a possible example of how to dynamically im
port scripts with JavaScript. CSS CSS Tutorial Aimed at complete beginners, this CSS tutorial for beginners introduces you to Cascading Style Sheets (CSS). It guides you through the basic features of the language with practical examples that you can try for yourself on your own computer and illustrates the standard features of CSS ...
JavaScript Debugger Service - Archive of obsolete content
cript stack trace using the JSD. Note that onError is called for every exception. ...
...ry exception. ...
...ineNo, colNo, flags, errnum, exc) { dump(message + "@" + fileName + "@" + lineNo + "@" + colNo + "@" + errnum + "\n"); // check message type var jsdIErrorHook = Components.interfaces.jsdIErrorHook; var messageType; if (flags & jsdIErrorHook.RE
PORT_ERROR) messageType = "Error"; if (flags & jsdIErrorHook.RE
PORT_WARNING) messageType = "Warning"; if (flags & jsdIErrorHook.RE
PORT_EXCEPTION) messageType = "Uncaught-Exception"; if (flags & jsdIErrorHook.RE
PORT_STRICT) messageType += "-Strict"; dump(messageType + "\n"); return false; // trigger debugHook // return true; if you do not wish to trigger debugHook } }; // note that debugHook does not _always_ trigger when jsd.errorHook[onError] returns false // it is not well-known why debugHook sometimes fail...
LookupNamespaceURI - Archive of obsolete content
Here is an implementation of Node.lookupNamespaceURI which should work cross-browser. Note that all Gecko-based browsers (including Firefox) sup
port Node.lookupNamespaceURI. This function is not necessary for Gecko-based browsers (though the function will quickly return the standard value for Mozilla browsers) when used to reflect on static documents. However, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with Node.prefix). ...
...rowsers (though the function will quickly return the standard value for Mozilla browsers) when used to reflect on static documents. However, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with Node.prefix). ...
...NamespaceURIHelper (node, prefix) { // adapted directly from http://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespaceURIAlgo var i, att, htmlMode = document.contentType, // Mozilla only xmlnsPattern = /^xmlns:(.*)$/; switch (node.nodeType) { case 1: // ELEMENT_NODE (could also just test for Node.ELEMENT_NODE, etc., if sup
ported in all browsers) if (node.namespaceURI != null && node.prefix === prefix) { // Note: prefix could be "null" in the case we are looking for default namespace return node.namespaceURI; } if (node.attributes.length) { for (i = 0; i < node.attributes.length; i++) { at...
Extension Etiquette - Archive of obsolete content
ion, for instance, might all be prefixed with cool-beans-. Global variables might all be defined as properties of the CoolBeans object. Some namespaces have specific conflict prevention conventions, which should be followed as appropriate. XPCOM contract IDs, for instance, should always begin with an @, followed by a domain name that the author controls, e.g., "@example.com/foo/bar;1" It is im
portant that the prefix that you use be unlikely to conflict with other code, and that it be indicative of the name of your add-on. Generic prefixes such as myextension-, or short prefixes such as ffx-, are likely to be used elsewhere, and therefore unsuitable to the purpose. Call .noConflict(true) where applicable Many common libraries which create global variables provide a method called noCon...
...vailable, these methods should always be used to prevent conflicts with third-party code. Names and Metadata Naming Be creative! Don't be redundant and include "extension," "Mozilla/Firefox/Thunderbird," or the version number in the name. Be original! Descriptions Use something that is descriptive, but that would fit in the default add-on manager width. The Mozilla extensions (Inspector/Re
porter/Talkback) believe starting with a verb is the best way. For example, "Does an action in the browser." Documentation Assume that the vast majority of your users don't have inner working knowledge of Mozilla. Make sure your extension's homepage states the "obvious," including the purpose of your extension. Users also appreciate when your extension is shipped with a simple how-to document. IDs ...
...uate -- don't require people to tweak options in order to get your extension's core functionality. Preferences' internal names Internal Firefox preference names for extensions or to be clear, the name of the preference as it appears in the about:config, should start with "extensions.," then the name of the extension, with a dot, then the name of the preference. For instance, a boolean for the Re
porter extension's option for hiding the privacy statement is "extensions.re
porter.hidePrivacyStatement". General Dependencies Requiring a user to download another extension in order to use yours isn't nice. Avoid the dependency on other extensions, especially extensions that you didn't develop. ...
Inline options - Archive of obsolete content
The user interface for the preferences defined with this new syntax appears in the extension's detail view in the Add-on Manager. This functionality originally appeared in Firefox mobile and is now available in Firefox on the desktop as well. Options file The XUL allowed for the inline options is limited to a few new tags. ...
... mydialog SYSTEM "chrome://myaddon/locale/mydialog.dtd"> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting type="bool" pref="extensions.myaddon.bool" title="Boolean" desc="Stored as a boolean preference" /> </vbox> Note that it's limited to <setting> tags. The root <vbox> just acts as a container, it isn't merged into the main window. If you need script sup
port, see the display notifications section. Setting types There are several types of <setting>s, each with a different type attribute: type attribute displayed as preference stored as bool checkbox boolean boolint checkbox integer (use the attributes on and off to specify what values to store) integer textbox integer string te...
...So like for the type="file", once a user browses and picks a file, when it updates the label it will trigger the oninputchanged attribute. So if you would like to do some changes to the XUL on the inline options page you can do so. The this value is the setting XUL element. See MXR for what all this holds: http://mxr.mozilla.org/mozilla-release/source/toolkit/mozapps/ext...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
: What does nsILocalFile.initWithPath do? What arguments does it take? How is nsILocalFile.initWithPath actually implemented? Let's examine these questions one at a time. What does this do? What arguments does it take? First we'll search for the component's definition. Type interface nsILocalFile (with a trailing space) in the search field and go. Nearly all components inherit from nsISup
ports (FIXME: why 'Nearly' ?), so adding a trailing space when you search serves as a delimiter on the inheritance position, and makes it easier to specify what you're looking for (see Figures 6, 7).4 This results in the file nsILocalFile.idl. Let's display it. Every method includes explanatory comments. In initWithPath, the nsILocalFile object gets initialized, and any information already in it get...
...onzui for win32" http://soutaro.com/gonzui-win32/ Run it as follows: Download gonzui-win32-1.2.2.zip and expand it into a suitable directory. Download the Firefox source code and place it in the same directory as gonzui (simply because it's easier to specify a file that's in the same directory). Open a command prompt and navigate to the directory containing gonzui. ...
...o.com/gonzui-win32/ Run it as follows: Download gonzui-win32-1.2.2.zip and expand it into a suitable directory. Download the Firefox source code and place it in the same directory as gonzui (simply because it's easier to specify a file that's in the same directory). Open a command prompt and navigate to the directory containing gonzui. The next command will im
port the source code: gonzui-im
port.exe mozilla Once the im
port process is complete, type the following command to launch the gonzui server: gonzui-server.exe Now you can access gonzui from your web browser by typing the following into your location bar : http://localhost:46984 This lets you browse all packages, click on links to traverse them, and take traversed-link locations as search starting points (Figure A). FIXME: Figu...
Adding Events and Commands - Archive of obsolete content
event name without the "on" prefix, while element attributes do have the prefix. There's a long list of events you can listen to, and which you use depend on the situation. Elements only implement the events that are relevant to them, but there are several events that are implemented for most elements. These are some notable events you should keep in mind: oncommand. This is one of the most im
portant and commonly used events in XUL. It's very useful because it represents the most common action for input controls such as menu items, buttons and checkboxes. For a button, it represents the action of the user clicking on it, or focusing it with the keyboard and then pressing the ENTER key. It's an abstraction of the main way to interact with a control element. onselect. Fired when the selecti...
...ith it. Also keep in mind that there are 2 drag and drop APIs, the newest (and preferred) one introduced in Firefox 3.5. Event handlers can take an event argument, which is an Event object that holds information on the event. You can get information on key modifiers (in case the user was holding a modifier key like Alt while performing the event), screen coordinates for mouse events, and most im
portantly, the target element for the event. For example: <button label="&xulschoolhello.defaultGreeting.label;" oncommand="XulSchoolChrome.BrowserOverlay.changeGreeting(event);" /> Then on the Javascript code you would have something like this: changeGreeting : function(aEvent) { // more stuff aEvent.target.setAttribute("label", someNewGreeting); } The target in this example is the button...
...u a solid foundation to handle interaction between web content and XUL. Additional information on custom events and how they can be used to effect communication between web content and XUL can be found in the Interaction between privileged and non-privileged pages code snippets, which describe and provide examples of this sort of communication. Broadcasters Keeping a consistent UI is another im
portant aspect of extension behavior. Maybe your extension needs to disable or enable a series of controls when the user logs in or out of a service, or when Firefox detects it's online or offline. It's common that you need to change several elements at the same time, and this can be difficult to manage through JavaScript. The broadcaster element can help you out in these cases. First you need to add...
Signing an extension - Archive of obsolete content
article describes how to digitally sign your extension for Firefox and Thunderbird, with a code signing certificate for Object Signing. The following instructions also apply to a theme and other XPI files. These instructions assume you're working on Mac and you've already got a valid certificate from CA. Get the signing tool We use NSS to sign an extension. This can be easily installed with Mac
Ports. sudo
port install nss Ex
port your certificate If you have your certificate in Firefox, ex
port it by following the steps below. The certificate which the author purchased from VeriSign was directly installed to Firefox. Click the Firefox button and select Options. In the Options window, open the Advanced panel, then select the Encryption tab. Click View Certificates. In the Certificate ...
... the Firefox button and select Options. In the Options window, open the Advanced panel, then select the Encryption tab. Click View Certificates. In the Certificate Manager, select the Your Certificates tab. Select your organization's certificate and click Backup. Enter the file name, e.g. codesign.p12. Enter the password to protect your certificate backup and click OK. A P12 file will be ex
ported on your desktop. Create a certificate database First, create a certificate database that will be used for signing. mkdir keystore cd keystore nss-certutil -N -d . You will be asked for the password. Use a strong password to protect your database. Then cert8.db, key3.db and secmod.db will be generated. Next, im
port your certificate. nss-pk12util -i codesign.p12 -d . Show the certificate l...
...o the content area of Firefox. On the installation dialog, you can see your organization name along with the file name. References Signing a XPI - more detailed instructions including test procedures. Key Manager - a Firefox extention that has the ability to sign XPI files. Signing a Firefox extension with a Windows Authenticode SSL certificate / key - Note that some CAs do not allow (or sup
port) to divert an Authenticode certificate to Object Signing. Please check the terms of service. Signing an executable with Authenticode - for signing executable file (exe) ...
Case Sensitivity in class and id Names - Archive of obsolete content
e can affect your site design and best practices to avoid any problems. In the authoring of both CSS and JavaScript/DOM (otherwise known as DHTML) routines, it is a near-certainty that class and id names will be used to identify elements. We have discovered, however, that many authors are running into trouble with class and id names because they're used to the bugs of browsers that don't fully sup
port open standards. The most common case is where the name uses different case in the document source than is found in the CSS or JavaScript. For example, there might be this CSS: p.Warning {color: red; background: yellow;} ...coupled with this HTML: <p class="warning">WARNING!</p> In Netscape 6, the paragraph in question will have neither red text nor a yellow background. As far as Netscape 6 is c...
...wo different identifiers, because HTML 4.01 defines class and id names to be case-sensitive. (For a detailed explanation of what HTML 4.01 says, see the following section, "Why So Case-Sensitive?") The only way to avoid this particular problem is to make sure that your class and id names have consistent case throughout the entire document, and with respect to your CSS and JavaScript. It is also im
portant to avoid using class or id names which are a case-insensitive match within the same document. For example, you would not want to do something like: .Urgent {color: purple;} .urgent {color: yellow;} Even though these are technically two distinct class names, browsers other than Netscape 6 will treat them as though they are the same thing. Therefore, authors should not rely on case-sensitivity ...
...te id for name and the point would be the same, since name and id share the same name space (see section 12.2.3). Thus, even though class and id values are defined to be case-sensitive, there is an aspect of case-insensitivity to the use of id values. Recommendation Because of the flaws which are present in some existing implementations and the restrictions defined in HTML 4.01, it is doubly im
portant to ensure that your class and id names are of a consistent case throughout a document, and that you do not attempt to define names which are case-insensitive matches. Related Links HTML 4.01, section 7.5.2 HTML 4.01, section 12.2.3 Original Document Information Author(s): Eric A. Meyer, Netscape Communications Last Updated Date: Published 05 Mar 2001 Copyright Information: Copyrigh...
Defining Cross-Browser Tooltips - Archive of obsolete content
o define "tooltips" in a cross-browser, standards-friendly way. Authors are used to using the alt attribute to create "tooltips" in Web browsers. The classic example is a "tooltip" of an image; when the user pauses the mouse pointer over an image, the contents of the alt attribute are displayed as a "tooltip." Gecko-based browsers such as Mozilla, Netscape 6+, and Compuserve 7 do not sup
port this behavior. See bug 25537 for a lengthy, sometimes passionate discussion of Gecko's behavior in this regard. The Problem According to the HTML 4.01 definition of the alt attribute: alt = text CS For user agents that cannot display images, forms, or applets, this attribute specifies alternate text. The language of the alternate text is specified by the lang attribute. In other words, al...
...te text. The language of the alternate text is specified by the lang attribute. In other words, alt text should only be displayed when a user agent cannot display the primary content of the element (e.g., a text-mode browser that cannot display images). In a visual browser, the image should be displayed and the alt text should not. This assumes that the browser can find the image and that it sup
ports the image format used; if either of these is not true, and the image cannot be displayed, then the alt text should be displayed in place of the missing image. On the other hand, the HTML 4.01 definition of the title attribute states: title = text CS This attribute offers advisory information about the element for which it is set. Unlike the TITLE element, which provides information about a...
... On the other hand, the HTML 4.01 definition of the title attribute states: title = text CS This attribute offers advisory information about the element for which it is set. Unlike the TITLE element, which provides information about an entire document and may only appear once, the title attribute may annotate any number of elements. Please consult an element's definition to verify that it sup
ports this attribute... Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object). Between these two passages, it is fairly clear that the proper method for defining a "tooltip" for an image (or, indeed, for any element) is ...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
nks to Mozilla's thorough implementation of CSS2, the problem of inline images in table cells forcing open unwanted space has come to the attention of the CSS Working Group. There have been many proposals to fix the problem, but one of the most promising approaches is the property line-box-contain, which has been proposed for inclusion in CSS3. Should this property be adopted, then any browser sup
porting it could emulate traditional "shrinkwrap" behavior without risking other layout upset with the following rule: td {line-box-contain: font replaced;} /* proposed for CSS3 */ There are other possible fixes contained within the current CSS3 Working Drafts, such as line-height-policy. Obviously, the sooner a solution can be found and implemented, the happier authors everywhere will be. Recomme...
... traditional "shrinkwrap" behavior without risking other layout upset with the following rule: td {line-box-contain: font replaced;} /* proposed for CSS3 */ There are other possible fixes contained within the current CSS3 Working Drafts, such as line-height-policy. Obviously, the sooner a solution can be found and implemented, the happier authors everywhere will be. Recommendations Absent sup
port for CSS3, it is difficult to provide a clear set of steps for fixing every instance of these problems, because the best solution for a given document will greatly depend on its structure. If your document uses transitional markup, make sure your DOCTYPE reflects that fact and does not trigger "standards" mode. This will prevent browsers from using standards-based rendering, and thus all the image...
... should be vertically aligned with the bottom of the line box. Any image in a table cell with other images and text should have its vertical alignment changed as necessary, if at all. With a judicious mixture of approaches and a reduction of single-pixel image tricks-- which, in a CSS-capable browser, are unnecessary anyway-- it is quite possible to sidestep this strange effect of standards sup
port. The best solution may be to ensure that images are always in a cell by themselves, thus allowing authors to make them block-level, but as always this will depend on the author's design. Related Links Gecko's Almost Standards Mode Mozilla's Quirks Mode Original Document Information Author(s): Eric A. Meyer Last Updated Date: March 21st, 2003 Copyright (C) 2001-2003 Netscape. ...
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
Introduction Microsoft has removed sup
port for Netscape plug-ins from IE 5.5 SP 2 and beyond. If you are a plug-in author, you may find this project saves you a lot of work! This page describes a control that implements the NP API and hosts most Netscape-compatible plug-ins. Now you can use your plug-ins in any recent version of IE or in any other ActiveX container for that matter. The control itself is implemented in a DLL called pluginhostctrl.dll which is standalone from the rest of the Mozilla project. If you're wondering how Microsoft used to sup
port the NP API, look for a file called plugin.ocx in your Windows system directory. This 100k ActiveX control contains the entire NP API implementation and probably worked much like pluginhostctrl.dll does now. The sections below tell you...
... Build it It is quite simple to build the control Locate the pluginhostctrl directory: Open pluginhostctrl.dsp Build "Win32 Debug" or another target Open some of the test files under pluginhostctrl\tests in Internet Explorer to verify the control has built and registered correctly. The control currently reads plug-ins from your most current Netscape 4.x and IE installations. There is no sup
port for Mozilla or NS 6.x yet. A note to developers If you intend to modify this control IN ANY WAY then you MUST also change the CLSID from {DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2} to something else and any other GUIDs this control relies upon (IID, LIBIDs etc). This is necessary so that your control may coexist with the generic version and any other versions that other plug-ins vendors may have inst...
...ill redirect you to this page when you do not have the correct plug-in installed. You may also supply any custom plug-in parameters as additional <PARAM> elements. Still to do Only hosts windowed plug-ins. An official pluginhostctrl.cab file. Doesn't work for the Adobe Acrobat plug-in yet. Plug-ins cannot create writeable streams or seek in readable streams. LiveConnect scripting is not sup
ported. If you need scripting functionality, consider shipping a modified pluginhostctrl.dll that exposes methods you wish to call on your plugin. ...
Autodial for Windows NT - Archive of obsolete content
Autodial Addresses db, and a set of heuristics are used to determine if an address is already in the database or not. Essentially, if some address at domain.com is in the database, then any address at domain.com is considered to be in the database. Also, if any address that starts with www is in the database, then any other address that begins with www is considered to be in the database. It is im
portant to note that the function of this system service in no way depends on the settings found in Control Panel | Internet Options | Connections. Since the service is the correct way to use autodial for these OSs, the first part of the fix to this bug is to help users of the service. Generally, if the service is running, and an address can't be reached, the autodial helper adds the address to the RA...
...to use the autodial feature whenever you are not connected to the LAN, it's probably better to use the Control Panel | Internet Options | Connections options. Select "Dial whenever a network connection is not present" or "Always dial my default connection". These two behave the same for Mozilla, and trigger autodial when you fail to reach a requested address. Issues There have been a few bug re
ports filed against this new feature that are the result of the fact that Mozilla now looks at the Control Panel | Internet Options | Connections settings. Some users have had the autodial setting turned on, but Mozilla never triggered them before. Starting in Mozilla 1.1, autodial is triggered whenever an address can't be reached (Mozilla now mimics the Remote Access Autodial service.) See bug 160846...
...e more reliably. I don't see a need to expose this pref in the UI, but perhaps it should be there. Or pehaps we should assume Mozilla users can configure the autodial service and disable the helper by default, but Netscape users need a little more help, and enable it for them. Original Document Information Author(s): Benjamin Chuang Last Updated Date: October 2, 2002 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Building TransforMiiX standalone - Archive of obsolete content
Read the build instructions for your platform to get the requirements, which are the same as for Mozilla. You need to get the source from CVS. Add TX_EXE=1 mk_add_options BUILD_MODULES="xpcom transformiix" ac_add_options --enable-standalone-modules="xpcom transformiix" to your .mozconfig, and use client.mk to pull as usual. ...
...usual. This will pull the necessary subtree with mozilla/client.mk mozilla/build/unix/modules.mk mozilla/build mozilla/config mozilla/expat mozilla/extensions/transformiix mozilla/include mozilla/allmakefiles.sh mozilla/client.mk mozilla/aclocal.m4 mozilla/configure mozilla/configure.in mozilla/Makefile.in plus nspr and xpcom from the cvs repository. Building from a full mozilla tree is not sup
ported. It is recommended to add ac_add_options --disable-gtktest ac_add_options --without-jpeg ac_add_options --without-zlib ac_add_options --without-png ac_add_options --without-x to your .mozconfig, too, as it stops configure from testing unneeded libs. make -f client.mk build as usual. Of course, make -f client.mk checks out and builds just TransforMiiX alright. The binary transformiix...
...ld as usual. Of course, make -f client.mk checks out and builds just TransforMiiX alright. ...
Structure of an installable bundle - Archive of obsolete content
l.rdf Extension/Theme Install Manifest /application.ini Application Launch Manifest /bootstrap.js The bootstrap script for extensions not requiring a restart (those with <em:bootstrap>true</em:bootstrap> in their install.rdf). Note that other files and directories (e.g. chrome.manifest, components, defaults) in bootstrapped extensions are not processed by a sup
porting application. (>=2.0) /chrome.manifest Chrome Registration Manifest (>=1.8) /components/* XPCOM components (*.js, *.dll), and interface files from *.xpt (>=1.7) /defaults/preferences/*.js Default Preferences (>=1.7) /plugins/* NPAPI Plugins (>=1.8) /chrome/icons/default/* Window Icons (>=1.8) /icon.png Ext...
... /dictionaries/*.{aff|dic} Myspell dictionaries Firefox 2 and greater Of course, an extension need not (and normally won't) have all of these directories. Themes are limited for security reasons, and can normally only provide a chrome.manifest which registers the theme and a JAR file. Platform-specific files Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) removed sup
port for platform-specific subdirectories, described below. Instead, you need to use manifest flags, such as the OS and ABI flags, in your chrome manifest to specify components that should be loaded for specific platforms. For example: binary-component components/windows/mycomponent.dll ABI=WINNT_x86-msvc binary-component components/mac/mycomponent.dylib ABI=Darwin_x86-gcc3 binary-component componen...
...omponent components/mac/mycomponent.dylib ABI=Darwin_x86-gcc3 binary-component components/mac/mycomponent64.dylib ABI=Darwin_x86_64-gcc3 binary-component components/linux/mycomponent.so ABI=Linux_x86-gcc3 This also means you can no longer have platform-specific preference files in your bundle. Platform-specific subdirectories: Gecko 1.9.2.x and earlier Note: Platform-specific subdirectory sup
port was removed in Gecko 2.0. See the section Platform-specific files to learn how to use platform-specific files. In some cases a single extension or application may wish to include binary component or plugins for multiple platforms, or theme authors might want to include multiple platform-specific JAR files. To facilitate the first case, the extension/app loader has special sub-directories specif...
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
or be officially registered with IANA (unlikely) or be a standard type (e.g. if you want to play MPEG files). file extension reflects the data type handled by the plugin, esp. when loaded from local disk on Windows. Build Create a new project in Visual Studio for a Win32 GUI library (DLL) (in .NET 2003: Win32 template, then switch to DLL in Application Settings in the following dialog, ex
port symbols too?)(in Visual Studio 2008, it is Visualc++|Win32|Win32 Project, then check DLL in the wizard). If a wizard gives you a checkbox to create an empty project, then check it. Otherwise you'll delete files later. Again note that the resulting DLL filename must start with "np", so either call your project like this or rename the file later Delete the .cpp and .h and ReadMe files from the p...
...th (example : C:\npapi-sdk\headers) to Project Properties|(all configurations)|C++|General|Additional Include Directories. Note: If your project is still empty, the C++ tree might not be visible. So, add some files first. Add the following preprocessor definitions to Project Properties|(all configurations)|C++|Preprocessor|Preprocessor Definitions: WIN32;_WINDOWS;XP_WIN32;XP_WIN;_X86_;NPSIMPLE_EX
PORTS Disable precompiled headers using Project Properties|(all configurations)|C++|Precompiled headers|Create/Use precompiled header. They may be already disabled. Define the function ex
ports by adding the .def filename (e.g. nprt.def) to Project Properties|(all configurations)|Linker|Input|Module Definition File. It could be either the full path or the path relative to the project directory. Opti...
...You have to add #include "nptypes.h" in top of plugin.h file. Feel free to append here your issues fixes if the above guide helped you. ...
Creating a hybrid CD - Archive of obsolete content
Many Mozilla files have long file names which makes creating the CD on a Macintosh difficult because the HFS filesystem limits the length of file names to 32 characters. The utility mkhybrid lets you create hybrid CDs that work with all three filesystems. ...
... 'MSWD' 'WDBN' "Word file" .mov Raw 'TVOD' 'MooV' "QuickTime Movie" .bin Raw 'SITx' 'BINA' "Mac Binary" .h Ascii 'CWIE' 'TEXT' "C/C++ header file" .c Ascii 'CWIE' 'TEXT' "C source file" .cp Ascii 'CWIE' 'TEXT' "C++ source file" .cpp Ascii 'CWIE' 'TEXT' "C++ source file" .exp Ascii 'CWIE' 'TEXT' "Symbol ex
port file" .mcp Raw 'CWIE' 'MMPr' "CodeWarrior project file" .r Ascii 'MPS ' 'TEXT' "Rez file" .html Ascii 'MOSS' 'TEXT' "HTML file" .htm Ascii 'MOSS' 'TEXT' "HTML file" .txt Ascii 'MOSS' 'TEXT' "text file" README Ascii 'MOSS' 'TEXT' "text file" CHANGES Ascii 'MOSS' 'TEXT' "text file" INSTALL Ascii 'MOSS' 'TEXT' "text f...
... ...
Developing New Mozilla Features - Archive of obsolete content
Our cross-platform component model ("XPCOM") is similar to COM, but you'll want to make sure you use it well before going too far with your project. ...
...n some cases the developers may be in error and staff will work to make this clear and get you connected. In other cases, mozilla.org staff may agree with the developers that it does not make sense for them to spend much time assisting with your project. This is a painful setting and we hope it doesn't happen often. But our developers are a precious commodity and their time is probably the most im
portant resource we have. It's also possible that a developer is over-worked or on vacation or just drops the ball. Obviously, we'll never reach perfection but we need to reduce these occurrences as much as possible to have a successful project. If this happens to you, let us know. We'll talk to the developers in question, find others to help you, and try to improve your experience with the project. ...
...itted to this style of development, but recognize that vigilance is necessary to make sure newcomers and their features don't get lost. If you're having a particularly bad experience or if you've got suggestions on how to improve our process, please let mozilla.org staff know. Original Document Information Author(s): Mitchell Baker Last Updated Date: October 30, 2004 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Drag and drop events - Archive of obsolete content
drag Sent when a drag operation begins. dragend Sent when a drag operation ends. ...
... drag Sent when a drag operation begins. dragend Sent when a drag operation ends. ...
... drag Sent when a drag operation begins. dragend Sent when a drag operation ends. ...
Drag and Drop - Archive of obsolete content
This section describes how to implement objects that can be dragged around and dropped onto other objects. The Drag and Drop Interface Many user interfaces allow one to drag particular objects around within the interface. For example, dragging files to other directories, or dragging an icon to another window to open the document it refers to. Mozilla and XUL provide a number of events that can handle when the user attempts to drag objects around. A user can start dragging by holding down the mouse button and moving the mouse. ...
...an be handled. This first involves using the drag and drop XPCOM interfaces directly. The second is to use a JavaScript wrapper object that handles some of this for you. The code for this wrapper can be found in a file named toolkit/content/nsDragAndDrop.js nsDragAndDrop.js which is contained in the widget-toolkit (or global) package. XPCOM Drag and Drop interfaces Two interfaces are used to sup
port drag and drop. The first is a drag service, nsIDragService and the second is the drag session, nsIDragSession. The nsIDragService is responsible for creating drag sessions when a drag starts, and removing the drag session when the drag is complete. The function invokeDragSession should be called to start a drag inside an ondraggesture event handler. Once this function is called, a drag has start...
...agged. For example, this will be set to 5 if five bookmarks are being dragged. getData(transfer,index) Get the data being dragged. The first argument should be an nsITransferable object to hold the data. The second argument, index, should be the index of the item to return. sourceDocument The document where the drag started. sourceNode The DOM node where the drag started. isDataFlavorSup
ported(flavor) Returns true if the data being dragged contains data of the specified flavor. Next >> Original Document Information Author(s): Neil Deakin Original Document: Copyright Information: Copyright (C) Neil Deakin ...
Editor Embedding Guide - Archive of obsolete content
content on the browser. Below is the sequence of steps that need to be followed for the same: 1. Get the nsICommandManager from the nsIWebBrowser using do_GetInterface: nsCOMPtr<nsICommandManager> commandManager; nsIWebBrowser->do_GetInterface(getter_AddRefs(commandMgr)); 2. Call a command -- DoCommand: commandManager->DoCommand(aCommand, aCommandParams); aCommand is a const char * to a sup
ported command name (see list below). aCommandParams could possibly be a null pointer or a pointer to a valid structure filled with relative parameters to aCommand (see list below for legal params). 3. Verify if a command is enabled -- IsCommandEnabled: commandManager->IsCommandDisabled(aCommand, retval) 4. Get the current command state of a given command -- GetCommandState: commandManager->GetC...
...se cases will return whether or not it is possible to call DoCommand. This will not really give you any concrete information on the state of the command. nsICommandParams Creating How do you create an nsICommandParams? -saari Writing Once you have created an nsICommandParams you call the "Set" methods. SetBooleanValue SetLongValue SetDoubleValue SetStringValue SetCStringValue SetISup
portsValue RemoveValue Each will take a name value pair. In the case of SetBooleanValue for example you use a boolean as the second parameter. commandParam->SetCStringValue("state_attribute","left"); Reading For reading you may go after individual name/value pairs you know are there or you may iterate through all the name/value pairs and programatically pull off data. First GetNext (returns...
...tically pull off data. First GetNext (returns the next name in the name/value pair list) HasMoreElements GetValueType (numeric enum type see nsICommandParams for values) If the name/value pair is known or it was obtained using the methods described above, it is possible to call the following methods: GetBooleanValue GetLongValue GetDoubleValue GetStringValue GetCStringValue GetISup
portsValue All of these take pointers to values except for GetStringValue which demands a reference to an nsAString. commandParam->GetBooleanValue("state_enabled",&boolval); Original Document Information Authors: Michael Judge (mjudge@netscape.com) Contributor: Kathleen Brade (brade@netscape.com) Last Updated Date: March 27, 2003 Original Document: A Guide to Embedding The Gecko Editor ...
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
ntOpenInfo This class encapsulates all the information related to a particular load. There is basically one of these per load (though see the section on stream converters). nsDocumentOpenInfo implements nsIStreamListener and proxies the nsIStreamListener calls over to the "real" stream listener once one is chosen. This is the class that handles deciding where the data from the load should go. Sup
porting Roles Necko This is the Mozilla networking library. This handles actually going out and getting the data. It also handles determining the MIME type of the data, which is used to decide who gets the data. Category Manager This is used in a last-ditch attempt to find a content listener. nsIURIContentListener implementations We try to find one of these which can handle data of the type we're lo...
...ssion history issues. It calls DoURILoad(). DoURILoad() creates a channel, massages it to have the right POST data, load flags, cache key, referrer, etc. It then passes the channel to DoChannelLoad, which does some more flag massaging and then calls into the URILoader. nsURILoader::OpenURI gets a channel to open, a boolean indicating whether this load is the result of a link click, and an nsISup
ports "window context" (the docshell triggering the load, actually, but in drag and heavy makeup). It immediately hands off to nsURILoader::OpenChannel. nsURILoader::OpenChannel notifies the nsIURIContentListener hanging off the window context, if any, of the start of the load; this gives embedders a chance to abort the load if this URI type is something they want to handle in the embedding app. If ...
...nsDocumentOpenInfo handle the final dispatch. If we still do not have a stream listener, that means that we failed to find an nsIURIContentListener or nsIContentHandler for this type. Give the load to the helper app service; this will return an nsIStreamListener that we can use. Original Document Information Author(s): Boris Zbarsky Last Updated Date: October 24, 2003 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Documentation for BiDi Mozilla - Archive of obsolete content
This is preliminary documentation of the changes introduced to Mozilla as part of the BiDi sup
port contributed by IBM (a.k.a. IBMBIDI), written by Simon Montagu and posted to the mozilla-layout mailing list. While it was published in 2001 and might not be totally accurate, it does help understanding the internals of the BiDi code. Overview of BiDi processing Bidi text is reordered according to the Unicode Bidi Algorithm (UBA). The implementation is based on IBM's International Components for Unicode (ICU), which was chosen after comparing and testing the available open-source implementations. As far as we could discover, ICU is the only one which is 100% compatible with UBA, including sup
port for explicit directional controls (LRO, RLO, etc, and their HTML equivalents). Bidi process...
...t a Logical application will display it (from a Bidi point of view) as it is displayed by Mozilla. Text pasted from the clipboard is treated exactly as if it came from a Logical source. Form controls: based on Bidi Options in Preferences, the text mode of form controls may be "Logical", "Visual" or "Like Containing Document". We have also tested behaviour of all controls with dir=rtl and added sup
port where necessary. Some sup
port added for alignment in tables and lists, and fixes for problems with different combinations of dir and align. Improvements to lists with Hebrew and Arabic list-style-type Summary of New Classes Class Name XPCOM interface (if applicable) Implementation Comments nsIBidi intl\unicharutil\public\nsIBidi.h intl\unicharutil\src\nsBidiImp.cpp Implementation of the Un...
...It is created when resolving text containing a U...
GRE - Archive of obsolete content
ed by XULRunner. Mozilla Suite: the old GRE There are two different forms for the GRE: the "old" GRE was part of the Mozilla application suite. It was installed with the Windows installer of Mozilla 1.4 through 1.7.x. There was never an official GRE shipped for Linux, but various distributors such as Red Hat have registered Mozilla installations as if they were a GRE. The Mozilla suite never sup
ported a GRE on Mac. XULRunner: the new GRE XULRunner is the new version of the GRE, which not only allows embedding but is capable of bootstrapping entire XUL applications such as Firefox. XULRunner sup
ports or is planned to sup
port embedding on all three major platforms (Windows, Mac, and Linux). Finding and using a GRE from application code Avoid linking directly against xpcom.dll If an applic...
... To find a compatible GRE, you should use the function GRE_GetGREPathWithProperties() (declared in xpcom/glue/standalone/nsXPCOMGlue.h). ...
...id linking directly against xpcom.dll If an application wishes to use the GRE, it must take careful steps to ensure that it links against the proper libraries. If you link directly against xpcom.dll/libxpcom.so (xpcom.lib im
port lib), your application will not launch unless xpcom.dll is in your PATH. This prevents dynamically finding a compatible GRE at runtime. Find a compatible GRE Note: Sup
port for locating a standalone glue was removed in Gecko 6.0. To find a compatible GRE, you should use the function GRE_GetGREPathWithProperties() (declared in xpcom/glue/standalone/nsXPCOMGlue.h). This allows the embedder to specify what version(s) of GRE are appropriate, and to specify any special features the GRE must have (currently there are no special features defined). Statically link to xpc...
Creating a Help Content Pack - Archive of obsolete content
a Content Pack The Content Pack Descriptor File As mentioned earlier, the content pack descriptor file is written using RDF. If you don't know RDF, that's okay - for our purposes, you won't need to learn very much. If you understand the basics of HTML or (preferably) XML, you'll understand the very basics of the syntax - elements, attributes, and element contents. Understanding the syntax is im
portant because small syntax errors can mean that a whole file won't be loaded correctly. However, while it may seem like this is a disadvantage, it's actually an advantage - if you make an error you'll know immediately, and you should be able to easily figure out what the problem is by directly loading the file in Firefox. Later, when we get to actually writing content, you'll need to know XHTML, but...
...f:li element serves purely to contain each separate entry. The rdf:Description element describes the glossary entry. It has two required attributes: nc:name and nc:link. nc:name is the name for the entry - it's what's currently displayed in the glossary as the entry's title. nc:link contains a URI referencing what will be displayed in the viewer when the entry is accessed. The Index File One im
portant note on the index file is that there is no automatically generated set of top-level letters (e.g., A for Accessibility and Automation or B for Book and Border). Help documentation may be written in any language, so such automatic splitting is not desirable. You must implement such splitting if you wish to have it. The index data source structurally differs from the glossary in that it is mor...
...orks exactly the same no matter how deeply or shallowly nested your entry is. Nesting theoretically can work to any number of levels, but for practical reasons nesting is limited to roughly 20 levels. If you're coming anywhere close to this limit, however, you probably should be considering exactly why you need so much nesting. The Table of Contents File The table of contents file is the most im
portant data source you'll create. The help viewer will display the table of contents when you start the viewer. In some versions of the viewer, it will be the only data source ever directly displayed. It's the primary way to provide a structured view of the help you provide to users. The table of contents also provides the list of topics from which the home page for the viewer will be chosen. Recall...
Helper Apps (and a bit of Save As) - Archive of obsolete content
) method on nsILocalFileMac. Unix: launch directly via nsIProcess. Security considerations Multiple checks for whether a file is executable (on Windows) to keep from launching such files via ::ShellExecute(). Checks happen in OnStartRequest, in the helper app dialog, and as a last ditch in the launching code. Limitations of nsIMIMEInfo No way to say "do whatever the OS default is." No sup
port for command-line arguments. No sup
port for multiple commands connected by pipes (mostly useful on Unix). Ongoing work Sup
port synchronous dialogs, not just asynchronous ones (fixes many issues related to pre-downloading, content-decoding, etc). Reworking the nsIMIMEService API to improve the quality of the MIMEInfo we get. Reworking the helper app dialog to save user choices better. GNOME...
... Possible KDE integration. Possibly reflecting the OS settings in our helper app preferences (readonly? writable?). Have a way for users to override things in the "not overridable" built-in list. ...
...ork Fix the deficiencies in nsIMIMEInfo. Better sup
port for mailcap syntax. Possible KDE integration. Possibly reflecting the OS settings in our helper app preferences (readonly? writable?). Have a way for users to override things in the "not overridable" built-in list. Original Document Information Author(s): Boris Zbarsky Last Updated Date: September 12, 2002 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
generateCRMFRequest() - Archive of obsolete content
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. DeprecatedThis feature has been removed from the Web standards. Though some browsers may still sup
port it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. Warning: The features mentioned in this article are deleted proprietary Mozilla extensions, and are not sup
ported in any other browser. They won't work i...
... This string is an optional algorithm dependent parameter value. For Diffie-Hellman it is used to specify p and g parameters. For DSA, it will be used to specify pqg. If the key generation requires parameters and the value passed in is NULL, then the client will generate the parameters on its own. Currently, this value is ignored. "keyGenAlgN" Which algorithm the generated key will sup
port. Acceptable values are (the mentioned values for keyUsage pertain to the keyUsage value of the Certificate Extension that will ultimately be in the issued certificate): "rsa-ex" - generate an RSA key for key exchange only (This will have eyEncipherment set for keyUsage.) "rsa-dual-use" - generate a single RSA key for both signing and encryption. (This will have digitalSignature, ke...
...gning and non-repudiation. (This will have digitalSignature and nonRepudiation set for keyUsage.) "dh-ex" "ec-ex" "ec-dual-use" "ec-sign" "ec-sign-nonrepudiation" "ec-nonrepudiation" The generateCRMFRequest() method will cause the user to be presented with a key generation dialog. The dialog describes the key generation process and gives the user the op
portunity to cancel the operation. The method generateCRMFRequest() will return an instance of a CRMF Request object. The JavaScript passed in as the "CRMF Generation Done Code" parameter should look at the attribute request of the returned object to get the result of the CRMF generation. The string found by accessing crmfObject.request is the base-64 encoded CRMF message to be sent to the CA/RA, or a...
Twitter - Archive of obsolete content
In fact it's hardly more than syntactic sugar for doing XMLHttpRequests. To use this library, you therefore need to be familiar with Twitter's own API. (It's easy!) Methods Each method in Twitter's API maps to a method here. ...
...ore need to be familiar with Twitter's own API. (It's easy!) Methods Each method in Twitter's API maps to a method here. For example, the Twitter method for tweeting, statuses/update, maps to jetpack.lib.twitter.statuses.update(). To call trends/current, use jetpack.lib.twitter.trends.current(). For search, jetpack.lib.twitter.search(). Replace slashes with dots. Most of Twitter's methods are sup
ported, but not all. List methods, spam re
porting methods, and OAuth are not currently sup
ported. If something is not sup
ported but you would like it to be, please file a bug. (Or write a patch!) Arguments Each and every method in the library takes a single argument, an object. There are two styles you can use to define this object. The first is simple: Define properties on the object correspondin...
...e second, more advanced call style described above. Or you can simply rely on Firefox. When you call a method that requires authentication -- such as jetpack.lib.twitter.statuses.update() -- without providing a username or password, Firefox will prompt the user for them if she is not already authenticated with Twitter. Both methods use HTTP basic authentication. In the future, the library may sup
port OAuth. See Twitter's authentication documentation for related information. FAQ See Twitter's API FAQ. Since Jetpack's Twitter library is a very thin wrapper around Twitter's API, most everything there applies here, and not much applies here that doesn't apply there. Example usage Tweeting jetpack.lib.twitter.statuses.update({ status: "O frabjous day!" }); Firefox will prompt for a username a...
Enabling Experimental Jetpack Features - Archive of obsolete content
Note: This page documents the Jetpack Prototype, which is no longer under active development. Read the experiment re
port for what we learned from it and the blog post announcing the first SDK release for what we're up to next! The proposed method for accessing Jetpack features that are still in development and may be added in the future is inspired by python's future module. In Python, you can call from __future__ im
port foo which adds the functionality that foo yields to the script. In Jetpack, we propse adding a new function to the base namespace called im
portFromFuture. Methods im
port(stringMountPath string)Im
ports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. To get a l...
...ack, we propse adding a new function to the base namespace called im
portFromFuture. Methods im
port(stringMountPath string)Im
ports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. To get a list of mount paths that are available, see the method below. string Here is an example of how to im
port a feature (the clipboard) from the future. jetpack.future.im
port("clipboard"); The goal here is to be able to remove the jetpack.future.im
port() call when the feature has been formally accepted into the core without additionally changing the script (barring any other changes made during integration). list() arrayReturns an array of the set of potential stringMountPath as used in jetpack.future.im...
...This is an example of how to get this array. A quick way of displaying the list is to write it to the console.log. ...
Enabling - Archive of obsolete content
The proposed method for accessing Jetpack features that are still in development and may be added in the future is inspired by python's future module. In Python, you can call from __future__ im
port foo which adds the functionality that foo yields to the script. In Jetpack, we propse adding a new function to the base namespace called im
portFromFuture. Methods im
port(stringMountPath string)Im
ports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. ...
...pack, we propse adding a new function to the base namespace called im
portFromFuture. Methods im
port(stringMountPath string)Im
ports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. To get a list of mount paths that are available, see the method below. string Here is an example of how to im
port a feature (the clipboard) from the future. jetpack.future.im
port("clipboard"); The goal here is to be able to remove the jetpack.future.im
port() call when the feature has been formally accepted into the core without additionally changing the script (barring any other changes made during integration). ...
...This is an example of how to get this array. A quick way of displaying the list is to write it to the console.log. var list = jetpack.future.list(); console.log(list); Open the firebug console to view. ...
Me - Archive of obsolete content
onFirstRun() accepts a callback which is called after installation. ...
...onFirstRun() accepts a callback which is called after installation. ...
...onFirstRun() accepts a callback which is called after installation. ...
Settings - Archive of obsolete content
etpacks to specify user-configurable settings. Jetpack will automatically generate a user interface based on the specification. The settings persist across browser sessions and are stored using the Jetpack [simple storage API][]. Settings are private to each jetpack and are not accessible by other jetpacks. Because it is still under development, the API currently lives in the future and must be im
ported before it is used: Specifying settings in a manifest To specify its settings, a jetpack defines a variable named manifest in its global namespace before it im
ports the settings API. The value of this variable must be an object that contains a property named settings. The value of the settings property is an array of objects representing the settings to expose to users. Jetpack will automaticall...
...With the above manifest the following stored properties are available in the jetpack's code: * jetpack.storage.settings.twitter.username * jetpack.storage.settings.twitter.password * jetpack.storage.settings.facebook.username * je...
...With the above manifest the following stored properties are available in the jetpack's code: * jetpack.storage.settings.twitter.username * jetpack.storage.settings.twitter.password * jetpack.storage.settings.facebook.username * jetpack.storage.settings.facebook.password * jetp...
Selection - Archive of obsolete content
Note: This page documents the Jetpack Prototype, which is no longer under active development. Read the experiment re
port for what we learned from it and the blog post announcing the first SDK release for what we're up to next! Jetpack's selection API provides a method for detecting the selections made by the user. Features can get, set, and listen for selection events in HTML or plain text. The namespace for this api is jetpack.selection. This API currently lives in the future and must be im
ported for use: jetpack.future.im
port("selection"); Getting and Setting the Selection The current version of jetpack.selection includes these formats: .text and .html Getting the selection The following is an example of getting the selection from the user. jetpack.im
port.future("selection");var tex...
... the Selection The current version of jetpack.selection includes these formats: .text and .html Getting the selection The following is an example of getting the selection from the user. jetpack.im
port.future("selection");var textOfSel = jetpack.selection.text;var htmlOfSel = jetpack.selection.html; Setting the selection The following is an example of getting the selection from the user. jetpack.im
port.future("selection");jetpack.selection.text = 'Hello';jetpack.selection.html = '<b>Hello</b>'; Methods onSelection(func function)This method allows you to execute an event function when a selection is made. funcA function to be called when the selection is made. This function receives no arguments. Use jetpack.selection.*. function Adding a selection event jetpack.selection.onSelection( fn ); R...
...xecute an event function when a selection is made. funcA function to be called when the selection is made. This function receives no arguments. Use jetpack.selection.*. ...
Enabling Experimental Jetpack Features - Archive of obsolete content
The proposed method for accessing Jetpack features that are still in development and may be added in the future is inspired by python's future module. In Python, you can call from __future__ im
port foo which adds the functionality that foo yields to the script. In Jetpack, we propse adding a new function to the base namespace called im
portFromFuture. Methods im
port(stringMountPath string)Im
ports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. ...
...pack, we propse adding a new function to the base namespace called im
portFromFuture. Methods im
port(stringMountPath string)Im
ports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. To get a list of mount paths that are available, see the method below. string Here is an example of how to im
port a feature (the clipboard) from the future. jetpack.future.im
port("clipboard"); The goal here is to be able to remove the jetpack.future.im
port() call when the feature has been formally accepted into the core without additionally changing the script (barring any other changes made during integration). list() arrayReturns an array of the set of potential stringMountPath as used in jetpack.future.i...
...This is an example of how to get this array. A quick way of displaying the list is to write it to the console.log. ...
Simple Storage - Archive of obsolete content
e.open(), although the data comes loaded automatically. Don't abuse these methods, since they cause Firefox -- all of Firefox -- to drop what it's doing to make a trip to the disk. If you call them too often, Firefox may become unresponsive for some of your users. Unless you are doing something strange, let Jetpack flush your data for you. The namespace currently lives in the future and must be im
ported before it is used: jetpack.future.im
port("storage.simple"); Methods sync()As described above, the jetpack.storage.simple object is automatically written to disk, but a feature may force flush by calling jetpack.storage.simple.sync(). Don't abuse this method. open()As described above, the jetpack.storage.simple object is automatically populated when a feature is loaded, but a feature may force ...
...k, but a feature may force flush by calling jetpack.storage.simple.sync(). Don't abuse this method. open()As described above, the jetpack.storage.simple object is automatically populated when a feature is loaded, but a feature may force the object to read from disk by calling jetpack.storage.simple.open(). Don't abuse this method. ...
...ust a normal JavaScript object. They could have simply used jetpack.storage.simple directly. Here's a complete real-world example. It's a simple note-taking jetpack. Select some text on the page, right-click, and select Note. The text will be remembered across browser restarts as a note. All notes are shown in the Tools menu. You can install this example from the Jetpack Gallery. jetpack.future.im
port("menu"); jetpack.future.im
port("selection"); jetpack.future.im
port("storage.simple"); // Create the persistent notes array if it doesn't already exist. jetpack.storage.simple.notes = jetpack.storage.simple.notes || []; var notes = jetpack.storage.simple.notes; // Updates the Jetpack menu with the current notes. We'll add a Notes menu with // a submenu, which lists all the notes. If there are ...
Metro browser chrome tests - Archive of obsolete content
The metro browser chrome test suite is an automated testing framework designed to allow testing of the immersive version of Firefox for Windows 8 and above using JavaScript. It currently allows you to run JavaScript code in the same scope as the immersive browser and re
port results using the same functions as the Mochitest test framework. Running the metro browser chrome tests To run Mochitest, first build Mozilla with your changes; then run ./mach mochitest-metro This will launch metro browser chrome tests in the default immersive browser. For information on setting your local build as the default, visit the Windows 8 Integration wiki page. It is possible to run individual tests as well. As with Mochitest, the path given as an argument is the path to a test file within the Mozilla sou...
...ts that make up the library of tests your test file will contain. Each test can have start up and tear down logic, plus the body of the test contained in run(). The test file can contain other functions which will be ignored unless invoked by test(). gTests make use of Promises and Tasks for managing execution. Test comparison functions used in metro browser chrome tests are identical to those sup
ported by Mochitests, see how the comparison functions work in the Mochitest documentation for more details. Helper functions The EventUtils helper functions are available on the EventUtils object defined in the global scope. Additional metro specific test helpers can be found in /browser/metro/base/tests/mochitest/head.js. You may add additional common utils and helpers to head.js. Be careful about c...
...s and helpers to head.js. Be careful about changing existing helpers as changes may impact tests in other libraries. Static content for tests Static content (html files, images, etc.) should be stored in sub directories to avoid polluting the main test directory. Sub directories for larger test suites may also be created. Exceptions in tests Any exceptions thrown under test() will be caught and re
ported as a general failure. setUp(), tearDown(), and run() each have individual exception handlers to prevent one method from interfering with the execution of another. An exception in any of these methods will cause a test failure. Additional built-in framework test checks will run after the completion of each individual test insuring tests clean up properly. For more information on test execution s...
How to Write and Land Nanojit Patches - Archive of obsolete content
M/TR repo. For tracemonkey, use the "make update-nanojit" target (it requires that Mercurial's "convert" extension be enabled; add "hgext.convert =" to your .hgrc file under "[extensions]"). For tamarin, use the update-nanojit.sh script. Note that updating will clobber the contents of the nanojit/ directory in your private TM/TR repo. It will also generate a commit that updates the nanojit-im
port-rev file in your target repository; this file records which commits have been copied over from nanojit. Build and test the changes. In the easy case, you'll have a consistent TM/TR repo. Land the TM/TR changes. Then for each revision involved, mark its whiteboard as fixed-in-tracemonkey or fixed-in-tamarin. You're done, but watch the tinderbox. In the hard case, you'll have a broken TM/TR re...
... external patch(es), P, landed on the other (TR/TM) repo, thus changing NJ's API but your TM/TR repo hasn't been updated to match the API change. In this case, you have to look through the converted revisions you're about to push (run hg outgoing to list them) and figure out which patch(es) caused the breakage. Then find the corresponding bug(s) and commit the (hopefully already-reviewed!) TR/TM
portion of the patch(es) on top of your current, un-pushed tip. At this point the set of changes you are about to push will consist of a sequence of converted revisions from nanojit-central, followed by one of more "fixups" to TR/TM to make them work properly. Test this entire group and land them with a single hg push. Then update the whiteboard for the each such bug P and add a comment URL. And like...
...sing the existing mercurial "backout" command in your target repository. If you do so, the next time you copy revisions from nanojit-central to your target repository, the script will re-copy the backed-out revisions, as well as those that occurred after. You can explicitly manipulate the revision from which the copying process begins by writing a nanojit-central revision ID to the file nanojit-im
port-rev, held in your target repository. If you are at all confused about this, ask in #nanojit IRC. Scenario 4: if you break something If you land a patch that breaks nanojit-central, and then land a follow-up fix, it's a good idea to ensure the follow-up fix gets merged to TM and TR as soon as possible. Otherwise, it might be possible that the broken patch gets pulled into TM/TR but the fix does...
Priority Content - Archive of obsolete content
Keller Licensing: These CSS charts appear to be under a CC:By-NC-SA license, please make note of that on the page when you do the migration. Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Location: Usin...
...Keller Licensing: These CSS charts appear to be under a CC:By-NC-SA license, please make note of that on the page when you do the migration. Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Location: Using Mozilla in Testing and Debug...
...n: Scripting Plugins: Macromedia Flash Migrators: Dependant on (these parts need to be done, put your name down) Completed: SOAP in Netscape Gecko-based Browsers Original: SOAP in Netscape Gecko-based Browsers Wiki Location: SOAP in Gecko-based Browsers Migrators: Doron Rosenberg In progress: CSS Sup
port Charts Original: CSS Sup
port Charts and Archive.org mirror Wiki Location: CSS Sup
port Charts Migrators: Serge K. Keller Licensing: These CSS charts appear to be under a CC:By-NC-SA license, please make note of that on the page when you do the migration. Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Location: Using Mozilla in Testing and Debugging Web Sites Migrators: Serge K. Keller NOTE: Henrik c...
Proxy UI - Archive of obsolete content
Products Firefox Menu: Preferences > Advanced Tab > Networking tab > Connection button. Thunderbird Menu: Preferences > Advanced Tab > Networking tab > Connection button. Seamonkey Menu: Preferences > Advanced group > Proxies panel Menu: right-click on Offline-online button (on browser windows). Camino Configured in OS (Networking Preferences) (Recently Added - some sup
port for reading OS and account settings.)UI Elements Preferences Panel Overview The UI is based on selecting a proxy mode, then filling out any additional needed information in "related" UI. The "OK" button saves the preferences. The preference changes Selecting the proxy "mode" All product's Proxy preference panels share a basic design: a radio button that selects the proxy mode, then "related proxy mode" UI ...
...". For example, Firefox 3: [ ] No Proxy [ ] Auto-detect proxy settings for this network [ ] Manual proxy configuration: [ ] Automatic proxy configuration URL: Behavior Default value: "No Proxy" is selected All other "type" radio buttons are enabled, but not selected. "related" UI elements Only two proxy modes have related UI. Manual proxy is a list of proxy types that require a hostname and a
port number. Proxy autoconfiguration has a URL field and a reload button. Enabling and disabling related fields When a radio button is selected, the related UI elements are enabled (and editable). The previously selected radio button becomes unselected, and the related UI of the previous button is disabled (and is not editable). Saving changes Click "OK" to save changes to prefs. Click "Cancel" to...
...he protocol was proxyable and did not match any of the previous protocols), then use SOCKS. The socks version is selected by radio buttons: ( ) SOCKS v4 ( ) SOCKS v5 "No proxy for:" Discussed in detail elsewhere... but should be noted that if you cut and paste from IE, the semi-colons are automatically converted to commas when you save changes (FF, TB, SM). Automatic proxy configuration URL Sup
ports a URL (which is checked via URIfixup) and a reload button. Offline|Online "plug" Location Status bar on the right side. Right-click A menu is displayed that has the following items: Online (Proxy: None) Online (Proxy: Auto Discover) Online (Proxy: Auto URL) Online (Proxy: Manual) --- Proxy Configuration... <h7 name="Details">Details</h7> The menu should display the current proxy mode with a dot.
Remotely debugging Firefox for Metro - Archive of obsolete content
This can be a security risk, especially if you also set the force-local preference to false.) Set up Firefox for desktop On the desktop, remote debugging is enabled by a setting in the Toolbox. Open the Toolbox, cli...
... This can be a security risk, especially if you also set the force-local preference to false.) Set up Firefox for desktop On the desktop, remote debugging is enabled by a setting in the Toolbox. Open the Toolbox, click the "Settings" button...
...e Settings tab. If you're using a version of Firefox older than 27, you'll need to restart the browser for the setting to take effect. Connecting On the desktop On the desktop, open the Web Developer menu and select "Connect...". You'll see a page that looks like this: If you are running Firefox for Metro on the same computer with the default settings, use the default host (localhost) and
port (6000), and press the "Connect" button. If you are connecting to Firefox for Metro on a different computer or a different
port, enter the appropriate hostname and
port number and then press "Connect." In the Windows 8 (Metro) browser Next you'll see a dialog in Firefox for Metro asking you to confirm the connection. Press the "OK" button to continue. Tip: If the remote connection times out, ...
Using addresses of stack variables with NSPR threads on win16 - Archive of obsolete content
Problem statement WIN-16 (aka, Windows 3.1, et al), is unique in that the architecture depends on the Operating Environment (i.e., Windows) knows the address of the stack, and that there is only one such address. Consequently, implementing threads, with their implication of a unique stack for each thread, requires that the NSPR copy the stacks during thread context switches. The actual copying of the stack is not such a hardship as one would imagine. ...
...rn (PR_SUCCESS == rv) ? 0 : 1; } This is a completely correct (albeit trivial) program that will run predictably on all NSPR platforms other than WIN-16. On WIN-16, the thread's attempt to address the <tt>SharedData</tt> through the pointer shared will provide interesting (though always incorrect) results. It's difficult to tell exaclty where the updated <tt>counter</tt> is being stored. The only
portable manner to write this program requires that the shared structure be allocated from the heap. Well, that isn't so hard to remember, is it? What is probably more likely to cause problems is passing addresses of automatically allocated variables to a function that wends its way though arbitrary amounts of convoluted logic, and finds its way into an object that is shared. One should be particularl...
... amounts of convoluted logic, and finds its way into an object that is shared. ...
Venkman - Archive of obsolete content
ts the existing JavaScript API, providing clients with a useful set of debugger functionality implemented in C. Bandhauer then went on to reflect that API into Java, and create his cross platform front end, eventually producing Netscape JavaScript Debugger 1.0 and 1.1. In April of 2001, Robert Ginda began work on a JavaScript debugger for Mozilla, called Venkman. Venkman builds on the js/jsd
portion of John's 1998 work, exposing it as an XPCOM component. This allows the user interface be written in JavaScript and XUL, which allows Venkman to be fully cross-platform. Venkman is named after the character Dr. Peter Venkman, played by Bill Murray in the movies Ghostbusters and Ghostbusters II. Getting Venkman Firefox and Thunderbird The latest vers...
...encourage you to use the latest available version 0.9.87.1 (or higher) with Firefox instead. Source Code The source code for Venkman may be found in Mercurial at the following URL: http://hg.mozilla.org/venkman/summary Community View Mozilla forums... Mailing list Newsgroup RSS feed IRC: #venkman on irc.mozilla.org Re
port a bug in Venkman If you find a problem with Venkman, please follow directives mentioned at Venkman FAQ section 5.4 and then you may re
port a bug on JavaScript Debugger component. Related Topics JavaScript, Web Development, Developing Mozilla Original Document Information Author(s): Robert Ginda Other contributors: Doctor Unclear Last Updated Date: July 13, 2007 C...
...If you find a problem with Venkman, please follow directives mentioned at Venkman FAQ section 5.4 and then you may re
port a bug on JavaScript Debugger component. Related Topics JavaScript, Web Development, Developing Mozilla Original Document Information Author(s): Robert Ginda Other contributors: Doctor Unclear Last Updated Date: July 13, 2007 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
XPJS Components Proposal - Archive of obsolete content
This is a proposal for a system that got implemented, but it may differ from the actual implementation. See the status document for more recent info on the status of this proposal. Draft 1.0 What are XPJS Components? XPJS Components is a (cheesy) name for a system to sup
port xpcom components written in JavaScript. Now, you might ask: "Isn't that what XPConnect does?" And I would answer that XPConnect is necessary, but not sufficient to the task. ...
...nswer that XPConnect is necessary, but not sufficient to the task. XPConnect provides the mechanisms for communication between native and JS xpcom components, but it does not provide all of the infrastructure to register and instantiate JS components outside of the limitations of the browser window. XPJS will provide that infrastructure. So what does this mean? The XPJS Component system will sup
port implementing xpcom services, factories, and components in JavaScript. It will sup
port service and factory registration. These components will be independent of web content and browser windows. They will run from the user's disk just like native components. How will it work? The overriding principle is to make this work as much like native components as possible. XJS Components will 'live' in.js...
...xt of a relatively 'raw' JS global object. The standard (non-DOM) JS classes will be available. The xpconnectComponents object will be available. And some additional yet to be defined objects may be available. The xpconnectComponents object allows access to the whole repository of native and JS xpcom components, so this is not as isolated an environment as it might at first sound. A 'load' or 'im
port' function will also be provided to let the JS code im
port other .js files where libraries of code might be stored. This is akin to 'static' libraries. Accessing other components/services via xpcom/xpconnect is more akin to 'dynamic' libraries. When a XPJS Component module is first installed - or at autoregistration time - the XPJSManager will load the .js file into a fresh JS environment, let it...
Deprecated and defunct markup - Archive of obsolete content
lp anyone who comes across them in old code or documentation. ...
...ke <textbox>) <thumb> (<button> with deprecated <gripper>; implements sliding box in center of scrolbar) <title> (to add a caption on a <titledbox> <titledbox> (box with a frame) <titledbutton> (attempt to combine text and images before <button>) <toolbarpaletteitem> Required to embed non-buttons in customisable toolbars --Neil 03 March 2011 <treebody> (old/experimental and unsup
ported XUL tags) Lives on as the internal name for the ancestor <treechildren> element --Neil 03 March 2011 <treecaption> (old/experimental and unsup
ported XUL tags) <treecolgroup> (former name for <treecols> <treecolpicker> (internal use only; part of XBL for <tree>) <treefoot> (old/experimental and unsup
ported XUL tags) <treeindentation> (old/experimental and unsup
ported XUL tags) Was...
...
ported XUL tags) <treecolgroup> (former name for <treecols> <treecolpicker> (internal use only; part of XBL for <tree>) <treefoot> (old/experimental and unsup
ported XUL tags) <treeindentation> (old/experimental and unsup
ported XUL tags) Was a part of the old <tree> that predated <outliner> that was not converted to <listbox>--Neil 03 March 2011 <treeicon> (old/experimental and unsup
ported XUL tags) <treerows> (internal use only; part of XBL for <tree>) Attributes @debug="true" provided struts and springs around boxes to facilitate identification of flex issues but does not seem to work now You need a special DEBUG_LAYOUT build --Neil 03 March 2011 References XUL Element Reference by Neal Deakin Rapid Application Development With Mozilla, by Nigel McFarlane ...
Accessing Files - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. Accessing Files This section describes how to cre...
...n files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. Accessing Files This section describes how to create a file reference. Retrieving a File When working with files, usage is always done via a File object and not via string paths. This allows files to used in a
portable way. Because string paths are not used, references to files in a File object are made relative to some starting directory. A number of starting directories may be used, for instance, the user's home directory, the desktop, the system's temporary folder, and so forth. Once one of these starting directories is determined, a file reference may be created relative to this. A common case is to wri...
... of this directory will vary by user and system, so this is a convenient means to refer to a common directory without having to locate it yourself. For a full list of starting directories, see Starting Directories below. The second argument to nsIScriptableIO.getFile() is the filename to locate, which, here, is 'sample.txt'. The result is that a reference is made to the 'sample.txt' file. It is im
portant to note that this file does not have to exist for a file reference to be valid. That is, nsIScriptableIO.getFile() will still return a valid file reference even if the file 'sample.txt' does not yet exist. You can check if the file exists by using nsIFile.exists(). var file = IO.getFile("Profile", "sample.txt"); if (file.exists()) alert("The file is there!"); else alert("File not found!");...
Reading from Files - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. Reading data from a file involves getting a reference to...
...readLine method may be used to read a line from the file. This method doesn't take a count of characters to read but instead keeps reading until the end of a line is reached. This method handles all the different types of end of line characters and combinations, so you do not need to worry about platform specific conventions. The line read from the file is returned by the readLine method. It is im
portant to note that the newline characters themselves are not included in the returned string. var lines = []; while(stream.available()) lines.push(stream.readLine()); In this example, each line from a stream is read and added to an array. The result is an array containing each of the lines in the file. Reading Other Character Encodings The default character encoding is UTF-8. If you know that a f...
...ings The default character encoding is UTF-8. If you know that a file is stored using a different encoding, you can specify a third argument to nsIScriptableIO.newInputStream() which specifies the encoding. This example opens a file using the UTF-16 encoding. var stream = IO.newInputStream(file, "text", "UTF-16"); This third argument is not needed if the file is stored in UTF-8. For a list of sup
ported character encodings, see Sup
ported Character Sets. The files can be read in the same manner using the readString and readLine methods. The difference is handled internally so you don't need to write any other part of the code differently. Reading Binary Data In addition to text, binary values may be read from a file either as bytes, or interpreted as numbers. A number of methods are available w...
ContextMenus - Archive of obsolete content
t-clicked or pressed normally, as opposed to context clicked. You can indicate this item, if it applies, using the default attribute. <menupopup id="link-menu"> <menuitem label="Open Link" default="true"/> <menuitem label="Open In New Window"/> <menuitem label="Properties"/> </menupopup> The default attribute has been set to true on the first menu item ('Open Link'). On platforms that sup
port it, it will be marked as a default item. On other platforms, the attribute will just be ignored and the menuitem will be displayed normally. Naturally, it only makes sense to have one default item per context menu. Note that the default attribute just affects how the item is displayed, it performs no other function itself. You will still need to associate code with the element to handle the defa...
...he menuitem instead of hiding it, by setting the item's disabled property. deleteItem.disabled = (rows.childNodes.length == 0); For this example, using the disabled property is more suitable. Items should be disabled when they don't apply in certain circumstances, but should be hidden when they would never apply to the element that was clicked on. Determining what was Context Clicked It is im
portant to remember that a context menu may be opened in other ways than just with the mouse. However, even when using the keyboard, there will still be a node (the context) that the menu applies to, which will be the element that is currently focused. When the mouse is used, the context will be the element that is clicked. You can retrieve this element using the popup's triggerNode property. In Fire...
...Image Details"/> </menupopup> <browser src="http://www.mozilla.org" context="contentAreaContextMenu"/> When the popupshowing event is fired, the showHideItems function is called. The triggerNode is retrieved and examined to see if it is an image. The nsIImageLoadingContent interface is implemented by all types of images. This is useful instead of comparing the tag, as several different tags sup
port images. The test also checks to ensure that the element has a uri set. Finally, the hidden state of two menuitems are adjusted based on whether the context is an image or not. The result is that context clicking on images will show a menu with three items, but will only show one item for other types of elements. ...
Providing Command-Line Options - Archive of obsolete content
* @param aChromeURISpec a string specifying the URI of the window to open. * @param aArgument an argument to pass to th...
... * @param aChromeURISpec a string specifying the URI of the window to open. * @param aArgument an argument to pass to the window (may be null) */ function openWindow(aChromeURISpec, aAr...
... { try { // CHANGEME: change "viewapp" to your command line flag that takes an argument var uristr = cmdLine.handleFlagWithParam("viewapp", false); if (uristr) { // convert uristr to an nsIURI var uri = cmdLine.resolveURI(uristr); openWindow(CHROME_URI, uri); cmdLine.preventDefault = true; } } catch (e) { Components.utils.re
portError("incorrect parameter passed to -viewapp on the command line."); } // CHANGEME: change "myapp" to your command line flag (no argument) if (cmdLine.handleFlag("myapp", false)) { openWindow(CHROME_URI, null); cmdLine.preventDefault = true; } }, // CHANGEME: change the help info as appropriate, but // follow the guidelines in nsICommandLineHandler.idl // spe...
Building Trees - Archive of obsolete content
Rather than generate content for every row in the tree, the results are stored in a list inside the builder. This means that DOM nodes are not constructed for any of the items. ...
...eitem uri="?"> <treerow> <treecell label="?subject"/> <treecell label="?sender"/> <treecell label="?date"/> </treerow> </treeitem> </treechildren> </action> </template> </tree> Features of the Tree Builder Besides the label of a cell, there are several other cell properties you can set when using the tree builder. The sup
ported properties are: label, mode, properties, src and value. The label attribute is used to set the label for a cell. The mode is used for progress meter columns. It may be set to either "normal" for a normal progress meter or "undetermined" for an undetermined progress meter. The value attribute is used to set the current progress value for normal progress meters. The value attribute may also be us...
...w to 150 pixels. You may want to change the syntax to refer to a specific treechildren element rather than all of them. Once the row height is changed, we can see the full photos. Note: If you want to have the state of the disclosure triangles ("twisties") be persistent, be sure to give each node a unique "id" attribute. These are used to track the current state of the disclosure triangles. Sup
port for this was introduced in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4). Using Tree Properties Since we need to use special CSS for trees, the properties attribute on a cell becomes extremely useful. It can be used to define extra properties for reference later in a stylesheet. For example, if the properties attribute was set to the value "?creator", you could style the photos creat...
Custom toolbar button - Archive of obsolete content
e. You can also use this page to learn about extensions, and as a starting point if you plan to write a more complex extension. Note that this extension is very simplified. Use other tutorials and articles to find out more--the main Extensions page here is a good starting point. In particular, the articles Creating toolbar buttons and Building an Extension explain the process in more detail. Sup
ported applications You can use the steps on this page with any or all of these Mozilla applications: Firefox 1.5 or a later version SeaMonkey 2.0 or a later version Thunderbird 1.5 or a later version Sunbird 0.3 or a later version Pre-release versions of these (alphas, betas and release candidates) are also OK. In the rest of this page, the term application means the Mozilla application whe...
... later version Sunbird 0.3 or a later version Pre-release versions of these (alphas, betas and release candidates) are also OK. In the rest of this page, the term application means the Mozilla application where you want to add the button. Note: There is a similar tutorial for SeaMonkey 1.x on the page: Custom Toolbar Button:SeaMonkey Earlier versions and other Mozilla applications also sup
port extensions, but some parts of this tutorial are not appropriate for them. Required tools You will need two tools. Your operating system normally provides them: A way to create and work with files and directories A text editor for plain text files Character encoding Some text editors have a setting for character encoding. If your language uses only plain Latin (ASCII) characters, set yo...
... the file, type some of the special characters that your language uses. Save the file. Open the file in Firefox (for example, by dragging it and dropping it in Firefox, or by choosing File - Open File... from Firefox's menu bar). From Firefox's menu bar, choose View - Character Encoding - Unicode (UTF-8). Check that the text you typed looks OK with this setting. If your text editor does not sup
port UTF-8, search the Internet for a better one that you can download. Optional tools You can optionally use any image editor to customize the images. You can optionally use a jar tool or zip tool to package your button as a cross-platform installable (XPI) for other people to install and use. Making a button There are ten easy steps. When you have completed all the steps, you will have a struc...
Adding Labels and Images - Archive of obsolete content
abel> As with HTML, line breaks and extra whitespace are collapsed into a single space. Later, we'll find out how to constrain the width of elements so that we can see the wrapping more easily. Control Attribute You can use the control attribute to set which control the label is associated with. When the user clicks on an associated label, that control will be focused. This association is also im
portant for accessibility, so that screen readers read aloud the label for the control as the user tabs to it. Set the value of the control attribute to the id of the element to be focused. Example 3 : Source View <label value="Click here:" control="open-button"/> <button id="open-button" label="Open"/> In the example above, clicking the label will cause the button to be focused. Description Element ...
...et the text via script using the textContent property, as in the following example: <description id="text" width="200"/> document.getElementById('text').textContent = "Some lengthy word wrapped text goes here."; Internally, both the label element and the description elements are the same. The label element is intended for labels of controls, such as text fields. The control attribute is only sup
ported for labels. The description element is intended for other descriptive text such as informative text at the top of a dialog box. Images XUL has an element to display images within a window. This element is appropriately named image. Note that the tag name is different than HTML (image instead of img). You can use the src attribute to specify the URL of the image file. The example below shows thi...
... the top of a dialog box. Images XUL has an element to display images within a window. This element is appropriately named image. Note that the tag name is different than HTML (image instead of img). You can use the src attribute to specify the URL of the image file. The example below shows this: <image src="images/banner.jpg"/> Although you can use this syntax, it would be better in order to sup
port different themes to use a style sheet to set the image URL. A later section will describe how to use style sheets, but an example will be shown here for completeness. You can use the list-style-image CSS property to set the URL for the image. Here are some examples: XUL: <image id="image1"/> <image id="search"/> Style Sheet: #image1 { list-style-image: url("chrome://findfile/skin/banner.jp...
Creating a Window - Archive of obsolete content
bute to the window tag. Here is a line by line breakdown of the code above: <?xml version="1.0"?> This line simply declares that this is an XML file. You would normally add this line as is at the top of each xul file. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> This line is used to specify the style sheets to use for the file. This is the syntax that XML files use to im
port style sheets. In this case, we im
port the styles found in the global part of a skin package. We didn't specify a specific file so Mozilla will determine which files in the directory to use. In this case, the all-im
portant global.css file is selected. This file contains all the default declarations for all of the XUL elements. Because XML does not have any knowledge of how elements should be displ...
... <window This line declares that you are describing a window. Each user interface window is described in a separate file. ...
... <window This line declares that you are describing a window. Each user interface window is described in a separate file. This tag is much like the HTML tag which surrounds an entire HTML document, except that a user interface window is described instead of a document. ...
Cross Package Overlays - Archive of obsolete content
You can also go the other way and have the overlays specify which windows that they apply to. You specify this by modifying the contents.rdf file for your package. This is useful because the overlay can modify the user interface of another package without changing the other package. ...
...You can also go the other way and have the overlays specify which windows that they apply to. You specify this by modifying the contents.rdf file for your package. This is useful because the overlay can modify the user interface of another package without changing the other package. ...
...ed on the toolbox. This value (browser-toolbox) is the same as the identifier of the toolbox in the browser window (navigator.xul). This means that the overlay will apply to the toolbox in the browser window and the content will be added as an extra toolbar. The ID of the toolbox changed from "<code>navigator-toolbox</code>" to "<code>browser-toolbox</code>" in Firefox 3 beta 3. You can sup
port both Firefox 2 and earlier and Firefox 3 by duplicating the <code><span class="plain">' .. <toolbox> .. '</span></code> section with that ID. To add this overlay to the manifest file, we need to add two resources. First, we add one for each window that we are applying an overlay to. The code below should be added into contents.rdf just before the closing RDF tag. <RDF:Seq about="urn:mozilla:o...
Introduction - Archive of obsolete content
ool") was created to make development of the Mozilla browser easier and faster. It is an XML language so all features available to XML are also available to XUL. Most applications need to be developed using features of a specific platform making building cross-platform software time-consuming and costly. A number of cross-platform solutions have been developed in the past. Java, for example, has
portability as a main selling point. XUL is one such language designed specifically for building
portable user interfaces. It takes a long time to build an application even for only one platform. The time required to compile and debug can be lengthy. With XUL, an interface can be implemented and modified quickly and easily. XUL has all the advantages of other XML languages. For example XHTML or other...
... in lowercase as XML is case-sensitive (unlike HTML). Attribute values in XUL must be placed inside quotes, even if they are numbers. XUL files are usually split into four files, one each for the layout and elements, for style declarations, for entity declarations (used for localization) and for scripts. In addition, you may have extra files for images or for platform specific data. XUL is sup
ported in Mozilla and browsers that are also based upon on the Gecko engine, such as Netscape 6 or later and Mozilla Firefox. Due to various changes in XUL syntax over time, you will want to get the latest version for the examples to work properly. XUL is fairly similar in Firefox and to other browsers, although it has some specific differences such as sup
port for customizable toolbars. This tutorial...
...get the latest version for the examples to work properly. XUL is fairly similar in Firefox and to other browsers, although it has some specific differences such as sup
port for customizable toolbars. This tutorial attempts to cover much of XUL's functionality, however, not all features are discussed. Once you are familiar with XUL, you can use the XUL Reference to find out about other features sup
ported by specific elements. Next >> ...
XPCOM Interfaces - Archive of obsolete content
nt. Get a component Get the part of the component that implements the interface that we want to use. Call the function we need Once you've done the first two steps, you can repeat the last step as often as necessary. Let's say we want to rename a file. For this we can use the nsILocalFile interface. The first step is getting a file component. Second, we query the file component and get the
portion of it that implements the nsILocalFile interface. Finally, we call functions provided by the interface. This interface is used to represent a single file. We've seen that interfaces are often named starting with 'nsI' or 'mozI'. Components, however, are referred to using a URI like string. Mozilla stores a list of all the components that are available in its own registry. A particular user ca...
...the following: var sound = Components.classes["@mozilla.org/sound;1"].createInstance(); if (sound) sound.QueryInterface(Components.interfaces.nsISound); XPCOM interfaces can inherit from other interfaces. The interfaces that inherit from others have their own functions and the functions of all the interfaces that they inherit from. All interfaces inherit from a top-level interface called nsISup
ports. It has one function supplied to JavaScript, QueryInterface(), which we have already seen. Because the interface nsISup
ports is implemented by all components, the function QueryInterface() function is available in every component. Several components may implement the same interface. Typically, they might be subclasses of the original but not necessarily. Any component may implement the function...
...of these lines together: var aLocalFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); This will do the same thing as the two lines but in one line of code. It eliminates the need to create the instance and then query it for an interface in two separate steps. If you call QueryInterface() on an object and the requested interface is not sup
ported by an object, an exception is thrown. If you're not sure that an interface is sup
ported by a component, you can use the instanceof operator to check: var aFile = Components.classes["@mozilla.org/file/local;1"].createInstance(); if (aFile instanceof Components.interfaces.nsILocalFile){ // do something } The instanceof operator returns true if aFile implements the nsILocalFile interface. Thi...
Using Remote XUL - Archive of obsolete content
This also means you can't load XUL using file:// URLs unless you set the preference dom.allow_XUL_XBL_for_file to true. However, there is a whitelist that lets you specify sites that can still use remote XUL. ...
...s://www.mozilla.org/MPL/" /> <menuitem label="Newsbot" value="https://www.mozilla.org/newsbot/" /> </menupopup> </menu> <menu label="Developer Docs"> <menupopup> <menuitem label="Roadmap" value="https://www.mozilla.org/roadmap.html" /> <menuitem label="Projects" value="https://www.mozilla.org/projects/" /> <menuitem label="
Ports" value="https://www.mozilla.org/
ports/" /> <menuitem label="Module Owners" value="https://www.mozilla.org/owners.html" /> <menuitem label="Hacking" value="https://www.mozilla.org/hacking/" /> <menuitem label="Get the Source" value="https://www.mozilla.org/source.html" /> <menuitem label="Build It" value="https://www.mozilla.org/build/" ...
...https://www.mozilla.org/hacking/" /> <menuitem label="Get the Source" value="https://www.mozilla.org/source.html" /> <menuitem label="Build It" value="https://www.mozilla.org/build/" /> </menupopup> </menu> <menu label="Testing"> <menupopup> <menuitem label="Download" value="https://www.mozilla.org/releases/" /> <menuitem label="Re
port a Bug" value="https://bugzilla.mozilla.org/enter_bug.cgi?format=guided" /> <menuitem label="Bugzilla" value="https://www.mozilla.org/bugs/" /> <menuitem label="Bug Writing" value="https://www.mozilla.org/quality/bug-writing-guidelines.html" /> </menupopup> </menu> <menu label="Tools"> <menupopup> <menuitem label="View Source" value="ht...
Using the Editor from XUL - Archive of obsolete content
- we use this to get the URL to be loaded), then it calls EditorStartup(), where the real work happens. It passes two parameters; the first indicates whether we want a plain text or HTML editor (pass text or html here), and the second is the <iframe> element on which we wish to create the editor. We could either pass document.getElementById("content-frame") or window._content here. The im
portant stuff in EditorStartup() begins where we get or create an editorShell. The <editor> tag actually creates an nsEditorBoxObject behind the scenes. The nsEditorBoxObject creates an nsEditorShell, and holds the owning reference to it. Through the magic of XBL, the XUL bindings, and the nsIEditorBoxObject interface, you can get a JavaScript reference to the editorShell from the editor element with ...
...arting and stopping the throbber etc.). The contentWindow (another settable attribute on nsIEditorShell) points to the XUL element which is to become editable. Note: since we already know this when we have an <editor></editor> tag, we should remove the need to call this. EditorStartup() does some other minor bits of setup before finally kicking off the URL load, which the most im
portant part here. When the XUL was parsed, the src attribute on the content frame was set to about:blank (our default 'blank page' URL). We can't set that before XUL parsing, so we have to force a load of the page we now want to edit. We get the URL to load from the args element, then kick off the load: var url = document.getElementById("args").getAttribute("value"); editorShell.LoadUrl(url); ...
... and ready to go. One thing to note about editor initialization is that we pass into the editor's Init() method an nsIContent* that corresponds to the root of the content tree that the editor is allowed to work with. When initializing the editor from the nsEditorShell, we pass NULL here (which tells the editor that it can edit everything under the <body> of the document). This parameter is more im
portant when the editor is in a text widget, where it points to the the subtree of the parent document that corresponds to widget content. Editor teardown Window destruction, and hence editor teardown is initiated in two ways, listed below. In both cases, the EditorCanClose() method is the JavaScript is called, which causes the nsEditorShell to display a dialog asking the user if they want to sav...
XUL accessibility tool - Archive of obsolete content
General Information The XUL Accessibility Tool is a Firefox extension designed by Aaron Andersen of WebAIM as part of a Mozilla Foundation accessibility minigrant in the spring of 2007. It is designed to test (insofar as automated testing is possible) the guidelines and requirement for creating accessible XUL as set forth in the XUL accessibility guidelines, and to re
port on any problems found in tested documents. While not meant to be a comprehensive test suite (meaning that passing all included tests does not guarantee that an application is free of accessibility bugs or issues), many of the most common accessibility mistakes will be found and re
ported. Availability The XUL Accessibility Tool can currently be obtained from [http://www.xulplanet.com/aaron/files...bilitytool.xpi]. Fut...
... Thunderbird 3.0a+ Recent Sunbird builds Recent Songbird builds. It probably also works on Seamonkey, but I haven't verified this. Use To launch the tool after installation, look for an entry in the Tools menu of the host application, or hit Ctrl+Alt+Shift+F12. Once the tool window has loaded, select either a local file, web url, or currently open window from the File menu to generate a XUL re
port for that document. Be aware that the re
port might take a little while to be ready depending on the complexity of the application being analyzed and the speed of your machine. Future Work The following things have been suggested or are planned for a future version of the tool: New Tests: (aaronlev) Warning: hardcoded color and pixel sizings (aaronlev) Error: Duplicate accesskey in a dialog (...
...aaronandy) List of things to check manually, such as a list oftrees in the document (make sure they have accessible column picker equivs) or a list of toolbarbuttons (make sure they have accessible alternatives). New Features: (aaronlev) Automatically test any new windows as they are opened. (aaronandy) Highlight or blink source element in original XUL app upon click of referencing line in re
port. (aaronlev) Compatibility with more XUL Applications. (aaronandy) Maybe an online tool to automatically generate a XUL A11y Tool compatible with a user-specified XUL app. (aaronandy) Link re
port sections to relevant part of XUL A11y Guidelines. (aaronandy) Enable tabs, context menu, and other browser extras in re
port window. (aaronandy) XUL Runner version that can run from the command line, c...
arrowscrollbox - Archive of obsolete content
ement, leave this attribute out entirely. Visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. smoothscroll Type: boolean true initially enables smooth scrolling for the corresponding arrowscrollbox, false disables it. Currently, smooth scrolling sup
ports horizontal arrowscrollboxes only. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. Properties Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, ...
...you retrieve the number of pixels by which scrolling will occur when the arrowscrollbox is clicked. smoothScroll Type: boolean Can be set to enable or disable smooth scrolling for the corresponding arrowscrollbox. If not set explicitly, it will fall back to the smoothscroll attribute and then to the toolkit.scrollbox.smoothScroll preference. Currently, smooth scrolling sup
ports horizontal arrowscrollboxes only. tabIndex Type: integer Gets and sets the value of the tabindex attribute. Methods ensureElementIsVisible( element ) Return type: no return value If the specified element is not currently visible to the user, the displayed items are scrolled so that it is. If the item is already visible, no scrolling occurs. scrollByIndex( ...
...ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
panel - Archive of obsolete content
the button's type attribute so that when the button is pressed, the panel will be displayed. A panel may also be opened via a script using the openPopup method. The panel is closed when the user clicks outside the panel, presses Escape or when the panel's hidePopup method is called. Warning: For Firefox versions between 3.6 and 4.0, placing an iframe, browser or editor inside a panel is not sup
ported. Some features may work, but only on some platforms. For those versions of Firefox, it is best to avoid child frames in a panel, if possible. This limitation was resolved as of Firefox 4.0. Attributes backdrag, close, consumeoutsideclicks, fade, flip, ignorekeys, label, left, level, noautofocus, noautohide, norestorefocus, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, positio...
... ...
...d_before, end_after, overlap, and after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values. x, y For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the view
port of the document containing the popup node. In this case, the position and attributesOverride arguments are ignored. isContextMenu The isContextMenu argument should be true for context menus and false for all other types of popups. It affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesO...
Deploying XULRunner - Archive of obsolete content
Current XULRunner is a stable developer preview release. This means that while the release is immature in some areas such as embedding, application deployment, and OS integration, it can be used by developers that are releasing standalone XUL applications. This document explains how deployment should be managed for self contained
portable applications built on XULRunner. Note: To actually install a XULRunner application, a compatible version of XULRunner must be registered on the system and the app must be deployed per the instructions at XUL Application Packaging. If your installer is capable of determining whether or not XULRunner has been registered on the system you could perform the check and register the appropriate version if necessary. After that, the app could be installed t...
...r and appear in start menus, lists of installed programs, etc. (Bonus points for checking the operating system and downloading the right XULRunner on the fly, or bundling them into your installer). Registration and app installation are performed with command line switches as outlined in the XULRunner section of article Command Line Options. It may turn out to be easier to create a self contained
portable application, as described here, and deploy it with a generic installer that would create shortcuts to scripts that launch your application in the unregistered bundled XULRunner. The responsibility still lies with the developer to provide the correct version of XULRunner per platform. In the end, most users are afraid of links that don't have a pretty icon so you may want to have a look at the...
...ou should copy this file from /Library/Frameworks/XUL.framework/Versions/1.8/xulrunner.) libmozglue.dylib (the main XUL library) ... other executables and libraries The core changes to XUL and Gecko that require this new file layout were implemented in Gecko 34, except that the XULRunner application was not updated to know about the change, so it will re
port an error: "Unable to load XPCOM." XULRunner was fixed in Gecko 39. See this blog post for additional background about this change. XULRunner 38 and earlier In XULRunner 38 and earlier, XULRunner is provided in a Mac OS X Framework bundle, which is placed in your application bundle's Frameworks directory. The complete bundle structure is as follows: MyApp.app/ Contents/ Inf...
Dialogs in XULRunner - Archive of obsolete content
ou can use in a dialog. In the future, I will try to go into more detail on some of the existing and planned XUL input controls. Not too sure if I'll use the <dialogheader>, but if I did, the single element would be a big time saver over building the header from scratch. Common dialogs Some of the most frequently used common dialogs are for opening and saving files. For instance, Windows has sup
ported built-in file open and file save dialogs for many years, and the Macintosh has always had them. It makes creating an application easier for developers; in addition, the consistent user experience also makes applications easier to use. XUL sup
ports native implementations of filepickers (Mozilla terminology for File Open and Save dialogs). Newer releases will allow using preferences to switch to ...
... Future articles in this series will look at input controls, printing, the clipboard, and XPCOM. See also dialog XUL Tutorial:Creating Dialogs nsIFilePicker XUL Tut...
..., nsIFilePicker.modeOpen); fp.appendFilters(nsIFilePicker.filterText | nsIFilePicker.filterAll); var res = fp.show(); if (res == nsIFilePicker.returnOK) { var thefile = fp.file; alert(thefile.leafName); // --- do something with the file here --- } } XUL does not currently sup
port any other common dialogs. That could change in future releases. Firefox and Thunderbird both sup
port nearly native Page Setup and Print dialogs. However, XUL does sup
port elements to make creating wizards a simple task as well. Future articles in this series will look at input controls, printing, the clipboard, and XPCOM. See also dialog XUL Tutorial:Creating Dialogs nsIFilePicker XUL Tutorial:Open and Save Dialogs << Previous Original Document Information Author: Mark Finkl...
Mozprofile - Archive of obsolete content
perated on may be specified with the --profile switch. If a profile is not specified, one will be created in a temporary directory which will be echoed to the terminal: (mozmill)> mozprofile /tmp/tmp4q1iEU.mozrunner (mozmill)> ls /tmp/tmp4q1iEU.mozrunner user.js To run mozprofile from the command line enter: mozprofile --help for a list of options. ...
...p for a list of options. API Usage To use mozprofile as an API you can im
port mozprofile.profile and/or the AddonManager. mozprofile.profile features a generic Profile class. In addition, subclasses FirefoxProfile and ThundebirdProfile are available with preset preferences for those applications. Installing Addons Addons may be installed individually or from a manifest. ...
...ub.com/mozilla/mozbase/b...permissions.py Resources Other Mozilla programs offer additional and overlapping functionality for profiles. There is also substantive documentation on profiles and their management. ProfileManager : XULRunner application for managing profiles. Has a GUI and CLI. python-profilemanager : python CLI interface similar to ProfileManager profile documentation : http://sup
port.mozilla.com/kb/Profiles ...
2006-12-01 - Archive of obsolete content
Announcements Introducing RhinoLoader A byproduct of Helma that extends Java applications with Rhino/JS. It is basically a Java classloader that creates classes from JavaScript files. Server Side SpiderMonkey JuiceScript is an open source version of a Server Side JavaScript. It sup
ports a Apache2 module and stand alone version. http://www.juicescript.org/ Discussions Deleting Objects in SpiderMonkey A user asks if there's a method of manually deleting an object in SpiderMonkey before garbage collector deletes it. Peter Wilson's reply was to add a method that does the deleting with a native implementation that releases the resources held by the object as seen in this database interface: var myDbase = new PgsqlConnection; myDbase.connect("database"); myDbase.exec("SELECT * FR...
... http://www.whitebeam.org is an example of open source Server Side JavaScript. ...
...ECT * FROM mytable WHERE ..."); // Use the result data - (native implementation function) myDbase.close() SpiderMonkey for Server side Inquiry about why JavaScript hasn't caught on for general server-side scripting. Peter Wilson lists some im
portant comparisons between SpiderMonkey and PHP. He states that JavaScript is powerful server-side scripting but it lacks in popularity since its only sup
ported by Netscape, lacks a wide range of libraries, minimal marketing sup
port. http://www.whitebeam.org is an example of open source Server Side JavaScript. ...
NPN_GetAuthenticationInfo - Archive of obsolete content
<< Gecko Plugin API Reference << Browser Side Plug-in API Summary The function is called by plugins to get HTTP authentication information from the browser. ...
...The browser passes back the HTTP username. If the function succeeds, the result buffer will be allocated with NPN_MemAlloc; the plugin is responsible for freeing the buffer. Note: the username may have internal NULL bytes and may not be NULL-terminated. ulen Out parameter. The length...
...The browser passes back the HTTP username. If the function succeeds, the result buffer will be allocated with NPN_MemAlloc; the plugin is responsible for freeing the buffer. Note: the username may have internal NULL bytes and may not be NULL-terminated. ulen Out parameter. The length of t...
NPAPI plugin reference - Archive of obsolete content
PI This chapter describes methods in the plug-in API that are provided by the browser; these allow call back to the browser to request information, tell the browser to repaint part of the window, and so forth. The names of all of these methods begin with NPN_ to indicate that they are implemented by the browser and called by the plug-in. NP_GetMIMEDescription NP_GetMIMEDescription returns a sup
ported MIME Type list for your plugin. It works on Unix (Linux) and MacOS. On Windows you have to define sup
ported mimetypes in the dll resource file. NP_GetValue Allows the browser to query the plug-in for information. NP_Initialize Provides global initialization for a plug-in. NP_
Port Contains information required by the window field of an NPWindow structure. NP_Shutdown Provides global dein...
...asMethod Determines whether or not the specified NPObject has a particular method. NPN_HasProperty Determines whether or not the specified NPObject has a particular property. NPN_IdentifierIsString Determines whether or not an identifier is a string. NPN_IntFromIdentifier Returns the integer value corresponding to the given integer identifier. NPN_InvalidateRect Invalidates the specified
portion of the plugin's drawing area, adding it to the region that needs to be redrawn when the plugin next repaints its contents. NPN_InvalidateRegion Invalidates the specified drawing region prior to repainting or refreshing a windowless plug-in. NPN_Invoke Invokes a method on the given NPObject. NPN_InvokeDefault Invokes the default method, if one exists, on the given NPObject. NPN_MemAlloc ...
...ented by browsers. This call is used to inform the browser of variable information controlled by the plugin. NPN_SetValueForURL Allows a plugin to change the stored information associated with a URL, in particular its cookies. (While the API theoretically allows the preferred proxy for a given URL to be changed, doing so does not have much meaning given how proxies are configured, and is not sup
ported.) NPN_Status Lets a plug-in display a message on the browser's status line. NPN_UserAgent Returns the browser's user agent field. This can be used to handle variations in different browsers (or versions thereof) when implementing your plug-in. NPN_UTF8FromIdentifier Returns the UTF-8 string corresponding to the given string identifier. NPN_Version Lets plugins obtain version information...
Adobe Flash - Archive of obsolete content
e is to present tips on scripting Flash within Gecko(TM)-based web browsers. Detecting the Right Flash Plugin (and browser) Adobe Flash has exposed the scriptability feature in Netscape Gecko browsers since Flash 6r49 and later. Versions of Flash prior to Flash 6r49 (such as Flash 5) are not scriptable in Netscape Gecko browsers. Thus client-side detection for the right version of Flash is an im
portant aspect of creating a scripted Flash experience. On Mac OS X, there is an additional caveat: Netscape Gecko browsers such as Camino (formerly Chimera), the latest Mozilla browsers, and future versions of Netscape which are built using the Mach-O binary format won't be able to use Flash's scriptability features. Until Macromedia changes this from within the Flash plugin, scriptability can not be...
...ntire Web. As part of Mozilla's effort to improve the user experience, a feature was added in Firefox 49 that automatically blocks certain Flash modules that have little or no user-noticeable impact from being used. These block-listed modules include various fingerprinting and HTTP_cookie#Supercookie modules. In the future, other modules may be blocked as well. And, of course, eventually Flash sup
port will be removed from Firefox entirely. Most of its functions can be reproduced using modern Web APIs. Using the right HTML The object element OR the embed element can be used to invoke plugins in Netscape Gecko browsers. The former is part of the W3C HTML 4 standard, whereas the latter is a deprecated element, as discussed in Using the Right Markup to Invoke Plugins. However, if you wish to use...
...sh animation affects something in the HTML page that contains the Flash animation. Example 3 shows FSCommands in action. If you are embedding a Flash animation and wish to use FSCommands in Netscape Gecko browsers, currently you must use the embed element and not the object element. You can always nest the embed element within the object element that you serve to IE. Future Flash versions may sup
port the object element for use with FSCommands in Netscape Gecko browsers. This issue is being tracked in Mozilla's bug 184722. The background color of the entire page is toggled by clicking on a color within the Flash animation. Clicking on the animation makes a callback to the external environment that hosts the plugin (the HTML page) and looks for a JavaScript method to handle the call from withi...
Encryption and Decryption - Archive of obsolete content
he symmetric key is kept secret by the two parties involved. If anyone else discovers the key, it affects both confidentiality and authentication. A person with an unauthorized symmetric key not only can decrypt messages sent with that key, but can encrypt new messages and send them as if they came from one of the two parties who were originally using the key. Symmetric-key encryption plays an im
portant role in the SSL protocol, which is widely used for authentication, tamper detection, and encryption over TCP/IP networks. SSL also uses techniques of public-key encryption, which is described in the next section. Public-Key Encryption The most commonly used implementations of public-key encryption are based on algorithms patented by RSA Data Security. Therefore, this section describes the RS...
...data encrypted with your private key can be decrypted only with your public key. This would not be a desirable way to encrypt sensitive data, however, because it means that anyone with your public key, which is by definition published, could decrypt the data. Nevertheless, private-key encryption is useful, because it means you can use your private key to sign data with your digital signature-an im
portant requirement for electronic commerce and other commercial applications of cryptography. Client software such as Firefox can then use your public key to confirm that the message was signed with your private key and that it hasn't been tampered with since being signed. "Digital Signatures" describes how this confirmation process works. Key Length and Encryption Strength Breaking an encryption a...
...is determined by finding the fastest method to break the algorithm and comparing it to a brute force attack. For symmetric keys, encryption strength is often described in terms of the size or length of the keys used to perform the encryption: in general, longer keys provide stronger encryption. Key length is measured in bits. For example, 128-bit keys for use with the RC4 symmetric-key cipher sup
ported by SSL provide significantly better cryptographic protection than 40-bit keys for use with the same cipher. Roughly speaking, 128-bit RC4 encryption is 3 x 1026 times stronger than 40-bit RC4 encryption. (For more information about RC4 and other ciphers used with SSL, see "Introduction to SSL.") An encryption key is considered full strength if the best known attack to break the key is no faster...
Create Your Own Firefox Background Theme - Archive of obsolete content
be anchored to the top-right corner of the browser window. View a sample Theme Header here. Image Requirements Dimensions should be 3000px wide x 200px high PNG or JPG file format Image must be no larger than 300 KB in file size Tips Subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser UI. Firefox may reveal more of the lower
portion of the image if another toolbar or other UI element is added to the top of the window. The upper right-hand side of the image should have the most im
portant information--as a user increases the width of the browser window, the browser reveals more of the left-hand side of the image. Online Image Editor Resources Pixlr -- Pixlr offers professional and easy-to-use tools for creating and ed...
... corner of the browser window. Footer images are optional. View a sample Theme Footer here. Image Requirements Dimensions should be 3000px wide x 100px high PNG or JPG file format Image must be no larger than 300 KB in file size Tips Subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser UI. Firefox may reveal more of the upper
portion of the image if the find bar is open or if an extension adds more height to the bottom of the window. The left-hand side of the image should have the most im
portant information--as a user increases the width of the browser window, the browser reveals more of the right-hand side of the image. Submitting your Theme Images To get started submitting your images, go to the Theme Submission page...
...is obvious that your category and/or tags are unrelated to your theme. Describe your theme -- write a short description of your theme. Keep in mind that a reviewer may reject your theme if your description is not an accurate representation of your theme. Select a license for your theme -- decide on a copyright license for your work. Read more about the types of Creative Common licenses. Im
portant: Please be sure you have the rights to use the image in your theme! Upload your images -- make sure they are under 300 KB in size and JPG or PNG format! Select text and tab colors -- you can choose the tab ("background") color and foreground text color that work best with your header image. Preview your theme -- you're ready to preview your theme! Simply mouse over the image above the ...
Theme changes in Firefox 2 - Archive of obsolete content
New file; CSS used in the application's about box. global/alltabs-box-bkgnd.png New file; the background for the "all tabs" drop-down menu at the right side of the tab bar. global/alltabs-box-overflow-bkgnd.png New file; the background for the "all tabs" drop-down menu when there are enough tabs to activate tab bar scrolling. global/browser.css Revised to sup
port new styles for the main browser window. global/globalBindings.xml Updated to sup
port changes to the tab bar, including per-tab close buttons. global/icons/alltabs.png Not actually used; left over from earlier drafts of the theme. global/inactivetab-left.png Removed file. global/inactivetab-right.png Removed file. global/menu.css Updated ...
... global/tabbrowser-tabs-bkgnd.png New file; the background for the tab bar, displayed behind all tabs. global/toolbar.css Needs to be updated to include new styles. mozapps/extensions/about.css Updated with a simplified set of style names, since several styles were identical. mozapps/extensions/extensions.css CSS for the add-ons manager window. Updated to sup
port the new features of the Firefox 2 add-ons manager. mozapps/extensions/itemDisabledFader.png New file; a translucent PNG used as an overlay on top of items that are disabled in the add-ons manager. mozapps/extensions/itemEnabledFader.png New file; a translucent PNG used as an overlay on top of items that are enabled in the add-ons manager. mozapps/extensions/notify...
...button-icon .feedSubscribeLink .feedSubscribeLinkBox .field .link .link:hover:active .plain .plain > .button-box .plain:focus > .button-box .styleLessBorderLess The default theme also includes styles for a[href] img, body, h1, h2, and html. safebrowser/browser-protection.css This file, new to Firefox 2, skins browser protection features. ...
Using SSH to connect to CVS - Archive of obsolete content
source code page for directions accessing read-only CVS, and our getting write access page for directions on obtaining write access. Generating an SSH key First, install ssh. Most Linux, BSD, and OSX distributions come with it installed already. Cygwin makes ssh available on Windows if you install the openssh package from the Net category. If all else fails, OpenSSH is a widely used and highly
portable implementation. The following command should generate a suitable key pair: ssh-keygen -t dsa This will take a moment, followed by a prompt for a passphrase. Once you have entered a passphrase, ssh-keygen will create two files, ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub Do not sendid_dsa. Do file a Server Operations bug in Bugzilla and attach yourid_dsa.pub to the bug. Setting up CVS to us...
...owing the instructions in the INSTALL file in the corkscrew source distribution. Corkscrew uses the standard "./configure; make install" technique common to many open source projects. Make sure you have a ~/.ssh/config file that has at least the following directives PreferredAuthentications hostbased,publickey,password Host cvs.mozilla.org ProxyCommand corkscrew <i>proxyserver.foo.com</i> <i>
port</i> %h %p Replaceproxyserver.foo.com with the hostname of your proxy server, and
port with the numeric TCP
port on which the http tunnel is running. The usual cvs commands should now work. Avoiding passphrase requests You can avoid repeated passphrase requests by using ssh-agent. If you don't already run ssh-agent on your computer, it's probably easiest to start it up whenever you set up your...
.../id_dsa start /b /wait cmd.exe ssh-agent -k exit Essentially both sets of commands do the same thing. First ssh-agent is called and its output is evaluated in the current environment. This sets environment variables that let cvs know how to find and use the agent. Your private key is then added to ssh-agent using ssh-add at which point you will be prompted for the key's passphrase. Since it's im
portant that you kill the agent when you're finished with it, the last three lines start a child environment that, when exited, will result in the agent's process being killed. The environment you will actually use to build is the child environment. There are a few things to note about the commands for the MS-DOS Command Prompt. First of all they will only work in versions of Windows based on NT (NT/...
:-moz-system-metric(windows-default-theme) - Archive of obsolete content
e.g. to XUL / chrome code). See bug 1396066 for more details. Example HTML Content <p id="defaultThemes"> This paragraph should have a green background with Luna/Royale/Zune/Aero Windows themes and red with other themes. </p> <p id="nonDefaultThemes"> This paragraph should have a green background with Windows Classic or third-party themes and red with other themes. ...
...g 1396066 for more details. Example HTML Content <p id="defaultThemes"> This paragraph should have a green background with Luna/Royale/Zune/Aero Windows themes and red with other themes. </p> <p id="nonDefaultThemes"> This paragraph should have a green background with Windows Classic or third-party themes and red with other themes. ...
...ssic or third-party themes and red with other themes. </p> <p id="notSup
ported">Theme detection is not sup
ported.</p> CSS Content #defaultThemes, #nonDefaultThemes { background-color: #FFA0A0; } #defaultThemes:-moz-system-metric(windows-default-theme) { background-color: #A0FFA0; } #nonDefaultThemes:not(-moz-system-metric(windows-default-theme)) { background-color: #A0FFA0; } #notSup
ported:-moz-system-metric(windows-default-theme), #notSup
ported:not(:-moz-system-metric(windows-default-theme)) { display: none; } Specifications Not part of any specification. ...
:-moz-system-metric() - Archive of obsolete content
ox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). See bug 1396066 for more details. ...
...ard) CSS pseudo-class will match an element if the computer's user interface includes a backward arrow button at the start of scrollbars.:-moz-system-metric(scrollbar-start-forward)The :-moz-system-metric(scrollbar-start-forward) CSS pseudo-class will match an element if the computer's user interface includes a forward arrow button at the start of scrollbars.:-moz-system-metric(scrollbar-thumb-pro
portional)The :-moz-system-metric(scrollbar-thumb-pro
portional) CSS pseudo-class will match an element if the computer's user interface uses pro
portional scrollbar thumbs; that is, the draggable thumb on the scrollbar resizes to indicate the relative size of the visible area of the document.:-moz-system-metric(touch-enabled)The :-moz-system-metric(touch-enabled) CSS pseudo-class will match an element ...
...seudo-class will match an element if the computer's user interface uses pro
portional scrollbar thumbs; that is, the draggable thumb on the scrollbar resizes to indicate the relative size of the visible area of the document.:-moz-system-metric(touch-enabled)The :-moz-system-metric(touch-enabled) CSS pseudo-class will match an element if the device on which the content is being rendered offers a sup
ported touch-screen interface.:-moz-system-metric(windows-default-theme)The :-moz-system-metric(windows-default-theme) CSS pseudo-class matches an element if the user is currently using one of the following themes in Windows: Luna, Royale, Zune, or Aero (i.e., Vista Basic, Vista Standard, or Aero Glass). This will exclude Windows Classic themes as well as third-party themes. Formal syntax Syntax not...
Enumerator.atEnd - Archive of obsolete content
The Enumerator.atEnd method returns a Boolean value indicating if the enumerator is at the end of the collection. Syntax myEnum.atEnd() Remarks The required myEnum reference is any Enumerator object. The atEnd method returns true if the current item is the last one in the collection, the collection is empty, or the current item is undefined. Otherwise, it returns false. ...
... Applies To: Enumerator Object ...
... Applies To: Enumerator Object ...
Enumerator.item - Archive of obsolete content
The Enumerator.item method returns the current item in the collection. Syntax enumObj.item() Remarks The required enumObj reference is any Enumerator object. The item method returns the current item. If the collection is empty or the current item is undefined, it returns undefined. ...
... Applies To: Enumerator Object ...
... Applies To: Enumerator Object ...
Enumerator.moveFirst - Archive of obsolete content
The Enumerator.moveFirst method resets the current item in the collection to the first item. Syntax enumObj.moveFirst( ) Remarks The required enumObj reference is any Enumerator object. If there are no items in the collection, the current item is set to undefined. ...
... Applies To: Enumerator Object ...
... Applies To: Enumerator Object ...
Enumerator.moveNext - Archive of obsolete content
The Enumerator.moveNext method moves the current item to the next item in the collection. Syntax enumObj.moveNext( ) Remarks The required enumObj reference is any Enumerator object. If the enumerator is at the end of the collection or the collection is empty, the current item is set to undefined. ...
... Applies To: Enumerator Object ...
... Applies To: Enumerator Object ...
VBArray.dimensions - Archive of obsolete content
The VBArray.dimensions method returns the number of dimensions in a VBArray. Syntax array.dimensions( ) Remarks The required array is a VBArray object. Example The dimensions method provides a way to retrieve the number of dimensions in a specified VBArray. The following example consists of three parts. The first part is VBScript code to create a Visual Basic safe array. The second part is JavaScript code that determines the number of dimensions in the safe array and the upper bound of each dimension. Both of these parts go into the <HEAD> section of an HTML page. ...
... Applies To: VBArray Object ...
... Applies To: VBArray Object ...
VBArray.getItem - Archive of obsolete content
The VBArray.getItem method returns the item at the specified location. Syntax safeArray.getItem(dimension1[, dimension2, ...], dimensionN) Parameters safeArray A VBArray object. dimension1, ..., dimensionN Specifies the exact location of the desired element of the VBArray. n equals the number of dimensions in the VBArray. Example The following example consists of three parts. The first part is VBScript code to create a Visual Basic safe array. The second part is JavaScript code that iterates the Visual Basic safe array and prints out the contents of each element. ...
...See Version Information. Applies To: VBArray Object ...
...See Version Information. Applies To: VBArray Object ...
VBArray.lbound - Archive of obsolete content
The VBArray.lbound method returns the lowest index value used in the specified dimension of a VBArray. Syntax safeArray.lbound(dimension) Remarks If the VBArray is empty, the lbound method returns undefined. If dimension is greater than the number of dimensions in the VBArray, or is negative, the method generates a "Subscript out of range" error. Parameters safeArray A VBArray object. dimension Optional Optional. The dimension of the VBArray for which the lower bound index is wanted. If omitted, lbound behaves as if a 1 was passed. Example The following example consists of three parts. ...
... Applies To: VBArray Object ...
... Applies To: VBArray Object ...
VBArray.toArray - Archive of obsolete content
The VBArray.toArray method returns a standard JavaScript array converted from a VBArray. Syntax safeArray.toArray( ) Remarks The required safeArray reference is a VBArray object. The conversion translates the multidimensional VBArray into a single dimensional JavaScript array. Each successive dimension is appended to the end of the previous one. For example, a VBArray with three dimensions and three elements in each dimension is converted into a JavaScript array as follows: Suppose the VBArray contains: (1, 2, 3), (4, 5, 6), (7, 8, 9). ...
... Applies To: VBArray Object ...
... Applies To: VBArray Object ...
VBArray.ubound - Archive of obsolete content
The VBArray.ubound method returns the highest index value used in the specified dimension of the VBArray. Syntax safeArray.ubound(dimension) Parameters safeArray A VBArray object. dimension Optional The dimension of the VBArray for which the higher bound index is wanted. If omitted, ubound behaves as if a 1 was passed. Remarks If the VBArray is empty, the ubound method returns undefined. If dim is greater than the number of dimensions in the VBArray, or is negative, the method generates a "Subscript out of range" error. Example The following example consists of three parts. ...
... Applies To: VBArray Object ...
... Applies To: VBArray Object ...
@cc_on - Archive of obsolete content
Warning: Conditional compilation is not sup
ported in Internet Explorer 11 Standards mode and Windows 8.x Store apps. Conditional compilation is sup
ported in Internet Explorer 10 Standards mode and in all earlier versions. The @cc_on statement activates conditional compilation sup
port within comments in a script. Syntax @cc_on Remarks The @cc_on statement activates conditional compilation within comments in a script. It is not common to use conditional compilation variables in scripts written for ASP or ASP.NET pages or command-line programs because the capabilities of the compilers can be determined by using other methods. When you write a script for a Web page, always put conditional compilation code in comments. ...
...ivates conditional compilation within comments in a script. It is not common to use conditional compilation variables in scripts written for ASP or ASP.NET pages or command-line programs because the capabilities of the compilers can be determined by using other methods. When you write a script for a Web page, always put conditional compilation code in comments. This enables hosts that do not sup
port conditional compilation to ignore it. It is strongly recommended that you use the @cc_on statement in a comment, so that browsers that do not sup
port conditional compilation will accept your script as valid syntax: An @if or @set statement outside of a comment also activates conditional compilation. Example The following example illustrates the use of the @cc_on statement. /*@cc_on @*/ /*@ ...
... ...
@if - Archive of obsolete content
The @if statement conditionally executes a group of statements, depending on the value of an expression. Syntax @if ( condition1 ) text1 [@elif ( condition2 ) text2] [@else text3] @end Parameters text1 Optional Text to be parsed if condition1 is true. text2 Optional Text to be parsed if condition1 is false and condition2 is true. text3 Optional Text to be parsed if both condition1 and condition2 are false. ...
...ng several options should be used for text output. It is not common to use conditional compilation variables in scripts written for ASP or ASP.NET pages or command-line programs. This is because the capabilities of the compilers can be determined by using other methods. When you write a script for a Web page, always add conditional compilation code in comments. This enables hosts that do not sup
port conditional compilation to ignore it. Example The following example illustrates the use of the @if...@elif...@else...@end statement. /*@cc_on @*/ /*@ document.write("JavaScript version: " + @_jscript_version + "."); document.write("<br />"); @if (@_win32) document.write("Running on a 32-bit version of Windows."); @elif (@_win16) document.write("Running on a 16-b...
... ...
New in JavaScript 1.2 - Archive of obsolete content
JavaScript versions Netscape Navigator 4.0 executes JavaScript language versions up to 1.2. Note that Netscape Navigator 3.0 and earlier ignored scripts with the language attribute set to "JavaScript1.2" and higher. ...
... Number now converts a specified object to a number. Number now produces NaN rather than an error if x is a string that does not contain a well-formed numeric literal. String now converts a specified object to a string. Array.prototype.so...
... Number now converts a specified object to a number. Number now produces NaN rather than an error if x is a string that does not contain a well-formed numeric literal. String now converts a specified object to a string. Array.prototype.sort() now...
New in JavaScript 1.3 - Archive of obsolete content
Changed functionality in JavaScript 1.3 Changes to Date to conform with ECMA-262 New constructor Date(year, month, day, [,hours [, minutes [, seconds [, milliseconds ]]]]) Additional method parameters: setMonth(month[, date]) setHours(hours[, min[, sec[, ms]]]) setMinutes(min[, sec[, ms]]) setSeconds(sec[, ms]) ...
... toString(). Non-ECMA-262 features of JavaScript 1.3 The following is a comparison between the June 1998 version of ECMA-262 and JavaScript 1.3. The following features were not part of the standard at that time, but implemented in JavaScript 1.3. Keywords and operators Strict equality operators vertical tab (\v or \u000B) as an escape sequence. ...
...g(). Non-ECMA-262 features of JavaScript 1.3 The following is a comparison between the June 1998 version of ECMA-262 and JavaScript 1.3. The following features were not part of the standard at that time, but implemented in JavaScript 1.3. Keywords and operators Strict equality operators vertical tab (\v or \u000B) as an escape sequence. ...
Reference - Archive of obsolete content
possible; language="JavaScript1.x" tags will always use the current version now, i.e. JS 1.6. So while the examples do show what JS 1.2 does, they incorrectly indicate that it's possible to switch to the 1.2 engine. --Maian 05:41, 22 September 2005 (PDT) This is true. The wording should be changed with the Javascript 1.x examples, as well as refer to the versions in the past tense. I also sup
port the use of a deprecated pre box with these examples. Since it's been 9 months since the last comment on this, I think I'll go ahead and change all of the examples. If anyone disagrees, you can always revert. Sevenspade 13:19, 2 July 2006 (PDT) After some thought, I removed the references to using LANGUAGE="JavaScript1.2", and all references are merely presented as information detailing past...
...anyone feverishly working on it. (There are some other priorities ahead of that, imho). If downloading the stuff is your priority you are free to field ideas/concept to the DevMo Mailing List for discussion, and then actually code it (or find someone to do so). Thanks for your thoughts --Callek 15:05, 13 January 2006 (PST) Notification when reorganization is finished Leandro (localiser for the
Portuguese wiki) would like to be emailed when the JS Reference reorganization has been finished. His user page is here: http://developer.mozilla.org/pt/docs...%C3%AAs_Xavier -- dria 08:19, 24 February 2006 (PST) Object and Function Relation here is my problem , it has been breaking my head for quite some time now. i'm very confused about the way Function and Object in the JavaScript core are rela...
...avaScript 2.0, JavaScript XXXXII.1, etc. comes out ? Make a footnote on each page, pointing to a page listing "Hot New JavaScript Features", which in turn points to 1 page for 1.6, 1 page for 1.7, etc., listing all the differences from one version to the next ? This would be the simplest thing for us to write. But someone trying write some JavaScript 2.0, wanting a list of all the features it sup
ports, might be annoyed at having to read through *all* the updates. Make a footnote on each page, pointing to a page listing "Hot New JavaScript Features", which lists all the differences between the current latest version, and the documented 1.5 version ? (Every time a new version comes out, a few more things are added to that page). None of those options appeal to me. What is the Right Way to wri...
XForms Select Element - Archive of obsolete content
Introduction Allows the user to choose one or more selections from a list of pre-defined items (see the spec). The list of pre-defined items can be specified by either item (see the spec) or itemset (see the spec) elements. You can visually group these pre-defined items by using the choices (see the spec) element to contain them. Note, some representations of the select element do not sup
port visual grouping. Attributes UI Common appearance - the value of this attribute gives a hint to the XForms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special selection - isn't currently sup
ported. This attribute, when set to 'open', allows the user to provide free ent...
...t to the XForms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special selection - isn't currently sup
ported. This attribute, when set to 'open', allows the user to provide free entry to the list. Possible values are open and closed, default is closed. incremental - sup
ported, default value is true Properties selection - see corresponding attribute incremental - see corresponding attribute Type restrictions The select element can be bound to a node containing simple content capable of holding a sequence. The data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to be obtained from an XF...
... if incremental attribute value is false, the bound node is updated when the select control is blurred (i.e. loses focus), otherwise it is updated upon item selection check group The select is represented as group of checkboxes (xhtml/xul). ...
XForms Textarea Element - Archive of obsolete content
The default value is false. Type restrictions The textarea element can be bound to a node of type xsd:string or any type derived from it. Representations The XForms textarea element is represented by a multiline text field (xhtml/xul). ...
...The default value is false. Type restrictions The textarea element can be bound to a node of type xsd:string or any type derived from it. Representations The XForms textarea element is represented by a multiline text field (xhtml/xul). ...
...The default value is false. Type restrictions The textarea element can be bound to a node of type xsd:string or any type derived from it. Representations The XForms textarea element is represented by a multiline text field (xhtml/xul). ...
RDF in Mozilla FAQ - Archive of obsolete content
RDF in Fifty Words or Less is a quick, high-level description of what RDF does in Mozilla. The RDF Back-end Architecture document describes in more detail how Mozilla's RDF implementation works, and gives a quick overview of the interfaces that are involved. ...
...rally a bad idea, because your UI will completely lock up! remote.Refresh(false); // Note that ds will load asynchronously, so assertions will not // be immediately available You may decide that you need to "manually" create an RDF/XML datasource if you want to force it to load synchronously. How do I reload an RDF/XML datasource? You can force an RDF/XML datasource (or any datasource that sup
ports nsIRDFRemoteDataSource) to reload using the Refresh() method of nsIRDFRemoteDataSource. Refresh() takes a single parameter that indicates whether you'd like it to perform its operation synchronously ("blocking") or asynchrounously ("non-blocking"). You should never do a synchronous load unless you really know what you're doing: this will freeze the UI until the load completes! How can I tell if...
...ned scripts, and are runnable from HTTP directly. See also duplicates.rdf (for live RDF feed from Mozilla) alongside duplicates.xul. Note that for these to work, you have to relax Mozilla's security model. To do this, add the following line to your preferences file. (Shut down Mozilla first since it overwrites your preferences file when you quit.) user_pref("signed.applets.codebase_principal_sup
port", true); Mozilla will ask you if you want to grant the scripts in duplicates.xul permission to access XPConnect; respond in the affirmative. Currently, Mozilla does not allow unprivileged access to the RDF interfaces and services; see bug 122846 for details. Please mail danbri, mozilla-rdf or waterson with URLs if you are aware of other examples to which we ought to link! Notes See also W...
XQuery - Archive of obsolete content
XQuery is a W3C standard language which is meant to be for XML what SQL is for relational data--i.e., the ability to search, sort, extract, and remold data. It offers powerful and yet intuitive searching based on XPath, has SQL-like syntax for the query
portion, and has scripting features such as function and variable definitions, XML-inclusion, etc. While XQuery is currently not sup
ported in Firefox (whether through JavaScript to developers or to browser users), at least one extension has been developed to give a preliminary sup
port for XQuery for browser users (and serving as a simple model for how XQuery can be implemented within extensions). XqUSEme is a working proof-of-concept (so far tested on Windows and Linux with Java installed; Mac does not work) extension which allows one...
... allows one to perform XQueries on external URLs, the currently loaded webpage (even if originally from poorly formed HTML), and/or XML (including well-formed XHTML) documents stored locally. The extension now includes and interfaces with the open-source version of Saxonica's Saxon B (though this extension currently only performs the XQueries). ...
...ally from poorly formed HTML), and/or XML (including well-formed XHTML) documents stored locally. The extension now includes and interfaces with the open-source version of Saxonica's Saxon B (though this extension currently only performs the XQueries). Other popular native XML databases might also be sup
ported (e.g., eXist) in the future, especially now that the extension has added some basic sup
port for the open-standard (XQJ) for Java and eXist is in the midst of getting such an API. Berkeley DB XML was the initial choice by the extension developer for its sup
port across many languages (C++, Java, Python, Perl, PHP, etc.) (besides its also being open source), but now some problems may exist with BDBXML (unlike Saxon). A simple usage example is available. Notes for developers wishing to ac...
Common causes of memory leaks in extensions - Extensions
unload JavaScript modules in restartless add-ons Another common cause of leaks is forgetting to unload JavaScript code modules in bootstrapped add-ons. When your add-on gets updated and re-enabled, the previous module version that is still loaded will be used, which might break your add-on entirely. ...
...en your add-on gets updated and re-enabled, the previous module version that is still loaded will be used, which might break your add-on entirely. ...
...d register some chrome Components.utils.im
port("chrome://myaddon/content/mymodule.jsm"); } function shutdown(data, reason) { // No need to do regular clean up when the application is closed // unless you need to break circular references that might negatively // impact the shutdown process. if (reason == APP_SHUTDOWN) return; // Your add-on needs to unload all modules it ships and im
ported! Components.utils.unload("chrome://myaddon/content/mymodule.jsm"); } Note: Modules not belonging to your add-on -- such as Services.jsm -- should not be unloaded by your add-on, as this might cause errors and/or performance regressions and will actually increase the memory usage. Other information Also see Using XPCOM in JavaScript without leaking (though that page could use some updating...
Unconventional controls - Game development
vaScript client for the Leap Motion controller and read the documentation there. If all else fails, there's also a gallery of working examples you can look at. To get the Leap Motion working on your computer you have to first install it by following the steps at leapmotion.com/setup. When everything is installed and the controller is connected to your computer we can proceed with implementing sup
port in our little demo. First, we add a <script> tag with the url pointing at this file, and add <div id="output"></div> just before the closing </body> tag for outputting diagnostic information. We will need a few helper variables for our code to work -- one for the purpose of calculating the degrees from radians, two for holding the horizontal and vertical amount of degrees our hand is leaning abo...
...ference page for more details. MaKey MaKey If you want to go completely bananas you can use MaKey MaKey, a board that can turn anything into a controller -- it's all about connecting real-world, conductive objects to a computer and using them as touch interfaces. Check out the banana piano video, and be sure to visit the quick start guide for all the needed info. ...
...he quick start guide for all the needed info. There's even a Cylon.js-sup
ported Makey Button functionality inspired by the MaKey MaKey board, so you can use the popular Cylon robotics framework for your experiments with Arduino or Raspberry Pi. ...
Square tilemaps implementation: Scrolling maps - Game development
lready. The camera The camera is an object that holds information about which section of the game world or level is currently being shown. Cameras can either be free-form, controlled by the player (such as in strategy games) or follow an object (such as the main character in platform games.) Regardless of the type of camera, we would always need information regarding its current position, view
port size, etc. In the demo provided along with this article, these are the parameters the camera has: x and y: The current position of the camera. In this implementation, we are assuming that (x,y) points to the top left corner of visible
portion of the map. width and height: The size of the camera's view
port. maxX and maxY: The limit for the camera's position -- The lower limit will nearly alwa...
...current position of the camera. In this implementation, we are assuming that (x,y) points to the top left corner of visible
portion of the map. width and height: The size of the camera's view
port. maxX and maxY: The limit for the camera's position -- The lower limit will nearly always be (0,0), and in this case the upper limit is equal to the size of the world minus the size of the camera's view
port. Rendering the map There are two main differences between rendering scrolling maps vs. static maps: Partial tiles might be shown. In static maps, usually the rendering starts at the top left corner of a tile situated at the top left corner of a view
port. While rendering scrolling tilemaps, the first tile will often be clipped. TODO: show a diagram here explaining this. Only a section o...
... To handle these issues, we need to slightly modify the rendering algorithm. ...
2D maze game with device orientation - Game development
ons available) and the optional ID of the DOM container we want to put the Canvas in. If there's nothing specified in that last argument or the element is not found, the Canvas will be added to the <body> tag. Without the framework, to add the Canvas element to the page, you would have to write something like this inside the <body> tag: <canvas id='game' width='320' height='480'></canvas> The im
portant thing to remember is that the framework is setting up helpful methods to speed up a lot of things like image manipulation or assets management, which would be a lot harder to do manually. Note: You can read the Building Monster Wants Candy article for the in-depth introduction to the basic Phaser-specific functions and methods. Back to game states: the line below is adding a new state call...
...physics calculations to the middle of the ball, enabling the Arcade physics engine (which handles all the physics for the ball movement), and setting the size of the body for the collision detection. The bounce property is used to set the bounciness of the ball when it hits the obstacles. Controlling the ball It's cool to have the ball ready to be thrown around in the play area, but it's also im
portant to be able to actually move it! Now we will add the ability to control the ball with the keyboard on the desktop devices, and then we will move to the implementation of the Device Orientation API. Let's focus on the keyboard first by adding the following to the create() function : this.keys = this.game.input.keyboard.createCursorKeys(); As you can see there's a special Phaser function called...
...asy with Phaser. Implementing the Vibration API When collision detection works as expected let's add some special effects with the help from the Vibration API. The best way to use it in our case is to vibrate the phone every time the ball hits the walls -- inside the wallCollision function: if("vibrate" in window.navigator) { window.navigator.vibrate(100); } If the vibrate method is sup
ported by the browser and available in the window.navigator object, vibrate the phone for 100 miliseconds. That's it! Adding the elapsed time To improve replayability and give players the option to compete with each other we will store the elapsed time -- players can then try to improve on their best game completion time. To implement this we have to create a variable for storing the actual number o...
Site - MDN Web Docs Glossary: Definitions of Web-related terms
The site of a piece of web content is determined by the registrable domain of the host within the origin. This is computed by consulting a Public Suffix List to find the
portion of the host which is counted as the public suffix (e.g. com, org or co.uk). The concept of a site is used in SameSite cookies, as well as a web application's Cross-Origin Resource Policy. ...
... registrable domain of the host within the origin. This is computed by consulting a Public Suffix List to find the
portion of the host which is counted as the public suffix (e.g. com, org or co.uk). The concept of a site is used in SameSite cookies, as well as a web application's Cross-Origin Resource Policy. ...
... com, org or co.uk). The concept of a site is used in SameSite cookies, as well as a web application's Cross-Origin Resource Policy. ...
Origin - MDN Web Docs Glossary: Definitions of Web-related terms
Web content's origin is defined by the scheme (protocol), host (domain), and
port of the URL used to access it. Two objects have the same origin only when the scheme, host, and
port all match. Some operations are restricted to same-origin content, and this restriction can be lifted using CORS. ...
...match. Some operations are restricted to same-origin content, and this restriction can be lifted using CORS. ...
...:80 http://example.com same origin because a server delivers HTTP content through
port 80 by default Examples of different origin http://example.com/app1 https://example.com/app2 different schemes http://example.com http://www.example.com http://myapp.example.com different hosts http://example.com http://example.com:8080 different
ports Specifications Specification Status Comment HTML Living StandardThe definition of 'origin' in that specification. Living Standard Learn more See Same-origin policy for more information. ...
Backgrounds and borders - Learn web development
ed using the background-attachment property, which can take the following values: scroll: It causes the element's background to scroll when the page is scrolled. If the element content is scrolled, the background does not move. In effect, the background is fixed to the same position on the page, so it scrolls as the page scrolls. fixed: It causes an element's background to be fixed to the view
port so that it doesn't scroll when the page or element content is scrolled. It will always remain in the same position on the screen. local: This value was added later on (it is only sup
ported in Internet Explorer 9+, whereas the others are sup
ported in IE4+) because the scroll value is rather confusing and doesn't really do what you want in many cases. The local value fixes the background to the el...
...ckground image or color, you should take care that you have enough contrast for the text to be legible for your visitors. If specifying an image, and text will be placed on top of that image, you should also specify a background-color that will allow the text to be legible if the image does not load. Screen readers cannot parse background images, therefore they should be purely decoration; any im
portant content should be part of the HTML page and not contained in a background. Borders When learning about the Box Model, we discovered how borders affect the size of our box. In this lesson we will look at how to use borders creatively. Typically when we add borders to an element with CSS we use a shorthand property that sets the color, width, and style of the border in one line of CSS. We can...
...{ border-top-right-radius: 1em 10%; } We have set all four corners in the example below and then changed the values for the top right corner to make it different. You can play with the values to change the corners. Take a look at the property page for border-radius to see the available syntax options. Test your skills! We have covered a lot in this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Backgrounds and Borders. Summary We have covered quite a lot here, and you can see that there is quite a lot to adding a background or a border to a box. Do explore the different property pages if you want to find out more about any of the features we have ...
Images, media, and form elements - Learn web development
t your user visits the site with. In the example below we have styled some text inputs using CSS -- you can see that things such as borders, margins and padding all apply as you would expect. We are using attribute selectors to target the different input types. Try changing how this form looks by adjusting the borders, adding background colors to the fields, and changing fonts and padding. Im
portant: You should take care when changing the styling of form elements to make sure it is still obvious to the user they are form elements. You could create a form input with no borders and background that is almost indistinguishable from the content around it, but this would make it very hard to recognise and fill in. As explained in the lessons on form styling in the HTML part of this course, ma...
...sizing: border-box; padding: 0; margin: 0; } textarea { overflow: auto; } Note: Normalizing stylesheets are used by many developers to create a set of baseline styles to use on all projects. Typically these do similar things to those described above, making sure that anything different across browsers is set to a consistent default before you do your own work on the CSS. They are not as im
portant as they once were, as browsers are typically more consistent than in the past. However if you want to take a look at one example, check out Normalize.css, which is a very popular stylesheet used as a base by many projects. For further information on styling forms, take a look at the two articles in the HTML section of these guides. Styling web forms Advanced form styling Test your skil...
... past. However if you want to take a look at one example, check out Normalize.css, which is a very popular stylesheet used as a base by many projects. For further information on styling forms, take a look at the two articles in the HTML section of these guides. Styling web forms Advanced form styling Test your skills! We have covered a lot in this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Images and form elements. Summary This lesson has highlighted some of the differences you will encounter when working with images, media, and other unusual elements in CSS. In the next article we'll look over a few tips you'll find useful when you have to s...
Organizing your CSS - Learn web development
ggestions for ways to keep your stylesheets organised and tidy. Does your project have a coding style guide? If you are working with a team on an existing project, the first thing to check is whether the project has an existing style guide for CSS. The team style guide should always win over your own personal preferences. There often isn't a right or wrong way to do things, but consistency is im
portant. Keep it consistent If you get to set the rules for the project or are working alone, then the most im
portant thing to do is to keep things consistent. Consistency can be applied in all sorts of ways, such as using the same naming conventions for classes, choosing one method of describing color, or maintaining consistent formatting (for example will you use tabs or spaces to indent your code...
...Navigation */ ... You don't need to comment every single thing in your CSS, as much of it will be self-explanatory. What you should comment are the things where you made a particular decision for a reason. You may have used a CSS property in a specific way to get around older browser incompatibilities, for example: .box { background-color: red; /* fallback for older browsers that don't sup
port gradients */ background-image: linear-gradient(to right, #ff0000, #aa0000); } Perhaps you followed a tutorial to achieve something, and the CSS is a little non-obvious. In that case you could add the URL of the tutorial to the comments. You will thank yourself when you come back to this project in a year or so, and can vaguely remember there was a great tutorial about that thing, but where is...
...rial, so I will briefly explain a couple of the things that Sass can do, which are really helpful in terms of organisation, even if you don't use any of the other Sass features. If you want to learn a lot more about Sass, start with the Sass basics article, then move on to their other documentation. Defining variables CSS now has native custom properties, making this feature increasingly less im
portant, however one of the reasons you might use Sass is to be able to define all of the colors and fonts used in a project as settings, then use that variable around the project. This means that if you realise you have used the wrong shade of blue, you only need change it in one place. If we created a variable called $base-color as in the first line below, we could then use it through the styleshee...
Pseudo-classes and pseudo-elements - Learn web development
e next set of selectors we will look at are referred to as pseudo-classes and pseudo-elements. There are a large number of these, and they often serve quite specific purposes. Once you know how to use them, you can look at the list to see if there is something which works for the task you are trying to achieve. Once again the relevant MDN page for each selector is helpful in explaining browser sup
port. Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn about the pseudo-class and pseudo-element selectors. What is a pseudo-class? A pseudo-class is a selector that selects elements that are in a sp...
...at is a pseudo-element? Pseudo-elements behave in a similar way, however they act as if you had added a whole new HTML element into the markup, rather than applying a class to existing elements. Pseudo-elements start with a double colon ::. ::pseudo-element-name Note: Some early pseudo-elements used the single colon syntax, so you may sometimes see this in code or examples. Modern browsers sup
port the early pseudo-elements with single- or double-colon syntax for backwards compatibility. For example, if you wanted to select the first line of a paragraph you could wrap it in a <span> element and use an element selector; however, that would fail if the number of words you had wrapped were longer or shorter than the parent element's width. As we tend not to know how many words will fit on a ...
...on ::after Matches a stylable element appearing after the originating element's actual content. ::before Matches a stylable element appearing before the originating element's actual content. ::first-letter Matches the first letter of the element. ::first-line Matches the first line of the containing element. ::grammar-error Matches a
portion of the document containing a grammar error as flagged by the browser. ::marker Matches the marker box of a list item, which typically contains a bullet or number. ::selection Matches the
portion of the document that has been selected. ::spelling-error Matches a
portion of the document containing a spelling error as flagged by the browser. Previous...
CSS building blocks - Learn web development
erminology that relates to it. Backgrounds and borders In this lesson we will take a look at some of the creative things you can do with CSS backgrounds and borders. From adding gradients, background images, and rounded corners, backgrounds and borders are the answer to a lot of styling questions in CSS. Handling different text directions In recent years, CSS has evolved in order to better sup
port different directionality of content, including right-to-left but also top-to-bottom content (such as Japanese) -- these different directionalities are called writing modes. As you progress in your study and begin to work with layout, an understanding of writing modes will be very helpful to you, therefore we will introduce them in this article. Overflowing content In this lesson we will look at...
...directionality of content, including right-to-left but also top-to-bottom content (such as Japanese) -- these different directionalities are called writing modes. As you progress in your study and begin to work with layout, an understanding of writing modes will be very helpful to you, therefore we will introduce them in this article. Overflowing content In this lesson we will look at another im
portant concept in CSS -- overflow. Overflow is what happens when there is too much content to be contained comfortably inside a box. In this guide, you will learn what it is and how to manage it. CSS values and units Every property used in CSS has a value or set of values that are allowed for that property. In this lesson, we will take a look at some of the most common values and units in use. Siz...
...values and units Every property used in CSS has a value or set of values that are allowed for that property. In this lesson, we will take a look at some of the most common values and units in use. Sizing items in CSS In the various lessons so far you have come across a number of ways to size items on a web page using CSS. Understanding how big the different features in your design will be is im
portant, and in this lesson, we will summarize the various ways elements get a size via CSS and define a few terms around sizing that will help you in the future. Images, media, and form elements In this lesson we will take a look at how certain special elements are treated in CSS. Images, other media, and form elements behave a little differently in terms of your ability to style them with CSS than...
Getting started with CSS - Learn web development
choosing the HTML element that you want to change, and using a CSS rule to change the way it looks. A good example is our <ul>, an unordered list. It has list bullets, and if I decide I don't want those bullets I can remove them like so: li { list-style-type: none; } Try adding this to your CSS now. The list-style-type property is a good property to look at on MDN to see which values are sup
ported. Take a look at the page for list-style-type and you will find an interactive example at the top of the page to try some different values in, then all allowable values are detailed further down the page. Looking at that page you will discover that in addition to removing the list bullets you can change them -- try changing them to square bullets by using a value of square. Adding a class So ...
...lise that the pink color is quite light and hard to read -- why not change that to a better color? Can you make the links bold? We have removed the underline on our link on hover. You could remove the underline from all states of a link. It is worth remembering however that in a real site, you want to ensure that visitors know that a link is a link. Leaving the underline in place, can be an im
portant clue for people to realize that some text inside a paragraph can be clicked on -- this is the behavior they are used to. As with everything in CSS, there is the potential to make the document less accessible with your changes -- we will aim to highlight potential pitfalls in appropriate places. Note: you will often see mention of accessibility in these lessons and across MDN. When we talk ab...
...usable by everyone. Your visitor may well be on a computer with a mouse or trackpad, or a phone with a touchscreen. Or they might be using a screenreader, which reads out the content of the document, or they may need to use much larger text, or be navigating the site using the keyboard only. A plain HTML document is generally accessible to everyone -- as you start to style that document it is im
portant that you don't make it less accessible. Combining selectors and combinators It is worth noting that you can combine multiple selectors and combinators together. For example: /* selects any <span> that is inside a <p>, which is inside an <article> */ article p span { ... } /* selects any <p> that comes directly after a <ul>, which comes directly after an <h1> */ h1 + ul + p { ... } You ...
How CSS works - Learn web development
sn't recognise. The answer is that it does nothing, and just moves on to the next bit of CSS! If a browser is parsing your rules, and encounters a property or value that it doesn't understand, it ignores it and moves on to the next declaration. It will do this if you have made an error and misspelled a property or value, or if the property or value is just too new and the browser doesn't yet sup
port it. Similarly, if a browser encounters a selector that it doesn't understand, it will just ignore the whole rule and move on to the next one. In the example below I have used the British English spelling for color, which makes that property invalid as it is not recognised. So my paragraph has not been colored blue. All of the other CSS have been applied however; only the invalid line is ignored...
...t means that you can use new CSS as an enhancement, knowing that no error will occur if it is not understood -- the browser will either get the new feature or not. Coupled with the way that the cascade works, and the fact that browsers will use the last CSS they come across in a stylesheet when you have two rules with the same specificity you can also offer alternatives for browsers that don't sup
port new CSS. This works particularly well when you want to use a value that is quite new and not sup
ported everywhere. For example, some older browsers do not sup
port calc() as a value. I might give a fallback width for a box in pixels, then go on to give a width with a calc() value of 100% - 50px. Old browsers will use the pixel version, ignoring the line about calc() as they don't understand it. N...
..., then go on to give a width with a calc() value of 100% - 50px. Old browsers will use the pixel version, ignoring the line about calc() as they don't understand it. New browsers will interpret the line using pixels, but then override it with the line using calc() as that line appears later in the cascade. .box { width: 500px; width: calc(100% - 50px); } We will look at many more ways to sup
port varying browsers in later lessons. And finally You've nearly finished this module; we only have one more thing to do. In the next article you'll use your new knowledge to restyle an example, testing out some CSS in the process. Previous Overview: First steps Next In this module What is CSS? Getting started with CSS How CSS is structured How CSS works Using your new knowledge ...
What are browser developer tools? - Learn web development
or: DOM explorer and CSS editor The developer tools usually open by default to the inspector, which looks something like the following screenshot. This tool shows what the HTML on your page looks like at runtime, as well as what CSS is applied to each element on the page. It also allows you to instantly modify the HTML and CSS and see the results of your changes reflected live in the browser view
port. If you don't see the inspector, Tap/click the Inspector tab. In Internet Explorer, tap/click DOM Explorer, or press Ctrl + 1. In Microsoft Edge, or Opera, tap/click Elements. In Safari, the controls are not so clearly presented, but you should see the HTML if you haven't selected something else to appear in the window. Press the Style button to see the CSS. Exploring the DOM inspector...
...tap/click Elements. In Safari, the controls are not so clearly presented, but you should see the HTML if you haven't selected something else to appear in the window. Press the Style button to see the CSS. Exploring the DOM inspector For a start, right-click (Ctrl-click) an HTML element in the DOM inspector and look at the context menu. The available menu options vary among browsers, but the im
portant ones are mostly the same: Delete Node (sometimes Delete Element). Deletes the current element. Edit as HTML (sometimes Add attribute/Edit text). Lets you change the HTML and see the results on the fly. Very useful for debugging and testing. :hover/:active/:focus. Forces element states to be toggled on, so you can see what their styling would look like. Copy/Copy as HTML. Copy the curre...
... out more Find more out about the JavaScript debugger in different browsers: Firefox JavaScript Debugger Microsoft Edge Debugger Chrome Debugger Safari Debugger The JavaScript console The JavaScript console is an incredibly useful tool for debugging JavaScript that isn't working as expected. It allows you to run lines of JavaScript against the page currently loaded in the browser, and re
ports the errors encountered as the browser tries to execute your code. To access the console in any browser: If the developer tools are already open, click or press the Console tab. If not, Firefox allows you to open the console directly using Ctrl + Shift + K or using the menu command: Menu ? Web Developer ? Web Console, or Tools ? Web Developer ? Web Console. On other browser, open the developer...
What is a web server? - Learn web development
In this article, we explain what web servers are, how web servers work, and why they are im
portant. Prerequisites: You should already know how the Internet works, and understand the difference between a web page, a web site, a web server, and a search engine. Objective: You will learn what a web server is and gain a general understanding of how it works. Summary The term web server can refer to hardware or software, or both of them working together. On the hardware side, a web server is a computer that stores web server software and a website's component files. ...
...er is and gain a general understanding of how it works. Summary The term web server can refer to hardware or software, or both of them working together. On the hardware side, a web server is a computer that stores web server software and a website's component files. (for example, HTML documents, images, CSS stylesheets, and JavaScript files) A web server connects to the Internet and sup
ports physical data interchange with other devices connected to the web. On the software side, a web server includes several parts that control how web users access hosted files. At a minimum, this is an HTTP server. An HTTP server is software that understands URLs (web addresses) and HTTP (the protocol your browser uses to view webpages). An HTTP server can be accessed through the domain names of th...
...od hosting provider is a key part of building your website. Examine the various services companies offer. Choose one that fits your needs and budget. (Services range from free to thousands of dollars per month.) You can find more details in this article. Once you have web hosting service, you must upload your files to your web server. Communicating through HTTP Second, a web server provides sup
port for HTTP (Hypertext Transfer Protocol). As its name implies, HTTP specifies how to transfer hypertext (linked web documents) between two computers. A Protocol is a set of rules for communication between two computers. HTTP is a textual, stateless protocol. Textual All commands are plain-text and human-readable. Stateless Neither the server nor the client remember previous communications. F...
JavaScript basics - Learn web development
ate the work of building sites and applications. It's outside the scope of this article--as a light introduction to JavaScript--to present the details of how the core JavaScript language is different from the tools listed above. You can learn more in MDN's JavaScript learning area, as well as in other parts of MDN. The section below introduces some aspects of the core language, and offers an op
portunity to play with a few browser API features too. Have fun! A Hello world! example JavaScript is one of the most popular modern web technologies! As your JavaScript skills grow, your websites will enter a new dimension of power and creativity. However, getting comfortable with JavaScript is more challenging than getting comfortable with HTML and CSS. You may have to start small, and progress g...
... your websites will enter a new dimension of power and creativity. However, getting comfortable with JavaScript is more challenging than getting comfortable with HTML and CSS. You may have to start small, and progress gradually. To begin, let's examine how to add JavaScript to your page for creating a Hello world! example. (Hello world! is the standard for introductory programming examples.) Im
portant: If you haven't been following along with the rest of our course, download this example code and use it as a starting point. Go to your test site and create a new folder named scripts. Within the scripts folder, create a new file called main.js, and save it. In your index.html file, enter this code on a new line, just before the closing </body> tag: <script src="scripts/main.js"></scrip...
...ent Object Model (DOM) API, which has the capability to manipulate documents. Language basics crash course To give you a better understanding of how JavaScript works, let's explain some of the core features of the language. It's worth noting that these features are common to all programming languages. If you master these fundamentals, you have a head start on coding in other languages too! Im
portant: In this article, try entering the example code lines into your JavaScript console to see what happens. For more details on JavaScript consoles, see Discover browser developer tools. Variables Variables are containers that store values. You start by declaring a variable with the var (less recommended, dive deeper for the explanation) or the let keyword, followed by the name you give to the ...
Tips for authoring fast-loading HTML pages - Learn web development
or a more responsive site for your visitors but also reduces the load on your web servers and Internet connection. This can be crucial for high volume sites or sites which have a spike in traffic due to unusual circumstances such as breaking news stories. Optimizing page load performance is not just for content which will be viewed by narrowband dial-up or mobile device visitors. It is just as im
portant for broadband content and can lead to dramatic improvements even for your visitors with the fastest connections. Tips Reduce page weight Page weight is by far the most im
portant factor in page-load performance. Reducing page weight through the elimination of unnecessary whitespace and comments, commonly known as minimization, and by moving inline script and CSS into external files, can imp...
...and the <colgroup> elements. Use lazy loading for images By default, imags are loaded eagerly; that is, the image is fetched and rendered as soon as it's processed in the HTML. All eagerly loaded images are rendered before the document's load event is sent. Switching to lazy loading of images tells the browser to hold off on loading images until they're about to be needed to draw the visual view
port. To mark an image for lazy loading, specify its loading attribute with a value of lazy. With this set, the image will only be loaded when it's needed. <img href="./images/footerlogo.jpg" loading="lazy"> Note that lazily-loaded images may not be available when the load event is fired. You can determine if a given image is loaded by checking to see if the value of its Boolean complete property i...
...s true. Choose your user-agent requirements wisely To achieve the greatest improvements in page design, make sure that reasonable user-agent requirements are specified for projects. Do not require your content to appear pixel-perfect in all browsers, especially not in down-version browsers. Ideally, your basic minimum requirements should be based on the consideration of modern browsers that sup
port the relevant standards. This can include recent versions of Firefox, Internet Explorer, Google Chrome, Opera, and Safari. Note, however, that many of the tips listed in this article are common-sense techniques which apply to any user agent, and can be applied to any web page, regardless of browser-sup
port requirements. Use async and defer, if possible Make the JavaScript scripts such that they...
Document and website structure - Learn web development
ain> <!-- It contains an article --> <article> <h2>Article heading</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Donec a diam lectus. Set sit amet ipsum mauris. Maecenas congue ligula as quam viverra nec consectetur ant hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut
porta lorem lacinia consectetur.</p> <h3>Subsection</h3> <p>Donec ut librero sed accu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor.</p> <p>Pelientesque auctor nisi id magna consequat sagittis. Curabitur dapibus, enim sit amet elit pharetra tincid...
...rdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros.</p> <h3>Another subsection</h3> <p>Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum soclis natoque penatibus et manis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p> <p>Vivamus fermentum semper
porta. Nunc diam velit, adipscing ut tristique vitae sagittis vel odio. Maecenas convallis ullamcorper ultricied. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, is fringille sem nunc vet mi.</p> </article> <!-- the aside content can also be nested within the main content --> <aside> <h2>Related</h2> <ul> <li><a href="#">Oh I...
... exceptions. You might also want to include notes about how things might be presented. Active learning: create your own sitemap Try carrying out the above exercise for a website of your own creation. What would you like to make a site about? Note: Save your work somewhere; you might need it later on. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find a detailed assessment that tests these skills at the end of the module; see Structuring a page of content. We'd advise going through the next article in the series first and not just skipping to it though! Summary At this point you should have a better idea about how to structure a web page/site. In the last article of this module, we'll study how to debug HTML. ...
Getting started with HTML - Learn web development
Overview: Introduction to HTML Next In this article we cover the absolute basics of HTML. To get you started, this article defines elements, attributes, and all the other im
portant terms you may have heard. It also explains where these fit into HTML. You will learn how HTML elements are structured, how a typical HTML page is structured, and other im
portant basic language features. Along the way, there will be an op
portunity to play with HTML too! Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of working with files. Objective: To gain basic familiarity with HTML, and practice writing a few HTML elements. What is HTML? HTML (Hypertext Markup Language) is not a programming language. It is a markup language that tells...
...osing the p. The following is an example of the wrong way to do nesting: <p>My cat is <strong>very grumpy.</p></strong> The tags have to open and close in a way that they are inside or outside one another. With the kind of overlap in the example above, the browser has to guess at your intent. This kind of guessing can result in unexpected results. Block versus inline elements There are two im
portant categories of elements to know in HTML: block-level elements and inline elements. Block-level elements form a visible block on a page. A block-level element appears on a new line following the content that precedes it. Any content that follows a block-level element also appears on a new line. Block-level elements are usually structural elements on the page. For example, a block-level elemen...
...ditable sample window represents just the contents of the <body> element, in this case). Sharpen your skills by implementing the following tasks: Just below the opening tag of the <body> element, add a main title for the document. This should be wrapped inside an <h1> opening tag and </h1> closing tag. Edit the paragraph content to include text about a topic that you find interesting. Make im
portant words stand out in bold by wrapping them inside a <strong> opening tag and </strong> closing tag. Add a link to your paragraph, as explained earlier in the article. Add an image to your document. Place it below the paragraph, as explained earlier in the article. Earn bonus points if you manage to link to a different image (either locally on your computer, or somewhere else on the web). If ...
Introduction to HTML - Learn web development
of our Getting started with the web complete beginner's module. Note: If you are working on a computer/tablet/other devices that doesn't let you create your own files, you can try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This module contains the following articles, which will take you through all the basic theory of HTML and provide ample op
portunity for you to test out some skills. Getting started with HTML Covers the absolute basics of HTML, to get you started -- we define elements, attributes, and other im
portant terms, and show where they fit in the language. We also show how a typical HTML page is structured and how an HTML element is structured, and explain other im
portant basic language features. Along the way, we'll play with...
..., we'll play with some HTML to get you interested! What's in the head? Metadata in HTML The head of an HTML document is the part that is not displayed in the web browser when the page is loaded. It contains information such as the page <title>, links to CSS (if you want to style your HTML content with CSS), links to custom favicons, and metadata (data about the HTML, such as who wrote it, and im
portant keywords that describe the document). HTML text fundamentals One of HTML's main jobs is to give text meaning (also known as semantics), so that the browser knows how to display it correctly. This article looks at how to use HTML to break up a block of text into a structure of headings and paragraphs, add emphasis/im
portance to words, create lists, and more. Creating hyperlinks Hyperlinks a...
... that describe the document). HTML text fundamentals One of HTML's main jobs is to give text meaning (also known as semantics), so that the browser knows how to display it correctly. This article looks at how to use HTML to break up a block of text into a structure of headings and paragraphs, add emphasis/im
portance to words, create lists, and more. Creating hyperlinks Hyperlinks are really im
portant -- they are what makes the web a web. This article shows the syntax required to make a link and discusses best practices for links. Advanced text formatting There are many other elements in HTML for formatting text that we didn't get to in the HTML text fundamentals article. The elements here are less well-known, but still useful to know about. In this article, you'll learn about marking up ...
Mozilla splash page - Learn web development
ng Call them something sensible, e.g. firefoxlogo400.png and firefoxlogo120.png. Along with mdn.svg, these images will be your icons to link to further resources, inside the further-info area. You'll also link to the firefox logo in the site header. Save copies of all these inside the same directory as index.html. Next, create a 1200px wide landscape version of red-panda.jpg, and a 600px wide
portrait version that shows the panda in more of a close up shot. Again, call them something sensible so you can easily identify them. Save a copy of both of these inside the same directory as index.html. Note: You should optimise your JPG and PNG images to make them as small as possible, while still looking ok. tinypng.com is a great service for doing this easily. Adding a logo to the header Ins...
...iv> with the class of further-info you will find four <a> elements -- each one linking to an interesting Mozilla-related page. To complete this section you'll need to insert an <img> element inside each one containing appropriate src, alt, srcset and sizes attributes. In each case (except one -- which one is inherently responsive?) we want the browser to serve the 120px wide version when the view
port width is 500px wide or less, or the 400px wide version otherwise. Make sure you match the correct images with the correct links! Note: To properly test the srcset/sizes examples, you'll need to upload your site to a server (using Github pages is an easy and free solution), then from there you can test whether they are working properly using browser developer tools such as the Firefox Network M...
...roperly test the srcset/sizes examples, you'll need to upload your site to a server (using Github pages is an easy and free solution), then from there you can test whether they are working properly using browser developer tools such as the Firefox Network Monitor. An art directed red panda Inside the <div> with the class of red-panda, we want to insert a <picture> element that serves the small
portrait panda image if the view
port is 600px wide or less, and the large landscape image otherwise. Example The following screenshots show what the splash page should look like after being correctly marked up, on a wide and narrow screen display. Assessment or further help If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable ed...
Introduction to web APIs - Learn web development
ly without having to reload the whole entire page from the server can make the site or app feel much more responsive and "snappy". APIs that make this possible include XMLHttpRequest and the Fetch API. You may also come across the term Ajax, which describes this technique. Find out more about such APIs in Fetching data from the server. ...
...this technique. Find out more about such APIs in Fetching data from the server. APIs for drawing and manipulating graphics are now widely sup
ported in browsers -- the most popular ones are Canvas and WebGL, which allow you to programmatically update the pixel data contained in an HTML <canvas> element to create 2D and 3D scenes. For example, you might draw shapes such as rectangles or circles, im
port an image onto the canvas, and apply a filter to it such as sepia or grayscale using the Canvas API, or create a complex 3D scene with lighting and textures using WebGL. Such APIs are often combined with APIs for creating animation loops (such as window.requestAnimationFrame()) and others to make constantly updating scenes like cartoons and games. Audio and Video APIs like HTMLMediaElement, the W...
...do all sorts of things with maps on your web pages. The Facebook suite of APIs enables you to use various parts of the Facebook ecosystem to benefit your app, for example by providing app login using Facebook login, accepting in-app payments, rolling out targetted ad campaigns, etc. The Telegram APIs allows you to embed content from Telegram channels on your website, in addition to providing sup
port for bots. The YouTube API, which allows you to embed YouTube videos on your site, search YouTube, build playlists, and more. The Pinterest API provides tools to manage Pinterest boards and pins to include them in your website. The Twilio API, which provides a framework for building voice and video call functionality into your app, sending SMS/MMS from your apps, and more. The Mastodon API ena...
Storing the information you need — Variables - Learn web development
st make sense, and as you learn more about JavaScript they will start to become second nature. Another special thing about variables is that they can contain just about anything -- not just strings and numbers. Variables can also contain complex data and even entire functions to do amazing things. You'll learn more about this as you go along. Note: We say variables contain values. This is an im
portant distinction to make. Variables aren't the values themselves; they are containers for values. You can think of them being like little cardboard boxes that you can store things in. Declaring a variable To use a variable, you've first got to create it -- more accurately, we call this declaring the variable. To do this, we type the keyword var or let followed by the name you want to call your...
...myName = 'Chris'; let myName = 'Bob'; You'd have to do this instead: let myName = 'Chris'; myName = 'Bob'; Again, this is a sensible language decision. There is no reason to redeclare variables -- it just makes things more confusing. For these reasons and more, we recommend that you use let as much as possible in your code, rather than var. There is no reason to use var, unless you need to sup
port old versions of Internet Explorer with your code (it doesn't sup
port let until version 11; the modern Windows Edge browser sup
ports let just fine). Updating a variable Once a variable has been initialized with a value, you can change (or update) that value by simply giving it a different value. Try entering the following lines into your console: myName = 'Bob'; myAge = 40; An aside on variabl...
...word const, which lets us store values that can never be changed: const daysInWeek = 7; const hoursInDay = 24; const works in exactly the same way as let, except that you can't give a const a new value. In the following example, the second line would throw an error: const daysInWeek = 7; daysInWeek = 8; Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: variables. Summary By now you should know a reasonable amount about JavaScript variables and how to create them. In the next article, we'll focus on numbers in more detail, looking at how to do basic math in JavaScript. Previous Overview: First steps ...
What went wrong? Troubleshooting JavaScript - Learn web development
he "Submit guess" button, it doesn't work! Note: You might well have your own version of the game example that doesn't work, which you might want to fix! We'd still like you to work through the article with our version, so that you can learn the techniques we are teaching here. Then you can go back and try to fix your example. At this point, let's consult the developer console to see if it re
ports any syntax errors, then try to fix them. You'll learn how below. Fixing syntax errors Earlier on in the course we got you to type some simple JavaScript commands into the developer tools JavaScript console (if you can't remember how to open this in your browser, follow the previous link to find out how). What's even more useful is that the console gives you error messages whenever a syntax err...
...Changing addeventListener to addEventListener should fix this. Do this now. Note: See our TypeError: "x" is not a function reference page for more details about this error. Syntax errors round two Save your page and refresh, and you should see the error has gone. Now if you try to enter a guess and press the Submit guess button, you'll see ... another error! This time the error being re
ported is "TypeError: lowOrHi is null", on line 78. Note: Null is a special value that means "nothing", or "no value". So lowOrHi has been declared and initialised, but not with any meaningful value -- it has no type or value. Note: This error didn't come up as soon as the page was loaded because this error occurred inside a function (inside the checkGuess() { ... } block). As you'll learn in mor...
...page for more details about this error. The program always says you've won, regardless of the guess you enter This could be another symptom of mixing up the assignment and strict equality operators. For example, if we were to change this line inside checkGuess(): if (userGuess === randomNumber) { to if (userGuess = randomNumber) { the test would always return true, causing the program to re
port that the game has been won. Be careful! SyntaxError: missing ) after argument list This one is pretty simple -- it generally means that you've missed the closing parenthesis at the end of a function/method call. Note: See our SyntaxError: missing ) after argument list reference page for more details about this error. SyntaxError: missing : after property id This error usually relates to an...
Inheritance in JavaScript - Learn web development
The technique we covered here is not the only way to create inheriting classes in JavaScript, but it works OK, and it gives you a good idea about how to implement inheritance in JavaScript. You might also be interested in checking out some of the new ECMAScript features that allow us to do inheritance more cleanly in JavaScript (see Classes). We didn't cover those here, as they are not yet sup
ported very widely across browsers. All the other code constructs we discussed in this set of articles are sup
ported as far back as IE9 or earlier, and there are ways to achieve earlier sup
port than that. A common way is to use a JavaScript library -- most of the popular options have an easy set of functionality available for doing inheritance more easily and quickly. CoffeeScript for example provide...
...ty will come with practice. ECMAScript 2015 Classes ECMAScript 2015 introduces class syntax to JavaScript as a way to write reusable classes using easier, cleaner syntax, which is more similar to classes in C++ or Java. In this section we'll convert the Person and Teacher examples from prototypal inheritance to classes, to show you how it's done. Note: This modern way of writing classes is sup
ported in all modern browsers, but it is still worth knowing about the underlying prototypal inheritance in case you work on a project that requires sup
porting a browser that doesn't sup
port this syntax (most notably Internet Explorer). Let's look at a rewritten version of the Person example, class-style: class Person { constructor(first, last, age, gender, interests) { this.name = { fi...
...l, and you certainly don't need inheritance. Alternatives for extending the prototype chain In JavaScript, there are several different ways to extend the prototype of an object aside from what we've shown above. To find out more about the other ways, visit our Inheritance and the prototype chain article. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Object-oriented JavaScript. Summary This article has covered the remainder of the core OOJS theory and syntax that we think you should know now. At this point you should understand JavaScript object and OOP basics, prototypes and prototypal inheritance, how...
Working with JSON - Learn web development
For example: superHeroes.homeTown superHeroes['active'] To access data further down the hierarchy, y...
...her for loop to loop through the current hero's superpowers -- for each one we create an <li> element, put the superpower inside it, then put the listItem inside the <ul> element (myList) using appendChild(). The very last thing we do is to append the <h2>, <p>s, and <ul> inside the <article> (myArticle), then append the <article> inside the <section>. The order in which things are appended is im
portant, as this is the order they will be displayed inside the HTML. Note: If you are having trouble getting the example to work, try referring to our heroes-finished.html source code (see it running live also.) Note: If you are having trouble following the dot/bracket notation we are using to access the JavaScript object, it can help to have the superheroes.json file open in another tab or you...
...ion: let myJSON = { "name": "Chris", "age": "38" }; myJSON let myString = JSON.stringify(myJSON); myString Here we're creating a JavaScript object, then checking what it contains, then converting it to a JSON string using stringify() -- saving the return value in a new variable -- then checking it again. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: JSON. Summary In this article, we've given you a simple guide to using JSON in your programs, including how to create and parse JSON, and how to access data locked inside it. In the next article, we'll begin looking at object-oriented JavaScript. ...
Object building practice - Learn web development
t to give us a context on which we can start to draw. The resulting constant (ctx) is the object that directly represents the drawing area of the canvas and allows us to draw 2D shapes on it. Next, we set constants called width and height, and the width and height of the canvas element (represented by the canvas.width and canvas.height properties) to equal the width and height of the browser view
port (the area that the webpage appears on -- this can be gotten from the Window.innerWidth and Window.innerHeight properties). Note that we are chaining multiple assignments together, to get the variables all set quicker -- this is perfectly OK. The last bit of the initial script looks as follows: function random(min, max) { const num = Math.floor(Math.random() * (max - min + 1)) + min; return...
...s.y = y; this.velX = velX; this.velY = velY; this.color = color; this.size = size; } Here we include some parameters that define the properties each ball needs in order to function in our program: x and y coordinates -- the horizontal and vertical coordinates where the ball starts on the screen. This can range between 0 (top left hand corner) to the width and height of the browser view
port (bottom right hand corner). horizontal and vertical velocity (velX and velY) -- each ball is given a horizontal and vertical velocity; in real terms these values are regularly added to the x/y coordinate values when we animate the balls, to move them by this much on each frame. color -- each ball gets a color. size -- each ball gets a size -- this is its radius, in pixels. This handles the p...
...thod, which basically states "finish drawing the path we started with beginPath(), and fill the area it takes up with the color we specified earlier in fillStyle." You can start testing your object out already. Save the code so far, and load the HTML file in a browser. Open the browser's JavaScript console, and then refresh the page so that the canvas size changes to the smaller visible view
port that remains when the console opens. Type in the following to create a new ball instance: let testBall = new Ball(50, 100, 4, 4, 'blue', 10); Try calling its members: testBall.x testBall.size testBall.color testBall.draw() When you enter the last line, you should see the ball draw itself somewhere on the canvas. Updating the ball's data We can draw the ball in position, but to actua...
Object prototypes - Learn web development
rred to as a prototype chain, and explains why different objects have properties and methods defined on other objects available to them. In JavaScript, a link is made between the object instance and its prototype (its __proto__ property, which is derived from the prototype property on the constructor), and the properties and methods are found by walking up the chain of prototypes. Note: It's im
portant to understand that there is a distinction between an object's prototype (available via Object.getPrototypeOf(obj), or via the deprecated __proto__ property) and the prototype property on constructor functions. The former is the property on each instance, and the latter is the property on the constructor. That is, Object.getPrototypeOf(new Foobar()) refers to the same object as Foobar.prototyp...
...my string.'; myString immediately has a number of useful methods available on it, like split(), indexOf(), replace(), etc. Note: It is worth reading our more in-depth guide to "Using prototypes in JavaScript", once you've made sense of this section and wish to know more. This section is intentionally simplified to make these concepts a little easier to understand when you first meet them. Im
portant: The prototype property is one of the most confusingly-named parts of JavaScript -- you might think that this points to the prototype object of the current object, but it doesn't (that's an internal object that can be accessed by __proto__, remember?). prototype instead is a property containing an object on which you define members that you want to be inherited. Revisiting create() Earlier ...
...with property definitions function Test(a, b, c, d) { // property definitions } // First method definition Test.prototype.x = function() { ... }; // Second method definition Test.prototype.y = function() { ... }; // etc. This pattern can be seen in action in Piotr Zalewa's school plan app example. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Object-oriented JavaScript. Note that this set of tests relies on some of the knowledge taught in the next article, so you might want to read that first before you try them. Summary This article has covered JavaScript object prototypes, including how proto...
The business case for web performance - Learn web development
You've learned what you need to do to optimize for web performance. But how do you convince your clients and/or management to prioritize and invest in performance? In this section, we discuss creating a clear business-case to convince decision-makers to make the investment. Prerequisites: Basic computer literacy, basic knowledge of client-side web technologies, and a basic understanding of web performance optimization. Objective: To gain confidence in working with clients and management to get them to make web performance a priority. ...
...ity We've discussed how prioritizing performance can improve user experience and therefore revenue. We know that not prioritizing web performance can result in a loss of business revenue. This article discusses how certain business metrics directly relate to a user's web performance experience and how to apply service design to boost the user's experiences of web performance. It highlights the im
portance of understanding how cumulative experiences impact conversion and retention rates. Performance budgets Setting a web performance budget can help you make sure the team stays on track in keeping the site and help prevent regressions. A performance budget is a set of limits that are set to specify limits, such as maximum number of http requests allowed, the maximum total size of all the as...
...nt to add videos, 3rd party scripts, or even frameworks. Performance budgets help developer teams protect optimal performane for users while enabling the business to tap into new markets and deliver custom experiences. key performance indicators Setting key performance indicators (KPI) as objectives can hiltie performance objectives that are also business objectives. KPIs can be both a set of im
portant business metrics in measuring the impact of user experience and performance on the business's top line, and a way of demonstrating the benefits of prioritizing performance. Here are some KPIs to consider: Conversion Rate The percent of your traffic that takes an intended action, such as completing a purchase or signing up for a newsletter. When a business site is slow, it can prevent user...
JavaScript performance - Learn web development
ttery. It can make the UI feel unresponsive or janky. We'll introduce concepts for handling that as well. Download impact Web applications include a lot of JavaScript. Many applications are built with a JavaScrpit framework, or multiple, with several additional dependencies. Often times third party scripts and APIs are added, including A/B testing, tracking pixels, and features like maps and sup
port features. All of this JavaScript must be downloaded. Eventually. Performance optimizatins should include: Reducing the amount of JavaScript that is needed. Some features requiring complex JavaScript can be done with a few lines of JavaScript. Requiring a library for other features may improve developer experience, but is all that JavaScript required? Is there a lighter weight or home spun so...
...e developer experience, but is all that JavaScript required? Is there a lighter weight or home spun solutions? Some features may not be necessary, and though they may add some bling, is the cost of the feature in terms of performance worth it? Remove unused code Split the JavaScript into smaller files Code-split JavaScript into critical and non-critical parts. Module bundlers like webpack sup
port code-splitting. Optimize these smaller files Minification reduces the number of characters in your file, thereby reducing the number of bytes or weight of your JavaScript. Gzipping compresses the file further, and should be used even if you don't minify. Brotli is similar to Gzip, generally outperforming Gzip's compression. Render impact Web applications include a lot of JavaScript. M...
...ed even if you don't minify. Brotli is similar to Gzip, generally outperforming Gzip's compression. Render impact Web applications include a lot of JavaScript. Many applications are built with a JavaScrpit framework, or multiple, with several additional dependencies. Often times third party scripts and APIs are added, including A/B testing, tracking pixels, and features like maps and sup
port features. Battery impact Conclusion While optimizing your media files and scripts will get you very far along in terms of web performance optimization, everything that touches a web pages impacts performance. In the next article we take a look at some HTML features that can impact performance, including some attributes specifically created to improve performance. Previous Overview: Perfo...
Introduction to the server side - Learn web development
erting data from a database into placeholders in HTML templates (this is a much more efficient way of storing large amounts of content than using static websites). A dynamic site can return different data for a URL based on information provided by the user or stored preferences and can perform other operations as part of returning a response (e.g. sending notifications). Most of the code to sup
port a dynamic website must run on the server. Creating this code is known as "server-side programming" (or sometimes "back-end scripting"). The diagram below shows a simple architecture for a dynamic website. As in the previous diagram, browsers send HTTP requests to the server, then the server processes the requests and returns appropriate HTTP responses. Requests for static resources are handled ...
... inside a web browser and has little or no access to the underlying operating system (including limited access to the file system). Web developers can't control what browser every user might be using to view a website -- browsers provide inconsistent levels of compatibility with client-side code features, and part of the challenge of client-side programming is handling differences in browser sup
port gracefully. Server-side code can be written in any number of programming languages -- examples of popular server-side web languages include PHP, Python, Ruby, C#, and NodeJS(JavaScript). The server-side code has full access to the server operating system and the developer can choose what programming language (and specific version) they wish to use. Developers typically write their code using we...
...y the different types of tasks faced in a particular domain. Again, while both client and server-side code use frameworks, the domains are very different, and hence so are the frameworks. Client-side web frameworks simplify layout and presentation tasks while server-side web frameworks provide a lot of "common" web server functionality that you might otherwise have to implement yourself (e.g. sup
port for sessions, sup
port for users and authentication, easy database access, templating libraries, etc.). Note: Client-side frameworks are often used to help speed up development of client-side code, but you can also choose to write all the code by hand; in fact, writing your code by hand can be quicker and more efficient if you only need a small, simple web site UI. In contrast, you would almost...
Website security - Learn web development
on Security Project). A few key messages Almost all of the security exploits in the previous sections are successful when the web application trusts data from the browser. Whatever else you do to improve the security of your website, you should sanitize all user-originating data before it is displayed in the browser, used in SQL queries, or passed to an operating system or file system call. Im
portant: The single most im
portant lesson you can learn about website security is to never trust data from the browser. This includes, but is not limited to data in URL parameters of GET requests, POST requests, HTTP headers and cookies, and user-uploaded files. Always check and sanitize all incoming data. Always assume the worst. A number of other concrete steps you can take are: Use more effect...
...word management. Encourage strong passwords that are changed regularly. Consider two-factor authentication for your site, so that in addition to a password the user must enter another authentication code (usually one that is delivered via some physical hardware that only the user will have, such as a code in an SMS sent to their phone). Configure your web server to use HTTPS and HTTP Strict Trans
port Security (HSTS). HTTPS encrypts data sent between your client and server. This ensures that login credentials, cookies, POST requests data and header information are not easily available to attackers. Keep track of the most popular threats (the current OWASP list is here) and address the most common vulnerabilities first. Use vulnerability scanning tools to perform automated security testing on...
...that it can be copied by an attacker and used on another site. The most common pattern at this time is to only display the last 4 digits of a credit card number. Web frameworks can help mitigate many of the more common vulnerabilities. Summary This article has explained the concept of web security and some of the more common threats against which your website should attempt to protect. Most im
portantly, you should understand that a web application cannot trust any data from the web browser. All user data should be sanitized before it is displayed, or used in SQL queries and file system calls. With this article, you've come to the end of this module, covering your first steps in server-side website programming. We hope you've enjoyed learning these fundamental concepts, and you're now read...
React resources - Learn web development
, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To provide further resources for learning more about React. Component-level styles Although this tutorial doesn't use this approach, many React applications define their styles on a per-component basis, rather than in a single, monolithic stylesheet. ...
...cations define their styles on a per-component basis, rather than in a single, monolithic stylesheet. create-react-app makes it possible to im
port CSS files into JavaScript modules, so that CSS is only sent to your user when the corresponding component is rendered. For this app, we could have for example written a dedicated Form.css file to house the styles of those respective components, then im
ported the styles into their respective modules like this: im
port Form from './Form'; im
port './Form.css' This approach makes it easy to identify and manage the CSS that belongs to a specific component. However, it also fragments your stylesheet across your codebase, and this fragmentation might not be worthwhile. For larger applications with hundreds of unique views and lots of moving parts, it mak...
...properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript sup
port in Svelte Deployment and next steps ...
Beginning our React todo list - Learn web development
ng the mouse or keyboard. edit any task, using the mouse or keyboard. view a specific subset of tasks: All tasks, only the active task, or only the completed tasks. We'll tackle these stories one-by-one. Pre-project housekeeping create-react-app has made a few files we won't be using at all for our project. We're not going to write per-component stylesheets, so first delete the App.css im
port from the top of App.js. We are also not going to be using the logo.svg file, so remove that im
port too. Then, copy and paste the following commands into your terminal to delete some unneeded files. Make sure you're starting in the app's root directory! # Move into the src directory of your project cd src # Delete a few files rm -- App.test.js App.css logo.svg serviceWorker.js setupTests.js # ...
...a3c3c; border-color: #bd2130; } .btn__filter { border-color: lightgrey; } .btn__primary { color: #fff; background-color: #000; } .btn-group { display: flex; justify-content: space-between; } .btn-group > * { flex: 1 1 49%; } .btn-group > * + * { margin-left: 0.8rem; } .label-wrapper { margin: 0; flex: 0 0 100%; text-align: center; } .visually-hidden { position: absolute !im
portant; height: 1px; width: 1px; overflow: hidden; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; } [class*="stack"] > * { margin-top: 0; margin-bottom: 0; } .stack-small > * + * { margin-top: 1.25rem; } .stack-large > * + * { margin-top: 2.5rem; } @media screen and (min-width: 550px) { .stack-small > * + * { margin-top: 1.4rem; } .stac...
...properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript sup
port in Svelte Deployment and next steps ...
Styling Vue components with CSS - Learn web development
The reset styles should be applied to the app now. The images below show the look of the app before and after the reset is applied. Before: After: Noticeable changes include the removal of the list bullets, background color changes, ...
... The reset styles should be applied to the app now. The images below show the look of the app before and after the reset is applied. Before: After: Noticeable changes include the removal of the list bullets, background color changes, and changes to the base button and i...
...properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript sup
port in Svelte Deployment and next steps ...
Understanding client-side JavaScript frameworks - Learn web development
udy the high-level structure of the whole project and an individual component, see how to run the project locally, and get it prepared to start building our example. 2. Creating our first Vue component Now it's time to dive deeper into Vue, and create our own custom component -- we'll start by creating a component to represent each item in the todo list. Along the way, we'll learn about a few im
portant concepts such as calling components inside other components, passing data to them via props and saving data state. 3. Rendering a list of Vue components At this point we've got a fully working component; we're now ready to add multiple ToDoItem components to our App. In this article we'll look at adding a set of todo item data to our App.vue component, which we'll then loop through and displ...
...r into Svelte's reactivity system. We'll also look at solving some accessibility focus issues, and more besides. 6. Working with Svelte stores In this article we will show another way to handle state management in Svelte -- Stores. Stores are global global data repositories that hold values. Components can subscribe to stores and receive notifications when their values change. 7. TypeScript sup
port in Svelte We will now learn how to use TypeScript in Svelte applications. First we'll learn what TypeScript is and what benefits it can bring us. Then we'll see how to configure our project to work with TypeScript files. Finally we will go over our app and see what modifications we have to make to fully take advantage of TypeScript features. 8. Deployment and next steps In this final article w...
...ecent popularity. There is a variety of reasons for this: They are popular choices that will be around for a while -- like with any software tool, it is good to stick with actively-developed choices that are likely to not be discontinued next week, and which will be desirable additions to your skill set when looking for a job. They have strong communities and good documentation. It is very im
portant to be able to get help with learning a complex subject, especially when you are just starting out. We don't have the resources to cover all modern frameworks. That list would be very difficult to keep up-to-date anyway, as new ones appear all the time. As a beginner, trying to choose what to focus on out of the huge number of choices available is a very real problem. Keeping the list short i...
Accessibility/LiveRegionDevGuide
This page is currently under construction. This developer's guide lays out general guidelines that assistive technology (AT) developers can use in developing live region sup
port. This guide was written from an ATK/AT-SPI point of view as part of the Orca Live Region Sup
port project. However, many of the concepts were also used during the development of FireVox, an AT using IAccessible2. Sometimes the very best guide for some developers is the code itself. Please refer to the liveregions and Gecko Python modules in Orca for a real world example. For more information about Live Regions, please read the ARIA properties spec or the live region re
port to learn about ARIA Live Region markup and the Live Region API Sup
port document for the latest Firefox API with regards to Live Regions. As ...
...It is responsible for queuing messages derived from live region events, where priority is determined by chronological order and the live politeness properties. ...
... as possible. container-atomic The atomic property determines if a live region change should be presented on it's own or if an AT should present the entire region. If atomic is set to "true", it means that the region must be presented as a whole while atomic="false" (default) indicates that the region can stand on it's own. The text offsets associated with a text changed event are used when sup
porting this property. The offsets can be acquired directly in a text changed event object in AT-SPI and through the use of IAccessibleText::get_oldText and IAccessibleText::get_newText in IAccessible2. When atomic is set to "false", the start index and end index/run length are used as given. The result being that only the change will be presented. When atomic is set to "true", the entire region shoul...
Information for users
has help topics (From the menubar: ? > Help Contents F1 > Accessibility Features) which describe any special features and keyboard shortcuts designed to help users with disabilities. Please check the Accessibility help topic for more information. Firefox Accessibility Features This page defines most of the accessibility features possible in Firefox. Features include assistive technology sup
port on Windows (like Window-Eyes, JAWS, etc.), Firefox keyboard sup
port, available accessibility extensions like Fire Vox and other extensions. Assistive Technology Compatibility This is a wiki page which users can edit to provide up to date information on any issues related to compatibility with assistive technologies such as screen readers, screen magnifiers, voice input software and on screen...
...always a good chance to find someone to chat with there, day or night. ...
...e to find someone to chat with there, day or night. ...
Multiprocess on Windows
t allows us to do whatever we want with that request. Our callback implementation forwards the method call to the main thread in order to invoke the method on the wrapped object. The interceptor is also aware that any outparams, which contain interfaces, must also be wrapped with interceptors of their own. This code lives in the mscom library, located in the tree at /ipc/mscom. Its headers are ex
ported to mozilla/mscom. Ensuring that the interceptor sup
ports your interfaces This information is current, but is likely to change when bug 1346957 is landed. Interceptors cannot replicate interfaces without access to the metadata that describes those interfaces. Since we are using COM, we already generate metadata by declaring interfaces using midl. This does not (yet) work as transparently as...
...st format strings" (also known as OICF) and (optionally, if a library statement is included in the IDL) type libraries (also known as typelib). OICF metadata is much richer than typelib metadata, however COM requires typelibs whenever it is being used with interpreted languages. In particular, typelibs were originally designed to work with 1990s-era Visual Basic. Typelib metadata is limited to sup
porting the same language features which were sup
ported by VB at that time. Given those two options, it may seem that OICF is the preferred format. However, for various reasons, our COM interceptor currently only sup
ports typelib metadata. In order for the interceptor to be able to work with our interfaces, we must do some additional work to compensate for typelib's weaknesses. The required steps are...
...arams that consist of arrays of interfaces Recall that one of the limitations of typelibs is that their metadata isn't as rich as OICF metadata. Something typelibs do not include in their metadata, is IDL annotations, such as length_is and size_is. Remember, for interceptors to work correctly, they must be able to wrap any outparams that are interfaces with their own interceptors. Without the sup
port for length_is and size_is annotations, the interceptor cannot tell the difference between a scalar outparam and an array outparam. If your interface outputs an array of interfaces, the interceptor would only wrap the first element in the array, because it cannot distinguish between scalars and arrays. Note: If your new interface does not contain either of these annotations, then you do not need...
Add-ons
user interface Add new features to Firefox There are several types of add-ons, but the most common type are extensions. Developing extensions In the past, there were several toolsets for developing Firefox extensions, but as of November 2017, extensions must be built using WebExtensions APIs. Other toolsets, such as overlay add-ons, bootstrapped add-ons, and the Add-on SDK, are no longer sup
ported. Extensions written using WebExtensions APIs for Firefox are designed to be cross-browser compatible. In most cases, it will run in Chrome, Edge, and Opera with few if any changes. They are also fully compatible with multiprocess Firefox. You can see the APIs currently sup
ported in Firefox and other browsers. Extension Workshop The Firefox Extension Workshop can help you develop extensions f...
...xtension An enterprise guide for developing and using extensions How to develop themes for Firefox Firefox developer communities Extensions for Firefox for Android In 2020, Mozilla will release a new Firefox for Android experience. This new, high-performance browser for Android has been rebuilt from the ground up using GeckoView, Mozilla's mobile browser engine. ...
...ase a new Firefox for Android experience. This new, high-performance browser for Android has been rebuilt from the ground up using GeckoView, Mozilla's mobile browser engine. We are currently building sup
port for the WebExtensions API on GeckoView. Migrate an existing extension If you maintain a legacy extension, such as an XUL overlay, bootstrapped, or Add-on SDK-based extension, you can still
port it to use WebExtension APIs. There are some
porting resources on Firefox Extension Workshop, our site for Firefox-specific development resources. For more information about transition sup
port, please visit our wiki page. Publishing add-ons Addons.mozilla.org, commonly known as "AMO," is Mozilla's official site for developers to list add-ons, and for users to discover them. By uploading your a...
Creating Sandboxed HTTP Connections
(aRequest, aContext, aProgress, aProgressMax) { }, onStatus : function (aRequest, aContext, aStatus, aStatusArg) { }, // nsIHttpEventSink (not implementing will cause annoying exceptions) onRedirect : function (aOldChannel, aNewChannel) { }, // we are faking an XPCOM interface, so we need to implement QI QueryInterface : function(aIID) { if (aIID.equals(Components.interfaces.nsISup
ports) || aIID.equals(Components.interfaces.nsIInterfaceRequestor) || aIID.equals(Components.interfaces.nsIChannelEventSink) || aIID.equals(Components.interfaces.nsIProgressEventSink) || aIID.equals(Components.interfaces.nsIHttpEventSink) || aIID.equals(Components.interfaces.nsIStreamListener)) return this; throw Components.results.NS_NOINTERFACE; }...
.../ Make sure it is our connection first. if (aSubject == gChannel) { var httpChannel = aSubject.QueryInterface(Components.interfaces.nsIHttpChannel); if (aTopic == "http-on-modify-request") { // ... } else if (aTopic == "http-on-examine-response") { // ... } } }, QueryInterface : function(aIID) { if (aIID.equals(Components.interfaces.nsISup
ports) || aIID.equals(Components.interfaces.nsIObserver)) return this; throw Components.results.NS_NOINTERFACE; } }; // get the observer service and register for the two coookie topics. var observerService = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); observerService.addObserver(listen...
...n the nsIInputStream and the type (in this case, "application/x-www-form-urlencoded"): var uploadChannel = gChannel.QueryInterface(Components.interfaces.nsIUploadChannel); uploadChannel.setUploadStream(inputStream, "application/x-www-form-urlencoded", -1); Due to a bug, calling setUploadStream will reset the nsIHttpChannel to be a PUT request, so now the request type is set to POST: // order im
portant - setUploadStream resets to PUT httpChannel.requestMethod = "POST"; ...
Debugging Table Reflow
728 3=024DD780 This is followed by the information which width has been set for each column. The index of the column, whether it is anonymous and what kind of constrained has been appliedcolIndex=0 isAnonymous=0 constraint=0. ...
... for each column. The index of the column, whether it is anonymous and what kind of constrained has been appliedcolIndex=0 isAnonymous=0 constraint=0. The following constraint types are known: eNoConstraint = 0, ePixelConstraint = 1, // pixel width ePercentConstraint = 2, // percent width ePro
portionConstraint = 3, // 1*, 2*, etc. ...
...Leaving AssignNonPctColWidths shows that already to all columns a width of 360 twips has been assigned AssignNonPctColWidths ex ***START TABLE DUMP*** mColWidths=360 360 360 360 col frame cache -> 0=00B93...
Debugging a hang on OS X (Archived)
Warning: The content of this article may be out of date. This article contains historical information about older versions of OS X. See How to Re
port a Hung Firefox instead. If you find a hang in an application, it is very useful for the developer to know where in the code this hang happens, especially if he or she can't reproduce it. Below are steps you can use to attach so-called "Samples" to bug re
ports. Creating the sample on Mac OS X 10.5 (XCode < 4.2) When the application is still hung, open up Spin Control.app (it's in your <tt>/Developer/Applications/Performance Tools/</tt> folder; if it is missing, install the latest Computer Hardware Understanding Development (CHUD) Tools from Apple). By default, sampling of any hanging application will begin automatically. After...
...Development (CHUD) Tools from Apple). By default, sampling of any hanging application will begin automatically. After about 3-4 seconds, select the hanging application in the "Detected Hangs" window and click the "Interrupt Sampling" button. Note that sampling will quickly hog up a lot of memory if you leave it on for too long! When it's done parsing the data, click the "Show text re
port" button; a new window will open with a couple of rows with stacktraces for all the threads in the sampled application. If you need to upload the sample to Bugzilla, select all the sample text, copy it into your favorite text editor, and save as a plain-text file. For a more detailed view of the sample data, make sure the sample you just recorded is selected in the "Detected Hangs" window and cl...
...ually suffice, note that this will quickly hog up a lot of memory if you leave it on for too long! When it's done parsing the data, you should now have a couple of rows with stacktraces for all the threads in the sampled application. When you have the raw Sample data, you can't just save that and attach it to a bug, because the format is not very usable (unless the developer is a Mac hacker). Ex
port it using Tools > Generate Re
port, and attach this as a text file to the bug re
port. The final data will show where the application spent all its time when it was hung, and hopefully your bug will be easier to fix now! See also Debugging on Mac OS X ...
Debugging on Mac OS X
select the "Info" tab. Set the Executable by clicking on "None" and selecting "Other...". A new dialog titled "Choose an executable to launch" will pop up. Browse to the .app file that you want to debug (Firefox.app, NightlyDebug.app etc). The .app file is typically found inside the dist folder in your build directory. If you are debugging Firefox, Thunderbird, or some other application that sup
ports multiple profiles, using a separate profile for debugging purposes is recommended. See "Having a profile for debugging purposes" below. Select the "Arguments" tab in the scheme editor, and click the '+' below the "Arguments passed on launch" field. Add "-P profilename", where profilename is the name of a profile you created previously. Repeat that to also add the argument "-no-remote". Also in ...
...under Targets (otherwise it may cause problems when you try to run the executable for debugging since you will get build errors). Click "Close" to close the scheme editor. At this point you can run the application from Xcode, and when you pause or hit breakpoints it should show open the correct source file at the correct line. Setting up lldb lldb is the debugger XCode provides/uses. ...
.../uses. One im
portant issue that the Mozilla .lldbinit file fixes is that by default some breakpoints will be listed as "pending", and XCode will not stop at them. If you don't include the Mozilla's .lldbinit, you must at least put settings set target.inline-breakpoint-strategy always in your $HOME/.lldbinit as recommended on Debugging Mozilla with lldb. The .lldbinit file in the source tree im
ports many useful Mozilla specific lldb settings, commands and formatters into lldb, but you may need to take one of the following steps to make sure this file is used. If you are using lldb on the command line (independently of Xcode) and you will always run it from either the top source directory, the object directory or else the dist/bin subdirectory of the object directory, then adding the follow...
Makefile - targets
s possible targets provided by the makefile. Target name Description build Default target. Compile Firefox, Thunderbird, etc check Standalone shell unit test invoked directly by make configure Launch the configure program to define headers and and attributes for the target build machine. ...
... makefile. Target name Description build Default target. Compile Firefox, Thunderbird, etc check Standalone shell unit test invoked directly by make configure Launch the configure program to define headers and and attributes for the target build machine. ...
... Target name Description build Default target. Compile Firefox, Thunderbird, etc check Standalone shell unit test invoked directly by make configure Launch the configure program to define headers and and attributes for the target build machine. ...
ESLint
/whatever" is unknown Run ./mach eslint --setup Restart your editor If that doesn't work, check that you have your editor pointing to the correct node_modules folder. Node.js is not recognized Add it to your PATH environment variable by running PATH="$PATH:/path/to/node.js/". ...
... Add a line like: /* eslint-env mozilla/browser-window */ or enable the rule in a .eslintrc.js if it will apply to the whole directory. ...
...nvironment: /* eslint-env worker */ or, to use a chrome worker environment: /* eslint-env mozilla/chrome-worker */ My file uses Chrome/XBL specific globals Either, specify the global at the top of the file: /* globals MyChromeGlobal */ or, add to the global section toolkit/.eslintrc.js if it is widely used. Foo.jsm ex
ports a symbol, but that is not recognised by ESlint Check it is listed correctly in tools/lint/eslint/modules.json Using Services.scriptloader.loadSubScript? You'll need to include the following just above it: /* im
port-globals-from relative/path/to/file.js */ do_check_eq, add_task not defined in a test directory. Ensure there is a .eslintrc.js file th...
SVG Guidelines
ith editor" comments Non-standard editor specific tags and attributes (sketch:foo, illustrator:foo, sopodi:foo, ...) The XML namespace definition that comes with the latter (xmlns:sketch, xmlns:sopodi, ...) Other metadata In addition to non-standard editor metadata, standard compliant metadata also exists. Typical examples of this are <title> and <desc> tags. Although this kind of data is sup
ported by the browser, it can only be displayed when the SVG is opened in a new tab. Plus, in most of the cases, the filename is quite descriptive So it's recommended to remove that kind of metadata since it doesn't bring much value. You shouldn't include DOCTYPEs in your SVGs either; they are a source of many issues, and the SVG WG recommends not to include them. See SVG Authoring guidelines. Avoid...
...colored ones are easier to spot, since they usually come with styles making them invisible. They must meet two conditions: they must be devoid of any fill (or a transparent one) or stroke. Unused attributes on root <svg> element The root <svg> element can also host many useless attributes. ...
...monly seen examples: style="display: none;" on <defs> elements (a <defs> element is hidden by default) type="text/css" on <style> elements stroke: none or stroke-width: 0 SVG grouping Style grouping Group similarly styled shapes under one <g> tag; this avoids having to set the same class/styles on many shapes. Avoid excessive grouping Editors can sometimes do excessive grouping while ex
porting SVGs. This is due to the way editors work. Nested groups Avoid multiple-level nesting of groups, these make the SVG less readable. Nested transforms Some editors use <g> tags to do nested transforms, which is usually not needed. You can avoid this by doing basic algebra, for example: <g transform="translate(-62, -310)"><shape transform="translate(60, 308)"/></g> can be cut down to: <sha...
Performance
s are also objects. And since frame scripts get evaluated for each tab this means new function objects get instantiated, new constants get computed, block scopes must be set up etc. While it may seem fairly innocencous in this toy example, real scripts often have a lot more functions and initialize some fairly heavyweight objects. BETTER: addon.js as above // framescript.js Components.utils.im
port("resource://my-addon/processModule.jsm", {}).addFrame(this) // processModule.jsm const EX
PORTED_SYMBOLS = ['addFrame']; const precomputedConstants = // ... function helper(window, action) { // ... do some work on the window } function doSomething(message) { frameGlobal = message.target result = helper(frameGlobal.content, message.data) frameGlobal.sendAsyncMessage("my-addon:response...
...ch tab. Not only does that increase memory footprint but the deserialization also has to be executed seperately for each tab, thus requiring more CPU time. ...
...) { Services.ppmm.broadcastAsyncMessage("my-addon:update-configuration", {newConfig: main.serialize()}) } // processModule.jsm const EX
PORTED_SYMBOLS = ['getMainCopy']; var mainCopy; Services.cpmm.addMessageListener("my-addon:update-configuration", function(message) { mainCopy = message.data.newConfig; }) funtion getMainCopy() { return mainCopy; } // framescript.js Components.utils.im
port("resource://my-addon/processModule.jsm") // getMainCopy() used by other functions Don't register observers (and other callbacks to global services) in a frame script BAD: //framescript.js Services.obs.addObserver("document-element-inserted", { observe: function(doc, topic, data) { if(doc.ownerGlobal.top != content) return; // bail out if this is for another tab decorat...
Storage access policy: Block cookies from trackers
re they reach our Release users. We'll keep this page updated with the newest information as we strengthen our protections. These protections are on by default in Nightly. The cookie policy can be enabled in other versions of Firefox through the Content Blocking settings (these steps will vary by version; the linked documentation includes a dropdown to select the appropriate Firefox version). Re
port Broken Sites If you find a website broken as a result of this change, file a bug under the Tracking Protection component within the Firefox product on Bugzilla. Alternatively you can re
port broken sites directly in Firefox by clicking "Re
port a Problem" in the Content Blocking section of the Control Center (this shortcut may not be available in all versions of Firefox). Tracking protection expl...
... section of the Control Center (this shortcut may not be available in all versions of Firefox). Tracking protection explained How does Firefox determine which resources are tracking resources? Firefox uses the Tracking Protection list to determine which resources are tracking resources. The Tracking Protection list is maintained by Disconnect. When the list is applied in Firefox, we make two im
portant changes: First, we only use the "Basic Protection" version of the list, which excludes some categories of trackers. In the future, we may expand our protections to use the "Strict Protection" version of the list. Second, Firefox uses an additional "entity list", which prevents domains from being classified as trackers when they are loaded on a top-level site owned by the same organization.
... will grant storage access scoped to the first party for a particular third-party origin as described in this section. Currently, Firefox includes some web compatibility heuristics that grant storage access to third-party resources classified as trackers when a user interacts with those third parties. We do this when we expect that not granting access would cause the web page to break. We also sup
port an initial implementation of the Storage Access API, through which embedded <iframe>s can request storage access by calling Document.requestStorageAccess(). Although both of these approaches provide the same level of storage access, we recommend third parties switch to using the Storage Access API in order to guarantee their access to storage. Automatic storage access upon interaction In order ...
Embedding the editor
editor needs to deal with. Note here that I use the term 'Composer' to mean an HTML-savvy compose widget that does rich text editing, and 'Editor' to mean a plain text editor (as well as the underlying technology for Composer). <htmlarea> is intended as a shorthand for a rich-text multiline text widget embedded in an HTML document, and is not meant to infer that future versions of Mozilla will sup
port this specific tag. Composer embedded in a XUL application Developers need to embed composer widgets in their XUL applications, by using the <editor> tag as we do today. They should need to do as little work as possible to get basic editing functionality, be able to have any number of <editor>s per window, and control whether those <editor>s are in HTML or plain text mode. Composer embedded in a n...
... This type of embedding requires that the composer code is agnostic to where its UI is coming from; communication between the core editor and the UI needs to go through one or more interfaces that insulate the editor from its host application. (The current nsEditorShell makes assumptions about the hosting XUL document, which need to be broken.) Composer embedded in a web page (<htmlarea>) IE 5 sup
ports the <HTMLArea> element; if Mozilla is to sup
port something similar, editor needs to be embeddable to the extent that this can be done. It is likely that we'd use XBL to implement this type of widget, as is the plan for other form controls. As is the case for composer embedded in a native application, there is a requirement here that the composer UI be configurable, such that it can be displayed ...
... XUL nodes. Fix existing JS and C++ code which explicitly addresses elements in the XUL document to go through nsIEditorUserInterface. Steps to embedding This section attempts to lay out an implementation plan, with the aim of keeping everything working as the various steps are taken. Some of these tasks can be done concurrently. ...
Embedding Tips
c.) How do I implement tool tips? Make your chrome object implement the nsITooltipListener interface. Methods to hide or show the tool tips will automatically be called upon it when the user hovers over an item with TITLE text. The contract ID is defined here. For an example, see BrowserImpl.cpp in mfcembed and its simple CBrowserToolTip class implemented in MFC. How do I disable drag/drop sup
port? When setting up your browser add a hook to the command manager which points to your nsIWebBrowserChrome implementation. This implementation should also implement nsIClipboardDragDropHooks. Deny the drop by setting the return value of the AllowDrop() function. nsCOMPtr<nsICommandManager> CommandManager = do_GetInterface(iWebBrowser); if (CommandManager) { nsCOMPtr<nsIDOMWindow> theDOMWindow =...
...lso implement nsIClipboardDragDropHooks. Deny the drop by setting the return value of the AllowDrop() function. ...
... the drop by setting the return value of the AllowDrop() function. ...
Roll your own browser: An embedding how-to
led config. Contained within this directory are a couple of makefiles: basebrowser-unix basebrowser-win The XPInstall packager follows the same format. However in our case, we only have one named XPI package. After the build is done, you can change directory into mozilla/embedding/config, and do a make. This will produce a directory in DIST named Embed. It should include all of the base sup
port that you need to get a web browser started up. Included is the sample test application (gtkEmbed or winEmbed). What initializations do I have to do? Somewhere during the start of your application, you must initialize XPCOM. You will also want to shut this down when you quit. Other initialization must be done to start up event queues and load some string bundles. All of this is somewhat generi...
...la to be embedded into the Konqueror browser. Uses GtkMozEmbed widget, part of the kdebindings module and available from http://websvn.kde.org/trunk/KDE/kdebindings/xparts/. (News release, screenshot) Mozilla Examples GtkMozEmbed widget: Gtk widget wrapper for the Mozilla Gecko Engine. TestGtkEmbed: Basic browser built with the GtkMozEmbed widget. URL location field, menu bar, html area, sup
ports SSL. Windows External projects K-Meleon browser: the Windows answer to Galeon. Fast IE-look-alike browser, uses IE and NS bookmarking system, fast loading time, privacy features, Java sup
port and complete control of the menus and "hotkeys". Implemented with Mozilla embedding APIs. (Screenshots) Neoplanet browser: A Gecko add-on for the NeoPlanet browser. ActiveState's Komodo: Development...
...xample application for win32. Basic browser, menus, toolbar, URLbar, html area. winEmbed: Obsoleted by mfcEmbed. A bare-bones browser with URLbar and html area. ActiveX control: An ActiveX control for Mozilla using the Gecko layout engine. More information at 1 and 2. Mac External projects ActiveState's Komodo: Development environment, based on Mozilla's XUL. (Screenshot) marbrow : Mac
port of X2Web (ja, ko) embedding Mozilla. Mozilla Examples PPEmbed: Standard Mozilla sample application implemented with Metroworks' Powerplant. Camino: A project aimed at delivering a best-of-breed browser on the Mac OS X platform. Camino uses Cocoazilla, a variant of Fizzilla that consists of a UNIX back end wed to a Cocoa front end. Java Examples Java Webclient: Provides a browser-neut...
Gecko SDK
as a result of security updates. You do have to get and distribute the newest Gecko components (gklayout.dll etc.), though. Downloading For Gecko versions before 2.0, you should choose the Gecko SDK version for the earliest version of Mozilla you wish to target. For Gecko versions 2.0 and higher, you must recompile your component for each release as cross-version compatibility is no longer sup
ported. In addition to the below versions, you can find other versions (including Beta) here: Xulrunner Releases (files include "sdk" in the name). The SDK follows the same release schedule as Firefox/Thunderbird. Once the SDK enters Beta, it is suitable for building extensions; your component should work with release builds of the SDK without any modifications. Due to the Rapid Release process, i...
...g the tool that looks something along the lines of this: dyld: Library not loaded: /opt/local/lib/libintl.3.dylib Referenced from: /Users/varmaa/xulrunner-sdk/bin/./xpidl Reason: image not found Trace/BPT trap Unfortunately, this is caused by a problem with the SDK build process which cannot currently be resolved (see Bugzilla bug #430274). To get around it, you'll need to first install Mac
Ports as outlined in the Mac OS X Build Prerequisites and install libidl with it. On 64-bit versions of Mac OS X, you'll need to install libidl with the +universal flag. Once that's done, you should perform the following command: ln -s /opt/local/lib/libintl.8.dylib /opt/local/lib/libintl.3.dylib This should fix the problem. Building the SDK To build the SDK, you should build XULRunner (the Gecko...
...led the XULRunner SDK). See the Build Documentation for complete details. After the XULRunner build is complete running make sdk from your object directory will create a package of the sdk in dist. Contents of the SDK The SDK contains the following: 1.9.2 IDL files for frozen interfaces (under idl/) Header files for frozen interfaces, XPCOM functions, and NSPR functions (under include/) Im
port libraries or shared libraries (under lib/) Static utility libraries (under lib/) Various tools (under bin/) For more information about safely linking XPCOM components using the XPCOM "glue" library, see XPCOM Glue. Using the Mozilla Build System with the SDK It's possible to use the Mozilla Build System with the SDK. This can be done by downloading the source code for Firefox and using the ...
HTML parser threading
ialized tokenizer/tree builder for speculatively scanning the tail of document.write() data when the parser blocks without parsing the document.write() data to completion. nsHtml5StreamParser has one tokenizer/tree builder pair for parsing data from the network. Additionally, each nsHtml5Parser has an associated nsHtml5TreeOpExecutor that turns the output (tree operations; discussed later) of the
portable parser core into actions performed on the Gecko DOM. Initialization An nsHtml5Parser is constructed without an nsHtml5StreamParser due to legacy code structure around parser creation. If the parser is not script-created, nsHtml5Parser::MarkAsNotScriptCreated() is called to create an nsHtml5StreamParser for the nsHtml5Parser. Due to legacy interface design oddities, an nsHtml5Parser is initial...
...ding a node into another, that can later be performed on the main thread. Note that mTokenizerMutex is being held by the parser thread for the entire time that the tokenizer runs. ParseAvailableData() checks for parser termination or interruption from time to time. The termination and interruption indicators are guarded by a more narrowly scoped mTerminatedMutex, so ParseAvailableData() has the op
portunity to receive an order to terminate or interrupt even while the parser thread is holding mTerminatedMutex. The tree op queue is flushed to the main thread from time to time. There's a timer that calls TimerFlush() (which takes mTokenizerMutex). Tree ops from the queue in the tree builder are moved to a tree op stage (nsHtml5TreeOpStage). The staging queue is protected by a mutex. This way, the ...
...g an attribute holder, the tree builder deletes the attribute holder explicitly. Attribute values, public identifiers (in doctype) and system identifiers (in doctype) are heap-allocated nsString objects (i.e. pointed to by nsString*!). Attribute values nsStrings are deleted by the attribute holder when it gets deleted. Public identifiers and system identifiers are deleted by the tree op or by the
portable parser core if they don't make it as far a tree op. The backing nsStringBuffers are thread-safely refcounted appropriately when the nsString goes away. (Aside: It would make more sense to make the parser deal with nsStringBuffers directly without having heap-allocated nsStrings involved.) Element names, attribute names and the doctype name are represented as nsIAtoms. Pre-interned attribute a...
Script security
the call or where it is going. Cross-compartment access Same-origin As we've already seen, the most common scenario for same-origin access is when objects belonging to the same window object interact. This all takes place within the same compartment, with no need for security checks or wrappers. When objects share an origin but not a global - for example two web pages from the same protocol,
port, and domain - they belong to two different compartments, and the caller gets a transparent wrapper to the target object. Transparent wrappers allow access to all the target's properties: functionally, it's as if the target is in the caller's compartment. Cross-origin If the two compartments are cross-origin, the caller gets a cross-origin wrapper. This denies access to all the object's pr...
...iltered access to the untrusted object. See Xray vision for much more information on Xrays. Unprivileged to privileged code If the caller has lower privileges than the target object, then the caller gets an opaque wrapper. An opaque wrapper denies all access to the target object. However, the privileged target is able to copy objects and functions into the less privileged scope using the ex
portFunction() and cloneInto() functions, and the less privileged scope is then able to use them. Security checks To determine the security relation between two compartments, Gecko uses two concepts: security principals and the act of subsuming. To establish the security relationship between two compartments A and B, Gecko asks: Does the security principal for compartment A subsume the security pri...
...he privileges of B, and possibly more, and therefore A is allowed to see and do anything that B can see and do. A Subsumes B && B Subsumes A A and B are same-origin. A Subsumes B && B !Subsumes A A is more privileged than B. A gets access to all of B, by default with Xray vision, which it may choose to waive. B gets no access to A, although A may choose to ex
port objects to B. A !Subsumes B && B !Subsumes A A and B are cross-origin. Security principals There are four types of security principal: the system principal, content principals, expanded principals, and the null principal. System principal The system principal passes all security checks. It subsumes itself and all other principals. Chrome code, by definition, runs with ...
How to get a stacktrace with WinDbg
of the Command window. Tip: All commands must be entered exactly as written, one line at a time, into the bottom of the Command box. Copying and pasting each line is the easiest method to avoid mistakes Some commands start with a period (.) or a pipe character (|), which is required. (The keystroke for a pipe character on US keyboards is SHIFT+\) Submit the log file on a bug or via the sup
port site, even if nothing seems to happen during the debug process Start debugging Now that Firefox is opened in the debugger, you need to configure your WinDbg to download symbols from the Mozilla symbol server. To load the symbols, enter the three commands below, pressing enter after each one. (More details are available at Using the Mozilla symbol server.) .sympath SRV*c:\symbols*http://symbo...
... Once the browser crashes, you will see an error (such as "Access violation") in the WinDbg Command window. If Firefox hangs and there is no command prompt available in the debugger, open the Debug menu and choose Break. Once the browser has crashed or been stopped, continue with the steps below. ...
... Producing a minidump Sometimes the stacktrace alone is not enough information for a developer to figure out what went wrong. A developer may ask you for a "minidump" or a "full memory dump", which are files containing more information about the process. You can easily produce minidumps from WinDBG and provide them to developers. ...
Extending a Protocol
a message from the content process (main thread) to the chrome process (UI Thread). The tutorial is designed for beginners and will walk you through all the steps you need to get things working. The tutorial is designed for browser engineers who are implementing DOM/Web APIs that need to, for example, send a message to the OS or spin up something off the main thread - so it's biased towards sup
porting W3C/WHATWG DOM APIs. What are we going to implement? tl:dr: you can see the final implementation of PEcho.ipdl as a diff in Phabricator. To make this tutorial less abstract (more fun!), we are going to implement a JS method called echo() on the Navigator interface. The method will take one argument, a DOMString, which we will pass to the parent process. Then we will send that same string ...
...LINE_DECL_THREADSAFE_REFCOUNTING(EchoChild, final) public: explicit EchoChild(); protected: void ActorDestroy(ActorDestroyReason aWhy) override; // We get SendEcho(nsCString& aString) from the superclass. private: ~EchoChild() = default; bool mActorAlive; }; } // end of namespace dom } // end of namespace Mozilla And add the EchoChild.h to dom/ipc/moz.build, as part of the EX
PORTS.mozilla.dom array. Again, remember that this must be in alphabetical order! Compiling this will now complain: "fatal error: 'mozilla/dom/EchoParent.h' file not found", so let's define EchoParent.h. Defining EchoParent.h Like before, create ./dom/ipc/EchoParent.h, and code it as follows - the inline comments describe what's going on. Note the RecvEcho(), we finally get to define where a mess...
...Again, remember that this must be in alphabetical order! Ok, if we now try to compile, it should complain that "error: no member named 'AllocPEchoParent' in 'mozilla::dom::WindowGlobalParent'". This is part of WindowGlobalParent managing our protocol for us. So let's add that. Defining WindowGlobalParent's Alloc/DeallocPEchoParent() Open up dom/ipc/WindowGlobalParent.h and...
Implementing Download Resuming
This document describes how an embedder or other Gecko/Necko-using application can implement download resuming. The interfaces in question exist in the form they are described here since Gecko 1.8a4 (Firefox 1.5, SeaMonkey 1.0, XULRunner 1.8.0.1). Introduction Various protocols sup
port getting partial files. This means that if a download was interrupted, it can be resumed from that point on, rather than regetting the whole file. The Necko implementations of HTTP 1.1 (RFC 2616) as well as FTP sup
port this feature. Not only is the ability to specify a start position im
portant, but it's also im
portant to have some assurance that the file did not change since the initial download attempt. That would lead to a situation where the first part of the file corresponds to the initial version...
...s onStopRequest method with a failure status. (TODO: document what webbrowserpersist/exthandler do). The front-end code can then notify the user of this, and offer to resume the download. Resuming a download In order to resume a download, you should create a channel as usual (using nsIIOService). Then, you can check if it implements nsIResumableChannel. If it does not, the protocol does not sup
port resuming. Otherwise, call resumeAt with the desired start position, and the previously stored entity ID. (It is possible to pass an empty string as the ID; however, this means that you have no assurance that the file remained unchanged) Now, you can open the channel as usual (using nsIChannel.asyncOpen() in the common case) and write to the file in the onDataAvailable notifications. You may want...
... to existing files (as opposed to overwriting them), and is therefore not usable for this task (see bug 129921). Detecting when a file changed If the file changed (that is, the entity ID does not match), then Necko will notify the stream listener with an NS_ERROR_ENTITY_CHANGED error code. The front-end may want to offer the user to get the new file from scratch in such a case. Resuming not sup
ported In some cases, it's not possible to detect whether the server sup
ports resuming until the user actually tries to resume. In such a case, the stream listener will get an NS_ERROR_NOT_RESUMABLE status. Here, too, the front-end may want to offer downloading the entire file from scratch. ...
DeferredTask.jsm
Firefox 28 note Interface was changed in Firefox 28, and old methods were removed. The DeferredTask.jsm JavaScript code module offers utility routines for a task that will run after a delay. Multiple attempts to run the same task before the delay will be coalesced. To use it, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/DeferredTask.jsm"); Use this, for instance, if you write data to a file and you expect that you may have to rewrite data very soon afterwards. With DeferredTask, the task is delayed by a few milliseconds and, should a new change to the data occur during this period, only the final version of the data is actually written; a further grace delay is added to take into account other cha...
...red while running, but can be executed again after a previous run finished. A common use case occurs when a data structure should be saved into a file every time the data changes, using asynchronous calls, and multiple changes to the data may happen within a short time: let saveDeferredTask = new DeferredTask(function* () { yield OS.File.writeAtomic(...); // Any uncaught exception will be re
ported. }, 2000); // The task is ready, but will not be executed until requested. The "arm" method can be used to start the internal timer that will result in the eventual execution of the task. Multiple attempts to arm the timer don't introduce further delays: saveDeferredTask.arm(); // The task will be executed in 2 seconds from now. yield waitOneSecond(); saveDeferredTask.arm(); // The task ...
... ); Instead, if you are going to delete the saved data from disk anyways, you might as well prevent any pending write from starting, while still ensuring that any write that is currently in progress terminates, so that the file is not in use any more: saveDeferredTask.disarm(); saveDeferredTask.finalize().then(() => OS.File.remove(...)) .then(null, Components.utils.re
portError); ...
Interfacing with the Add-on Repository
The Add-on Repository JavaScript code module makes it easy for your extension to interface with the AMO repository. You an use the code module to get lists of add-ons and even install new add-ons. This article provides some sample code that queries the recommended add-ons list on AMO and lets the user click a button to install an add-on from the list. Im
porting the repository code module Before you can use the Add-on Repository API, you need to im
port the code module: Components.utils.im
port("resource://gre/modules/AddonRepository.jsm"); Having done this, you can then access the API through the resulting AddonRepository object. Enabling the recommendation feature In current builds of Firefox 4, the recommendation API doesn't work because the preference for the URL to query to get recom...
...ncorrect) is if there is already a pending request, since only one request can be in progress at a time. For example: searchFailed: function() { this.showNotification("I have no recommendations for you right now!", "Oh noes!", null); }, Here, we call a showNotification() method with some parameters that we'll look at shortly when we get to our showNotification() method below. The im
portant thing to note is that this will handle the failure case. Handling successful requests The callback object's searchSucceeded() method gets called when a search completes successfully. It receives a list of the matching addons, the number of add-ons returned, and the total number of add-ons that matched the query (in case the returned number is smaller than the requested number, for example). ...
...n() routine, passing in as parameters a prompt including the name of the returned add-on, a label for the button to show in the notification ("Install"), and the AddonInstall object that can be used with the Add-on Manager API to install the add-on. ...
NetUtil.jsm
The NetUtil.jsm JavaScript code module provides easy-to-use APIs for performing common network related tasks. To use these utilities, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/NetUtil.jsm"); Once you've im
ported the module, you can then use its methods. Method overview nsIAsyncStreamCopier asyncCopy(nsIInputStream aSource, nsIOutputStream aSink, [optional] aCallback) void asyncFetch(aSource, aCallback) nsIChannel newChannel(aWhatToLoad, [optional] aOriginCharset, [optional] nsIURI aBaseURI) nsIURI newURI(aTarget, [optional] aOriginCharset, [optional] nsIURI aBaseURI) String readInputStreamToString(aInputStream, aCount, aOptions) Attributes Attri...
...ccessCode(aResult)) { // an error occurred! } }) asyncFetch() The asyncFetch() method opens an input source, asynchronously, and gives an nsIInputStream containing the data obtained to the callback provided. The callback may then consume data from the input stream passed to the callback. Note: Prior to Gecko 2, the input source was required to be specified as an nsIChannel. Note: Sup
port for specifying an nsIInputStream as the input source was added in Gecko 5. asyncFetch( aSource, aCallback ); Parameters aSource The source to open asynchronously. This may be specified as an nsIURI, nsIFile, nsIChannel, nsIInputStream or as a string specifying the URL to open. aCallback A function that will be called when the open operation is completed. The callback receives three ...
... optional character set to use when interpreting aWhatToLoad as a string; this is ignored if aWhatToLoad is not a string. Defaults to UTF-8 if not provided. aBaseURI The base URI for the spec, specified as an nsIURI. Only used if aWhatToLoad is a string. newURI() The newURI() method creates a new nsIURI. This method wraps the nsIIOService.newURI(). Note: Starting in Gecko 2, this method sup
ports specifying an nsIFile as the target of the URI. In previous versions of Gecko, you must use a string to specify the URI. nsIURI newURI( aTarget, [optional] aOriginCharset, [optional] aBaseURI ); Parameters aTarget Specifies the target of the URI as either a URI string or (starting in Gecko 2) as an nsIFile. aOriginCharset The optional character set for the URI. Defaults to UTF-8 ...
PerfMeasurement.jsm
The PerfMeasurement.jsm JavaScript code module lets you take detailed performance measurements of your code. Note: The PerfMeasurement.jsm JavaScript code module can only be used from chrome -- that is, from within the application itself or an add-on. Before you can use this module, you need to im
port it into your scope: Components.utils.im
port("resource://gre/modules/PerfMeasurement.jsm") See Measuring performance using the PerfMeasurement.jsm code module for details on how to use this API. Note: At present, PerfMeasurement.jsm is only functional on Linux, but it is planned to add sup
port for Windows (bug 583322) and OSX (bug 583323) as well, and we welcome patches for other operating systems. Method overview static bool canMeasureSomething(); void reset(); void start(); void stop...
...ofiled. cpu_migrations uint64 The number of times the profiled thread migrated from one CPU core to another. Event types measured constant The eventsMeasured constant provides a mask indicating which event types were recorded. Variable Type Description eventsMeasured EventMask A bit mask of the event types recorded; this can differ from the events requested if the platform doesn't sup
port all of the event types you specified when creating the PerfMeasurement object. Constants Event mask constants These constants are used to construct the mask indicating which events you want to monitor. Constant Value Description CPU_CYCLES 0x00000001 Measure CPU cycles elapsed. INSTRUCTIONS 0x00000002 Measure the number of instructions executed. CACHE_REFERENCES 0x00000004 Measure the...
...vent types you want to record; see Event mask constants for a list of values. OR together all the event types you want to record, and pass that value here. Pass PerfMeasurement.ALL to record all event types. Return value A new PerfMeasurement object configured to record the specified event types. Methods canMeasureSomething() Indicates whether or not the platform on which your code is running sup
ports this code module. static bool canMeasureSomething(); Parameters None. Return value If even one of the event types can be recorded, this will return true. Otherwise, it returns false. reset() Resets all the enabled counters to zero. void reset(); Parameters None. start() Starts measuring the performance indicators that were specified when the PerfMeasurement object was created. void start(); P...
Promise.jsm
A+ proposal as known in April 2013. This module was used before DOM Promises were made globally available in Gecko 29. Its usage is not suggested for new code. If you just need a Promise, consider using a DOM Promise instead. If you need a Deferred, because you want to create a Promise and manually resolve or reject it, consider using PromiseUtils.jsm instead. ...
... Promises were made globally available in Gecko 29. Its usage is not suggested for new code. If you just need a Promise, consider using a DOM Promise instead. If you need a Deferred, because you want to create a Promise and manually resolve or reject it, consider using PromiseUtils.jsm instead. ...
... Promise and manually resolve or reject it, consider using PromiseUtils.jsm instead. To use it, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/Promise.jsm"); Note: A preliminary promise module is also available starting from Gecko 17, though it didn't conform to the Promises/A+ proposal until Gecko 25: Components.utils.im
port("resource://gre/modules/commonjs/promise/core.js"); // Gecko 17 to 20 Components.utils.im
port("resource://gre/modules/commonjs/sdk/core/promise.js"); // Gecko 21 to 24 This implementation also includes helper functions that are specific to the Add-on SDK. While you may still im
port this module from the above paths, the recommended way for loading it is through the Add-on SDK loader. Intro...
Sqlite.jsm
ode easy to write and read. JavaScript-y API. Sqlite.jsm feels like a pure JavaScript module. The complexities of XPCOM are mostly hidden from view. JavaScript programmers should feel right at home using Sqlite.jsm. Note: The Sqlite.jsm JavaScript code module can only be used from chrome -- that is, from within the application itself or an add-on. Before you can use this module, you need to im
port it into your scope: Components.utils.im
port("resource://gre/modules/Sqlite.jsm") Obtaining a Connection Sqlite.jsm ex
ports the Sqlite symbol. This symbol is an object with a single function: openConnection. This function takes an object defining connection options: path (required) The database file to open. This can be an absolute or relative path. If a relative path is given, it is interp...
...executing. There is no default value which means no automatic memory minimization will occur. Please note that this is not a timer on the idle service and this could fire while the application is active. openConnection(options) returns a promise that resolves to an opened connection instance or is rejected if an error occurred while opening the database. Here is an example: Components.utils.im
port("resource://gre/modules/Sqlite.jsm"); try { const conn = await Sqlite.openConnection({ path: "myDatabase.sqlite", sharedMemoryCache: false }); // connection is the opened SQLite connection (see below for API). } catch (error) { // The connection could not be opened. error is an Error describing what went wrong. } Working with Opened Connections Opened connections are what you will inter...
...e. It returns a promise that is resolved with a boolean indicating whether the table exists. indexExists(name) This functions determines whether a named index exists in the current database. It returns a promise that is resolved with a boolean indicating whether the index exists. Statement Execution These APIs facilitate execution of statements on the connection. These are arguably the most im
portant APIs in this type. executeCached(sql, params, onRow) execute(sql, params, onRow) These similar functions are used to execute a single SQL statement on the connection. As you might have guessed by the name, there are 2 flavors: cached and non-cached. Other than that, they behave identically. These functions receive the following arguments: sql (required) String SQL statement to execute.
Localizing with Koala
: If you already have a repository set up by l10n-drivers (on BitBucket), type the URL of the remote repository, e.g. http://bitbucket.org/mozillal10n/x-testing. If you're starting a new localization, you may not have a remote repository set up yet. It is still recommended to use Mercurial locally to version your local files. Just type a single dot (".") in the URL field to enable Mercurial sup
port in Koala. Branch: default. Revision: leave empty. User: type your name and your e-mail address in the form: "Firstname Lastname <me@example.com>" (be sure to type the wrapping quotes: "") Note that you no longer have to edit the location now, it automatically fills in when you check the "Mercurial" checkbox (e.g. "C:\mozilla\l10n\locale\x-testing\3.6" If you enabled Mercurial (recommended), K...
...k to the local hg repository that you created in the "Creating a new project" section. Committing your work Hopefully by now, you have translated 3 strings in the following 2 files: searchbar.dtd: cmd_engineManager.label searchEndCap.label search.properties: cmd_addFoundEngine It's time to put these files under Mercurial's version control system. ...
...For the purposes of this tutorial, we will switch to the command line every now and then to see what Koala does behind the scenes. Normally though, you don't have to use the command line to commit your work. ...
gettext
Warning: This document pertains to the development of Mozilla web sites and not to the development of Gecko-based extensions or applications. Plurals gettext lets you define and use singular and plural forms of a string. To take advantage of this functionality, you need to use a different keyword (i.e. different gettext function name) for string which are supposed to sup
port plurals. For instance, in PHP the default keyword for regular messages is gettext() and _(). For messages with plural sup
port, the default keyword is ngettext(). A definition of a string with plurals takes three arguments: the singular form of the English string, the plural form of the English string, and the number basing on which the function will return the correct (singular or plural) form of the stri...
...cal English strings and disambiguate the translation. In the PO file, msgctxt looks like this: msgctxt "Button label" msgid "Log in" msgstr "" msgctxt "Dialog title" msgid "Log in" msgstr "" You can add context to your strings by passing an additional argument to the gettext function call and then having xgettext extract it as the context. In PHP, however, the default gettext functions don't sup
port passing such additional argument. To fix this, you may choose to write your own helper gettext functions. The following example illustrates this. <?php // Implement gettext context if (!function_exists('pgettext')) { function pgettext($context, $msgid) { $contextString = "{$context}\004{$msgid}"; $translation = _($contextString); if ($translation === $contextString) r...
...--keyword=n___:1,2 \ --keyword=n___:1,2,4c \ file.php Running xgettext will result in the following messages.po file: # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Re
port-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-09-28 16:18+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" #. L10N: This is a block comment one line di...
Mozilla Development Strategies
But keep in mind that your checkin rate isn't everything. It's better to fix one data loss bug, crasher, or performance bug that really affects the user than edge case bugs that are rarely seen or minor bugs. ...
...S conflicts. If you update every day for a week, you might not have any conflicts, but if you update once a week and you've changed a lot of code, you'll most likely have conflicts. See mozilla\config\fast-update.pl for a fast way to update your tree. You can update your main mozilla tree (minus nsprpub, etc) in 1-2 minutes. Work on multiple bugs in parallel You should be working on the most im
portant bugs first. But those might be difficult bugs (hard to reproduce crashers, big rewrites for performance, etc.) which can take several days or weeks to complete, plus the time for reviews. In your other trees, work on smaller, easier bugs. Pick bugs that won't cause conflicts with the work you're doing in your primary tree. Pick bugs that should only take you a few hours or a day to fix. In the...
... ...
Investigating leaks using DMD heap scan mode
th separator. For instance, ~/logs/leak/. The command you need to run Firefox will look something like this: XPCOM_MEM_BLOAT_LOG=1 MOZ_CC_LOG_SHUTDOWN=1 MOZ_DISABLE_CONTENT_SANDBOX=t MOZ_CC_LOG_DIRECTORY=$logdir MOZ_CC_LOG_PROCESS=content MOZ_CC_LOG_THREAD=main MOZ_DMD_SHUTDOWN_LOG=$logdir MOZ_DMD_LOG_PROCESS=tab ./mach run --dmd --mode=scan Breaking this down: XPCOM_MEM_BLOAT_LOG=1: This re
ports a list of the counts of every object created and destroyed and tracked by the XPCOM leak tracking system. From this chart, you can see how many objects of a particular type were leaked through shutdown. This can come in handy during the manual analysis phase later, to get evidence to sup
port your hunches. For instance, if you think that an nsFoo object might be holding your leaking object alive,...
... is needed so that when we get a DMD log the entire contents of each block of memory is saved for later analysis. With that command line in hand, you can start Firefox. Be aware that this may take multiple minutes if you have optimization disabled. Once it has started, go through the steps you need to reproduce your leak. If your leak is a ghost window, it can be handy to get an about:memory re
port and write down the PID of the leaking process. You may want to wait 10 or so seconds after this to make sure as much as possible is cleaned up. Next, exit the browser. This will cause a lot of logs to be written out, so it can take a while. Analyzing the Logs Getting the PID and address of the leaking object The first step is to figure out the PID of the leaking process. The second step is to...
...lement 0x7f0882fe3230 contains a strong reference to the EventListenerManager 0x7f0899b4e550. "[via hash] mListenerManager" is a description of that strong reference. Together, these lines show a chain of strong references from an object the cycle collector thinks needs to be kept alive, 0x7f0899b4e550, to the object 0x7f0897082c00 that you asked about. Most of the time, the actual chain is not im
portant, because the cycle collector can only tell us about what went right. Let us call the address of the leaking object (0x7f0882fe3230 in this case) $leakaddr. Besides $leakaddr, the other interesting part is the chunk at the bottom. It tells us that there is 1 unknown edge, and 2 known edges. What this means is that the leaking object has a refcount of 3, but the cycle collector was only told ab...
Scroll-linked effects
ects explained Often scrolling effects are implemented by listening for the scroll event and then updating elements on the page in some way (usually the CSS position or transform property.) You can find a sampling of such effects at CSS Scroll API: Use Cases. These effects work well in browsers where the scrolling is done synchronously on the browser's main thread. However, most browsers now sup
port some sort of asynchronous scrolling in order to provide a consistent 60 frames per second experience to the user. In the asynchronous scrolling model, the visual scroll position is updated in the compositor thread and is visible to the user before the scroll event is updated in the DOM and fired on the main thread. This means that the effects implemented will lag a little bit behind what the user...
... console (starting in version 46) if it detects the presence of a scroll-linked effect on a page. Pages that use scrolling effects without listening for scroll events in JavaScript will not get this warning. See the Asynchronous scrolling in Firefox blog post for some more examples of effects that can be implemented using CSS to avoid jank. Future improvements Going forward, we would like to sup
port more effects in the compositor. In order to do so, we need you (yes, you!) to tell us more about the kinds of scroll-linked effects you are trying to implement, so that we can find good ways to sup
port them in the compositor. Currently there are a few proposals for APIs that would allow such effects, and they all have their advantages and disadvantages. The proposals currently under consideration...
...th an additional proposal to map scroll position to time and use that as a timeline for the animation. CompositorWorker: Allows JavaScript to be run on the compositor thread in small chunks, provided it doesn't cause the framerate to drop. Scroll Customization: Introduces a new API for content to dictate how a scroll delta is applied and consumed. As of this writing, Mozilla does not plan to sup
port this proposal, but it is included for completeness. Call to action If you have thoughts or opinions on: Any of the above proposals in the context of scroll-linked effects. Scroll-linked effects you are trying to implement. Any other related issues or ideas. Please get in touch with us! You can join the discussion on the public-houdini mailing list. ...
TraceMalloc
DMD and removed from the codebase. This documentation is only relevant to older versions of the codebase that still contain it. TraceMalloc captures stack traces of all malloc, calloc , realloc, and free calls (this currently covers all operator new and delete calls in Mozilla, too). To enable TraceMalloc in your build, configure with --enable-trace-malloc. The built Mozilla application will sup
port the following additional command-line options: --trace-malloc filename The application will log allocation and deallocation events with stack traces in a binary format to the given file. If filename is -, nothing is written to a file, but TraceMalloc will be active and will track live allocations and their stack traces. --shutdown-leaks=filename On shutdown, the application will save live al...
...ry running with the unified output format option, -u. The output is a large HTML file that hyperlinks ancestor and descendent libraries, classes, and functions that call into one another, attributing malloc blame up and down each graph. Bloatblame accumulates allocation counts and ignores free calls. If you run with --trace-malloc -, your code can call NS_TraceMallocDumpAllocations(pathname) at op
portune times, and a human-readable listing of the current heap, including stack traces for every allocation, will be written to pathname. This file can be post-processed by tools in mozilla/tools/trace-malloc as follows: histogram.pl, which produces a type histogram that can be diffed with histogram-diff.sh to produce output that looks like this: ---- Base ---- ---- Incr ---- ----- Difference ...
...down-leaks=sdleak.log # Convert raw log to text representation of call trees perl source/tools/trace-malloc/diffbloatdump.pl --depth=15 --use-address /dev/null sdleak.log > sdleak.tree.raw # Frobulate trees to remove extraneous junk perl source/tools/rb/fix-macosx-stack.pl sdleak.tree.raw > sdleak.tree You can also use the leakstats program to analyze a log for shutdown leaks. It will produce a re
port like the following. Leaks: 382739 bytes, 3465 allocations Maximum Heap Size: 7751799 bytes 62095212 bytes were allocated in 391091 allocations. Detecting memory usage growth in a running process To do this, dump the existing allocations to a file by calling the function TraceMallocDumpAllocations from JavaScript. You can use the following web page to do so. <script type="text/javascript"> var...
Debugging out-of-memory problems
fails due to an out of memory error (OOM) somewhere during load time. By the time about:memory is loaded in a new tab and you have clicked the "Measure" button to diagnose what's happened, the memory usage causing the spike has gone away, making temporary memory spikes difficult to diagnose. This article explains how to debug such problems. ...
...exceptions from JS Setting memory.dump_re
ports_on_oom in about:config to true will cause the browser to automatically write about:memory dumps to a temp file printed to the Browser Console (note: not Web Console) when an OOM crash is encountered. For more information, see bug 969415. Out-of-memory crashes In some cases, running out of memory causes the browser to crash. Ideally, memory.dump_re
ports_on_oom would generate an about:memory dump, but it does not currently. Firefox Android On Firefox Android, an about:memory dump may be triggered from a connect desktop machine with the command: adb shell am broadcast -a org.mozilla.gecko.MEMORY_DUMP The location of the dump file will be printed to the Android log (viewed with adb logcat | grep GeckoConsole) and can be retrieved via adb pull...
... not currently. Firefox Android On Firefox Android, an about:memory dump may be triggered from a connect desktop machine with the command: adb shell am broadcast -a org.mozilla.gecko.MEMORY_DUMP The location of the dump file will be printed to the Android log (viewed with adb logcat | grep GeckoConsole) and can be retrieved via adb pull. Note: replace "/storage/emulated/0/Download/" in the re
ported file path with the device's download path (e.g. "/sdcard/download/") when calling adb pull. ...
Emscripten
To get started with Emscripten, go to the official Emscripten Wiki. Using Emscripten, you can Compile C and C++ code into JavaScript Compile any other code that can be translated into LLVM bytecode into JavaScript. ...
...imes of other languages into JavaScript, and then run code in those other languages in an indirect way (this has been done for Python and Lua)! Emscripten makes native code immediately available on the Web: a platform that is standards-based, has numerous independent compatible implementations, and runs everywhere from PCs to iPads. ...
...hat is standards-based, has numerous independent compatible implementations, and runs everywhere from PCs to iPads. With Emscripten, C/C++ developers don't have the high cost of
porting code manually to JavaScript -- or having to learn JavaScript at all. Web developers also benefit, as they can use the many thousands of pre-existing native utilities and libraries in their sites. Practically any
portable C or C++ codebase can be compiled into JavaScript using Emscripten, ranging from high performance games that need to render graphics, play sounds, and load and process files, through to application frameworks like Qt. Emscripten generates fast code -- its default output format is asm.js , a highly optimizable subset of JavaScript that can execute at close to native speed in many cases. Not...
L20n HTML Bindings
ack to the homepage">cancel</a>. </p> The input element is not on the default whitelist but since it's present in the source HTML, it is also allowed in the translation. The value attribute is allowed on input elements, but type is not. Similarly, href and onclick attributes are not allowed in translations and they are not inserted in the final DOM. However, the title attribute is safe. It is im
portant to note that applying translations doesn't replace DOM elements, but only modifies their text nodes and their attributes. This makes it possible to use L20n in conjunction with MVC frameworks. When all DOM nodes are localized, the document element will fire a DocumentLocalized event, which you can listen to: document.addEventListener('DocumentLocalized', function() { // the DOM has been lo...
...r attributes. This makes it possible to use L20n in conjunction with MVC frameworks. When all DOM nodes are localized, the document element will fire a DocumentLocalized event, which you can listen to: document.addEventListener('DocumentLocalized', function() { // the DOM has been localized and the user sees it in their language YourApp.init(); }); Exposing Context Data You can expose im
portant bits of data to the localization context in form of context data. <script type="application/l10n-data+json"> { "newNotifications": 3, "user": { "name": "Jane", "gender": "feminine" } } </script> This data will be available context-wide to all localized strings. For instance, a string could use the information about the user's gender to provide two variants of the translation, ...
...n about the available and the default locales, L20n will switch to the monolingual mode. You can then embed localization resources right in your HTML. <script type="application/l20n"> <brandName "Firefox"> <about "About {{ brandName }}"> </script> An alternative is to include localization resources in script elements. Note that this still only works for a single language. We plan to add sup
port for a Language Pack Service in the future that can tap into this scenario on the client side. <script type="application/l20n" src="../locales/strings.l20n"></script> Note that you currently cannot use the manifest file and manually add resources via script tags at the same time (bug 923670). ...
Localization Use Cases
In all presented examples, we try to show the existing code, explain the problem from the localizers' or developers' perspective, and suggest a solution. Declensions In Gaia's Browser app, there's an about-browser string defined as follows in apps/browser/locales/browser: about-browser=About {{browserBrandShortName}} Problem definition In many inflected languages (e.g. German, Finnish, Hungarian, all Slavic languages), the about preposition governs the grammatical case of the complement. It might be the accusative (German), ablative (Latin) or locative (Slavic languages). Let's take Slovenian as an example. ...
... In L20n, the English string could be as simple as: <availableSize "{{ $size }} {{ $unit }} available"> On the other hand, the Ita...
...t forget to pluralize some strings that in other languages might require pluralization (or other grammatical features that the framework sup
ports). Solution L20n isolates each language so that grammatical requirements of one don't affect others. This takes the responsibility away from the developers and puts it in the hands of localizers, at the same time transforming it from a burden into an op
portunity. In L20n, the English string could be as simple as: <availableSize "{{ $size }} {{ $unit }} available"> On the other hand, the Italian translation would make use of proper pluralization rules: <plural($n) { $n == 1 ? "one" : "other" }> <availableSize[plural($size)] { one: "{{ $size }} {{ $unit }} disponibile", other: "{{ $size }} {{ $unit }} disponibili" }> So far, s...
AsyncTestUtils extended framework
The AsyncTestUtils Extended Framework is one mechanism for testing the MailNews component of Thunderbird. See MailNews automated testing for a description of the other testing mechanisms. ...
...reate one or more new sets of messages and add them to the provided folders. Like make_folders_with_sets, the messages are spread across the folders. Folders Create a folder let folderHandle = make_empty_folder(aOptionalFolderName); You do not have to specify a folder name - if you don't care, we'll make one up for you. If you need to get fancy about having flags set on the folder, we sup
port that, but please check the method documentation. Get / create the Junk folder let junkFolder = get_junk_folder(); Create a Virtual folder (a folder whose contents are the result of a saved search) let virtualFolder = make_virtual_folder([aFolderToSearch1, aFolderToSearch2, ...], {subject: "", body: "", from: "", to: "", cc: "", recipient: "", involves:...
...s just makes your tests fail if errors get logged to the error console (like you see if you go to the "Tools | Error Console" menu). messageGenerator.js: Provides the SyntheticMessage abstraction and MessageGenerator class that can generate one or more SyntheticMessages at a time. The MessageScenarioFactory produces specific pre-configured message threading configurations using fresh messages (im
portant in avoiding duplicate messages for code that cares, like gloda). messageModifier.js: Slightly misnamed, this provides the SyntheticMessageSet abstraction that is a set abstraction for SyntheticMessages that also tracks what folders they got injected into and provides code to directly manipulate or aid other code that wants to directly manipulate them. messageInjection.js: All the logic for i...
NSPR's Position On Abrupt Thread Termination
I resist including this function in NSPR because it results in bad programming practice and unsup
portable programs. Threads are not processes. Abrupt termination has been available in the UNIX/C environment for some time (exit()), and I assume that the basic semantics defined there are applicable here. In that environment, exit() may be called and any time, and results in the calling thread's immediate termination. ...
...me, and then freed as the stack unwinds. In these cases, the presence of the data is recorded only on the stack, known only to the single thread (normally referred to as encapsulated). The problem with abrupt termination is that it can happen at any time, to a thread that is coded correctly to handle both normal and exceptional situations, but will be unable to do so since it will be denied the op
portunity to complete execution. It can happen because it called out of its own scope into some lazily implemented library. NSPR's answer to this is that there is no abrupt thread termination. All threads must unwind and return from their root function. If they cannot, because of some state corruption, then they must assume that the corruption, like the state, is shared, and their only resource is for...
... termination. All threads must unwind and return from their root function. If they cannot, because of some state corruption, then they must assume that the corruption, like the state, is shared, and their only resource is for the process to terminate. To make this solution work requires that a function that encounters an error be designed such that it first repairs its immediate state, and then re
ports that error to its caller. If the caller cannot deal with the failure, it must do the same. This process continues until the thread either recovers from the malady or returns from the root function. This is not all that difficult (though having done it a number of times to already existing code, I will admit it isn't much fun either). The implementation of either strategy within the NSPR runtime ...
Anonymous Shared Memory
ttr, fm, shmname ); PR_CreateProcess(Client); PR_DestroyProcessAttr(attr); ... yadda ... PR_MemUnmap( addr ); PR_CloseFileMap(fm); Client: ... started by server via PR_CreateProcess() fm = PR_GetInheritedFileMap( shmname ); addr = PR_MemMap(fm); ... yadda ... PR_MemUnmap(addr); PR_CloseFileMap(fm); Second protocol Server: fm = PR_OpenAnonFileMap(dirName, size, FilemapProt); fmstring = PR_Ex
portFileMapAsString( fm ); addr = PR_MemMap(fm); ... application specific technique to pass fmstring to child ... yadda ... Server uses his own magic to create child PR_MemUnmap( addr ); PR_CloseFileMap(fm); Client: ... started by server via his own magic ... application specific technique to find fmstring from parent fm = PR_Im
portFileMapFromString( fmstring ) addr = PR_MemMap(fm); ... yadda ... P...
..._MemUnmap( addr ); PR_CloseFileMap(fm); Client: ... started by server via his own magic ... application specific technique to find fmstring from parent fm = PR_Im
portFileMapFromString( fmstring ) addr = PR_MemMap(fm); ... yadda ... ...
...eFileMap(fm); Client: ... started by server via his own magic ... application specific technique to find fmstring from parent fm = PR_Im
portFileMapFromString( fmstring ) addr = PR_MemMap(fm); ... yadda ... ...
I/O Functions
Manipulation Functions Converting Between Host and Network Addresses Memory-Mapped I/O Functions Anonymous Pipe Function Polling Functions Pollable Events Manipulating Layers Functions that Operate on Pathnames A file or directory in a file system is specified by its pathname. NSPR uses Unix-style pathnames, which are null-terminated character strings. Only the ASCII character set is sup
ported. The forward slash (/) separates the directories in a pathname. NSPR converts the slashes in a pathname to the directory separator of the native OS--for example, backslash (\) on Windows and colon (:) on Mac OS--before passing it to the native system calls. Some file systems also differentiate drives or volumes. PR_Open PR_Delete PR_GetFileInfo PR_GetFileInfo64 PR_Rename PR_Access ...
...a socket API modeled after the popular Berkeley sockets. Differences include the following: The blocking socket functions in NSPR take a timeout parameter. Two new functions, PR_TransmitFile and PR_AcceptRead, can exploit the new system calls of some operating systems for higher performance. ...
...ctions of a file to be mapped to memory regions, allowing read-write accesses to the file to be accomplished by normal memory accesses. Memory-mapped I/O functions are currently implemented for Unix, Linux, Mac OS X, and Win32 only. PR_CreateFileMap PR_MemMap PR_MemUnmap PR_CloseFileMap Anonymous Pipe Function PR_CreatePipe Polling Functions This section describes two of the most im
portant polling functions provided by NSPR: PR_Poll PR_GetConnectStatus Pollable Events A pollable event is a special kind of file descriptor. The only I/O operation you can perform on a pollable event is to poll it with the PR_POLL_READ flag. You cannot read from or write to a pollable event. The purpose of a pollable event is to combine event waiting with I/O waiting in a single PR_Poll ca...
PRNetAddr
Type used with Socket Manipulation Functions to specify a network address. Syntax #include <prio.h> union PRNetAddr { struct { PRUint16 family; char data[14]; } raw; struct { PRUint16 family; PRUint16
port; PRUint32 ip; char pad[8]; } inet; #if defined(_PR_INET6) struct { PRUint16 family; PRUint16
port; PRUint32 flowinfo; PRIPv6Addr ip; } ipv6; #endif /* defined(_PR_INET6) */ }; typedef union PRNetAddr PRNetAddr; Fields The structure has the following fields: family Address family: PR_AF_INET|PR_AF_INET6 for raw.family, PR_AF_INET for inet.family, PR_AF_INET6 for ipv6.family. data Raw address data.
port Port number of TCP or UDP, in network byte order. ip The actual 32 (for inet.ip) or 128 (for ipv6.ip) bits of IP ...
...F_INET6 for raw.family, PR_AF_INET for inet.family, PR_AF_INET6 for ipv6.family. data Raw address data.
port Port number of TCP or UDP, in network byte order. ip The actual 32 (for inet.ip) or 128 (for ipv6.ip) bits of IP address. The inet.ip field is in network byte order. pad Unused. flowinfo Routing information. Description The union PRNetAddr represents a network address. NSPR sup
ports only the Internet address family. By default, NSPR is built to sup
port only IPv4, but it's possible to build the NSPR library to sup
port both IPv4 and IPv6. Therefore, the family field can be PR_AF_INET only for default NSPR, and can also be PR_AF_INET6 if the binary sup
ports IPv6. PRNetAddr is binary-compatible with the socket address structures in the familiar Berkeley socket interface, altho...
...(Note that PRNetAddr does not have the length field that is present in struct sockaddr_in on some Unix platforms.) The macros PR_AF_INET, PR_AF_INET6, PR_INADDR_ANY, PR_INADDR_LOOPBACK are defined if prio.h is included. ...
PR_InitializeNetAddr
Initializes or reinitializes a network address. The storage for the network address structure is allocated by, and remains the responsibility of, the calling client. Syntax #include <prnetdb.h> PRStatus PR_InitializeNetAddr( PRNetAddrValue val, PRUint16
port, PRNetAddr *addr); Parameters The function has the following parameters: val The value to be assigned to the IP Address
portion of the network address. This must be PR_IpAddrNull, PR_IpAddrAny, or PR_IpAddrLoopback.
port The
port number to be assigned in the network address structure. The value is specified in host byte order. addr A pointer to the PRNetAddr structure to be manipulated. Returns The function returns one of the following values: If successful, PR_SUCCESS. If unsuccessful, PR_FAILURE. This may occu...
...ipulated. Returns The function returns one of the following values: If successful, PR_SUCCESS. If unsuccessful, PR_FAILURE. This may occur, for example, if the value of val is not within the ranges defined by PRNetAddrValue. You can retrieve the reason for the failure by calling PR_GetError. Description PR_InitializeNetAddr allows the assignment of special network address values and the
port number, while also setting the state that indicates the version of the address being used. The special network address values are identified by the enum PRNetAddrValue: typedef enum PRNetAddrValue{ PR_IpAddrNull, PR_IpAddrAny, PR_IpAddrLoopback } PRNetAddrValue; The enum has the following enumerators: PR_IpAddrNull Do not overwrite the IP address. This allows the caller to change th...
... setting the state that indicates the version of the address being used. The special network address values are identified by the enum PRNetAddrValue: typedef enum PRNetAddrValue{ PR_IpAddrNull, PR_IpAddrAny, PR_IpAddrLoopback } PRNetAddrValue; The enum has the following enumerators: PR_IpAddrNull Do not overwrite the IP address. This allows the caller to change the network address'
port number assignment without affecting the host address. PR_IpAddrAny Assign logical PR_INADDR_ANY to IP address. This wildcard value is typically used to establish a socket on which to listen for incoming connection requests. PR_IpAddrLoopback Assign logical PR_INADDR_LOOPBACK. A client can use this value to connect to itself without knowing the host's network address. ...
HTTP delegation
RI and data to be sent, and returns the result data. But there is no such simple interface. The API should allow NSS to use the HTTP client either asynchronously or synchronously. In addition, during an application session with OCSP enabled, a large number of OCSP requests might have to be sent. Therefore the API should allow for keep-alive (persistent) HTTP connections. HTTP URIs consist of host:
port and a path, e.g. http://ocsp.provider.com:80/cgi-bin/ocsp-responder If NSS needs to access a HTTP server, it will request that an "http server session object" be created (SEC_HttpServer_CreateSessionFcn). The http server session object is logically associated with host and
port destination information, in our example this is "host ocsp.provider.com
port 80". The object may be used by the applicat...
...Should the application be unable to keep a physical connection alive all the time, the application is expected to create new connections automatically. ...
...work connection keep alive" function (SEC_HttpServer_KeepAliveSessionFcn) on the server session object, giving application code a chance to do whatever is required. For each individual HTTP request, NSS will request the creation of a "http request object" (SEC_HttpRequest_CreateFcn). No full URI is provided as a parameter. Instead, the parameters are a server session object (that carries host and
port information already) and the request path. In our example the path is "/cgi-bin/ocsp-responder". (When issueing GET requests, the "?query-string=data"
portion should already be appended to the request path) After creation, NSS might call functions to provide additional details of the HTTP request (e.g. SEC_HttpRequest_SetPostDataFcn). The application is expected to collect the details for later u...
HTTP delegation
RI and data to be sent, and returns the result data. But there is no such simple interface. The API should allow NSS to use the HTTP client either asynchronously or synchronously. In addition, during an application session with OCSP enabled, a large number of OCSP requests might have to be sent. Therefore the API should allow for keep-alive (persistent) HTTP connections. HTTP URIs consist of host:
port and a path, e.g. http://ocsp.provider.com:80/cgi-bin/ocsp-responder If NSS needs to access a HTTP server, it will request that an "http server session object" be created (SEC_HttpServer_CreateSessionFcn). The http server session object is logically associated with host and
port destination information, in our example this is "host ocsp.provider.com
port 80". The object may be used by the applicat...
...Should the application be unable to keep a physical connection alive all the time, the application is expected to create new connections automatically. ...
...work connection keep alive" function (SEC_HttpServer_KeepAliveSessionFcn) on the server session object, giving application code a chance to do whatever is required. For each individual HTTP request, NSS will request the creation of a "http request object" (SEC_HttpRequest_CreateFcn). No full URI is provided as a parameter. Instead, the parameters are a server session object (that carries host and
port information already) and the request path. In our example the path is "/cgi-bin/ocsp-responder". (When issuing GET requests, the "?query-string=data"
portion should already be appended to the request path) After creation, NSS might call functions to provide additional details of the HTTP request (e.g. SEC_HttpRequest_SetPostDataFcn). The application is expected to collect the details for later us...
4.3.1 Release Notes
New in JSS 4.3.1 A list of bug fixes and enhancement requests were implemented in this release can be obtained by running this bugzilla query JSS 4.3.1 requires NSS 3.12.5 or higher. SSL3 & TLS Renegotiation Vulnerability See CVE-2009-3555 and US-CERT VU#120541 for more information about this security vulnerability. ...
...ool) at http://mxr.mozilla.org/mozilla/source/security/jss/ The RUN TIME behavior of JSS can be affected by the NSS Environment Variables. Platform Information You can check out the source from CVS by cvs co -r JSS_4_3_1_RTM JSS JSS 4.3.1 works with JDK versions 4 or higher we suggest the latest. JSS 4.3.1 requires NSS 3.12.5 or higher. JSS 4.3.1 requires NSPR 4.7.1 or higher. JSS only sup
ports the native threading model (no green threads). Known Bugs and Issues For a list of re
ported bugs that have not yet been fixed, click here. Note that some bugs may have been fixed since JSS 4.3.1 was released. Compatibility JSS 4.3.1 is backwards compatible with JSS 4.2. Applications compiled against JSS 4.2 will work with JSS 4.3.1. The 4.3.1 version of libjss4.so/jss4.dll must only be used...
... The 4.3.1 version of libjss4.so/jss4.dll must only be used with jss4.jar. In general, a JSS JAR file must be used with the JSS shared library from the exact same release. To obtain the version info from the jar file use, "System.out.println(org.mozilla.jss.CryptoManager.JAR_JSS_VERSION)" and to check the shared library: strings libjss4.so | grep -i header Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla. You can also give feedback directly to the developers on the Mozilla Cryptography forums... Mailing list Newsgroup RSS feed ...
Build instructions for JSS 4.3.x
Instructions for JSS 4.3.x Newsgroup: mozilla.dev.tech.crypto Before building JSS, you need to set up your system as follows: Build NSPR/NSS by following the NSPR/NSS build instructions, To check that NSS built correctly, run all.sh (in mozilla/security/nss/tests) and examine the results (in mozilla/test_results/security/computername.#/results.html. Install a Java compiler and runtime. JSS sup
ports Java version 1.5 or later. We suggest you use the latest. You must have Perl version 5.005 or later. Now you are ready to build JSS. Follow these steps: Switch to the appropriate directory and check out JSS from the root of your source tree. cvs co -r JSS_4_3_1_RTM mozilla/security/jss or cvs co -r JSS_4_3_RTM mozilla/security/jss Setup environment variables needed for compiling ...
...nstallation. Note, on Windows platforms it is best to have JAVA_HOME set to a directory path that doest not have spaces. Unix setenv JAVA_HOME /usr/local/jdk1.5.0 (or wherever your JDK is installed) Windows set JAVA_HOME=c:\programs\jdk1.5.0 (or wherever your JDK is installed) Windows (Cygnus) JAVA_HOME=/cygdrive/c/programs/jdk1.5.0 (or wherever your JDK is installed) ex
port JAVA_HOME Windows build Configurations WINNT vs WIN95 As of NSS 3.15.4, NSPR/NSS/JSS build generates a "WIN95" configuration by default on Windows. We recommend most applications use the "WIN95" configuration. If you want JSS to be used with your applet and the Firefox browser than you must build WIN95. (See JSS FAQ) The "WIN95" configuration sup
ports all versions of Windows. The "WIN...
...Please see HOWTO_successfully_compile_JSS_and_NSS_for_32_and_64_bits_on_OSX_10.6_(10.6.7) for contributed instructions. Build JSS. ...
JSS
OR -- git clone https://github.com/dogtagpki/jss.git All future upstream enquiries to JSS should now use the Pagure Issue Tracker system: https://pagure.io/jss/issues Documentation regarding the JSS project should now be viewed at: http://www.dogtagpki.org/wiki/JSS NOTE: As much of the JSS documentation is sorely out-of-date, updated information will be a work in progress, and many
portions of any legacy documentation will be re-written over the course of time. Stay tuned! Legacy JSS information can still be found at: SOURCE: https://hg.mozilla.org/projects/jss ISSUES: https://bugzilla.mozilla.org/buglist.cgi?product=JSS WIKI: /docs/Mozilla/Projects/NSS/JSS Network Security Services for Java (JSS) is a Java interface to NSS. JSS sup
ports most of the security ...
...re-written over the course of time. Stay tuned! Legacy JSS information can still be found at: SOURCE: https://hg.mozilla.org/projects/jss ISSUES: https://bugzilla.mozilla.org/buglist.cgi?product=JSS WIKI: /docs/Mozilla/Projects/NSS/JSS Network Security Services for Java (JSS) is a Java interface to NSS. JSS sup
ports most of the security standards and encryption technologies sup
ported by NSS. JSS also provides a pure Java interface for ASN.1 types and BER/DER encoding. JSS offers a implementation of Java SSL sockets that uses NSS's SSL/TLS implementation rather than Sun's JSSE implementation. You might want to use JSS's own SSL classes if you want to use some of the capabilities found in NSS's SSL/TLS library but not found in JSSE. NSS is the cryptographic module where all...
... Documentation Before you use JSS, you should have a good understanding of the crypto technologies it uses. You might want to read these documents: Introduction to Public-Key Cryptography. Explains the basic concepts of public-key cryptography that underlie NSS and JSS. Introduction to SSL. Introduces the SSL protocol, including information about cryptographic ciphers sup
ported by SSL and the steps involved in the SSL handshake. For information on downloading NSS releases, see NSS sources building testing. Read Using JSS to get you started with development after you've built and downloaded it. Release Notes 4.3.1 Release Notes 4.3 Release Notes Older Release Notes Build Instructions Building JSS 4.4.x ...
JSS 4.4.0 Release Notes
Introduction The Java Security Services (JSS) team has released JSS 4.4.0, which is a minor release. Distribution information The hg tag is JSS_4_4_20170313. JSS 4.4.0 requires Netswork Security Services (NSS) 3.29.1 and Netscape
Portable Runtime (NSPR) 4.13.1 or newer. JSS 4.4.0 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/jss/releases/JSS_4_4_0_RTM/src/ New in JSS 4.40 New Functionality New Functions New Macros Notable Changes in JSS 4.40 Picks up work done downstream for Fedora and RHEL and used by various Linux distributions with includes:. Sup
port for IPv6. Sup
port for TLS v1.1 and TLS v1.2 via NSS though JSS. Bugs fixed in JSS 4.4.0 This Bugzilla query return...
...ADME Platform Information You can check out the source from mercurial via hg clone -r 055aa3ce8a61 https://hg.mozilla.org/projects/jss JSS 4.4.0 works with OpenJDK versions 1.7 or higher we suggest the latest - OpenJDK 1.8. JSS 4.4.0 requires NSS 3.12.5 or higher though NSS 3.28.3 is recommended. JSS 4.3.1 requires NSPR 4.7.1 or higher though NSPR 3.13 is recommended. JSS only sup
ports the native threading model (no green threads). Compatibility JSS 3.30 shared libraries are not backward compatible with all older JSS 4.3.2 shared libraries. A program linked with older jSS 4.3.2 shared libraries will not work with JSS 4.4.0 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of jSS APIs to the functions listed in JSS Public Fu...
...with all older JSS 4.3.2 shared libraries. A program linked with older jSS 4.3.2 shared libraries will not work with JSS 4.4.0 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of jSS APIs to the functions listed in JSS Public Functions will remain compatible with future versions of the JSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product JSS). ...
NSS_3.11.10_release_notes.html
tions are in https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.7.1/. Bugs Fixed The following bugs have been fixed in NSS 3.11.10. Bug 291384: certutil -K behavior doesn't match usage Bug 374247: modutil -disable command not disabling modules' slots Bug 384459: Certification path validation fails when Authority Key Identifier extension contains key identifier Bug 385946: Can't im
port certificate into cert database in FIPS mode (certutil). Bug 387892: Add Entrust root CA certificate(s) to NSS Bug 396999: PK11_Authenticate Bug 397478: Lock from ssl_InitSymWrapKeysLock not freed on selfserv shutdown. Bug 397486: Session cache locks not freed on strsclnt shutdown. Bug 398680: assertion botch in ssl3_RegisterServerHelloExtensionSender doing second handshake with SSL_Forc...
... Bug 397478: Lock from ssl_InitSymWrapKeysLock not freed on selfserv shutdown. Bug 397486: Session cache locks not freed on strsclnt shutdown. ...
...ible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.11.10 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with mozilla.org Bugzilla (product NSS). ...
NSS 3.15.2 release notes
ozilla.org/security/nss/releases/NSS_3_15_2_RTM/src/ Security Advisories The following security-relevant bugs have been resolved in NSS 3.15.2. Users are encouraged to upgrade immediately. Bug 894370 - (CVE-2013-1739) Avoid uninitialized data read in the event of a decryption failure. New in NSS 3.15.2 New Functionality AES-GCM Ciphersuites: AES-GCM cipher suite (RFC 5288 and RFC 5289) sup
port has been added when TLS 1.2 is negotiated. Specifically, the following cipher suites are now sup
ported: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 TLS_RSA_WITH_AES_128_GCM_SHA256 New Functions PK11_CipherFinal has been introduced, which is a simple alias for PK11_DigestFinal. New Types No ...
...256 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 TLS_RSA_WITH_AES_128_GCM_SHA256 New Functions PK11_CipherFinal has been introduced, which is a simple alias for PK11_DigestFinal. New Types No new types have been introduced. New PKCS #11 Mechanisms No new PKCS#11 mechanisms have been introduced Notable Changes in NSS 3.15.2 Bug 880543 - Sup
port for AES-GCM ciphersuites that use the SHA-256 PRF Bug 663313 - MD2, MD4, and MD5 signatures are no longer accepted for OCSP or CRLs, consistent with their handling for general certificate signatures. Bug 884178 - Add PK11_CipherFinal macro Bugs fixed in NSS 3.15.2 Bug 734007 - sizeof() used incorrectly Bug 900971 - nssutil_ReadSecmodDB() leaks memory Bug 681839 - Allow SSL_HandshakeNe...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.15.2 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.15 release notes
released Network Security Services (NSS) 3.15, which is a minor release. Distribution Information The HG tag is NSS_3_15_RTM. NSS 3.15 requires NSPR 4.10 or newer. ...
..._15_RTM/src/ New in NSS 3.15 New Functionality Sup
port for OCSP Stapling (RFC 6066, Certificate Status Request) has been added for both client and server sockets. TLS client applications may enable this via a call to SSL_OptionSetDefault(SSL_ENABLE_OCSP_STAPLING, PR_TRUE); Added function SECITEM_ReallocItemV2. It replaces function SECITEM_ReallocItem, which is now declared as obsolete. Sup
port for single-operation (eg: not multi-part) symmetric key encryption and decryption, via PK11_Encrypt and PK11_Decrypt. certutil has been updated to sup
port creating name constraints extensions. New Functions in ssl.h SSL_PeerStapledOCSPResponse - Returns the server's stapled OCSP response, when used with a TLS client socket that negotiated the status_request extension. SSL_S...
...efault handler should add appropriate calls to SSL_PeerStapledOCSPResponse and CERT_CacheOCSPResponseFromSideChannel. Bug 554369: Fixed correctness of CERT_CacheOCSPResponseFromSideChannel and other OCSP caching behaviour. Bug 853285: Fixed bugs in AES GCM. Bug 341127: Fix the invalid read in rc4_wordconv. Faster NIST curve P-256 implementation. Dropped (32-bit) SPARC V8 processor sup
port on Solaris. The shared library libfreebl_32int_3.so is no longer produced. Bugs fixed in NSS 3.15 This Bugzilla query returns all the bugs fixed in NSS 3.15: https://bugzilla.mozilla.org/buglist.cgi?list_id=6278317&resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.15 ...
NSS 3.16.2.1 release notes
een resolved in NSS 3.16.2.1. Users are encouraged to upgrade immediately. Bug 1064636 - (CVE-2014-1568) RSA Signature Forgery in NSS. See also MFSA 2014-73 for details. New in NSS 3.16.2.1 New Functionality No new functionality is introduced in this release. This is a patch release to fix a bug that caused NSS to accept forged RSA signatures. A new symbol, _SGN_VerifyPKCS1DigestInfo is ex
ported in this release. As with all ex
ported NSS symbols that have a leading underscore '_', this is an internal symbol for NSS use only. Applications that use or depend on these symbols can and will break in future NSS releases. Bugs fixed in NSS 3.16.2.1 Bug 1064636 - (CVE-2014-1568) RSA Signature Forgery in NSS Acknowledgements The NSS development team would like to thank Antoine Delignat-La...
...or depend on these symbols can and will break in future NSS releases. Bugs fixed in NSS 3.16.2.1 Bug 1064636 - (CVE-2014-1568) RSA Signature Forgery in NSS Acknowledgements The NSS development team would like to thank Antoine Delignat-Lavaud, security researcher at Inria Paris in team Prosecco, and the Advanced Threat Research team at Intel Security, who both independently discovered and re
ported this issue, for responsibly disclosing the issue by providing advance copies of their research. Compatibility NSS 3.16.2.1 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.2.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS A...
...ible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.2.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.16.5 release notes
ve been resolved in NSS 3.16.5. Users are encouraged to upgrade immediately. Bug 1064636 - (CVE-2014-1568) RSA Signature Forgery in NSS. See also MFSA 2014-73 for details. New in NSS 3.16.5 New Functionality No new functionality is introduced in this release. This is a patch release to fix a bug that caused NSS to accept forged RSA signatures. A new symbol, _SGN_VerifyPKCS1DigestInfo is ex
ported in this release. As with all ex
ported NSS symbols that have a leading underscore '_', this is an internal symbol for NSS use only. Applications that use or depend on these symbols can and will break in future NSS releases. Bugs fixed in NSS 3.16.5 Bug 1064636 - (CVE-2014-1568) RSA Signature Forgery in NSS Acknowledgements The NSS development team would like to thank Antoine Delignat-Lava...
...e or depend on these symbols can and will break in future NSS releases. Bugs fixed in NSS 3.16.5 Bug 1064636 - (CVE-2014-1568) RSA Signature Forgery in NSS Acknowledgements The NSS development team would like to thank Antoine Delignat-Lavaud, security researcher at Inria Paris in team Prosecco, and the Advanced Threat Research team at Intel Security, who both independently discovered and re
ported this issue, for responsibly disclosing the issue by providing advance copies of their research. Compatibility NSS 3.16.5 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.5 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.5 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.18 release notes
Network Security Services (NSS) 3.18, which is a minor release. Distribution Information The HG tag is NSS_3_18_RTM. NSS 3.18 requires NSPR 4.10.8 or newer. NSS 3.18 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_18_RTM/src/ New in NSS 3.18 New Functionality When im
porting certificates and keys from a PKCS#12 source, it's now possible to override the nicknames, prior to im
porting them into the NSS database, using new API SEC_PKCS12DecoderRenameCertNicknames. The tstclnt test utility program has new command-line options -C, -D, -b and -R. Use -C one, two or three times to print information about the certificates received from a server, and information about th...
... SEC_CheckCrlTimes - Check the validity of a CRL at the given time. SEC_GetCrlTimes - Extract the validity times from a CRL. in p12.h SEC_PKCS12DecoderRenameCertNicknames - call an application provided callback for each certificate found in a SEC_PKCS12DecoderContext. in pk11pub.h __PK11_SetCertificateNickname - this is an internal symbol for NSS use only, as with all ex
ported NSS symbols that have a leading underscore '_'. Applications that use or depend on these symbols can and will break in future NSS releases. New Types in p12.h SEC_PKCS12NicknameRenameCallback - a function pointer definition. An application that uses SEC_PKCS12DecoderRenameCertNicknames must implement a callback function that implements this function interface. Notable Ch...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.18 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.23 release notes
is a minor release. Distribution Information The HG tag is NSS_3_23_RTM. NSS 3.23 requires NSPR 4.12 or newer. NSS 3.23 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_23_RTM/src/ New in NSS 3.23 New Functionality ChaCha20/Poly1305 cipher and TLS cipher suites now sup
ported (bug 917571, bug 1227905) Experimental-only sup
port TLS 1.3 1-RTT mode (draft-11). This code is not ready for production use. New Functions in ssl.h SSL_SetDowngradeCheckVersion - Set maximum version for new ServerRandom anti-downgrade mechanism. Clients that perform a version downgrade (which is a dangerous practice) call this with the highest version number that they possibl...
... This gives them access to the version downgrade protection from TLS 1.3. ...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.23 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.28.3 release notes
Introduction Network Security Services (NSS) 3.28.3 is a patch release for NSS 3.28. The bug fixes in NSS 3.28.3 are described in the "Bugs Fixed" section below. Distribution Information The HG tag is NSS_3_28_3_RTM. NSS 3.28.3 requires Netscape
Portable Runtime (NSPR) 4.13.1 or newer. NSS 3.28.3 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_28_3_RTM/src/ New in NSS 3.28.3 New Functionality No new functionality is introduced in this release. This is a patch release to fix binary compatibility issues. Bugs fixed in NSS 3.28.3 NSS version 3.28, 3.28.1 and 3.28.2 contained changes that were in violation with the NSS compatibility promise. ECParams, which is part of t...
... ...
... ...
NSS 3.29.1 release notes
Introduction Network Security Services (NSS) 3.29.1 is a patch release for NSS 3.29. The bug fixes in NSS 3.29.1 are described in the "Bugs Fixed" section below. Distribution Information The HG tag is NSS_3_29_1_RTM. NSS 3.29.1 requires Netscape
Portable Runtime (NSPR) 4.13.1 or newer. NSS 3.29.1 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_29_1_RTM/src/ New in NSS 3.29.1 New Functionality No new functionality is introduced in this release. This is a patch release to fix binary compatibility issues. Bugs fixed in NSS 3.29.1 NSS version 3.28, 3.28.1, 3.28.2 and 3.29 contained changes that were in violation with the NSS compatibility promise. ECParams, which is par...
... ...
...Functions will remain compatible with future versions of the NSS shared libraries. If you had compiled your application against header files of NSS 3.28, NSS 3.28.1, NSS 3.28.2 or NSS 3.29, it it recommended that you recompile your application against NSS 3.29.1 (or NSS 3.28.3), at the time you upgrade to NSS 3.29.1 (or NSS 3.28.3). Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.34 release notes
Introduction The Network Security Services (NSS) team has released NSS 3.34, which is a minor release. Distribution information The hg tag is NSS_3_34_RTM. NSS 3.34 requires Netscape
Portable Runtime (NSPR) 4.17, or newer. NSS 3.34 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_34_RTM/src/ Notable Changes in NSS 3.34 The following CA certificates were Added: CN = GDCA TrustAUTH R5 ROOT SHA-256 Fingerprint: BF:FF:8F:D0:44:33:48:7D:6A:8A:A6:0C:1A:29:76:7A:9F:C2:BB:B0:5E:42:0F:71:3A:13:B9:92:89:1D:38:93 Trust Flags: Websites CN = SSL.com Root Certification Authority RSA SHA-256 Fingerprint: 85:66:6A:56:2E:E0:BE:5C:...
...s. New in NSS 3.34 New Functionality When listing an NSS database. using certutil -L, and the database hasn't yet been initialized with any non-empty or empty password, the text "Database needs user init" will be included in the listing. When using certutil, to set an inacceptable password in FIPS mode, a correct explanation of acceptable passwords will be printed. SSLKEYLOGFILE is now sup
ported with TLS 1.3, see Bug 1287711 for details. SSLChannelInfo has two new fields (Bug 1396525) SSLNamedGroup originalKeaGroup holds the key exchange group of the original handshake, when the session was resumed. PRBool resumed is PR_TRUE when the session is resumed, and PR_FALSE otherwise. RSA-PSS signatures are now sup
ported on certificates. Certificates with RSA-PSS or RSA-PKCS#1...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.34 shared libraries, without recompiling, or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (select product 'NSS'). ...
NSS 3.37 release notes
e on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_37_RTM/src/ Notable Changes in NSS 3.37 The TLS 1.3 implementation was updated to Draft 28. An issue where NSS erroneously accepted HRR requests was resolved. This issue was found by OSS fuzz. Added HACL* Poly1305 32-bit The code to sup
port the NPN protocol, which had already been disabled in a previous release, has been fully removed. NSS allows servers now to register ALPN handling callbacks to select a protocol. NSS sup
ports opening SQL databases in read-only mode. NSS now requires the SQLite APIs of version 3.5.0 or newer. Starting with NSS version 3.31, an alternative implementation for RNG seeding on the Linu...
...LY_DEV_URANDOM is undefined.) With NSS 3.37, this alternative implementation for Linux/Unix can be selected in "make" builds by defining the environment variable NSS_SEED_ONLY_DEV_URANDOM. With NSS 3.37, this alternative implementation for Linux has been enhanced to use the glibc function getentropy(), instead of reading from /dev/urandom directly, if the build and runtime Linux platform sup
ports it. The CA certificates list was updated to version 2.24. The following CA certificates were Removed: CN = S-TRUST Universal Root CA SHA-256 Fingerprint: D8:0F:EF:91:0A:E3:F1:04:72:3B:04:5C:EC:2D:01:9F:44:1C:E6:21:3A:DF:15:67:91:E7:0C:17:90:11:0A:31 CN = TC TrustCenter Class 3 CA II SHA-256 Fingerprint: 8D:A0:84:FC:F9:9C:E0:77:22:F8:9B:32:05:93:98:06:FA:...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.37 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.38 release notes
Network Security Services (NSS) 3.38, which is a minor release. Distribution Information The HG tag is NSS_3_38_RTM. NSS 3.38 requires NSPR 4.19 or newer. NSS 3.38 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_38_RTM/src/ New in NSS 3.38 New Functionality Added sup
port for the TLS Record Size Limit Extension. When creating a certificate request (CSR) using certutil -R, an existing orphan private key can be reused. Parameter -k may be used to specify the ID of an existing orphan key. The available orphan key IDs can be displayed using command certutil -K. When using certutil -O to print the chain for a given certificate nickname, the new parameter --simple-sel...
...s in ssl.h SSL_RECORD_SIZE_LIMIT - used to control the TLS Record Size Limit Extension Notable Changes in NSS 3.38 Fixed CVE-2018-0495 in bug 1464971. Various security fixes in the ASN.1 code. NSS automatically enables caching for SQL database storage on Linux, if it is located on a network filesystem that's known to benefit from caching. When repeatedly im
porting the same certificate into an SQL database, the existing nickname will be kept. Bugs fixed in NSS 3.38 This Bugzilla query returns all the bugs fixed in NSS 3.38: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.38 Compatibility NSS 3.38 shared libraries are backward compatible with all older NSS 3.x...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.38 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.39 release notes
which is a minor release. Distribution Information The HG tag is NSS_3_39_RTM. NSS 3.39 requires NSPR 4.20 or newer. NSS 3.39 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_39_RTM/src/ New in NSS 3.39 New Functionality The tstclnt and selfserv utilities added sup
port for configuring the enabled TLS signature schemes using the -J parameter. NSS will use RSA-PSS keys to authenticate in TLS. Sup
port for these keys is disabled by default but can be enabled using SSL_SignatureSchemePrefSet(). certutil added the ability to delete an orphan private key from an NSS key database. Added the nss-policy-check utility, which can be used to check an NSS ...
... Notable Changes in NSS 3.39 The TLS 1.3 implementation uses the final version number from RFC 8446. Previous versions of NSS accepted an RSA PKCS#1 v1.5 signature where the DigestInfo structure was missing the NULL parameter. Starting with version 3.39, NSS requires the encoding to contain the NULL parameter. The tstclnt and selfserv test utilities no longer accept the -z parameter, as sup
port for TLS compression was removed in a previous NSS version. The CA certificates list was updated to version 2.26. The following CA certificates were Added: OU = GlobalSign Root CA - R6 SHA-256 Fingerprint: 2CABEAFE37D06CA22ABA7391C0033D25982952C453647349763A3AB5AD6CCF69 CN = OISTE WISeKey Global Root GC CA SHA-256 Fingerprint: 8560F91C3624DABA9570B5FEA0DBE36...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.39 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.42 release notes
elease. Distribution Information The HG tag is NSS_3_42_RTM. NSS 3.42 requires NSPR 4.20 or newer. NSS 3.42 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_42_RTM/src/ Other releases are available in NSS Releases. ...
...//ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_42_RTM/src/ Other releases are available in NSS Releases. New in NSS 3.42 New Functionality Bug 818686 - Sup
port XDG basedir specification New Functions none Notable Changes in NSS 3.42 The following CA certificates were Added: None The following CA certificates were Removed: None Added sup
port for some of the testcases from the Wycheproof project: Bug 1508666 - Added AES-GCM test cases Bug 1508673 - Added ChaCha20-Poly1305 test cases Bug 1514999 - Added the Curve25519 test cases Thanks to Jonas Allmann for adapting these tests. Bugs fixed in NSS 3.42 Bug 1490006 - Reject invalid CH.legacy_version in TLS ...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.42 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.44.1 release notes
Information The HG tag is NSS_3_44_1_RTM. NSS 3.44.1 requires NSPR 4.21 or newer. NSS 3.44.1 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_44_1_RTM/src/ Other releases are available in NSS Releases. ...
...546229 - Add IPSEC IKE sup
port to softoken Many new FIPS test cases (Note: This has increased the source archive by approximately 50 megabytes for this release.) Bugs fixed in NSS 3.44.1 1554336 - Optimize away unneeded loop in mpi.c 1515342 - More thorough input checking (CVE-2019-11729) 1540541 - Don't unnecessarily strip leading 0's from key material during PKCS11 im
port (CVE-2019-11719) 1515236 - Add a SSLKEYLOGFILE enable/disable flag at build.sh 1473806 - Fix SECKEY_ConvertToPublicKey handling of non-RSA keys 1546477 - Updates to testing for FIPS validation 1552208 - Prohibit use of RSASSA-PKCS1-v1_5 algorithms in TLS 1.3 (CVE-2019-11727) 1551041 - Unbreak build on GCC < 4.3 big-endian Compatibility NSS 3.44.1 shared librarie...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.44.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.46 release notes
t.c Bug 1512605 - Incorrect alert description after unencrypted Finished msg Bug 1564715 - Read /proc/cpuinfo when AT_HWCAP2 returns 0 Bug 1532194 - Remove or fix -DDEBUG_$USER from make builds Bug 1565577 - Visual Studio's cl.exe -? ...
... 'int' and 'unsigned long' Bug 1564714 - Print certutil commands during setup Bug 1565013 - HACL image builder times out while fetching gpg key Bug 1563786 - Update hacl-star docker image to pull specific commit Bug 1559012 - Improve GCM perfomance using PMULL2 Bug 1528666 - Correct resumption validation checks Bug 1568803 - More tests for client certificate authentication Bug 1564284 - Sup
port profile mobility across Windows and Linux Bug 1573942 - Gtest for pkcs11.txt with different breaking line formats Bug 1575968 - Add strsclnt option to enforce the use of either IPv4 or IPv6 Bug 1549847 - Fix NSS builds on iOS Bug 1485533 - Enable NSS_SSL_TESTS on taskcluster This Bugzilla query returns all the bugs fixed in NSS 3.46: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXE...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.46 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.49 release notes
ug 1594933 for details. Bugs fixed in NSS 3.49 Bug 1513586 - Set downgrade sentinel for client TLS versions lower than 1.2. ...
...64/aarch64 Bug 1585189 - NSS database uses 3DES instead of AES to encrypt DB entries Bug 1603257 - Fix UBSAN issue in softoken CKM_NSS_CHACHA20_CTR initialization Bug 1590001 - Additional HRR Tests (CVE-2019-17023) Bug 1600144 - Treat ClientHello with message_seq of 1 as a second ClientHello Bug 1603027 - Test that ESNI is regenerated after HelloRetryRequest Bug 1593167 - Intermittent mis-re
porting potential security risk SEC_ERROR_UNKNOWN_ISSUER Bug 1535787 - Fix automation/release/nss-release-helper.py on MacOS Bug 1594933 - Disable building DBM by default Bug 1562548 - Improve GCM perfomance on aarch32 This Bugzilla query returns all the bugs fixed in NSS 3.49: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&t...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.49 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.53 release notes
The NSS team would like to recognize first-time contributors: Jan-Marek Glogowski Jeff Walden Distribution Information The HG tag is NSS_3_53_RTM. NSS 3.53 requires NSPR 4.25 or newer. NSS 3.53 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_53_RTM/src/ Other releases are available in NSS Releases. ...
... Bug 1638289 - Avoid multiple definitions of SHA{256,384,512}_* symbols when linking libfreeblpriv3.so in Firefox on ppc64le Bug 1636389 - Relocate deprecated SEED algorithm Bug 1637083 - lib/ckfw: No such file or directory. Stop. ...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.53 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
Build instructions
recent information. Numerous optional features of NSS builds are controlled through make variables. gmake is GNU make, usually your Linux-distro-regular "make" binary file, unless maybe it is a BSD make. Make variables may be set on the gmake command line, e.g., gmake variable=value variable=value target1 target2 or defined in the environment, e.g. (for POSIX shells), variable=value; ex
port variable gmake target1 target2 Here are some (not all) of the make variables that affect NSS builds: BUILD_OPT: If set to 1, means do optimized non-DEBUG build. Default is DEBUG, non-optimized build. USE_DEBUG_RTL: If set to 1, on Windows, causes build with debug version of the C run-time library. NS_USE_GCC: On platforms where gcc is not the native compiler, tells NSS to build with gcc ...
... BUILD_OPT: If set to 1, means do optimized non-DEBUG build. Default is DEBUG, non-optimized build. USE_DEBUG_RTL: If set to 1, on Windows, causes build with debug version of the C run-time library. NS_USE_GCC: On platforms where gcc is not the native compiler, tells NSS to build with gcc instead of the native compiler. Default is to build with the native compiler. USE_64: On platforms that sup
port both 32-bit and 64-bit ABIs, tells NSS to build for the 64-bit ABI. Default is 32-bit ABI, except on platforms that do not sup
port a 32-bit ABI. MOZ_DEBUG_SYMBOLS: tells NSS to build with debug symbols, even in an optimized build. On windows, in both DEBUG and optimized builds, when using MSVC, tells NSS to put symbols in a .pdb file. Required to build with MSVC 8 (2005 Express). Default is not ...
...uild to get a bash shell with the PATH already configured, and execute these instructions from within that bash shell. For RHEL-5, you need to use the new assembler. You can install the new assembler as root as follows: yum install binutils220 You can then use the new assembler by adding /usr/libexec/binutils220 to the beginning of your build path. This can be done in sh or bash as follows: ex
port PATH=/usr/libexec/binutils220:$PATH The following build instructions should work for all platforms (with some platform-specific changes as noted). Build Instructions for Recent Versions (Mercurial) Clone the NSPR and NSS repositories. hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss If you want to build a releases other than the tips of these r...
NSPR functions
NSPR is a platform abstraction library that provides a cross-platform API to common OS services. NSS uses NSPR internally as the
porting layer. However, a small number of NSPR functions are required for using the certificate verification and SSL functions in NSS. These NSPR functions are listed in this section. NSPR initialization and shutdown NSPR is automatically initialized by the first NSPR function called by the application. Call PR_Cleanup to shut down NSPR and clean up its resources. PR_Cleanup Error re
porting NSS uses NSPR's thread-specific error code to re
port errors. Call PR_GetError to get the error code of the last failed NSS or NSPR function. Call PR_SetError to set the error code, which can be retrieved with PR_GetError later. The NSS functions
PORT_GetError and ...
...NSPR function called by the application. Call PR_Cleanup to shut down NSPR and clean up its resources. PR_Cleanup Error re
porting NSS uses NSPR's thread-specific error code to re
port errors. Call PR_GetError to get the error code of the last failed NSS or NSPR function. Call PR_SetError to set the error code, which can be retrieved with PR_GetError later. The NSS functions
PORT_GetError and
PORT_SetError are simply wrappers of PR_GetError and PR_SetError. PR_GetError PR_SetError Calendar time NSS certificate verification functions take a PRTime parameter that specifies the time instant at which the validity of the certificate should verified. The NSPR function PR_Now returns the current time in PRTime. PR_Now Interval time The NSPR socket I/O functions PR_Recv and PR_Send (used by t...
...owing NSPR functions allow you to create your own NSPR I/O layer and manipulate it. PR_GetUniqueIdentity PR_CreateIOLayerStub PR_GetDefaultIOMethods PR_GetIdentitiesLayer PR_GetLayersIdentity PR_PushIOLayer PR_PopIOLayer Wrapping a native file descriptor If your current TCP socket code uses the standard BSD socket API, a lighter-weight method than creating your own NSPR I/O layer is to simply im
port a native file descriptor into NSPR. This method is convenient and works for most applications. PR_Im
portTCPSocket Socket I/O functions As mentioned above, the SSL library in NSS implements the SSL protocol as an NSPR I/O layer. Users call NSPR socket I/O functions to read from, write to, and shut down an SSL connection, and to close an NSPR file descriptor. PR_Read PR_Write PR_Recv PR_Send P...
NSS tools : crlutil
take zero or more arguments. To see a usage string, issue the command without options, or with the -H option. Options and Arguments Options Options specify an action. Option arguments modify an action. The options and arguments for the crlutil command are defined as follows: -G Create new Certificate Revocation List(CRL).- -D Delete Certificate Revocation List from cert database. -I Im
port a CRL to the cert database -E Erase all CRLs of specified type from the cert database -L List existing CRL located in cert database file. -M Modify existing CRL which can be located in cert db or in arbitrary file. If located in file it should be encoded in ASN.1 encode format. -G Arguments Option arguments modify an action and are lowercase. -B Bypass CA signature checks. -P dbpref...
...-c crl-script-file is not specified, crlutil will read script data from standard input. -d directory Specify the database directory containing the certificate and key database files. On Unix the Certificate Database Tool defaults to $HOME/.netscape (that is, ~/.netscape). On Windows NT the default is the current directory. The NSS database files must reside in the same directory. -i crl-im
port-file Specify the file which contains the CRL to im
port -f password-file Specify a file that will automatically supply the password to include in a certificate or to access a certificate database. This is a plain-text file containing one password. Be sure to prevent unauthorized access to this file. -l algorithm-name Specify a specific signature algorithm. List of possible algorithms: MD2...
...The most closely-related project is Dogtag PKI, with a project wiki at [1]http://pki.fedoraproject.org/wiki/. For information specifically about NSS, th...
NSS reference
nctions documentation." PKCS #5 functions Password-based encryption SEC_PKCS5GetIV SEC_PKCS5CreateAlgorithmID SEC_PKCS5GetCryptoAlgorithm SEC_PKCS5GetKeyLength SEC_PKCS5GetPBEAlgorithm SEC_PKCS5IsAlgorithmPBEAlg PKCS #12 functions Based on "Archived PKCS #12 Functions documentation." Used to exchange data such as private keys and certificates between two parties. ...
..._PKCS5IsAlgorithmPBEAlg PKCS #12 functions Based on "Archived PKCS #12 Functions documentation." Used to exchange data such as private keys and certificates between two parties. ...
...Archived PKCS #12 Functions documentation." Used to exchange data such as private keys and certificates between two parties. ...
NSS tools : crlutil
, issue the command without options, or with the -H option. Options and Arguments Options Options specify an action. Option arguments modify an action. The options and arguments for the crlutil command are defined as follows: -G Create new Certificate Revocation List(CRL). -D Delete Certificate Revocation List from cert database. -I Im
port a CRL to the cert database -E Erase all CRLs of specified type from the cert database -L List existing CRL located in cert database file. -M Modify existing CRL which can be located in cert db or in arbitrary file. If located in file it should be encoded in ASN.1 encode format. -G Arguments Option arguments modify a...
...ript data from standard input. -d directory Specify the database directory containing the certificate and key database files. On Unix the Certificate Database Tool defaults to $HOME/.netscape (that is, ~/.netscape). On Windows NT the default is the current directory. The NSS database files must reside in the same directory. -i crl-im
port-file Specify the file which contains the CRL to im
port -f password-file Specify a file that will automatically supply the password to include in a certificate or to access a certificate database. This is a plain-text file containing one password. Be sure to prevent unauthorized access to this file. -l algorithm-name Spec...
...The most closely-related project is Dogtag PKI, with a project wiki at [1]http://pki.fedoraproject.org/wiki/. For information spe...
Tutorial: Embedding Rhino
is standard Java and not specific to Rhino. It just collects all the arguments and concatenates them together. String s = ""; for (int i=0; i < args.length; i++) { s += args[i]; } Evaluating a script The code Object result = cx.evaluateString(scope, s, "<cmd>", 1, null); uses the Context cx to evaluate a string. Evaluation of the script looks up variables in scope, and errors will be re
ported with the filename <cmd> and line number 1. Printing the result The code System.out.println(cx.toString(result)); prints the result of evaluating the script (contained in the variable result). result could be a string, JavaScript object, or other values. The toString method converts any JavaScript value to a string. Exiting the Context The code } finally { Context.exit(); } exits t...
... Counter example The Counter example is a simple host object. We'll go through it method by method below. It's easy to try out new host object classes in the shell using its buil...
... Counter example The Counter example is a simple host object. We'll go through it method by method below. It's easy to try out new host object classes in the shell using its built-in defineClass function. We'll see how to add it to RunScript later. (Note t...
Rhino scopes and contexts
Both are required to execute scripts, but they play different roles. Simple embeddings of Rhino probably won't need any of the information here, but more complicated embeddings can gain performance and flexibility from the techniques described below. Contexts The Rhino Context object is used to store thread-specific information about the execution environment. There should be one and only one Context associated with each thread that will be executing JavaScript. ...
...ncremented. Only when the counter reaches zero will it be disassociated from the thread. Remember to put the exit() call in a finally block if you're executing code that could throw an exception. Scopes A scope is a set of JavaScript objects. Execution of scripts requires a scope for top-level script variable storage as well as a place to find standard objects like Function and Object. It's im
portant to understand that a scope is independent of the Context that created it. You can create a scope using one Context and then evaluate a script using that scope and another Context (either by exiting the current context and entering another, or by executing on a different thread). You can even execute scripts on multiple threads simultaneously in the same scope. Rhino guarantees that accesses to...
...ollected until there are no active references to the shared scope potentially leading to memory leaks. In addition if a script alters some of the standard objects, the library may not work properly for other scripts. Such bugs are hard to debug and to remove a possibility for them to occur one can seal the shared scope and all its objects. A notion of a sealed object is a JavaScript extension sup
ported by Rhino and it means that properties can not be added/deleted to the object and the existing object properties can not be changed. Any attempt to modify sealed object throws an exception. To seal all objects in the standard library passtrue for the sealed argument when calling Context.initStandardObjects(ScriptableObject, boolean): ScriptableObject sealedSharedScope = cx.initStandardObjects(n...
Shumway
For even more information, please refer to the external links. ...
...oint to allow plugin-free compatibility with SWF-based games and animations. Shumway has certain limitations compared to Adobe Flash Player especially when unavoidable patents (such as those surrounding Flash DRM) get in the way. Some of its current limitations are just temporary, however. There are a few situations where a user may use Shumway to view your content: Their platform does not sup
port Adobe Flash Player. The user did not install Adobe Flash Player. The user has Adobe Flash Player disabled (or set to "click-to-enable") for performance or security reasons. There might be a time where users want to experience your content but Flash is no longer sup
ported by Adobe. To emphasize a point: the current behavior is that Shumway works on any SWF file unless (or until) the Adobe Fla...
...the inspector window. You may wish to do this before opening your SWF file. Limitations of Shumway might be encountered through testing. There are two places where Shumway bugs are tracked: GitHub (via Issues and Pull Requests) manages problems relating to Shumway, itself. Bugzilla is intended for problems with integrating Shumway into Firefox. End-users and less involved developers may re
port issues by hovering over "Shumway" within Flash content, clicking "Re
port Problems", and filling the form. Performance and compatibility issues with Flash content should be re
ported through GitHub. From the main page for Shumway at GitHub, click on "Issues" and browse the outstanding issues for similar bugs to contribute to. Click on "New Issue" to file a new entry if a duplicate is not found. Pl...
SpiderMonkey Build Documentation
ug build instead, as described below.) cd js/src # This name should end with "_OPT.OBJ" to make the version control system ignore it. mkdir build_OPT.OBJ cd build_OPT.OBJ /bin/sh ../configure.in # Use "mozmake" on Windows make A few notes about this: The most common build problems are dependency problems. See the build prerequisites page for your platform. SpiderMonkey does not sup
port building in your source directory. You must configure and build in a separate build directory, as shown above. Note: If you are on Mac and getting an error similar to "checking whether the C compiler (gcc-4.2 ) works... no configure: error: installation or configuration problem: C compiler cannot create executables." You can try configuring like so: CC=clang CXX=clang++ ../configure I...
...lowing will pass the -g3 flag to the compiler, causing it to emit debug information about macros. Then you can use those macros in gdb commands: $ CXXFLAGS=-g3 $SRC/configure ... checking whether the C++ compiler (c++ -g3 ) works... yes ... $ Cross-compiling options For cross-compiling you will need a cross-compiling compiler. That tends to be easier with clang as clang has cross-compiling sup
port built in. You may need other libraries though. For example on debian linux you'll need the following to cross compile from x86_64 to x86. apt install clang libstdc++-8-dev-i386-cross binutils-i686-gnu zlib1g-dev:i386 You'll also need rust, in addition to having normal rust set up you'll need to add another target to your existing rust toolchain (don't add a new toolchain spidermonkey will use ...
...n configure. Building your application While "How to build your complete application" is clearly out of scope for this document, here are some tips that will help get you on your way: The SpiderMonkey developers frequently and deliberately change the JSAPI ABI. You cannot use headers built for one version/configuration of JSAPI to create object files which will be linked against another. Sup
port for JS_THREADSAFE was recently removed, and threadsafe builds are now enabled by default. The js-config script, described below, is the recommended way to determine correct include paths, required libraries, etc. for your embedding to use during compilation. We highly recommend calling the js-config script from your embedding's makefile to set your CFLAGS, LDFLAGS, and so forth. To install Spid...
Property cache
scribed by this property cache entry has been shadowed. The two shadowing guarantees ensure that if this happens, the shape of pobj changes, invalidating the entry. Setting. For JOF_SET instructions, this makes two additional guarantees: first, vword.isSprop(); second, the correct behavior is to set the property described by vword.toSprop(), rather than to shadow it with a new own property. Tele
portation. The JIT handles situations where scopeIndex != 0 or protoIndex > 1 specially. It walks the scope chain and prototype chain as described above only once, at compile time, and emits code containing the pointer to the object that contains the property. The emitted code guards on the identity of the object to search. Then it guards on the shape of the object containing the property. If both gua...
...Index > 1 specially. It walks the scope chain and prototype chain as described above only once, at compile time, and emits code containing the pointer to the object that contains the property. The emitted code guards on the identity of the object to search. Then it guards on the shape of the object containing the property. If both guards pass, there is no need to walk the chain. The JIT code "tele
ports" directly to the appropriate object. Adding cache entries {.kpc=pc, .kshape=kshape, .vshape()=vshape, .scopeIndex()=0, .protoIndex()=0, .vword=vword} where kshape != vshape This type of entry is only created for JSOP_SETPROP and JSOP_SETNAME instructions that create a new property. When the operand to the instruction at pc is an object obj with shape kshape,...
...operty has a stub getter and has a slot (i.e. it is not JSPROP_SHARED). The slot index is vword.toSlot(). vword.isObject() The property has a stub getter and its value is vword.toObject(). This special kind of entry is used only for JOF_CALL instructions and only when the result is a Function. It helps the JIT avoid extra loads and guards when calling methods. Branded scopes exist to sup
port this case. When a property cache entry of this type is created, the scope of the object that contains the property is branded. The "branded scope guarantee" documented above ensures that any changes to function-valued own properties of that object will bump its shape, conservatively invalidating all property cache entries of this type for that object (and JIT code that might inline a call to the ...
JS::CreateError
This article covers features introduced in SpiderMonkey 38 Create an Error object. Syntax // Added in SpiderMonkey 45 bool JS::CreateError(JSContext *cx, JSExnType type, HandleObject stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, JSErrorRe
port *re
port, HandleString message, MutableHandleValue rval); // Obsolete since JSAPI 39 bool JS::CreateError(JSContext *cx, JSExnType type, HandleString stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, JSErrorRe
port *re
port, HandleString message, MutableHandleValue rval); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS...
...ntext. type JSExnType The exception's type. stack JS::HandleString or JS::HandleObject The value of Error.prototype.stack. fileName JS::HandleString The value of Error.prototype.fileName. lineNumber uint32_t The value of Error.prototype.lineNumber. columnNumber uint32_t The value of Error.prototype.columnNumber. re
port JSErrorRe
port * A pointer to JSErrorRe
port instance. message JS::HandleString The value of Error.prototype.message. rval JS::MutableHandleValue Out parameter. Receives the created error object. Description JS::CreateError creates an Error object with specified properties. If successful, JS::CreateError stores the created error object to *rval and retur...
... rval JS::MutableHandleValue Out parameter. Receives the created error object. ...
JSNative
e Added in SpiderMonkey 17. (This structure is now provided in "js/CallArgs.h" Added in SpiderMonkey 24 as well as through "jsapi.h".) This structure encapsulates access to the callee function, this, the function call's arguments, and the eventual return value. On success, the callback must set JS::CallArgs::rval() or call JS_SET_RVAL (at least once) and return true. Otherwise it should either re
port an error (using e.g. JS_Re
portError or JS_Re
portOutOfMemory) or raise an exception (using JS_SetPendingException), and the callback must return false. (Returning false without re
porting an error or raising an exception terminates the script with an uncatchable error. This has limited use cases; it's used to implement Firefox's "slow script" dialog, for example.) When a JSNative is called, no JS...
...me is generated. ...
... This causes the function not to appear on the stack in JavaScript debuggers. It also means that applications that implement JSCheckAccessOp or JSCheckAccessIdOp in terms of APIs such as JS_FrameIterator and JS_StackFramePrincipals, must take extra care, as the native function's principals will be missing from the stack. See Also MXR ID Search for JSNative JS::CallArgs JS_Re
portError JS_Re
portOutOfMemory JS_SetPendingException ...
JS_AliasElement
int Alias number to assign to the element. Description JS_AliasElement assigns an alternate index number for an element or numeric property associated with a native object. obj is the object to which the element belongs. name is the element's current index in the object, and alias is the alternate index to assign to the element. This feature is deprecated, meaning that it is currently sup
ported only for backward compatibility with existing applications. Future versions of the engine may no longer sup
port this function. An alias does not replace an element's current index number; it supplements it, providing a second way to reference the element. If the alias is successfully created and associated with the property, JS_AliasElement returns JS_TRUE. Adding an alias element does not chan...
...Once you create an alias, you can reassign it to other elements as needed. Aliases can also be deleted. Deleting an alias does not delete the element to which it refers. ...
...Once you create an alias, you can reassign it to other elements as needed. Aliases can also be deleted. ...
Parser API
d that includes latest ECMAScript features and is backward-compatible with SpiderMonkey format. Example: > var expr = Reflect.parse("obj.foo + 42").body[0].expression > expr.left.property ({loc:null, type:"Identifier", name:"foo"}) > expr.right ({loc:{source:null, start:{line:1, column:10}, end:{line:1, column:12}}, type:"Literal", value:42}) It is also available since Firefox 7; it can be im
ported into the global object via: Components.utils.im
port("resource://gre/modules/reflect.jsm") or into a specified object via: Components.utils.im
port("resource://gre/modules/reflect.jsm", obj) Built-in objects Whether in SpiderMonkey shell or Firefox (after im
porting), the global singleton object Reflect currently contains just the parse method. Properties of the Reflect object The Reflect...
...atement. interface LetStatement <: Statement { type: "LetStatement"; head: [ VariableDeclarator ]; body: Statement; } A let statement. Note: The let statement form is SpiderMonkey-specific. interface DebuggerStatement <: Statement { type: "DebuggerStatement"; } A debugger statement. Note: The debugger statement is new in ECMAScript 5th edition, although SpiderMonkey has sup
ported it for years. Declarations interface Declaration <: Statement { } Any declaration node. Note that declarations are considered statements; this is because declarations can appear in any statement context in the language recognized by the SpiderMonkey parser. Note: Declarations in arbitrary nested scopes are SpiderMonkey-specific. interface FunctionDeclaration <: Function, Declaration { ...
... enum LogicalOperator { "||" | "&&" } A logical operator token. enum AssignmentOperator { "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" } An assignment operator token. enum UpdateOperator { "++" | "--" } An update (increment or decrement) operator token. E4X This section describes node types that are provided for E4X sup
port. E4X has since been removed as of Gecko 21. Note: E4X is not part of the ECMAScript standard (ECMA-262), but is a separate standard of its own (ECMA-357). Declarations interface XMLDefaultDeclaration <: Declaration { type: "XMLDefaultDeclaration"; namespace: Expression; } A default xml namespace declaration. Expressions interface XMLAnyName <: Expression { type: "XMLAnyName"...
SpiderMonkey 1.8.8
d with the introduction of type inference to enable faster JITted code. It also contains new language and API features described in detail below. Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. --INSERT-ACTUAL-RELEASE-DATE-HERE Platform sup
port SpiderMonkey 1.8.8 is sup
ported on all the platforms where Firefox INSERT-ACTUAL-FIREFOX-VERSION-NUMBER-HERE runs. SpiderMonkey 1.8.8 includes a just-in-time compiler (JIT) that compiles JavaScript to machine code, for a significant speed increase. It is sup
ported on x86, x86_64, and ARM architectures. On some other platforms (SPARC, MIPS), the JIT is provided but not sup
ported. On all other pla...
...ise <stdint.h> is used. The environment variable is provided as a solution for embedders whose code requires particular definitions of those types, and those particular definitions are incompatible with the standard definitions or the custom implementation needed for older versions of Visual Studio. In the long run we anticipate removing the environment variable-based overriding when we drop sup
port for versions of Visual Studio prior to 2010. In the meantime MOZ_CUSTOM_STDINT_H is intended to function as a bridge to always using the standard header. For more information on the fixed-size integer types changes, see this blog post. New C APIs ...list and link to new APIs here... New C++ helpers While JSAPI remains a C API, the engine is now implemented in C++. Some C++ helpers have been i...
...ure Direction INCLUDE-FOLLOWUP-ON-EXPERIMENTAL-LIBRARY-VERSIONING-SCHEME-HERE SpiderMonkey embedders should also be aware that Mozilla has no plans to keep the JSAPI, nor the JSDBGAPI stable for embedders. We have chosen to concentrate on performance and correctness as primary concerns instead. The team is considering the removal of TinyIDs JS_THREADSAFE is going away, with future versions sup
porting only thread-safe builds A new debugging API is on the way to replace JSD. Release Notes Errata This is a list of changes which need to be made to the release notes ASAP. Feel free to fix any problems you spot -- this is a Wiki! Don't add anything here -- this is for after the release notes are completed. :-) ...
SpiderMonkey 1.8
t safe to be shared among threads. This includes iterators and generators (bug 349263) and arrays (bug 417501). In short, applications that share objects among threads in such a way that two threads could access an array, iterator, or generator object at the same time should not use SpiderMonkey 1.8. There is a minor known bug in the new JavaScript 1.8 functionality. When JavaScript 1.8 sup
port is enabled, the parser accepts some incorrect programs by inserting a semicolon where it should instead throw a SyntaxError (bug 384758). This bug will be fixed in 1.8.1. Migrating to SpiderMonkey 1.8 SpiderMonkey 1.8 is not binary-compatible with previous releases. It is source-compatible with SpiderMonkey 1.7 though, which means you can probably just recompile and relink your application. A ...
... New JavaScript language features JavaScript 1.8 adds Array.reduce() and reduceRight(), expression closures, and generator expressions. There is also one obscure non-backwards-compatible change. For details, see New in JavaScript 1.8. New JSAPI features It has been a couple years since SpiderMonkey 1.7 was released, and many improvements have been made to the JSAPI. However, one of the most im
portant advances for JSAPI application developers is that the documentation is much improved. See the JSAPI User Guide and the JSAPI Reference. Native functions may implement the new callback signature JSFastNative instead of JSNative. JSFastNative can be significantly faster, but applications that use SpiderMonkey's fine-grained security features should heed the warning in its API documentation. ...
...treat C/C++ char strings as UTF-8 by compiling with a non-default compiler option. In SpiderMonkey 1.8, it is no longer necessary to make a special build to get this behavior. Applications can turn on UTF-8 at run time by calling JS_SetCStringsAreUTF8. JS_EncodeString is a new variation on JS_GetStringBytes that returns a newly allocated, writable buffer which the application must JS_free. JS_Re
portAllocationOverflow can be used (instead of JS_Re
portOutOfMemory) to indicate that the script is trying to do something that would require more memory than the implementation is designed to handle. The main difference is that JS_Re
portAllocationOverflow throws an exception which the application may catch. JS_ThrowStopIteration throws the appropriate StopIteration exception object for the given con...
SpiderMonkey 17
mpilation work and with the introduction of type inference to enable faster JITted code. It also contains new language and API features described in detail below. Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine. -- 25 March 2013 Platform sup
port SpiderMonkey 17 is sup
ported on all the platforms where Firefox 17 runs. SpiderMonkey 17 includes a just-in-time compiler (JIT) that compiles JavaScript to machine code, for a significant speed increase. It is sup
ported on x86, x86_64, and ARM architectures. On some other platforms (SPARC, MIPS), the JIT is provided but not sup
ported. On all other platforms the JIT is simply disabled; JavaScript...
...ise <stdint.h> is used. The environment variable is provided as a solution for embedders whose code requires particular definitions of those types, and those particular definitions are incompatible with the standard definitions or the custom implementation needed for older versions of Visual Studio. In the long run we anticipate removing the environment variable-based overriding when we drop sup
port for versions of Visual Studio prior to 2010. In the meantime MOZ_CUSTOM_STDINT_H is intended to function as a bridge to always using the standard header. For more information on the fixed-size integer types changes, see this blog post. New C APIs ...list and link to new APIs here... New C++ helpers While JSAPI remains a C API, the engine is now implemented in C++. Some C++ helpers have been i...
...ure Direction INCLUDE-FOLLOWUP-ON-EXPERIMENTAL-LIBRARY-VERSIONING-SCHEME-HERE SpiderMonkey embedders should also be aware that Mozilla has no plans to keep the JSAPI, nor the JSDBGAPI stable for embedders. We have chosen to concentrate on performance and correctness as primary concerns instead. The team is considering the removal of TinyIDs JS_THREADSAFE is going away, with future versions sup
porting only thread-safe builds A new debugging API is on the way to replace JSD. In the future every API is going to take Handles instead of raw pointers. Exact Stack Rooting is requirement for a (moving) Generational Garbage Collector. Release Notes Errata This is a list of changes which need to be made to the release notes ASAP. Feel free to fix any problems you spot -- this is a Wiki! Don't a...
Zest
losed, free or commercial. Zest is still at a very early stage of development, but is has been made available so that anyone can play around with it. All constructive feedback is very welcome. Anyone can contribute to the onward development of Zest, and teams or individuals who develop security tools are especially welcome to join and help shape Zest's future. ...
...ry early stage of development, but is has been made available so that anyone can play around with it. All constructive feedback is very welcome. Anyone can contribute to the onward development of Zest, and teams or individuals who develop security tools are especially welcome to join and help shape Zest's future. ...
...ard development of Zest, and teams or individuals who develop security tools are especially welcome to join and help shape Zest's future. Zest topics Usecases Re
porting security vulnerabilities to developers Re
porting security vulnerabilities to companies Defining active and passive scanner rules Deep integration with security tools Runtimes The runtime environments that sup
port Zest Tools The tools that include sup
port Zest Implementation The state of Zest development Videos Simon demoed Zest at AppSec USA in November 2013, and the full video of my talk is available on YouTube. The Zest part of the talk starts at 23:47. More details https://github.com/mozilla/zest - the code on github http://groups.google.com/group/mozilla-zest - the gr...
Redis Tips
Some Uses for Redis Data Types You may have heard of Redis referred to as a NoSQL Database. Technically, this is true: It's a database that doesn't use SQL. But the statement is meaningless. It is also true that ice cream is a food that isn't made from whale meat. ...
...ing. Node.JS redis client: https://github.com/mranney/node_redis npm install redis Python redis client: https://github.com/andymccurdy/redis-py There are some gotchas with the Python API: https://github.com/andymccurdy/redis-py#api-reference SELECT statement not implemented DEL is 'delete' in python ZADD argument order is wrong SETEX argument order is wrong The default redis
port is 6379. In node, create client with explicit host and
port like so: > var r = require('redis').createClient(6379, '127.0.0.1') Commands are asynchronous. In standard node fashion, first return value is error or null; second return value is result of redis command. > r.set('foo', 42, console.log) null 'OK' > r.get('foo', console.log) null '42' For the rest of this, I'm going to use the sy...
...aybe the data doesn't belong in your redis memory at all? For example, if you have a job queueing system, you might want redis to manage the queues themselves, and store pointers for the job data which might be retrieved by workers from some different, disk-resident db. (This is, for instance, how TJ Holowaychuk's implemented kue: https://github.com/learnboost/kue.) Memory usage in redis is im
portant to think about. The speed benefits of redis are lost when you overflow into disk memory. As a conservative calculation, I multiply all the bytes I think I might store and multiply by 10, which antirez once recommended as a worst-case factor for data structure overhead. Keyspace Design Here are some things I keep in mind when creating keys: Keys are like urls and should read like nice u...
A Web PKI x509 certificate primer
e certificate that signed the parent certificate is valid and so forth up to a root certificate that is known to be valid. This chain of certificates is called the Certificate Hierarchy. If your certificates will only be used to verify one domain (e.g. *.yourcompany.com) but you want others outside of your organization to be able to browse to your website using https without having to manually im
port a root certificate, then you can get an SSL certificate from one of the CAs who already have a root certificate included in the major browsers. Firefox uses a default set of X.509v3 root certificates for various Certification Authorities (CAs). The root certificates included by default have their "trust bits" set to indicate if the CA's root certificates may be used to verify certificates for SS...
...SI 2010 4096 200 256 RFC 3766 2358 200 --- BSI 1976 256 256 In other words, SHA1 is now deprecated for new uses. We should use at least 3072 key sizes and at least a 256 ECC curve. Thus the recommendation here is for the root to be 4096 if using RSA and p384 for the root key. (p384 also chosen for compatibility as most SSL/TLS implementations sup
port this part of suite B). Error Codes in Firefox Here are some common errors that might be encountered when working with certificates in Firefox. Error Code What It Means What Can I Do SEC_ERROR_BAD_DER A certificate is not properly encoded according to ASN.1 (DER) encoding Re-generate the improperly-encoded certificate SEC_ERROR_CA_CERT_INVALID An end-en...
...RROR_PATH_LEN_CONSTRAINT_INVALID SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION A certificate contains an extension marked as critical that is not handled by mozilla::pkix Re-generate the certificate without the extension or with it not marked as critical SEC_ERROR_UNKNOWN_ISSUER Either a missing intermediate or root certificate is necessary to verify the certificate Im
port the root certificate into Firefox or have the server send the intermediate SEC_ERROR_INVALID_KEY SEC_ERROR_UNSUP
PORTED_KEYALG SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE An issuer certificate is too old Re-issue the issuer certificate MOZILLA_PKIX_ERROR_CA_CERT_USED_AS_END_ENTITY A certificate with a basic constraints extension with cA:TRUE is...
Accessibility API Implementation Details
This article (from 2007) reviews the progress and technology as it has developed. ...
...This article (from 2007) reviews the progress and technology as it has developed. ...
...This article (from 2007) reviews the progress and technology as it has developed. ...
Mork
Mork is a database file format invented by David McCusker for the Mozilla code since the original Netscape database information was proprietary and could not be released open source. Starting with Mozilla 1.9, it was phased out in favor of SQLite, a more widely-sup
ported file format. The information on this page was constructed by reading the source code of the mork database in Mozilla and attempting to codify what it parses as faithfully as possible. In a few cases, constructs that the parser sup
ported but were never used in Mozilla's code are left unspecified. Mork Structure Mork is a schema-less database format. At its core, it can be viewed as a set of rows, collections of name-value pairs, which can be organized into various tables. Rows need not be in a table, nor need they be in...
... if it is verbose (which also appears to be unused). The presence of a row or rowReference in the meta-table indicates that said row is the meta-row of the table: it contains arbitrary properties for the entire table just like a normal row. For example, the message summary format files use a table for each thread, where the meta-rows represent information about the thread in general. The last im
portant point about tables is the meaning of the minuses. A minus before the table ID indicates that all the rows currently stored in the table should be removed before adding more rows. A minus sign before a row or rowReference indicates that said row should be removed from the table. Rows For the most part, a row should not be seen outside of a table; the only time I have seen one outside a table is...
...ws currently stored in the table should be removed before adding more rows. A minus sign before a row or rowReference indicates that said row should be removed from the table. Rows For the most part, a row should not be seen outside of a table; the only time I have seen one outside a table is for table meta-rows. The first mid, as you should expect by now, is the row ID, with the scope being an im
portant part of the ID, in that 1:scope1 is not the same row as 1:scope2. If the scope is not specified, then it is the default scope of the table (if it has one) or 'r' otherwise. These row IDs are global, even if defined in a table. Indeed, defining a row in a table is a shortcut for both defining a row and adding the row to the table. The presence of an initial minus means to delete all cells befor...
Bundling multiple binary components
cko is created. If the component uses only "frozen" XPCOM interfaces, there is a good chance the same binary component will work with different versions of Gecko (version 1.8 and 1.9, for example). The more likely case is that the component uses "unfrozen" interfaces and those interfaces can change between Gecko versions. This can create a difficult situation for extension developers trying to sup
port multiple Gecko versions (Firefox 2 and 3, for example). Possible Solutions This article covers two possible ways to make binary components sup
port multiple version of Gecko: Dynamic method loading Stub loader Dynamic method loading The idea with this approach is to figure out all the methods im
ported from Gecko and dynamically load the methods. Create small wrappers for calling the metho...
... This approach uses only one binary for each platform (win/mac/linux) but creates complexity in the binaries - loading the methods and creating the wrappers. The costs get higher if you have many methods that need to be loaded. ...
...names. One for each version of Gecko and OS platform. The real components are not in the "components" folder, but are in a side folder ("libraries" in the sample). The real components are manually loaded and registered using the stub ("kRealComponent" in the sample). This approach uses one binary component for each version of Gecko and platform, plus the stub loader component Therefore, to sup
port 2 Gecko versions on three platforms, you need seven components (6 real components + 1 stub). On the other hand, this approach is much more simple than the dynamic loading approach. The stub component can be either binary or JavaScript, but it is far easier in JavaScript is cross-platform and does not have compile- or load- time compatibility problems. The Gears project contains an example of a J...
Creating a Python XPCOM component
i and take everything you need. If you wish to use PyXPCOM from a normal Python executable, you will need to tell Python where it can find the PyXPCOM library. This is probably best done by setting a PYTHONPATH variable pointing at the 'bin/python' directory in the application. This is not necessary when your components are loaded by Mozilla as the Python loader modifies sys.path. ...
...his is probably best done by setting a PYTHONPATH variable pointing at the 'bin/python' directory in the application. This is not necessary when your components are loaded by Mozilla as the Python loader modifies sys.path. Then you can im
port xpcom in any Python module (mostly, in your component). Defining the interface Make a file named "nsIPySimple.idl" to define the interface: #include "nsISup
ports.idl" [scriptable, uuid(2b324e9d-a322-44a7-bd6e-0d8c83d94883)] interface nsIPySimple : nsISup
ports { attribute string yourName; void write( ); void change(in string aValue); }; This is the same as the nsISimple interface used here. Theoretically, because several components can share an interface, the same file could be used. Pay special attention to types here - Python and JavaScript...
...ild. For example: xpidl.exe -m typelib -w -v -I C:\source\mozilla\obj-i686-pc-mingw32\dist\idl foo.idl xpidl will then create nsIPySimple.xpt, which should be placed correctly (e.g., in the 'components' directory). Implementing the component Unlike C++, PyXPCOM does much of the work for you. ...
XPCOM glue
ndent glue. Code which wishes to use only frozen symbols but can tolerate a load-time dependency on xpcom.dll should link against xpcomglue_s.lib and xpcom.lib. It should not link against xpcom_core.lib. This is the case for XPCOM components, because they are loaded into Mozilla which already has full XPCOM loaded and initialized. Frozen linkage: standalone glue (no DLL dependencies) Note: Sup
port for locating a standalone glue was removed in Gecko 6.0. Use this when you have a custom application where you want to embed Gecko to show webpages in your own window. I.e. this linkage strategy is used when an embedder needs to bootstrap XPCOM by finding a compatible GRE on disk and loading it. In order to use XPCOM, the embedding application first needs to find where the XPCOM runtime is loc...
...ency on xpcom.dll should #define XPCOM_GLUE 1 while compiling, and link against xpcomglue.lib. It should not link against xpcomglue_s.lib or xpcom.lib. Embedders using the standalone glue typically also need to avoid linking against NSPR as well. However, when using threadsafe together with the glue libraries from Gecko 1.8 or later, a special step needs to be taken to use NS_IMPL_THREADSAFE_ISUP
PORTSn. This is because it forces a dependency on the NSPR library, which can otherwise be avoided. As described in bug 299664, the preprocessor symbol XPCOM_GLUE_USE_NSPR needs to be defined. Using Mozilla internal linkage Mozilla internal code defines MOZILLA_INTERNAL_API while compiling and links against xpcom.lib and xpcom_core.lib. In almost all cases embedders should *not* use internal linkage...
...ases embedders should *not* use internal linkage. Components using internal linkage will have shared-library dependencies against non-frozen symbols in the XPCOM libraries, and will not work with any other versions of XPCOM other than the one it was compiled against. Internal linkage will be unavailable to extension authors in XULRunner 1.9 (Firefox 3) because the nonfrozen symbols will not be ex
ported from libxul. Extension and application authors currently using internal linkage should read the guide on Migrating from Internal Linkage to Frozen Linkage. Sample Compiler/Linker Flags Code compiled using XPCOM headers should always #include "xpcom-config.h" from the SDK, to ensure that XPCOM #defines are correct. Linking Strategy: Dependent Glue Standalone Glue Compi...
XPCOM hashtable guide
that mfbt/HashTable.h now exists. It is a lot faster than the XPCOM hashtables due to more inlining and templating, and the API is arguably better. What Is a Hashtable? A hashtable is a data construct that stores a set of items. Each item has a key that identifies the item. Items are found, added, and removed from the hashtable by using the key. Hashtables may seem like arrays, but there are im
portant differences: Array Hashtable Keys: integer: arrays are always keyed on integers, and must be contiguous. any type: almost any datatype can be used as key, including strings, integers, XPCOM interface pointers, IIDs, and almost anything else. Keys can be disjunct (i.e. you can store entries with keys 1, 5, and 3000). Lookup Time: O(1): lookup time is...
...The first is the hash key and the second is the data to be stored. There are a number of builtin hash keys available in nsHashKeys.h, the more useful of which are listed below. Key Type Hashkey class Strings nsStringHashKey/nsCStringHashKey Integers nsUint32HashKey/nsUint64HashKey Pointers nsPtrHashKey<T> Owned Interface Pointers nsISup
portsHashKey Reference-Counted Concrete Classes nsRefPtrHashKey There are a number of more esoteric hashkey classes in nsHashKeys.h, and you can always roll your own if none of these fit your needs (make sure you're not duplicating an existing hashkey class though!) Once you've determined what hashtable and hashkey classes you need, you can put it all together. A few examples: ...
...ot duplicating an existing hashkey class though!) Once you've determined what hashtable and hashkey classes you need, you can put it all together. A few examples: A hashtable that maps UTF-8 origin names to a DOM Window - nsInterfaceHashtable<nsCStringHashKey, nsIDOMWindow> A hashtable that maps 32 bit integers to floats - nsDataHashtable<nsUint32HashKey, float> A hashtable that maps nsISup
ports pointers to reference counted CacheEntrys - nsRefPtrHashtable<nsISup
portsHashKey, CacheEntry> A hashtable that maps JSContext pointers to a ContextInfo struct - nsClassHashtable<nsPtrHashKey<JSContext>, ContextInfo> A hashset of strings - nsTHashtable<nsStringHashKey> Hashtable API The hashtable classes all expose the same basic API. There are three key methods, Get, Put, and Remove, which...
HOWTO
t). This is of course a massive, ugly hack prone to error, but this is what the xpcshell test harness does. There should really be a better solution in xpcshell. Using JS modules and non-UI JavaScript chrome files Problem You want to write a JavaScript file, and run it in xpcshell. The file uses JS modules. Maybe it even uses JavaScript files from chrome:// URLs. ...
...hould really be a better solution in xpcshell. Using JS modules and non-UI JavaScript chrome files Problem You want to write a JavaScript file, and run it in xpcshell. The file uses JS modules. Maybe it even uses JavaScript files from chrome:// URLs. E.g., you use: Components.utils.im
port("resource://app/modules/gloda/log4moz.js"); However, you get (for that particular line, which is the first im
port): uncaught exception: [Exception... ...
... file, and run it in xpcshell. The file uses JS modules. Maybe it even uses JavaScript files from chrome:// URLs. E.g., you use: Components.utils.im
port("resource://app/modules/gloda/log4moz.js"); However, you get (for that particular line, which is the first im
port): uncaught exception: [Exception... ...
XPCshell Test Manifest Expressions
n by specifying them in a manifest file. You can add conditions to tests in order to control when tests get run. The conditions accept a simple boolean expression syntax, described here. Operators In order of decreasing precedence: () == != && || Literal Values Booleans: the literal strings true and false. Integers: A series of contiguous digits. Only decimal integers are sup
ported. Strings: any series of characters enclosed in double quotes " or single quotes '. No escape sequences are sup
ported. Variables Variables are sup
ported as a series of letters, digits or underscores beginning with a letter or an underscore. There are a fixed set of variables provided by the test harness via mozinfo.py, with many of the values initialized at configure time by writemozi...
...e test is being run toolkit - The graphics toolkit used by this build One of: 'windows', 'cocoa', 'gtk2', 'android' processor - The CPU which the code is compiled for One of: 'x86', 'x86_64', 'arm' bits - The pointer size of the CPU architecture, in bits One of 32, 64, possibly unknown debug - Set to true if this build is a debug build, false otherwise crashre
porter - Set to true if this build has crash re
porting code enabled, false otherwise. Comments If an expression contains a # (pound/hash) character outside of a string, the character and the rest of the line will be treated as a comment. This is useful as the entire line will generally be re
ported whenever tests are re
ported as being skipped, meaning the comment as well as the expression itself wi...
...sh re
porting code enabled, false otherwise. Comments If an expression contains a # (pound/hash) character outside of a string, the character and the rest of the line will be treated as a comment. This is useful as the entire line will generally be re
ported whenever tests are re
ported as being skipped, meaning the comment as well as the expression itself will appear in any logs where this is re
ported. ...
RefPtr
able of type nsAutoRefCnt, which basically is a wrapper around a count of the number of references refering to the class. When should I use nsCOMPtr versus RefPtr? The rules are simple: use nsCOMPtr to hold pointers to XPCOM interfaces, and use RefPtr to hold pointers to concrete class, even if the concrete class implements one or more XPCOM interfaces. ...
...Bug 756640 is on file to enforce this rule but hasn't yet been fixed. While RefPtr should not generally be used to hold a pointer to an XPCOM interface, this is flexible. ...
...mon in implementation details of nsCOMPtr) but not when an instance of the concrete class is assigned directly?). And it's not clear what happens when the compiler does accept this pattern. What goes wrong at runtime - UAF? memory leak? QI failure and null-deref crashes?. Note: in the above example, "nsCOMPtr<nsFoo>" might compile and work OK (it won't if your XPCOM class multiply-inherits nsISup
ports). But this is considered Bad Form, and may soon be made a compile-time error. Don't do it! Can I QueryInterface a RefPtr to get a nsCOMPtr from the object it points to? Sure. Instead of using "do_QueryInterface()" (which is used for nsCOMPtrs), use "do_QueryObject()", which works with RefPtrs: // Let's say nsFoo implements nsIFoo and nsIBar XPCOM interfaces: RefPtr<nsFoo> foo = new nsFoo(...
XPCOM glue classes
, it is the responsibility of the object itself to implement reference counting. ...
...ence counting. ...
...This is done using the functions AddRef() and Release(), which respectively modify a variable of type nsAutoRefCnt, which basically is a wrapper around a count of the number of references refering to the class.nsStringClass DeclarationnsString externalClass DeclarationnsStringContainer (External)Class DeclarationnsSup
portsWeakReferenceInherit from this C++ class to add canonical sup
port for nsISup
portsWeakReference.nsXPIDLCStringClass DeclarationnsXPIDLStringClass DeclarationPromiseFlatCString (External)Class DeclarationPromiseFlatString (External)Class Declaration ...
IAccessibleTable2
other-licenses/ia2/AccessibleTable2.idlNot scriptable This interface gives access to a two-dimensional table. 1.0 66 Introduced Gecko 1.9.2 Inherits from: IUnknown Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Please also refer to the IAccessibleTableCell interface. If you want to sup
port older applications you should also sup
port the IAccessibleTable interface. Method overview [propget] HRESULT caption([out] IUnknown accessible ); [propget] HRESULT cellAt([in] long row, [in] long column, [out] IUnknown cell ); [propget] HRESULT columnDescription([in] long column, [out] BSTR description ); [propget] HRESULT isColumnSelected([in] long column, [out] boolean isSelected ); [propget] HRESULT isRowSelected([in] long row, [out] b...
...Parameters modelChange A struct of (type(insert, delete, update), firstRow, lastRow, firstColumn, lastColumn). Return value S_FALSE if there is nothing to return, [out] value is null. S_OK. nColumns() Returns the total number of columns in table. [propget] HRESULT nColumns( [out] long columnCount ); Parameters columnCount Number of columns in table (including columns outside the current view
port) Return value S_OK. nRows() Returns the total number of rows in table. [propget] HRESULT nRows( [out] long rowCount ); Parameters rowCount Number of rows in table (including rows outside the current view
port) Return value S_OK. nSelectedCells() Returns the total number of selected cells. [propget] HRESULT nSelectedCells( [out] long cellCount ); Parameters cellCount Number of cells curre...
... Return value E_INVALIDARG if bad [in] passed. S_OK. summary() Returns the summary description of the table. The returned object could be an IAccessible or an IAccessible2. [propget] HRESULT summary( [out] IUnknown accessible ); Parameters accessible Returns a reference to an implementation dependent accessible object representing the table's summary or a null pointer if the table does not sup
port a summary. Return value S_FALSE if there is nothing to return, [out] value is null. S_OK. unselectColumn() Unselects one column, leaving other selected columns selected (if any). The behavior should mimic that of the application, but for those applications which do not have a means in the GUI to unselect a full column of cells the behavior should be as follows: The entire column of cells for the...
mozISpellCheckingEngine
The built in Hunspell engine has contract ID "@mozilla.org/spellchecker/engine;1". Extensions can use this interface to check spelling or provide its own spell checker to editors. ...
...The built in Hunspell engine has contract ID "@mozilla.org/spellchecker/engine;1". Extensions can use this interface to check spelling or provide its own spell checker to editors. ...
...d A word to check for correct spelling. Return value Returns true if word is spelled correctly according to the dictionary attribute, and returns false if word is misspelled. getDictionaryList() Gets the list of dictionaries. void getDictionaryList( [array, size_is(count)] out wstring dictionaries, out PRUint32 count ); Parameters dictionaries A list of dictionaries sup
ported by this spell checker. The dictionary attribute can be set to one of these. Each dictionary name is typically but not always a locale code. count The length of dictionaries. removeDirectory() Removes all the dictionaries in the specified directory from the spell checker. void removeDirectory( nsIFile dir ); Parameters dir An nsIFile object indicating the directo...
nsIAccessibleStates
Constants State constants MSAA State flags - used for bitfield. More than 1 allowed. Constant Value Description STATE_UNAVAILABLE 0x00000001 The object is unavailable, that is disabled. ...
...CUSABLE 0x00100000 The object can be focused. STATE_SELECTABLE 0x00200000 The object can be selected. STATE_LINKED 0x00400000 The object is formatted as a hyperlink. The object role will usually be ROLE_TEXT_LEAF. (See nsIAccessibleRole.Constants). STATE_TRAVERSED 0x00800000 The object is a hyperlink that has been visited (previously clicked) by a user. STATE_MULTISELECTABLE 0x01000000 Sup
ports multiple selection. STATE_EXTSELECTABLE 0x02000000 Sup
ports extended selection. STATE_ALERT_LOW 0x04000000 This information is of low priority. STATE_ALERT_MEDIUM 0x08000000 This information is of medium priority. STATE_ALERT_HIGH 0x10000000 This information is of high priority. STATE_PROTECTED 0x20000000 Maps to Gnome's Role* ATK_ROLE_PASSWD_TEXT, nothing for Java? STATE_HASPOPUP 0x...
...d selection. STATE_ALERT_LOW 0x04000000 This information is of low priority. STATE_ALERT_MEDIUM 0x08000000 This information is of medium priority. STATE_ALERT_HIGH 0x10000000 This information is of high priority. STATE_PROTECTED 0x20000000 Maps to Gnome's Role* ATK_ROLE_PASSWD_TEXT, nothing for Java? STATE_HASPOPUP 0x40000000 New in MSAA 2.0. STATE_REQUIRED STATE_ALERT_LOW STATE_IM
PORTANT STATE_ALERT_MEDIUM Currently unused. STATE_INVALID STATE_ALERT_HIGH Indicates a validation failure. STATE_CHECKABLE STATE_MARQUEED Extended state constants Extended state flags (for now non-MSAA, for Java and Gnome/ATK sup
port) Constant Value Description EXT_STATE_SUP
PORTS_AUTOCOMPLETION 0x00000001 For editable areas that have any kind of auto completion. EXT_STATE_DEFUNCT 0x00...
nsIArray
Provides basic functionality for retrieving elements at a specific position, searching for elements. Indexes are zero-based, such that the last element in the array is stored at the index length-1. For an array which can be modified, see nsIMutableArray. Neither interface makes any attempt to protect the individual elements from modification. The convention is that the elements of the array should not be modified. Documentation within a specific interface should describe variations from this convention. ...
... a specific interface should describe variations from this convention. It is also convention that if an interface provides access to an nsIArray, that the array should not be QueryInterfaced to an nsIMutableArray for modification. If the interface in question had intended the array to be modified, it would have returned an nsIMutableArray! null is a valid entry in the array, and as such any nsISup
ports parameters may be null, except where noted. Method overview nsISimpleEnumerator enumerate(); unsigned long indexOf(in unsigned long startIndex, in nsISup
ports element); void queryElementAt(in unsigned long index, in nsIIDRef uuid, [iid_is(uuid), retval] out nsQIResult result); Attributes Attribute Type Description length unsigned long The number of elements in the array. Read only...
...e array. Exceptions thrown NS_ERROR_FAILURE If the array is empty (to make it easy to detect errors). NS_ERROR_OUT_OF_MEMORY If there is not enough memory to complete the operation. indexOf() Get the position of a specific element. Note that since null is a valid input, exceptions are used to indicate that an element is not found. unsigned long indexOf( in unsigned long startIndex, in nsISup
ports element ); Parameters startIndex The initial element to search in the array. To start at the beginning, use 0 as the startIndex. element The element you are looking for. Return value A number >= startIndex which is the position of the element in the array. Exceptions thrown NS_ERROR_FAILURE If the element was not in the array. queryElementAt() Retrieve a specific element of the array, and Q...
nsIAuthModule
netwerk/base/public/nsIAuthModule.idlScriptable This interface is intended to be used as server and client authentication service. ...
...idPtr aOutToken, out unsigned long aOutTokenLength ); Parameters aInToken A buffer containing the data received from the server. aInTokenLength The length of the input token. aOutToken A buffer containing the plaintext data from the server. aOutTokenLength The length of the output token buffer. Exceptions thrown NS_ERROR_NOT_IMPLEMENTED If the underlying authentication mechanism does not sup
port security layers. wrap() Once a security context has been established through calls to getNextToken() it may be used to protect data exchanged between client and server. Calls to this method are used to protect items of data to be sent to the server. void wrap( [const] in voidPtr aInToken, in unsigned long aInTokenLength, in boolean confidential, out voidPtr aOutToken, out unsigned long...
...rver. aInTokenLength The length of the input token. confidential If set to true, it will encrypt the data, otherwise data will just be integrity protected (checksummed). aOutToken A buffer containing the resulting data to be sent to the server. aOutTokenLength The length of the output token buffer. Exceptions thrown NS_ERROR_NOT_IMPLEMENTED If the underlying authentication mechanism does not sup
port security layers. ...
nsIAuthPrompt2
It can be used to prompt users for authentication information, either synchronously or asynchronously. This interface is implemented by @mozilla.org/login-manager/prompter;1. ...
...y or asynchronously. This interface is implemented by @mozilla.org/login-manager/prompter;1. To create an instance, use: var authPrompt2 = Components.classes["@mozilla.org/login-manager/prompter;1"] .createInstance(Components.interfaces.nsIAuthPrompt2); Method overview nsICancelable asyncPromptAuth(in nsIChannel aChannel, in nsIAuthPromptCallback aCallback, in nsISup
ports aContext, in PRUint32 level, in nsIAuthInformation authInfo); boolean promptAuth(in nsIChannel aChannel, in PRUint32 level, in nsIAuthInformation authInfo); Constants Constant Value Description LEVEL_NONE 0 The password will be sent unencrypted. No security provided. LEVEL_PW_ENCRYPTED 1 Password will be sent encrypted, but the connec...
...hrow when the prompt could already be potentially shown to the user. In that case information about the failure has to come through the callback. This way we prevent multiple dialogs shown to the user because consumer may fall back to synchronous prompt on synchronous failure of this method. nsICancelable asyncPromptAuth( in nsIChannel aChannel, in nsIAuthPromptCallback aCallback, in nsISup
ports aContext, in PRUint32 level, in nsIAuthInformation authInfo ); Parameters aChannel The channel that requires authentication. aCallback aContext level One of the level constants. authInfo Authentication information object. The implementation should fill in this object with the information entered by the user before returning. Return value promptAuth() Requests a userna...
nsIAuthPromptCallback
netwerk/base/public/nsIAuthPromptCallback.idlScriptable Interface for callback methods for the asynchronous nsIAuthPrompt2 method. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Callers must call exactly one method if nsIAuthPrompt2.asyncPromptAuth() returns successfully. They must not call any method on this interface before nsIAuthPrompt2.asyncPromptAuth() returns. Method overview void onAuthAvailable(in nsISup
ports aContext, in nsIAuthInformation aAuthInfo); void onAuthCancelled(in nsISup
ports aContext, in boolean userCancel); Methods onAuthAvailable() Authentication information is available. Note: Any exceptions thrown from this method should be ignored. void onAuthAvailable( in nsISup...
...ore nsIAuthPrompt2.asyncPromptAuth() returns. Method overview void onAuthAvailable(in nsISup
ports aContext, in nsIAuthInformation aAuthInfo); void onAuthCancelled(in nsISup
ports aContext, in boolean userCancel); Methods onAuthAvailable() Authentication information is available. Note: Any exceptions thrown from this method should be ignored. void onAuthAvailable( in nsISup
ports aContext, in nsIAuthInformation aAuthInfo ); Parameters aContext The context as passed to nsIAuthPrompt2.asyncPromptAuth(). aAuthInfo Authentication information. Must be the same object that was passed to nsIAuthPrompt2.asyncPromptAuth(). ...
... userCancel If false, this prompt was cancelled by calling the the cancel method on the nsICancelable; otherwise, it was cancelled by the user. ...
nsICRLManager
security/manager/ssl/public/nsICRLManager.idlScriptable Please add a summary to this article. ...
... security/manager/ssl/public/nsICRLManager.idlScriptable Please add a summary to this article. ...
...uteNextAutoUpdateTime() wstring computeNextAutoUpdateTime( in nsICRLInfo info, in unsigned long autoUpdateType, in double noOfDays ); Parameters info autoUpdateType noOfDays Return value deleteCrl() Delete the crl. void deleteCrl( in unsigned long crlIndex ); Parameters crlIndex getCrls() Get a list of Crl entries in the DB. nsIArray getCrls(); Parameters None. Return value im
portCrl() Im
port a CRL into the certificate database. void im
portCrl( [array, size_is(length)] in octet data, in unsigned long length, in nsIURI uri, in unsigned long type, in boolean doSilentDownload, in wstring crlKey ); Parameters data length uri type doSilentDownload crlKey rescheduleCRLAutoUpdate() This would reschedule the autoupdate of crls with auto update enable. void res...
nsIChromeRegistry
chrome/public/nsIChromeRegistry.idlScriptable Provides access to the chrome registry; you can use this to get information about chrome documents that have been registered. ...
...Constants Constant Value Description NONE 0 PARTIAL 1 FULL 2 Methods canonify() Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Note: This method is obsolete; use convertChromeURL() instead. Converts a chrome URL into a canonical representation by ensuring that the filename
portion of the URL is included, as in chrome://package/provider/file. This is useful because chrome URLs are allowed to be specified in "shorthand", leaving the "file"
portion off. In that case, the URL is expanded to chrome://package/provider/package.ext. The extension, ext, is one of: xul For a "content" package. css For a "skin" package. dtd For a "locale" package. void ...
...; Parameters None. convertChromeURL() Resolves a chrome URL to an loadable URI using the information in the registry. A new nsIURI is returned; the original is left unmodified. This lets you take a non-canonical chrome URI, such as chrome://package/provider/file, and convert it into a canonical one. This is useful because chrome URLs are allowed to be specified in "shorthand", leaving the "file"
portion off. In that case, the URL is expanded to chrome://package/provider/package.ext. The extension, ext, is one of: xul For a "content" package. css For a "skin" package. dtd For a "locale" package. nsIURI convertChromeURL( in nsIURI aChromeURL ); Parameters aChromeURL The URL that is to be converted. Return value A new nsIURI object containing the loadable...
nsIController
void doCommand( in string command ); Parameters command The name of the command to execute. ...
...void doCommand( in string command ); Parameters command The name of the command to execute. ...
... string command ); Parameters command The name of the command whose availability is to be checked. Return value Return true if the specified command is currently available to be used; otherwise, it should return false. onEvent() Implement this method to process the event with the specified name. void onEvent( in string eventName ); Parameters eventName The name of the event to process. sup
portsCommand() Implement this method to re
port whether or not the command with the specified name is sup
ported. boolean sup
portsCommand( in string command ); Parameters command The name of the command to determine whether or not it is sup
ported. Return value true if the specified command is sup
ported; otherwise false. See also nsICommandController nsIControllers XUL Tutorial/Commands ...
nsICookieService
This separation of interface is mainly historical. ...
...rovided to ensure that the cookie privacy preferences are honored. Return value Returns the resulting cookie string. getCookieStringFromHttp() Get the complete cookie string associated with the URI. Note: This function is redundant and will most likely be removed in a future revision of this interface. getCookieString() will query the documentURI property off of nsIHttpChannelInternal if sup
ported, so getCookieString() can be used in place of this method. string getCookieStringFromHttp( in nsIURI aURI, in nsIURI aFirstURI, in nsIChannel aChannel ); Parameters aURI The URI of the document for which cookies are being queried. aFirstURI The URI that the user originally typed in or clicked on to initiate the load of the document referenced by aURI. aChannel The channel ...
...s strongly recommended that a non-null value be provided to ensure that the cookie privacy preferences are honored. setCookieStringFromHttp() Set the cookie string and expires associated with the URI. Note: This function is redundant and will most likely be removed in a future revision of this interface. setCookieString() will query the documentURI property off of nsIHttpChannelInternal if sup
ported, and setCookieString() could also query the Date header from the channel if aChannel sup
ports nsIHttpChannel. void setCookieStringFromHttp( in nsIURI aURI, in nsIURI aFirstURI, in nsIPrompt aPrompt, in string aCookie, in string aServerTime, in nsIChannel aChannel ); Parameters aURI The URI of the document for which cookies are being queried. aFirstURI The URI that t...
nsIDOMClientRect
dom/interfaces/base/nsIDOMClientRect.idlScriptable Represents a rectangular box. The type of box is specified by the method that returns such an object. It is returned by functions like element.getBoundingClientRect. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Attributes Attribute Type Description bottom float Y-coordinate, relative to the view
port origin, of the bottom of the rectangle box. Read only. height float Height of the rectangle box (This is identical to bottom minus top). Read only. left float X-coordinate, relative to the view
port origin, of the left of the rectangle box. Read only. right ...
...bottom float Y-coordinate, relative to the view
port origin, of the bottom of the rectangle box. Read only. height float Height of the rectangle box (This is identical to bottom minus top). Read only. left float X-coordinate, relative to the view
port origin, of the left of the rectangle box. Read only. right float X-coordinate, relative to the view
port origin, of the right of the rectangle box. Read only. top float Y-coordinate, relative to the view
port origin, of the top of the rectangle box. Read only. width float Width of the rectangle box (This is identical to right minus left). Read only. x float X-coordinate, relative to the view
port origin, of the left of the rectangle box. Read only. ...
...Read only. See also CSSOM View Module : The ClientRect InterfaceWD This object was renamed a few times: initial name was TextRectangle, then ClientRect, then DOMRect. ...
nsIDOMGeoGeolocation
The nsIDOMGeoGeolocation interface provides access to geolocation information. You can request a single notification of the user's current position, or you can monitor the position over time. dom/interfaces/geolocation/nsIDOMGeoGeolocation.idlScriptable Please add a summary to this article. ...
... Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Inherits from: nsISup
ports Implemented by: @mozilla.org/geolocation;1. ...
...u can access this service using: var geolocation = Components.classes["@mozilla.org/geolocation;1"] .getService(Components.interfaces.nsIDOMGeoGeolocation); Note: if nsIDGeoGeolocation throws an exception when im
porting, try using this: var geolocation = Components.classes["@mozilla.org/geolocation;1"] .getService(Components.interfaces.nsISup
ports); Method Overview void clearWatch(in unsigned short watchId); void getCurrentPosition(in nsIDOMGeoPositionCallback successCallback, [optional] in nsIDOMGeoPositionErrorCallback errorCallback, [optional] in nsIDOMGeoPositionOptions options); unsigned short watchPosition(in nsIDOMGeoPositionCallback successCallback,...
nsIDOMOfflineResourceList
to be cached locally for use while offline. It includes methods for adding resources to and removing resources from the cache, as well as for enumerating the dynamically managed resource list. dom/interfaces/offline/nsIDOMOfflineResourceList.idlScriptable Please add a summary to this article. ...
... An event listener to be called when resources are being downloaded into the cache. onprogress nsIDOMEventListener An event listener to be called periodically throughout the download process. onupdateready nsIDOMEventListener An event listener to be called when a resource update is ready; this event is not currently used since versioned application caches aren't sup
ported yet. oncached nsIDOMEventListener An event listener to be called when caching is complete. status unsigned short One of the Application cache state constants indicating the status of the application cache. Constants Application cache state constants Constant Value Description UNCACHED 0 The object isn't associated with an appl...
...che, the cache entry is removed. void mozRemove( in DOMString uri ); Parameters uri The URI of the item to remove from the list. swapCache() Swaps in the newest version of the application cache. The newest version of resources are updated on first refresh. This means already loaded resources should only update after a page refresh. Note: Versioned application caches are not yet sup
ported; this method will throw an exception. void swapCache(); Parameters None. update() Begins the application cache update process. This will check for a new cache manifest but will not tell the browser to use the updated cache. void update(); Parameters None. See also Offline resources in Firefox nsIApplicationCache nsIApplicationCacheContainer nsIApplicationCacheService nsIAppl...
getFile
ComsD" Platform-specific locations Some symbolic names represent platform-specific locations. The following sections cover these. Available on both Mac and Unix These locations are available on both Mac OS X and Unix implementations of Gecko. C constant String value Notes NS_OS_SYSTEM_DIR "SysD" Available on Mac OS X only These locations are sup
ported only on Mac OS X versions of Gecko. C constant String value Notes NS_MAC_DESKTOP_DIR NS_OS_DESKTOP_DIR NS_MAC_TRASH_DIR "Trsh" NS_MAC_STARTUP_DIR "Strt" NS_MAC_SHUTDOWN_DIR "Shdwn" NS_MAC_APPLE_MENU_DIR "ApplMenu" NS_MAC_CONTROL_PANELS_DIR "CntlPnl" NS_MAC_EXTENSIONS...
... C constant String value Notes NS_WIN_WINDOWS_DIR "WinD" NS_WIN_PROGRAM_FILES_DIR "ProgF" NS_WIN_HOME_DIR NS_OS_HOME_DIR NS_WIN_DESKTOP_DIR "DeskV" virtual folder at the root of the namespace NS_WIN_PROGRAMS_DIR "Progs" User start menu programs directory!
... C constant String value Notes NS_UNIX_LOCAL_DIR "Locl" NS_UNIX_LIB_DIR "LibD" NS_UNIX_HOME_DIR NS_OS_HOME_DIR The following locations are provided only on OS/2 builds of Gecko. Deprecated These locations have been deprecated and should no longer be used. C constant String v...
nsIFrameLoader
content/base/public/nsIFrameLoader.idlScriptable Handles loading a frame. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Note: This interface works in tandem with the nsIContentView interface to manage frames across processes if Electrolysis is in use to sup
port per-frame processes. Method overview void activateFrameEvent(in AString aType, in boolean capture); void activateRemoteFrame(); void destroy(); void loadFrame(); void loadURI(in nsIURI aURI); void sendCrossProcessKeyEvent(in AString aType, in long aKeyCode, in long aCharCode, in long aModifiers, [optional] in boolean aPreventDefault); void sendCross...
...load from the owner content in the frame loader. void loadFrame(); Parameters None. loadURI() Loads the specified URI in this frame. Behaves identically to loadFrame(), except that this method lets you specify the URI to load. void loadURI( in nsIURI aURI ); Parameters aURI The URI to load into the frame. sendCrossProcessKeyEvent() Creates and sends a KeyEvent to the content view
port's process. See nsIDOMWindowUtils.sendKeyEvent() for details; this method is its equivalent for cross-process event handling. void sendCrossProcessKeyEvent( in AString aType, in long aKeyCode, in long aCharCode, in long aModifiers, [optional] in boolean aPreventDefault ); Parameters aType The event type. aKeyCode The key code. aCharCode The character code. aModifiers The mod...
... in long aKeyCode, in long aCharCode, in long aModifiers, [optional] in boolean aPreventDefault ); Parameters aType The event type. aKeyCode The key code. aCharCode The character code. aModifiers The modifier flags. aPreventDefault Whether or not to prevent default actions from being performed. sendCrossProcessMouseEvent() Creates and sends a MouseEvent to the content view
port's process. See nsIDOMWindowUtils.sendMouseEvent() for details; this method is its equivalent for cross-process event handling. void sendCrossProcessMouseEvent( in AString aType, in float aX, in float aY, in long aButton, in long aClickCount, in long aModifiers, [optional] in boolean aIgnoreRootScrollFrame ); Parameters aType The type of mouse event to send. aX The X coordin...
nsIFrameScriptLoader
Methods void loadFrameScript(in AString aURL, in boolean aAllowDelayedLoad, [optional] in boolean aRunInGlobalScope) void removeDelayedFrameScript(in AString aURL); jsval getDelayedFrameScripts(); loadFrameScript() Load a script in the remote frame. Frame scripts are loaded as soon as loadFrameScript() is called. ...
...ll. Frame scripts are essentially per-tab, so they don't get reloaded when the user navigates. If you want a frame script to do something whenever a new document is loaded, you can listen for the document-element-inserted notification. Parameters Name Type Description aURL String URL for the script to load. aURL must be the absolute URL. data: URLs are also sup
ported. For example data:,dump("foo\n"); aAllowDelayedLoad Boolean If true, this flag means that the frame script will be loaded into any new frames opened after the loadFrameScript() call, until removeDelayedFrameScript() is called for that script. aRunInGlobalScope Boolean Optional, defaults to false. By default, frame scripts each have their own scope, so the...
...e scripts each have their own scope, so they can declare global variables without causing conflicts with any other frame scripts. If present and set to true, this flag switches off that behavior, meaning that the script's scope is shared with any other frame scripts in the same frame that have also set the flag. removeDelayedFrameScript() Removes aURL from the list of scripts which sup
port delayed load. This cancels the effect of the aAllowDelayedLoad flag, meaning that the loader will no longer load the script into new frames. If you used aAllowDelayedLoad, you should call this as part of your cleanup (for example, when your add-on is disabled or uninstalled). Parameters Name Type Description aURL String URL for the script to remove. getDela...
nsIGeolocationProvider
After startup() is called, any geo location change should call callback.update(). ...
...rtup() is called, any geo location change should call callback.update(). The nsIGeolocationProvider interface provides information about the current users location to interested parties via nsIGeolocationUpdate. After the provider has been initialized, any changes to location should call callback.onRequest(). You may find the WiFi access point monitoring service useful if you wish to implement sup
port for WiFi-based location services. See dom/src/geolocation/NetworkGeolocationProvider.js for an example of how to write a geolocation provider. Method overview boolean isReady(); Obsolete since Gecko 1.9.2 void shutdown(); void startup(); void watch(in nsIGeolocationUpdate callback); Methods isReady() Obsolete since Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1...
... location services. See dom/src/geolocation/NetworkGeolocationProvider.js for an example of how to write a geolocation provider. Method overview boolean isReady(); Obsolete since Gecko 1.9.2 void shutdown(); void startup(); void watch(in nsIGeolocationUpdate callback); Methods isReady() Obsolete since Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Re
ports whether or not the device is ready and has a position. boolean isReady(); Parameters None. Return value true if the device is ready and has a position available to return; otherwise false. shutdown() Shuts down the location device. void shutdown(); Parameters None. startup() Start up the provider. This is called before any other method and may be called multiple times. void startup(); Paramet...
nsIHTMLEditor
editor/idl/nsIHTMLEditor.idlScriptable Please add a summary to this article. ...
...tIndentState(out boolean aCanIndent, out boolean aCanOutdent); void getInlineProperty(in nsIAtom aProperty, in AString aAttribute, in AString aValue, out boolean aFirst, out boolean aAny, out boolean aAll); AString getInlinePropertyWithAttrValue(in nsIAtom aProperty, in AString aAttribute, in AString aValue, out boolean aFirst, out boolean aAny, out boolean aAll); nsISup
portsArray getLinkedObjects(); void getListItemState(out boolean aMixed, out boolean aLI, out boolean aDT, out boolean aDD); void getListState(out boolean aMixed, out boolean aOL, out boolean aUL, out boolean aDL); AString getParagraphState(out boolean aMixed); nsIDOMElement getSelectedElement(in AString aTagName); nsIDOMElement getSelectionContainer(); ...
... in AString aValue, out boolean aFirst, out boolean aAny, out boolean aAll ); Parameters aProperty aAttribute aValue aFirst aAny aAll Return value getLinkedObjects() Find all the nodes in the document which contain references to outside URIs (for example a href, img src, script src, and so on.) The objects in the array will be type nsIURIRefObject. nsISup
portsArray getLinkedObjects(); Parameters None. Return value ANodeList the linked nodes found. getListItemState() getListItemState returns what list item type is in the selection. void getListItemState( out boolean aMixed, out boolean aLI, out boolean aDT, out boolean aDD ); Parameters aMixed true if there is more than one type of list item, or if there is some list and non-list.
nsIHapticFeedback
xpcom/system/nsIHapticFeedback.idlScriptable Implemented to provide sup
port for haptic feedback (that is, vibration sup
port). ...
... xpcom/system/nsIHapticFeedback.idlScriptable Implemented to provide sup
port for haptic feedback (that is, vibration sup
port). ...
... LongPress 1 Spe...
nsIHttpActivityDistributor
This is primarily useful for debuggers and other traffic monitoring tasks. ...
...void removeObserver( in nsIHttp...
...ivityDistributor); Method overview void addObserver(in nsIHttpActivityObserver aObserver); void removeObserver(in nsIHttpActivityObserver aObserver); Methods addObserver() Begins delivery of notifications of HTTP trans
port activity. void addObserver( in nsIHttpActivityObserver aObserver ); Parameters aObserver The nsIHttpActivityObserver that should receive notifications of HTTP trans
port activity; this object's nsIHttpActivityObserver.observeActivity() method will be called each time activity occurs. removeObserver() Stops delivery of notifications of HTTP trans
port activity. void removeObserver( in nsIHttpActivityObserver aObserver ); Parameters aObserver The nsIHttpActivityObserver that should no longer receive notifications of HTTP trans
port activity. See also Monitorin...
nsIHttpChannel
ERROR_FAILURE If set after the channel has been opened. redirectionLimit unsigned long This attribute specifies the number of redirects this channel is allowed to make. If zero, the channel will fail to redirect and will generate a NS_ERROR_REDIRECT_LOOP failure status. Note: An HTTP redirect results in a new channel being created. If the new channel sup
ports nsIHttpChannel, then it will be assigned a value to its redirectionLimit attribute one less than the value of the redirected channel's redirectionLimit attribute. The initial value for this attribute may be a configurable preference (depending on the implementation). referrer nsIURI Get or set the URI of the HTTP Referer: header. This is the address (URI) of the reso...
...( in ACString aHeader, in ACString aValue, in boolean aMerge ); Parameters aHeader The case-insensitive name of the request header to query (For example "Cookie"). aValue The request header value to set (For example "X=1"). aMerge If true, the new header value will be merged with any existing values for the specified header. This flag is ignored if the specified header does not sup
port merging (For example the "Content-Type" header can only have one value). The list of headers for which this flag is ignored is an implementation detail. If this flag is false, then the header value will be replaced with the contents of aValue. Exceptions thrown NS_ERROR_IN_PROGRESS If called after the channel has been opened. NS_ERROR_FAILURE If called during visitRequestHeaders(). set...
...in ACString header, in ACString value, in boolean merge ); Parameters header The case-insensitive name of the response header to set(For example "Cache-Cookie"). value The response header value to set (For example "no-cache"). merge If true, the new header value will be merged with any existing values for the specified header. This flag is ignored if the specified header does not sup
port merging (For example the "Content-Type" header can only have one value). The list of headers for which this flag is ignored is an implementation detail. If this flag is false, then the header value will be replaced with the contents of value. Exceptions thrown NS_ERROR_NOT_AVAILABLE If called before the response has been received (before onStartRequest()). NS_ERROR_ILLEGAL_VALUE If changi...
nsIHttpUpgradeListener
netwerk/protocol/http/nsIHttpChannelInternal.idlScriptable The callback interface for nsIHttpChannelInternal.HTTPUpgrade; this is called when an HTTP protocol upgrade is finished. 1.0 66 Introduced Gecko 6.0 Inherits from: nsISup
ports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) This is used, for example, by WebSockets in order to upgrade an HTTP channel to use the WebSocket protocol. ...
...face for nsIHttpChannelInternal.HTTPUpgrade; this is called when an HTTP protocol upgrade is finished. 1.0 66 Introduced Gecko 6.0 Inherits from: nsISup
ports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) This is used, for example, by WebSockets in order to upgrade an HTTP channel to use the WebSocket protocol. Method overview void onTrans
portAvailable(in nsISocketTrans
port aTrans
port, in nsIAsyncInputStream aSocketIn, in nsIAsyncOutputStream aSocketOut); Methods onTrans
portAvailable() Called when an HTTP protocol upgrade attempt is completed, passing in the information needed by the protocol handler to take over the channel that is no longer being used by HTTP. Note: To begin a protocol upgrade, call nsIHttpChannelInternal.HTT...
...ans
port aTrans
port, in nsIAsyncInputStream aSocketIn, in nsIAsyncOutputStream aSocketOut); Methods onTrans
portAvailable() Called when an HTTP protocol upgrade attempt is completed, passing in the information needed by the protocol handler to take over the channel that is no longer being used by HTTP. Note: To begin a protocol upgrade, call nsIHttpChannelInternal.HTTPUpgrade(). void onTrans
portAvailable( in nsISocketTrans
port aTrans
port, in nsIAsyncInputStream aSocketIn, in nsIAsyncOutputStream aSocketOut ); Parameters aTrans
port The nsISocketTrans
port describing the socket connection between the browser and the server; this socket can now be used for the new protocol instead of HTTP. aSocketIn The nsIAsyncInputStream object representing the input stream for data...
nsIJSON
dom/interfaces/json/nsIJSON.idlScriptable This interface provides a convenient way to encode and decode JSON strings from JavaScript code. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) Note: This interface may only be used from JavaScript code, with the exception of the legacyDecodeToJSVal() method. However, you should use native JSON instead if at all possible. Implemented by: @mozilla.org/dom/json;1. ...
...may only be used from JavaScript code, with the exception of the legacyDecodeToJSVal() method. However, you should use native JSON instead if at all possible. Implemented by: @mozilla.org/dom/json;1. To create an instance, use: var nativeJSON = Components.classes["@mozilla.org/dom/json;1"] .createInstance(Components.interfaces.nsIJSON); Method overview Note: The IDL file has
portions of the IDL commented out because they represent things that can't actually be properly described by IDL; however, for the purposes of this article, we'll pretend they can be and ignore that issue. JSObject decode(in AString str); Obsolete since Gecko 7.0 jsval decodeToJSVal(in AString str, in JSContext cx); Native code only! JSObject decodeFromStream(in nsIInputSt...
...a JavaScript object into JSON format, writing it to a stream. void encodeToStream( in nsIOutputStream stream, in string charset, in boolean writeBOM in JSObject value ); Parameters stream The nsIOutputStream to which to write the JSON string. charset The string encoding to use. Only the five Unicode encodings "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE" and "UTF-32BE" are sup
ported. writeBOM Specify true if you wish to write a byte-order mark (BOM) into the stream, otherwise specify false. value The JavaScript object to encode. legacyDecode() Decodes a JSON string. This method accepts slightly more than the exact JSON syntax; details of extra accepted syntax are deliberately not described. This method is intended for use only by code processing legacy data. When...
nsILoadGroup
netwerk/base/public/nsILoadGroup.idlScriptable A load group maintains a collection of nsIRequest objects. Inherits from: nsIRequest Last changed in Gecko 1.7 Method overview void addRequest(in nsIRequest aRequest, in nsISup
ports aContext); void removeRequest(in nsIRequest aRequest, in nsISup
ports aContext, in nsresult aStatus); Attributes Attribute Type Description activeCount unsigned long Returns the count of "active" requests (that is requests without the LOAD_BACKGROUND bit set). Read only. defaultLoadRequest nsIRequest Accesses the default load request for the group. Each time a number of requests are added to a group, the defaultLoadRequest m...
...uest() Adds a new request to the group. This will cause the default load flags to be applied to the request. If this is a foreground request then the groupObserver's onStartRequest will be called. If the request is the default load request or if the default load request is null, then the load group will inherit its load flags from the request. void addRequest( in nsIRequest aRequest, in nsISup
ports aContext ); Parameters aRequest The request to be added to the load group. aContext The context to be passed to the onStartRequest notification. removeRequest() Removes a request from the group. If this is a foreground request then the groupObserver's onStopRequest will be called. By the time this call ends, aRequest will have been removed from the loadgroup, even ...
... aContext The context to be passed to the onStartRequest notification. removeRequest() Removes a request from the group. If this is a foreground request then the groupObserver's onStopRequest will be called. By the time this call ends, aRequest will have been removed from the loadgroup, even if this function throws an exception. void removeRequest( in nsIRequest aRequest, in nsISup
ports aContext, in nsresult aStatus ); Parameters aRequest The request to be removed from the load group. aContext The context to be passed to the onStopRequest notification. aStatus The status to be passed to the onStopRequest notification. ...
nsILocalFileMac
nt Value Description CURRENT_PROCESS_CREATOR 0x8000000 Use with SetFileType() to specify the signature of current process. Obsolete since Gecko 2.0 Methods Native code only!getCFURL Note: Observes the state of the followLinks attribute. If the file object is an alias and followLinks is true, returns the target of the alias. If followLinks is false, returns the unresolved alias file. Note: Sup
ported only for XP_MACOSX. CFURLRef getCFURL(); Parameters None. Return value The CFURLRef of the file object. The caller is responsible for calling CFRelease() on it. Native code only!getFSRef Note: Observes the state of the followLinks attribute. If the file object is an alias and followLinks is true, returns the target of the alias. If followLinks is false, returns the unresolved alias file. Note:...
...nly for XP_MACOSX. CFURLRef getCFURL(); Parameters None. Return value The CFURLRef of the file object. The caller is responsible for calling CFRelease() on it. Native code only!getFSRef Note: Observes the state of the followLinks attribute. If the file object is an alias and followLinks is true, returns the target of the alias. If followLinks is false, returns the unresolved alias file. Note: Sup
ported only for XP_MACOSX. FSRef getFSRef(); Parameters None. Return value The FSRef of the file object. Native code only!getFSSpec Note: Observes the state of the followLinks attribute. If the file object is an alias and followLinks is true, returns the target of the alias. If followLinks is false, returns the unresolved alias file. FSSpec getFSSpec(); Parameters None. Return value The FSSpec of th...
... any time. Try to avoid using it. Init this object to point to an application having the given creator code. If this app is missing, this will fail. It will first look for running application with the given creator. void initToAppWithCreatorCode( in OSType aAppCreator ); Parameters aAppCreator The signature of the app. Native code only!initWithCFURL Init this object with a CFURLRef. Note: Sup
ported only for XP_MACOSX. Note: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand. void initWithCFURL( in CFURLRef aCFURL ); Parameters aCFURL The CoreFoundation URL. Native code only!initWithFSRef Init this object with an FSRef. Note: Sup
ported only for XP_MACOSX. void initWithFSRef( [const] in FSRefPtr aFSRef ); Parameters aFSRef The native FSRef. Native code only!ini...
nsIMicrosummaryService
toolkit/components/places/public/nsIMicrosummaryService.idlScriptable This interface provides methods for managing installed microsummaries, and the bookmarks they apply to. ...
... toolkit/components/places/public/nsIMicrosummaryService.idlScriptable This interface provides methods for managing installed microsummaries, and the bookmarks they apply to. ...
...er or not the given bookmark has a current microsummary. installGenerator() Install the microsummary generator in the given XML definition. nsIMicrosummaryGenerator installGenerator( in nsIDOMDocument xmlDefinition ); Parameters xmlDefinition An nsIDOMDocument XML document defining the generator. Return value Returns the nsIMicrosummaryGenerator that was installed. isMicrosummary() Re
ports whether or not the given microsummary is the current microsummary for the given bookmark. boolean isMicrosummary( in long long bookmarkID, in nsIMicrosummary microsummary ); Parameters bookmarkID The bookmark to check. microsummary The microsummary to check. Return value Returns whether or not the microsummary is the current one for the bookmark. refreshMicrosummary() Refr...
nsIModule
xpcom/components/nsIModule.idlScriptable This interface must be implemented by each XPCOM component. It is the main entry point by which the system accesses an XPCOM component. ...
...not the component module can be unloaded by XPCOM. boolean canUnload( in nsIComponentManager aCompMgr ); Parameters aCompMgr The global component manager. Return value Indicates to the caller whether or not the component module can be unloaded. Returning true is not a guarantee that the module will be unloaded. It constitues only willingness of the module to be unloaded. It is very im
portant to ensure that no outstanding references to the module's code/data exist before returning true. Returning false guaratees that the module will not be unloaded. If the component module is native (that is, as part of a DLL), then this method may be called to determine whether or not the DLL may be unloaded from memory. Note: As of Gecko 1.7, native component modules are never unloaded. getClassO...
...rameters aCompMgr The global component manager. aClass The ClassID of object instance requested. aIID The IID of interface requested. aResult The resulting interface pointer. Exceptions thrown NS_ERROR_FACTORY_NOT_REGISTERED Indicates that the requested class is not available. NS_ERROR_NO_INTERFACE Indicates that the requested interface is not sup
ported. registerSelf() When the nsIModule is discovered, this method will be called so that any setup registration can be preformed. void registerSelf( in nsIComponentManager aCompMgr, in nsIFile aLocation, in string aLoaderStr, in string aType ); Parameters aCompMgr The global component manager. aLocation The location of the nsIModule on disk. aLoaderStr Opaque load...
nsIMsgHeaderParser
nsIMsgHeaderParser Defined in comm-central/ mailnews/ mime/ public/ nsIMsgHeaderParser.idl mailnews/mime/public/nsIMsgHeaderParser.idlScriptable ??? Add brief description of Interface ??? ...
...If any of the addresses doesn't have a mailbox, then the user name is used instead. AUTF8String extractHeaderAddressMailboxes( in string line ); Parameters line The header line to parse. Return value A comma-separated list of just the mailbox parts of the addresses. Exceptions thrown Missing Exception Missing Description Native code only!extractHeaderAddressNames Given a ...
...tractHeaderAddressMailboxes( in string line ); Parameters line The header line to parse. Return value A comma-separated list of just the mailbox parts of the addresses. Exceptions thrown Missing Exception Missing Description Native code only!extractHeaderAddressNames Given a string which contains a list of Header addresses, returns a comma-separated list of just the 'user name'
portions. If any of the addresses doesn't have a name, then the mailbox is used instead. AUTF8String extractHeaderAddressNames( in string line ); Parameters line The header line to parse. Return value A comma-separated list of just the name parts of the addresses. Exceptions thrown Missing Exception Missing Description Native code only!extractHeaderAddressName Like extractHeaderAd...
nsINavHistoryBatchCallback
toolkit/components/places/public/nsINavHistoryService.idlScriptable Please add a summary to this article. ...
... toolkit/components/places/public/nsINavHistoryService.idlScriptable Please add a summary to this article. ...
... toolkit/components/places/public/nsINavHistoryService.idlScriptable Please add a summary to this article. ...
nsINavHistoryObserver
You can still access the database in this situation but be careful (of what?). ...
...it is being deleted. onTitleChanged() Called whenever either the real title or the custom title of the page changes. Both titles are always included in this notification, even though only one is changed each time it is called, since often consumers will want to display the user title if available, falling back to the title specified by the page's <title> element if there is no user title. It's im
portant to note that there is a difference between an empty title and a null title. An empty string means the title was specifically set to be nothing. null means the title was not set at all. From C++ code, use the IsVoid() and SetIsvoid() methods to see whether an empty string is "null" or not; in either case it will always be an empty string. void onTitleChanged( in nsIURI aURI, in AString aPag...
...arksService.Constants defined in the nsINavBookmarksService interface. aGUID The unique ID associated with the page. aAdded Incremented by query nodes when the visited uri belongs to them. If no such query exists, the history result creates a new query node dynamically. It is used in places views only and can be ignored. Using onBeforeDeleteURI() in Gecko 1.9.1 If you wish to sup
port onBeforeDeleteURI() in applications based on Gecko 1.9.1, you must implement your observer's QueryInterface() method to match on both nsINavHistoryObserver and nsINavHistoryObserver_MOZILLA_1_9_1_ADDITIONS, as shown below. QueryInterface: function(iid) { if (iid.equals(Ci.nsINavHistoryObserver) || iid.equals(Ci.nsINavHistoryObserver_MOZILLA_1_9_1_ADDITIONS) || iid.equals(Ci.nsISuppo...
nsINavHistoryQuery
toolkit/components/places/public/nsINavHistoryService.idlScriptable Encapsulates all the query parameters you're likely to need when building up history UI. All parameters are ANDed together. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) The nsINavHistoryQuery is not intended to be a super-general query mechanism. This was designed so that most queries can be done in only one SQL query. ...
...re likely to need when building up history UI. All parameters are ANDed together. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) The nsINavHistoryQuery is not intended to be a super-general query mechanism. This was designed so that most queries can be done in only one SQL query. ...
...Time PRTime Read only: Retrieves the begin time value that the currently loaded reference points + offset resolve to. absoluteEndTime PRTime Read only: Retrieves the end time value that the currently loaded reference points + offset resolve to. annotation AUTF8String The annotation name. annotationIsNot boolean Test for existance or non-existance of a given annotation. We don't currently sup
port >1 annotation name per query. If annotationIsNot is true, we test for the non-existance of the specified annotation. Testing for not annotation will do the same thing as a normal query and remove everything that doesn't have that annotation. Asking for things that DO have a given annotation is a little different. It also includes things that have never been visited. This allows place queries to b...
nsINetworkLinkService
netwerk/base/public/nsINetworkLinkService.idlScriptable Network link status monitoring service. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5) Implemented by: @mozilla.org/network/network-link-service;1 as a service: var networkLinkService = Components.classes["@mozilla.org/network/network-link-service;1"] .getService(Components.interfaces.nsINetworkLinkService); Attributes Attribute Type Description isLinkUp boolean This is set to true when the system is believed to have a usable network connection. The link is only up when network connections can be established. For example, the link is down during DHCP conf...
...is not currently known, we generally assume that it is up. Read only. linkStatusKnown boolean This is set to true when we believe that isLinkUp is accurate. Read only. linkType unsigned long The type of network connection, one of the LINK_TYPE_* constants. Read only. Note: As of Gecko 8.0, all Operating Systems currently return LINK_TYPE_UNKNOWN. Android sup
port was backed out due to perceived security concerns, see bug 691054. As of Gecko 28.0 Android sup
port is available again, see bug 939680. Constants Constant Value Description LINK_TYPE_UNKNOWN 0 We were unable to determine the network connection type. LINK_TYPE_ETHERNET 1 A standard wired Ethernet connection. LINK_TYPE_USB ...
... LINK_TYPE_WIFI 3 A connection via a WiFi access point (IEEE802.11). LINK_TYPE_WIMAX 4 A connection via WiMax (IEEE802.16). LINK_TYPE_2G 5 A '2G' mobile connection (for example, GSM, GPRS, EDGE). LINK_TYPE_3G 6 A '3G' mobile connection (for example, UMTS, CDMA). ...
nsIObserver
xpcom/ds/nsIObserver.idlScriptable This interface is implemented by an object that wishes to observe notifications. These notifications are often, though not always, broadcast via the nsIObserverService. Inherits from: nsISup
ports Last changed in Gecko 0.9.6 Method overview void observe(in nsISup
ports aSubject, in string aTopic, in wstring aData); Methods observe() This method will be called when there is a notification for the topic that the observer has been registered for. ...
...ubject, in string aTopic, in wstring aData); Methods observe() This method will be called when there is a notification for the topic that the observer has been registered for. If you expect multiple topics/subjects, the implementor is responsible for filtering. You should not modify, add, remove, or enumerate notifications in the implementation of this method. void observe( in nsISup
ports aSubject, in string aTopic, in wstring aData ); Parameters aSubject In general reflects the object whose change or action is being observed. aTopic Indicates the specific change or action. aData An optional parameter or other auxiliary data further describing the change or action. Remarks The specific values and meanings of the parameters provided varies widely, though, accordin...
... can handle being called with unknown values for aTopic. The most common implementation of nsIObserverService is the XPCOM observer service. With this implementation, it's safe (and common practice) for an implementation of nsIObserver to remove itself as an observer during the Observe callback, or to add or remove other observers. Be careful, though, because other uses of nsIObserver may not sup
port these operations correctly within Observe. Example The following code is an implementation of nsIObserver that is registered to receive notifications for the "myTopicID" topic. See Observer Notifications for a list of built-in topics possible. Observing preferences works slightly differently. See Code snippets:Preferences - Using preference observers for an example. function myObserver() { ...
nsIProcessScriptLoader
The scripts run only once per process. The global object for process scripts is a ContentProcessMessageManager. Methods void loadProcessScript(in AString aURL, in boolean aAllowDelayedLoad) void removeDelayedProcessScript(in AString aURL); jsval getDelayedProcessScripts(); loadProcessScript() Load a script in the child process. Process scripts are loaded as soon as loadProcessScript() is called. ...
...ble at the time of the loadProcessScript() call, and if you pass false in this situation, your process script won't be loaded. For example: let ppmm = Services.ppmm.getChildAt(1); ppmm.loadProcessScript('data:,dump("foo\n");', true); Parameters Name Type Description aURL String URL for the script to load. aURL must be the absolute URL. data: URLs are also sup
ported. For example data:,dump("foo\n"); aAllowDelayedLoad Boolean If this flag is false, the process script will only be loaded into child processes that are already running at the time of the call. If this flag is true, the process script will be loaded into any new child processes created after the loadProcessScript() call, until removeDelayedProcessScript() is called for t...
...f the call. If this flag is true, the process script will be loaded into any new child processes created after the loadProcessScript() call, until removeDelayedProcessScript() is called for that script. If you are calling loadProcessScript() on a ChromeMessageSender, you should always pass true here. removeDelayedProcessScript() Removes aURL from the list of scripts which sup
port delayed load. This cancels the effect of the aAllowDelayedLoad flag, meaning that the loader will no longer load the script into new child processes. If you used aAllowDelayedLoad, you should call this as part of your cleanup (for example, when your add-on is disabled or uninstalled). Parameters Name Type Description aURL String URL for the script to remove. ...
nsIProperties
xpcom/ds/nsIProperties.idlScriptable This interface provides methods to access a map of named XPCOM object values. Inherits from: nsISup
ports Last changed in Gecko 1.2 Implemented by: @mozilla.org/file/directory_service;1. To get an instance, use: var properties = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties); Method overview void get(in string prop, in nsIIDRef iid, [iid_is(iid),retval] out nsQIResult result); void getKeys(out PRUint32 count, [array, size_is(count), retval] out string keys); boolean has(in string prop); void set(in string prop, in nsISup
ports value); void undefine(in string prop); Methods get() Gets the XPCOM object associated with a particular name. void get( in s...
... Methods get() Gets the XPCOM object associated with a particular name. void get( in string prop, in nsIIDRef iid, [iid_is(iid),retval] out nsQIResult result ); Parameters prop The property name. iid The desired interface. result The resulting object instance. Exceptions thrown NS_ERROR_FAILURE If the property does not exist. NS_ERROR_NO_INTERFACE If the property exists, but does not sup
port the requested interface. getKeys() Returns an array of property names. nsMemory.h defines the macro NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY, which can be used to free aKeys when it is no longer needed. void getKeys( out PRUint32 count, [array, size_is(count), retval] out string keys ); Parameters count The length of the result array. keys The resulting array of keys. has() Tests if a proper...
...retval] out string keys ); Parameters count The length of the result array. keys The resulting array of keys. has() Tests if a property exists. boolean has( in string prop ); Parameters prop The property name. Return value true if the property exists, false if the property does not exist. set() Sets the XPCOM object associated with a particular name. void set( in string prop, in nsISup
ports value ); Parameters prop The property name. value The XPCOM object value to associate with prop. undefine() Undefines a property. void undefine( in string prop ); Parameters prop The property name. Remarks This interface was frozen for Gecko 1.2. See bug 162114 for details. From Gecko 2.0 interfaces are no longer frozen. ...
nsIResumableChannel
netwerk/base/public/nsIResumableChannel.idlScriptable This interface is meant to be implemented by the channels that sup
port resuming broken downloads (for example Necko's HTML and FTP channels). Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void asyncOpenAt(in nsIStreamListener listener, in nsISup
ports ctxt, in unsigned long startPos, in nsIResumableEntityID entityID); Obsolete since Gecko 1.8 void resumeAt(in unsigned long long startPos, in ACString entityID); Attributes Attribute Type Description entityID ACString The entity id for this URI. Available after OnStartRequest. Read only. Exceptions thrown NS_ERROR_NOT_RESUMABLE If this load is not resumable. Methods asyncOpenAt() ...
...ceptions thrown NS_ERROR_NOT_RESUMABLE If this load is not resumable. Methods asyncOpenAt() Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Open this channel, and read starting at the specified offset. The request given to the nsIStreamListener will be QIable to nsIResumableInfo. void asyncOpenAt( in nsIStreamListener listener, in nsISup
ports ctxt, in unsigned long startPos, in nsIResumableEntityID entityID ); Parameters listener As for asyncOpen. ctxt As for asyncOpen. startPos The starting offset, in bytes, to use to download. entityID Information about the file, to match before obtaining the file. Pass an empty string to use anything. resumeAt() Prepare this channel for resuming. The request will not start until asyncOpen o...
...aining the file. Pass an empty string to use anything. resumeAt() Prepare this channel for resuming. The request will not start until asyncOpen or open is called. Calling resumeAt after open or asyncOpen has been called has undefined behaviour. During OnStartRequest, this channel will have a status of NS_ERROR_NOT_RESUMABLE if the file cannot be resumed, for example because the server doesn't sup
port this. This error may occur even if startPos is 0, so that the front end can warn the user. Similarly, the status of this channel during OnStartRequest may be NS_ERROR_ENTITY_CHANGED, which indicates that the entity has changed, as indicated by a changed entityID. In both of these cases, no OnDataAvailable will be called, and OnStopRequest will immediately follow with the same status code. void re...
nsISSLErrorListener
Method overview boolean notifySSLError(in nsIInterfaceRequestor socketInfo, in PRInt32 error, in AUTF8String targetSite); Methods notifySSLError() Called in case of an SSL error. ...
...Method overview boolean notifySSLError(in nsIInterfaceRequestor socketInfo, in PRInt32 error, in AUTF8String targetSite); Methods notifySSLError() Called in case of an SSL error. ...
...sed to obtain more information about the active connection. error The code associated with the error. The SSL status object that describes the problem(s). targetSite The site name that was used to open the current connection. Return value The consumer shall return true if it wants to suppress the error message related to the error (the connection will still get canceled). See also nsISocketTrans
port ...
nsIScreen
widget/nsIScreen.idlScriptable This interface provides information about a display screen. Inherits from: nsISup
ports Last changed in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10) Use nsIScreenManager to obtain references to screens. Implemented by: @mozilla.org/gfx/screenmanager;1 as a service: var screen = Components.classes["@mozilla.org/gfx/screenmanager;1"] .getService(Components.interfaces.nsIScreen); Method overview void GetAvailRect(out long left, out long top, out long width, out long height); void GetRect(out long left, out long top, out long width, out long height); void lockMinimumBrightness(in unsigned long brightness); void unlockMinimumBrightness(in unsigned long brightness); Attributes ...
...en's color depth; this is the number of bits used to represent a color. Read only. pixelDepth long The screen's pixel depth; this is the number of bits used to represent a pixel. Read only. rotation unsigned long The screen's current rotation; you may set this to any of the values listed in Screen rotation constants. This will only have an effect on platforms that sup
port screen rotation. Gecko 1.9.2 note Starting in Gecko 1.9.2, Gecko running on Microsoft Windows re
ports 24 bits per pixel instead of 32 bits per pixel on 8-bits per color component displays, since this is typically what the caller is actually looking for. Constants Screen brightness constants Constant Value Description BRIGHTNESS_DIM 0 The screen is fully ...
...x 13.0 / Thunderbird 13.0 / SeaMonkey 2.10) Constant Value Description ROTATION_0_DEG 0 0? of rotation (that is, no rotation, or default orientation). ROTATION_90_DEG 1 90? of rotation. ROTATION_180_DEG 2 180? of rotation. ROTATION_270_DEG 3 270? of rotation. Methods GetAvailRect() Returns a rectangle indicating the
portion of the screen that is available for use. Note: This returns a rectangle representing the region of the screen that is available for application use. For example, this would exclude the area occupied by the menu bar and Dock on Mac OS X. void GetAvailRect( out long left, out long top, out long width, out long height ); Parameters left The left edge of the available screen rect...
nsISelectionPrivate
See the idl file linked above for up-to-date information. ...
...See the idl file linked above for up-to-date information. ...
...See the idl file linked above for up-to-date information. ...
nsIStandardURL
Inherits from: nsIMutable Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/network/standard-url;1. ...
... on how URLs are normalized. Inherits from: nsIMutable Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/network/standard-url;1. To create an instance, use: var standardURL = Components.classes["@mozilla.org/network/standard-url;1"] .createInstance(Components.interfaces.nsIStandardURL); Method overview void init(in unsigned long aUrlType, in long aDefault
Port, in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI); Attributes Attribute Type Description mutable boolean Control whether or not this URL can be modified. Protocol handlers can set this flag before handing out an URL to ensure that it is not inadvertently modified. Obsolete since Gecko 1.9 Constants These constants describe how to normalize an URL. Constant Value D...
...://foo/bar blah:/foo/bar => blah://foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah://foo/bar URLTYPE_NO_AUTHORITY 3 blah:foo/bar => blah:///foo/bar blah:/foo/bar => blah:///foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah:///foo/bar Methods init() Normalizes a given URL to an Standard URL. void init( in unsigned long aUrlType, in long aDefault
Port, in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI ); Parameters aUrlType One of the constants listed above. aDefault
Port If the
port parsed from the URL string matches this
port, then the
port will be removed from the canonical form of the URL. aSpec URL string. aOriginCharset The charset from which this URI string originated. this corresponds to the charset that should ...
nsIStreamConverter
anager using a contractid in the format below. Second, the stream converter must add the contractid to the registry. Stream converter contractid format (the stream converter root key is defined in this file): @mozilla.org/streamconv;1?from=FROM_MIME_TYPE&to=TO_MIME_TYPE Method overview void asyncConvertData(in string aFromType, in string aToType, in nsIStreamListener aListener, in nsISup
ports aCtxt); nsIInputStream convert(in nsIInputStream aFromStream, in string aFromType, in string aToType, in nsISup
ports aCtxt); Methods asyncConvertData() Asynchronous version: Converts data arriving via the converter's nsIStreamListener.OnDataAvailable() method from one type to another, pushing the converted data out to the caller via aListener::OnDataAvailable(). Use this method wh...
...Converts data arriving via the converter's nsIStreamListener.OnDataAvailable() method from one type to another, pushing the converted data out to the caller via aListener::OnDataAvailable(). Use this method when you want to proxy (and convert) nsIStreamListener callbacks asynchronously. void asyncConvertData( in string aFromType, in string aToType, in nsIStreamListener aListener, in nsISup
ports aCtxt ); Parameters aFromType The MIME type of the original/raw data. aToType The MIME type of the converted data. aListener The listener who receives the converted data. aCtxt Either an opaque context, or a converter specific context (implementation specific). convert() Synchronous version: Converts a stream of one type, to a stream of another type. Use this m...
...ner who receives the converted data. aCtxt Either an opaque context, or a converter specific context (implementation specific). convert() Synchronous version: Converts a stream of one type, to a stream of another type. Use this method when you have a stream you want to convert. nsIInputStream convert( in nsIInputStream aFromStream, in string aFromType, in string aToType, in nsISup
ports aCtxt ); Parameters aFromStream The stream representing the original/raw data. aFromType The MIME type of aFromStream. aToType The MIME type of the returned stream. aCtxt Either an opaque context, or a converter specific context (implementation specific). Return value The converted stream. Note: The returned stream may not already be converted. An efficient s...
nsITraceableChannel
netwerk/base/public/nsITraceableChannel.idlScriptable This interface is used to allow intercepting of HTTP traffic. It is implemented by nsIHttpChannel. 1.0 66 Introduced Gecko 1.9.0.4 Inherits from: nsISup
ports Last changed in Gecko 1.9.0.4 The typical way to use this interface is as follows: Register for the "http-on-examine-response" notification to track all HTTP responses; Skip redirects (responseStatus = 3xx on nsIHttpChannel), since otherwise you may end up with two listeners registered for a channel; QI the channel passed as the "subject" to your observer to nsITraceableChannel, and replace the default nsIStreamListener (that passes the data to the original requester - e.g. to XMLHttpRequest or to the browser tab that made the request) with your own implementatio...
...e the listener. In particular, listeners typically should not be replaced after onStartRequest has been called. Example This example can be copied and pasted into a JavaScript interpreter and run. This example uses Promise syntax that is available in Firefox 30 and onwards. ...
...aContext); }, onStopRequest: function(aRequest, aContext, aStatusCode) { this.responseBody = this.receivedChunks.join(""); delete this.receivedChunks; this.responseStatus = aStatusCode; this.originalListener.onStopRequest(aRequest, aContext, aStatusCode); this.deferredDone.resolve(); }, QueryInterface: function(aIID) { if (aIID.equals(Ci.nsIStreamListener) || aIID.equals(Ci.nsISup
ports)) { return this; } throw Cr.NS_NOINTERFACE; } }; var httpResponseObserver = { observe: function(aSubject, aTopic, aData) { var newListener = new TracingListener(); aSubject.QueryInterface(Ci.nsITraceableChannel); newListener.originalListener = aSubject.setNewListener(newListener); /////// END - DO NOT EDIT newListener.promiseDone.then( function() { // no error happened ...
nsIUploadChannel
Read only. Methods setUploadStream() Sets a stream to be uploaded by this channel. ...
...Read only. Methods setUploadStream() Sets a stream to be uploaded by this channel. ...
... Type Description uploadStream nsIInputStream Get the stream (to be) uploaded by this channel. Read only. Methods setUploadStream() Sets a stream to be uploaded by this channel. Most implementations of this interface require that the stream: implement threadsafe addRef and release implement nsIInputStream.readSegments() implement nsISeekableStream.seek(). History here is that we need to sup
port both streams that already have headers (for example, Content-Type and Content-Length) information prepended to the stream (by plugins) as well as clients (composer, uploading application) that want to upload data streams without any knowledge of protocol specifications. For this reason, we have a special meaning for the aContentType parameter. void setUploadStream( in nsIInputStream aStream, ...
nsIVariant
xpcom/ds/nsIVariant.idlScriptable XPConnect has magic to transparently convert between nsIVariant and JS types. We mark the interface [scriptable] so that JS can use methods that refer to this interface. But we mark all the methods and attributes [noscript] since any nsIVariant object will be automatically converted to a JS type anyway. ...
...olates the XPCOM interface guidelines PRInt16 getAsInt16(); Native code only! PRInt32 getAsInt32(); Native code only! PRInt64 getAsInt64(); Native code only! PRUint8 getAsInt8(); Native code only! void getAsInterface(out nsIIDPtr iid, [iid_is(iid), retval] out nsQIResult iface); Native code only! nsISup
ports getAsISup
ports(); Native code only! jsval getAsJSVal(); Native code only! string getAsString(); Native code only! void getAsStringWithSize(out PRUint32 size, [size_is(size), retval] out string str); Native code only! PRUint16 getAsUint16(); Native code only! PRUint32 getAsUint32(); Native code only! ...
...Uint8 getAsInt8(); Parameters None. Return value If the internal value is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRInt8 then the value is returned. Native code only!getAsInterface void getAsInterface( out nsIIDPtr iid, [iid_is(iid), retval] out nsQIResult iface ); Parameters iid The IID of the interface pointer, or nsISup
ports if no IID was provided. iface The interface pointer. (The reference count of the object is incremented.) Native code only!getAsISup
ports nsISup
ports getAsISup
ports(); Parameters None. Return value The interface pointer. (The reference count of the object is incremented.) Native code only!getAsJSVal jsval getAsJSVal(); Parameters None. Return value Returns the underlying JS valu...
nsIWebContentHandlerRegistrar
xpfe/appshell/public/nsIWebContentHandlerRegistrar.idlScriptable Applications wishing to use web content handlers need to implement this interface. Typically they will prompt the user to confirm adding an entry to the local list. ...
...else it will throw permission error. Can bypass this by opening about:config and setting preference of gecko.handlerService.allowRegisterFromDifferentHost to true. Examples Register a webmail service as mailto handler The following code aims to add "Outlook.com Live Mail" to list of webservice handlers. In the image below "Gmail" and "Yahoo! Mail" already exist as webservice handlers. ...
...s as a content or protocol handler' when calling method: [nsIWebContentHandlerRegistrar::registerProtocolHandler] If the host names do match then a confirmation like this will be seen: This domain check can be bypassed by setting the preference of gecko.handlerService.allowRegisterFromDifferentHost to true as in this code here: var {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.im
port("resource://gre/modules/Services.jsm"); var nsiwchr = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getService(Ci.nsIWebContentHandlerRegistrar); var allowRegisterFromDifferentHost = Services.prefs.getBoolPref('gecko.handlerService.allowRegisterFromDifferentHost'); if (!allowRegisterFromDifferentHost) { Services.prefs.setBoolPref('gecko.handlerService...
nsIWorker
hreads/nsIDOMWorkers.idlScriptable This interface represents a DOM worker thread. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsIAbstractWorker Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) For usage details, see worker and the article Using DOM workers. ...
...Workers.idlScriptable This interface represents a DOM worker thread. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsIAbstractWorker Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) For usage details, see worker and the article Using DOM workers. ...
...in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) For usage details, see worker and the article Using DOM workers. Method overview void postMessage(in DOMString aMessage, [optional] in nsIWorkerMessage
Port aMessage
Port); Attributes Attribute Type Description onmessage nsIDOMEventListener An object to receive notifications when messages are received on the worker's message
port. Methods postMessage() Used to allow the worker to send a message back to the web application that created it. void postMessage( in DOMString aMessage, in nsIWorkerMessage
Port aMessage
Port Optional ); Parameters aMessage The message the worker wishes to post back to its creator. aMessage
Port A message
port on which to post the message; if not specified, the default message
port is used. ...
nsIWorkerMessageEvent
ace represents an event in a web worker thread's event queue. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsIDOMEvent Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Method overview void initMessageEvent(in DOMString aTypeArg, in boolean aCanBubbleArg, in boolean aCancelableArg, in DOMString aDataArg, in DOMString aOriginArg, in nsISup
ports aSourceArg); Attributes Attribute Type Description data DOMString The event's data. Read only. origin DOMString The event's origin. Read only. source nsISup
ports The event's source. Read only. Methods initMessageEvent() Initializes the message event. void initMessageEvent( in DOMString aTypeArg, in boolean aCanBubb...
... aCanBubbleArg Whether or not the event can bubble. aCancelableArg Whether or not the event can be canceled. aDataArg The data to place into the data attribute. ...
...Sup
ports aSourceArg ); Parameters aTypeArg The event type. ...
nsIXPCScriptable
guarantee that they set the *_retval of the various methods that return a boolean to PR_TRUE before making the call. Implementations may skip writing to *_retval unless they want to return PR_FALSE. js/src/xpconnect/idl/nsIXPCScriptable.idlNot scriptable Please add a summary to this article. ...
...ous methods that return a boolean to PR_TRUE before making the call. Implementations may skip writing to *_retval unless they want to return PR_FALSE. js/src/xpconnect/idl/nsIXPCScriptable.idlNot scriptable Please add a summary to this article. ...
...P_MODS_TO_PROTOTYPE 1 << 25 DONT_SHARE_PROTOTYPE 1 << 26 DONT_REFLECT_INTERFACE_NAMES 1 << 27 WANT_EQUALITY 1 << 28 WANT_OUTER_OBJECT 1 << 29 WANT_INNER_OBJECT 1 << 30 RESERVED 1 << 31 The high order bit is RESERVED for consumers of these flags. No implementor of this interface should ever return flags with this bit set. ...
nsIXULWindow
When the window is destroyed, it will fire a "xul-window-destroyed" notification through the global observer service. This signals the application in case it needs to quit. ...
...this window. Read only. intrinsicallySized boolean Indicates if this window is instrinsically sized. primaryContentShell nsIDocShellTreeItem The primary content shell. Note: That this is a docshell tree item and therefore can not be assured of what object it is. It could be an editor, a docshell, or a browser object. Or down the road any other object that sup
ports being a DocShellTreeItem Query accordingly to determine the capabilities. Read only. XULBrowserWindow nsIXULBrowserWindow Provides access to the XULBrowserWindow object offering a way for the browser to update the user interface of the enclosing XUL window. zLevel unsigned long One of the Z level constants below. On some platforms, windows with a higher zLevel will...
...the function creates a browser window and waits for it to load. You can then load a document into the window's primary content shell. getContentShellById() The content shell specified by the supplied id. Note: That this is a docshell tree item and therefore can not be assured of what object it is. It could be an editor, a docshell, or a browser object. Or down the road any other object that sup
ports being a DocShellTreeItem Query accordingly to determine the capabilities. nsIDocShellTreeItem getContentShellById( in wstring ID ); Parameters ID The ID of the content shell, which is the same as the "type" attribute on the containing frame element. Return value The tree item corresponding to the given ID, if any. removeChildWindow() Tell this window that it has lost a child XUL wi...
XPCOM
cko is created. If the component uses only "frozen" XPCOM interfaces, there is a good chance the same binary component will work with different versions of Gecko (version 1.8 and 1.9, for example). The more likely case is that the component uses "unfrozen" interfaces and those interfaces can change between Gecko versions. This can create a difficult situation for extension developers trying to sup
port multiple Gecko versions (Firefox 2 and 3, for example).Creating a Python XPCOM componentCreating Applications with Mozilla already provides a tutorial for making a simple JavaScript or C++ component (implementing the nsISimple interface). Here is how to make the same component in Python using PyXPCOM.Fun With XBL and XPConnectGenerating GUIDsGUIDs are used in Mozilla programming for identifying s...
...art pointers. This guide provides some explanation and advice on how to choose between them.Observer NotificationsThe following are topics that you can observe during the course of an application. Unless otherwise noted you register for the topics using the nsIObserverService.Setting HTTP request headersHTTP is one of the core technologies behind the Web. In addition to the actual content, some im
portant information is passed with HTTP headers for both HTTP requests and responses.StorageStorage is a SQLite database API. It is available to trusted callers, meaning extensions and Firefox components only.The Thread ManagerThe Thread Manager, introduced in Firefox 3, offers an easy to use mechanism for creating threads and dispatching events to them for processing. Troubleshooting XPCOM compon...
...ese synchronization objects (e.g. Mutex::Lock()) has a matching function in NSPR (PR_Lock()). This is no accident, as mozilla:: primitives are merely bare-minimum wrappers around NSPR's.xptcall FAQxptcall is a small low level XPCOM method call library. It is implemented using platform specific C/C++ and assembly language code. It is used to facilitate cross language and cross thread method calls.
Porting this code is required in order to make Mozilla run on any given platform.Xptcall
Porting GuideOriginal Author: John Bandhauer, 31 May 1999.Xptcall
Porting StatusThis is a status page for the multiplatform
porting of xptcall. xptcall has a FAQ and a
Porting Guide. Join the XPCOM community Choose your preferred method for joining the discussion: ...
XUL Overlays
ut the components or additional packages that have been installed with the browser. When a component such as the "Super Stream Player" from the examples above is registered there, overlays associated with that component are loaded automatically. When the component is not present, only the base files are loaded. Loading overlays at runtime Firefox 1.5 and other Gecko 1.8-based applications also sup
port loading overlays on-the-fly via the document.loadOverlay() function. TODO: elaborate Overlays and skins Warning: Always load master skins from base files. Never load master skins from overlays. Unlike base files, overlays should never load the master skin file for a package. The navigatorOverlay.xul file, for example, does not and should never load the navigator.css file that defines the master...
...the same as the global skin. For any package, the master skin file is that CSS file named after the package itself. The master skin file for the bookmarks package, for example, is called bookmarks.css, and is located in the skin/default subdirectory. Overlaying attributes In addition to new elements and subtrees, you can also overlay attributes into existing elements. In XUL, attributes control im
portant features of the skin like image sources, as in the following example, where an overlay destructively overwrites the image source in the base file with a replacement. In the base file, the HTML image element points to a Netscape GIF icon: <html:img id="foo" src="netscapeImage.gif"/> In the overlay, an element with the same ID attribute specifies a different image, and that image is superimposed...
...a different image, and that image is superimposed on top of the original Netscape image as part of the merge process: <html:img id="foo" src="mozillaImage.gif"/> When the base file references an overlay file which contains the html image element above, the new src attribute is superimposed over the original, and the Mozilla icon replaces the Netscape icon. Overlay positioning XUL overlays also sup
port positioning of nodes. You can specify a position attribute on a node in the overlay to provide a hint for insertion into the master document. In the following example, the last menu item, Example Four, will be placed just after the "New" menu item instead of being appended to the end of the menu like the other kids. <overlay id="main-overlay" xmlns:html="http://www.w3.org/1999/xhtml" xml...
Mozilla technologies
Mozilla has several technologies used as components of its projects. These are documented here. Accessibility API Implementation DetailsThese pages contain documentation on Mozilla specific implementation details of Assistive Technology APIs.Animated PNG graphicsAPNG is an extension of the
Portable Network Graphics (PNG) format, adding sup
port for animated images. APNG is a simpler alternative to MNG, providing a spec suitable for the most common usage of animated images on the Internet.DocShellDocshell is the second iteration of what originally started out as WebShell. At the moment, the transition from WebShell to DocShell is not fully completed, but the long-term goal is to remove WebShell and switch over entirely to DocShell.Embedded Dialog APIFeed content access APIFirefox 2...
...th HTMLThis page gathers technical solutions to common problems encountered by teams shipping HTML-based interfaces inside Firefox.MorkMork is a database file format invented by David McCusker for the Mozilla code since the original Netscape database information was proprietary and could not be released open source. Starting with Mozilla 1.9, it was phased out in favor of SQLite, a more widely-sup
ported file format.PlacesPlaces is the bookmarks and history management system introduced in Firefox 3. It offers increased flexibility and complex querying to make handling the places the user goes easier and more convenient. It also includes new features including favicon storage and the ability to annotate pages with arbitrary information. It also introduces new user interfaces for managing all thi...
...rosoft COM. It has multiple language bindings, allowing XPCOM components to be used and implemented in JavaScript, Java, and Python in addition to C++.XPIDLXPIDL is an Interface Description Language used to specify XPCOM interface classes.Xray visionGecko runs JavaScript from a variety of different sources and at a variety of different privilege levels.XSLT 2.0Although XSLT 2.0 is not natively sup
ported in Firefox, it is possible via Saxon-B (Java) or, more recently, Saxon-CE (JavaScript) to perform XSLT 2.0.XTFThe eXtensible Tag Framework (XTF) allows adding sup
port for new namespaces using XPCOM components to Mozilla (written in JavaScript or C++). For example, the Mozilla XForms Project uses XTF to add sup
port for the XForms namespace. ...
Address Book examples
with remote address books (e.g. LDAP). Hence the additional !ab.isRemote check How do I add/edit/delete contacts? Note: Not all address books can be written to. ...
...sToDelete); How do I add and use my own properties? Use the setProperty/getProperty functions on nsIAbCard to set your property in the same way as you would do with normal properties: card.setProperty("Random1", "xyz"); card.setProperty("Random2", "foo"); ... my value = card.getProperty("Random1"); Note: Local (mork) address books are currently the only built-in type of address book that sup
ports saving of non-built-in properties. However, outlook directories are the only other built-in write capable directories. How do I add/edit/delete mailing lists? Adding a Mailing List First create a mailing list object and initialize it: var mailList = Components.classes["@mozilla.org/addressbook/directoryproperty;1"] .createInstance(Components.interfaces.nsIAbDirectory...
...ister a load listener for a contact, the following should take place within the scope of the contact editor dialog: /* An example load listener for a contact * aCard the nsIAbCard being loaded * aDocument a reference to the contact editor document */ function foo(aCard, aDocument) { // Do something useful, like disabling // input fields that cards for this // address book type do not sup
port. } RegisterLoadListener(foo); Save listeners are functions that take the same parameters, and can be registered with: RegisterSaveListener(foo); Load and save listeners can be unregistered using UnregisterLoadListener(foo) and UnregisterSaveListener(foo), respectively. Photo handlers Photo handlers allow developers to customize the behavior of the contact editor when loading or saving con...
Autoconfiguration in Thunderbird
count setup without having to set up a configuration server. This method is not practical for other use cases, because it is difficult to update the configuration file. Guessing If all other mechanisms failed, Thunderbird tries to guess the configuration, by trying common server names like imap.<domain>, smtp.<domain>, mail.<domain> etc., and, when a mail server answers, checking whether it sup
ports SSL, STARTTLS and encrypted passwords (CRAM-MD5). Manual configuration If guessing fails, the user must manually enter the configuration information. Users may also choose to manually modify the account settings, even if configuration information is successfully obtained by the methods described above. All the lookup mechanisms use the email address domain as base for the lookup. For exampl...
...for the email address fred@example.com , the lookup is performed as (in this order): tb-install-dir/isp/example.com.xml on the harddisk check for autoconfig.example.com look up of "example.com" in the ISPDB look up "MX example.com" in DNS, and for mx1.mail.hoster.com, look up "hoster.com" in the ISPDB try to guess (imap.example.com, smtp.example.com etc.) We may add DNS SRV records as sup
ported mechanism in the future, but we currently do not. How to add sup
port for your domain Classification If you are a big ISP (> 100,000 users) providing email addresses solely under a few domains like "example.com" and "example.de", you may either submit the configuration to the ISPDB or set up a configuration server. If you sup
port email aliases and the user's login name is not part of the e...
...turn 301 http://autoconfig.hoster.com$request_uri; } Or serve them directly from a common directory: server { listen 10.2.3.4:80; #again, use your server's public IP here! server_name autoconfig.*; location / { root /var/www/autoconfig; } } SSL https was added in June 2019 to the spec. Please use https whenever possible. Former versions of this spec defined http only. http is still sup
ported for existing hosts and in order to sup
port domain hosters. http is deprecated now, but will need to be sup
ported until at least end of 2023 for both of these reasons. Configuration file This is described at How to create a configuration file and defined on the sub-pages. ...
Filelink Providers
nsIMsgCloudFileProvider Note: Cloudfiles and BigFiles were the two temporary feature names that were used while Filelink was under construction. Both refer to the Filelink feature. Filelink storage providers must implement the nsIMsgCloudFileProvider interface. The Hightail implementation is a great place to look for examples and inspiration. ...
...ect what account type they would like to create from a menulist. Some providers require Thunderbird to do very little in order to connect a user to their account. Other providers however may require the user to fill in additional details in order to connect to the service. Hightail, for example, requires a username and password. Other services may require the user to fill in a server string or
port number. A provider implementation can choose what information it gets from the user from the setup dialog by pointing the settingsURL attribute of their nsIMsgCloudFileProvider implementation to a chrome URL for an XHTML page that contains a form with the extra information. That URL is then loaded into an IFrame directly beneath the provider menulist. Note: The setup dialog window should resize...
... settings, the settings XHTML page should contain a form with the id "provider-form", with its onsubmit attribute set to "return false;". Example: <form id="provider-form" onsubmit="return false;"> <label for="username">Username:</label> <input id="username" type="text" required="true" /> <label for="server">Server:</label> <input id="server" type="text" required="true" /> <label for="
port">
Port:</label> <input id="
port" pattern="[0-9]+" required="true" /> </form> The form is expected to use HTML5 form validation. For each input event, the checkValidity method of the form is automatically called. The button to set up the account will only become enabled once the checkValidity method for the form returns true. Saving custom settings in preferences Custom settings for a provide...
MailNews fakeserver
or use in automated tests. It can also be used in manual QA tests. Basic Structure Fakeserver is situated entirely under mailnews/test/fakeserver/. It is comprised of three major components: a daemon, a handler, and the server itself. The server itself is found in mailnews/test/fakeserver/maild.js and was largely based off of the httpd fakeserver from network code. It utilizes UTF-8 as its trans
port mechanism and is capable of performing proper pipelining of commands. The other two components are specific to the protocol type and found under similar files in the same directory (e.g., smtpd.js). A daemon is information about the server that can be manipulated. An example of such a manipulation is adding a folder or adding messages. Daemons should usually persist for the entirety of the test. ...
...rent components of fakeserver, a total of four objects need to be set up in a fakeserver test on top of other testing. The outline of a test looks like this: var daemon = setupDaemon(); // Check with your local fakeserver docs var handlers = [ /* Some set of handlers */ ]; for (var handler in handlers) { // This sets up the fake server var server = new nsMailServer(new handler(daemon)); //
Port to use. I tend to like using 1024 + default
port number myself. // Probably best to include as a constant somewhere. Also, use something // larger than 1024 for best results. server.start(
port); // Set up a nsIMsgIncomingServer locally localserver.someActionRequiringConnection(); server.performTest(); // Nothing will be executed until the connection is closed // localserver.close...
...To enable/disable debugging, call setDebugLevel on your nsMailServer instance with one of the following options: const fsD...
Building a Thunderbird extension 3: install manifest
Description> <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> <em:minVersion>1.5</em:minVersion> <em:maxVersion>5.0.*</em:maxVersion> </Description> </em:targetApplication> </Description> </RDF> The following items (shown in bold) should be customized for your application: <em:id>myfirstext@jen.zed</em:id>: This is the ID of the extension. The first
portion is the short name of the extension and must be in lowercase; the last
portion is a two-part period-delimited value such as your first and last name or the top-level domain of your website. While this value is in email address format, it is not an email address. It should, however, be a unique value so that it does not conflict with other extensions. <em:name>My First Extension</em:name>: The...
...defined by Mozilla. A list of valid application ids can be found here. Normally the id does not change and is always the same even for different versions of Thunderbird. <em:minVersion>1.5</em:minVersion>: This element indicates the earliest version of Thunderbird for which the extension is intended to work. Do not use a wildcard (such as "*"). ...
... There are more optional elements that can be specified in install.rdf. These are described on the Install Manifests page. Note that elements can be specified in any order, as long as they are children of the <Description> node. ...
Using the Multiple Accounts API
By Alec Flett alecf@flett.org Structure Servers Identities Storage Creating new accounts SMTP Servers Appendix A: Listing of all preferences and properties Structure The account system consists of: The Account Manager (nsIMsgAccountManager): There is a single account manager in the the client, which maintains the list of accounts, servers, etc. It is also responsible for the creation of any new account-related objects. The account manager maintains the main list of Accounts. ...
... created. To create accounts using the API, you should do the following: Create a fresh identity with createIdentity(); Assign values to the various identity properties as necessary. Create a fresh incoming server with createIncomingServer(). You will need to pass it the server type as a string, from the list above. Assign values to the various server properties as necessary. The most im
portant properties here are the userName and the hostname. Create a fresh account with createAccount(); Assign the server to the account with the incomingServer attribute. Assign the identity to the account with the AddIdentity() method. Some sample code: (where accountManager is the account manager. var identity = accountManager.createIdentity(); identity.email="fred@myisp.com"; var ser...
...entity(identity); That's it! Now you have a working account, identity, and server. It is possible, through some tricks with server and identity keys, to share servers and identities between accounts. You can do this by referring to the same identity or server key in the preferences, or with clever calls to the account manager. (Left as an exercise for the reader.)This will work but it is not sup
ported. The UI will act slighty strange when you share information between accounts. The current plans prevent sharing of information between accounts using the UI. Relevant API calls: nsIMsgAccount nsIMsgAccountManager.createAccount() nsIMsgAccount nsIMsgAccountManager.getAccount(in string key) nsIMsgIncomingServer nsIMsgAccountManager.createIncomingServer(in string type) nsIMsgIncoming...
Using popup notifications
These non-modal notifications let the user make decisions when they have a moment to do so, instead of being forced to deal with them at possibly inconvenient times. For example, this popup notification is displayed when a web site requests geolocation information: This lets the user decide whether or not to share their location when it's convenient to do so, instead of being compelled to do it at once. ...
... notification, then clicking on the notification icon to bring it back again. A popup notification can include a text message, a button action, and zero or more additional actions provided in a drop-down menu accessed through the notification's button. Creating a popup notification Popup notifications can be created using the PopupNotifications.jsm JavaScript code module. This code module is im
ported by the browser, so you don't need to do it explicitly yourself. Then you can create the popup notification at the appropriate time like this: PopupNotifications.show(gBrowser.selectedBrowser, "sample-popup", "This is a sample popup notification.", null, /* anchor ID */ { label: "Do Something", accessKey: "D", callback: function() { ...
... menu, the corresponding callback is invoked. Choosing the "Not Now" option dismisses the notification; it can be brought back by clicking on the notification icon again. Implementing a timeout function for the popup notification You can use a timeout to make your notification automatically disappear after some amount of time, by calling notification.remove() as shown below. ...
Using the Mozilla source server
PATH (the cvs.exe from MozillaBuild has problems, use this one instead) Note: Do not use the CVS from MozillaBuild, it will not work! Set up symbols Follow the instructions for Using the Mozilla symbol server. Once the symbol path is set you must now enable Source Server. Using the source server in WinDbg In the WinDbg command line, type .srcfix and hit enter. This enables source server sup
port. ...
...Also, disable (uncheck) the box that says "Require source files to exactly match the original version". ...
...Also, disable (uncheck) the box that says "Require source files to exactly match the original version". Start debugging your program. ...
Using Objective-C from js-ctypes
ries page. Converting Objective-C code to C code To convert Objective-C code to js-ctypes, we need to convert it to C code first. We can then convert it straight to js-ctypes code. Speech Synthesis Example Let's start with the following Objective-C code, which invokes the Speech Synthesis API to say "Hello, Firefox!". It uses the default system voice and waits until the speaking is done. #im
port <AppKit/AppKit.h> int main(void) { NSSpeechSynthesizer* synth = [[NSSpeechSynthesizer alloc] initWithVoice: nil]; [synth startSpeakingString: @"Hello, Firefox!"]; // Wait until start speaking. while (![synth isSpeaking]) {} // Wait while speaking. while ([synth isSpeaking]) {} [synth release]; return 0; } Save this file as test.m, and run with the following command, inside t...
...ctypes in a relatively straightforward manner. Types and Functions In addition to the above code, we need to declare function and types. Types Types can be readily declared. BOOL is defined in /usr/include/objc/objc.h. let id = ctypes.StructType("objc_object").ptr; let SEL = ctypes.StructType("objc_selector").ptr; let BOOL = ctypes.signed_char; Functions All functions in our example are ex
ported by /usr/lib/libobjc.dylib. let lib = ctypes.open(ctypes.libraryName("objc")); Function definition is the more tricky part. In this example, objc_msgSend is used in 3 ways. We need to declare three different FunctionType CDatas: Returns id or compatible type. Returns BOOL. Returns nothing. let objc_msgSend_id = lib.declare("objc_msgSend", ctypes.default_abi, ...
...NSUTF8StringEncoding)); Converted js-ctypes code Finally, we have our converted code. This can run with a copy-and-paste into a JavaScript shell. This example uses a busy loop, and thus, Firefox won't respond until the speaking is done. If this code were to be used in a production add-on, then to avoid Firefox locking up, run this code from a ChromeWorker. ...
Debugging Tips
Printing CData and CType Currently console.log doesn't show type information of CData. Running the following code shows only partial value information. ...
...s.int32_t(10); console.log(i); let Point = ctypes.StructType("Point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = Point(10, 20); console.log(p); let pp = p.address(); console.log(pp); The result will be as following: CData { value: 10 } CData { x: 10, y: 20 } CData { contents: CData } To see more descriptive information, you can use .toSource(). ...
...pe("Point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = Point(10, 20); console.log(p.toSource()); let pp = p.address(); console.log(pp.toSource()); The result will be : ctypes.int32_t(10) Point(10, 20) Point.ptr(ctypes.UInt64("0x15fdafb08")) To see the complete type information, you can use .constructor.toSource(), to print the source of CType. ...
Working with data
ce of this, and to see wrong ways of casting, and explanation on why this is the right way to cast an array (explained by matching constructor's) see here: GitHubGIST :: _ff-addon-tutorial-jsctypes_castingArrays Data and pointers A CData object represents a C value in memory. You can always get a pointer to the C value using the CData object's address() method. Objects can share memory It's im
portant to keep in mind that two (or more) CData objects can share the same memory block for their contents. This will happen, for example, when type casting. This is called aliasing. The shared memory can be whole or in part. For example: const Point = new ctypes.StructType("Point", [{x: ctypes.int32_t}, {y: ctypes.int32_t}]); const Rect = new ctypes.StructType("Rect", [{topLeft: Point}, {bottomRig...
...hat reason, 64-bit and pointer-sized C values of numeric types don't get automatically converted to JavaScript numbers. Instead, they're converted to JavaScript objects that you can manipulate using the methods provided by the Int64 and UInt64 objects. Note: These 64-bit integer types are intentionally low on features, so that when JavaScript adds a "big number" type, we can easily upgrade to sup
port that properly. Creating 64-bit integer objects To create a new 64-bit number object, use the ctypes.Int64.Int64() method to create a new 64-bit signed integer, or the ctypes.UInt64.UInt64() method to create a new unsigned 64-bit integer. For example: var num1 = ctypes.UInt64(5000); var num2 = ctypes.Int64(-42); If you need to create a 64-bit integer whose value can't be represented by a Java...
...nstruct 64-bit integers. It accepts as its input parameters the high and low 32-bit values and returns a new 64-bit integer. For example: var num = ctypes.Int64.join(-0x12345678, 0x90ABCDEF); Performing arithmetic with 64-bit values The Int64 and UInt64 objects don't provide any methods for performing arithmetic, which means you'll have to do it yourself by pulling out the high and low 32-bit
portions and doing math on them, then joining them back together if necessary to get the complete result. You'll also have to handle carry from the low to high word and back as appropriate. For example, adding two 64-bit integers can be done like this. This example is for unsigned numbers, but a similar approach can be taken for signed values. function add(a, b) { const MAX_INT = Math.pow(2, 32); ...
ctypes
uint16_t Unsigned 16-bit integer. int32_t Signed 32-bit integer. uint32_t Unsigned 32-bit integer. int64_t Signed 64-bit integer. uint64_t Unsigned 64-bit integer. float32_t 32-bit floating-point value. float64_t 64-bit floating-point value. Note: Some 64-bit values are outside the range of numeric values sup
ported by JavaScript. Because of this, ctypes.int64 and ctypes.uint64 do not automatically convert to JavaScript numbers. Instead, they convert to objects of the wrapper types ctypes.Int64 and ctypes.UInt64, which are JavaScript objects rather than CData objects. See 64-bit integers for details. Types that act like specific C types These types are designed to work exactly like the corresponding type...
...nt C types that have special meanings. Type Description void_t The special C type void. This can only be used as a return value type. Note: You must use void_t, not void, since void is a keyword in JavaScript. voidptr_t The C type void *. This is a pointer to an indeterminate type of data. Large integer types Because JavaScript doesn't sup
port large (64-bit) integers, js-ctypes provides two data types allowing access to 64-bit integer data. Type Description Int64 A JavaScript object representing a 64-bit signed integer. UInt64 A JavaScript object representing a 64-bit unsigned integer. Methods cast() Casts the specified CData object to a new type, returning a new CData object representing t...
...); } else { throw new Error("wut?!"); } console.log(struct_TBButton.size); // 20 on 32-bit, 32 on 64-bit if I'm not mistaken There is another way to do this, we can use ArrayType, but example for this I don't know at this time. ...
Debugger.Frame - Firefox Developer Tools
are treated as internal details, and omitted from the stack trace. If the non-debuggee function eventually calls back into debuggee code, then those frames are visible. (Note that the debuggee is not considered an "immediate caller" of handler methods it triggers. Even though the debuggee and debugger share the same JavaScript stack, frames pushed for SpiderMonkey's calls to handler methods to re
port events in the debuggee are never considered visible frames.) Invocation functions and "debugger" frames Aninvocation function is any function in this interface that allows the debugger to invoke code in the debuggee: Debugger.Object.prototype.call, Debugger.Frame.prototype.eval, and so on. While invocation functions differ in the code to be run and how to pass values to it, they all follow thi...
... frames, this property's value is undefined. When this handler is called, this frame's current execution location, as reflected in its offset and environment properties, is the operation which caused it to be unwound. In frames returning or throwing an exception, the location is often a return or a throw statement. In frames propagating exceptions, the location is a call. When an onPop call re
ports the completion of a construction call (that is, a function called via the new operator), the completion value passed to the handler describes the value returned by the function body. If this value is not an object, it may be different from the value produced by the new expression, which will be the value of the frame's this property. (In ECMAScript terms, the onPop handler receives the value ret...
...derMonkey proceeds with the exception or termination. That is, an undefined resumption value leaves the frame's throwing and termination process undisturbed. If multiple Debugger instances each have Debugger.Frame instances for a given stack frame with onPop handlers set, their handlers are run in an unspecified order. The resumption value each handler returns establishes the completion value re
ported to the next handler. This handler is not called on "debugger" frames. It is also not called when unwinding a frame due to an over-recursion or out-of-memory exception. Function properties of the Debugger.Frame prototype object The functions described below may only be called with a this value referring to a Debugger.Frame instance; they may not be used as methods of other kinds of object...
Debugger.Script - Firefox Developer Tools
bAssembly module is instantiated and via the findScripts method on Debugger instances. SpiderMonkey constructs exactly one Debugger.Script for each underlying WebAssembly module per Debugger instance. A Debugger.Script instance is a strong reference to the underlying WebAssembly module; it protects the module it refers to from being garbage collected. Please note at the time of this writing, sup
port for WebAssembly is very preliminary. Many properties and methods below throw. Convention For descriptions of properties and methods below, if the behavior of the property or method differs between the instance referring to a JSScript or to a block of WebAssembly code, the text will be split into two sections, headed by "if the instance refers to a JSScript" and "if the instance refers to WebAss...
... refers to a JSScript, return an object describing the source code location responsible for the bytecode atoffset in this script. The object has the following properties: lineNumber: the line number for which offset is an entry point columnNumber: the column number for which offset is an entry point isEntryPoint: true if the offset is a column entry point, as would be re
ported by getAllColumnOffsets(); otherwise false. getOffsetsCoverage(): If the instance refers to a JSScript, return null or an array which contains informations about the coverage of all opcodes. The elements of the array are objects, each of which describes a single opcode, and contains the following properties: lineNumber: the line number of the current opcode. columnNu...
...ript, return a new array whose elements are Debugger.Script objects for each function in this script. Only direct children are included; nested children can be reached by walking the tree. If the instance refers to WebAssembly code, throw a TypeError. setBreakpoint(offset,handler) If the instance refers to a JSScript, set a breakpoint at the bytecode instruction atoffset in this script, re
porting hits to the hit method ofhandler. Ifoffset is not a valid offset in this script, throw an error. When execution reaches the given instruction, SpiderMonkey calls the hit method ofhandler, passing a Debugger.Frame instance representing the currently executing stack frame. The hit method's return value should be a resumption value, determining how execution should continue. Any number of bre...
Deprecated tools - Firefox Developer Tools
aluating, the input isn't cleared, which makes it possible to quickly iterrate over a snippet of code. The results are displayed in the console output, to the right of the input, providing immediate feedback. Unlike in Scratchpad, errors are properly displayed in the output with an expandable stacktrace, making it easier to debug the code you're currently writing. Starting Firefox 72, you can im
port a Javascript file content in the console input with Ctrl + O (Cmd + O on macOS), as well as saving the console input content to a file using Ctrl + S (Cmd + S on macOS). WebIDE and Connect page WebIDE was deprecated as of Firefox 69 Disabled as of Firefox 70 (bug 1539451). Removed as of Firefox 71 (bug 1539462). Description WebIDE allowed you to connect the Firefox Developer Tools to remote...
...+ O on macOS), as well as saving the console input content to a file using Ctrl + S (Cmd + S on macOS). WebIDE and Connect page WebIDE was deprecated as of Firefox 69 Disabled as of Firefox 70 (bug 1539451). Removed as of Firefox 71 (bug 1539462). Description WebIDE allowed you to connect the Firefox Developer Tools to remote browsers, such as Firefox for Android. It was also intended to sup
port application development for Firefox OS. Alternatives Remote debugging is available in about:debugging as of Firefox 68. Features not
ported to about:debugging are: WiFi debugging for Firefox for Android, application development. Features that are planned but not
ported yet: remote browser screenshots and edit remote browser configuration. More details on the mailing-list thread. Canvas debug...
...Currently only the Babylon library does. ...
Migrating from Firebug - Firefox Developer Tools
xecution there, you need to set a breakpoint on the line with the modification within the Debugger panel. Search for elements via CSS selectors or XPaths Firebug allows to search for elements within the HTML panel via CSS selectors or XPaths. Also the DevTools' Inspector panel allows to search for CSS selectors. It even displays a list with matching IDs or classes. Searching by XPaths is not sup
ported though (see bug 963933. Debugger What's the Script panel in Firebug, is the Debugger panel in the DevTools. Both allow you to debug JavaScript code executed on a website. Switch between sources Firebug has a Script Location Menu listing all JavaScript sources related to the website. Those sources can be static, i.e. files, or they can be dynamically generated (i.e. scripts executed via even...
...reakpoints, which are all listed within the Breakpoints side panel. In the DevTools the breakpoints are shown below each script source within the Sources side panel. Those panels allow you to enable and disable single or all breakpoints and to remove single breakpoints or all of them at once. They do currently only allow to set script breakpoints. XHR, DOM, Cookie and Error breakpoints are not sup
ported yet (see bug 821610, bug 1004678, bug 895893 and bug 1165010). While there are no breakpoints for single JavaScript errors, there is a setting Pause on Exceptions within the Debugger panel options. Step through code Once the script execution is stopped, you can step through the code using the Continue (F8), Step Over (F10), Step Into (F11) and Step Out (Shift+F11) options. They work the same ...
...e script execution is not stopped, i.e. it doesn't display the window object. Though you can inspect that object either via the DOM property viewer or via the Web Console. Style Editor The Style Editor in the Firefox DevTools allows you to examine and edit the different CSS style sheets of a page like Firebug's CSS panel does it. In addition to that it allows to create new style sheets and to im
port existing style sheets and apply them to the page. It also allows you to toggle individual style sheets. Switch between sources The CSS panel of Firebug allows to switch between different CSS sources using the CSS Location Menu. The Style Editor has a sidebar for this purpose. Edit a style sheet Firebug's CSS panel offers three different ways for editing style sheets. The default one is to edi...
Edit fonts - Firefox Developer Tools
when opened it shows its full syntax as defined in the stylesheet. A text sample, to give you an idea of what the font looks like when rendered. The default text for the sample is "Abc" but the preview text can be edited by clicking on the input field at the top of the section and entering a new value. Once entered, all of the sample text will be set to the same custom value. Variable font sup
port in Firefox Developer Tools Firefox 62 added sup
port for variable fonts and Firefox 63 features sup
port for editing the properties of variable fonts in the Font Editor. What are variable fonts? Variable Fonts, or OpenType Font Variations, define a new font file format that allows the font designer to include multiple variations of a typeface inside a single font file. That means you no longer h...
...rent characteristics you want to vary. Variable fonts make it easy to vary font characteristics in a much more granular fashion because their allowable ranges are defined by axes of variation (see Introducing the 'variation axis' for more information). For example, font-weight can be set to any value between 1 and 1000 in variable fonts (although it is not guaranteed that a variable font will sup
port this entire range). There are several registered axes. Although it isn't required that these axes be defined for every font, if the font designer does implement a registered axis, its behavior must follow the defined behavior. All variable font axes have a four-character axis tag. The CSS font-variation-settings property uses the tag as part of the key-value pair. For example, to set font-weigh...
...g CSS font properties. Font designers can define whatever axis they want; each one needs to be given a unique four-character tag. The axis name and its range is up to the font designer. Note: Registered axis tags are identified using lower-case tags, whereas custom axes should be given upper-case tags. Note that font designers aren't forced follow this practice in any way, and some won't. The im
portant takeaway here is that axis tags are case-sensitive. Warning: In order to use variable fonts, you need to make sure that your operating system is up to date. For example Linux OSes need the latest Linux Freetype version, and macOS prior to 10.13 does not sup
port variable fonts. If your operating system is not up to date, you will not be able to use variable fonts in web pages or the Firefox ...
about:debugging (before Firefox 68) - Firefox Developer Tools
Opening the about:debugging page There are several different ways to open about:debugging: Type "about:debugging" in the Firefox URL bar. In the Tools > Web Developer menu, click "Service Workers". Select the Web Developer menu under the Hamburger menu (), then select "Service Workers". ...
...r enabling you to switch between the two main views: one for add-ons and one for workers. Whether or not system add-ons appear in the list on this page depends on the setting of the devtools.aboutdebugging.showSystemAddons preference. If you need to see system add-ons, navigate to about:config and make sure that this value is set to true. Add-ons The Add-ons section in about:debugging only sup
ports restartless add-ons, including basic bootstrapped extensions, Add-on SDK add-ons, and WebExtensions. This page enables you to do two things: Load an add-on temporarily from disk Connect the Add-on Debugger to any restartless add-ons Connecting the Add-on Debugger The Add-ons page in about:debugging lists all restartless add-ons that are currently installed (note that this list may inc...
... Firefox instance. Each tab entry has a Debug button next to it -- when clicked, this will open up a toolbox specific to that tab, allowing you to debug that tab's contents. Note that this feature isn't that immediately useful to debugging desktop tabs -- you can open up a toolbox to debug a tab easily enough already -- but this will become far more useful when about:debugging starts to sup
port remote debugging, and this page can begin to list tabs available for debugging on mobile device browsers, simulators, etc. See bug 1212802 for the latest on this work. Workers The Workers page shows your workers, categorised as follows: All registered Service Workers All registered Shared Workers Other workers, including Chrome Workers and Dedicated Workers You can connect the developer...
AudioConfiguration - Web APIs
Properties The AudioConfiguration dictionary is made up of four audio properties, including: contentType: A valid audio MIME type, For information on possible values and what they mean, see the web audio codec guide. channels: the number of channels used by the audio track. ...
...to be tested const mediaConfig = { type : 'file', // 'record', 'transmission', or 'media-source' audio : { contentType : "audio/ogg", // valid content type channels : 2, // audio channels used by the track bitrate : 132700, // number of bits used to encode 1s of audio samplerate : 5200 // number of audio samples making up that 1s. ...
...alid content type channels : 2, // audio channels used by the track bitrate : 132700, // number of bits used to encode 1s of audio samplerate : 5200 // number of audio samples making up that 1s. } }; // check sup
port and performance navigator.mediaCapabilities.decodingInfo(mediaConfig).then(result => { console.log('This configuration is ' + (result.sup
ported ? '' : 'not ') + 'sup
ported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powerEfficient ? '' : 'not ') + 'power efficient.' }); Specifications Specification Status Comment Media CapabilitiesThe definition of 'AudioConfiguration' in that specification. Draft Initial definition ...
AudioListener - Web APIs
Properties The position, forward, and up value are set and retrieved using different syntaxes. ...
... to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioNode.connect() - Web APIs
ut of the destination you want to connect the current AudioNode to; the default is 0. The index numbers are defined according to the number of input channels (see Audio channels). It is possible to connect an AudioNode to another AudioNode, which in turn connects back to the first AudioNode, creating a cycle. This is allowed only if there is at least one DelayNode in the cycle. Otherwise, a NotSup
portedError exception is thrown. This parameter is not allowed if the destination is an AudioParam. Return value If the destination is a node, connect() returns a reference to the destination AudioNode object, allowing you to chain multiple connect() calls. In some browsers, older implementations of this interface return undefined. If the destination is an AudioParam, connect() returns undefined. ...
...e connect() calls. In some browsers, older implementations of this interface return undefined. If the destination is an AudioParam, connect() returns undefined. Exceptions IndexSizeError The value specified as outputIndex or inputIndex doesn't correspond to an existing input or output. InvalidAccessError The destination node is not part of the same audio context as the source node. NotSup
portedError The specified connection would create a cycle (in which the audio loops back through the same nodes repeatedly) and there are no DelayNodes in the cycle to prevent the resulting waveform from getting stuck constructing the same audio frame indefinitely. Examples Connecting to an audio input The most obvious use of the connect() method is to direct the audio output from one node into t...
...d gain.connect(audioCtx.destination); // start the oscillator that will produce audio oscillator.start(); // start the oscillator that will modify the gain value lfo.start(); AudioParam notes It is possible to connect an AudioNode output to more than one AudioParam, and more than one AudioNode output to a single AudioParam, with multiple calls to connect(). Fan-in and fan-out are therefore sup
ported. An AudioParam will take the rendered audio data from any AudioNode output connected to it and convert it to mono by down-mixing (if it is not already mono). Next, it will mix it together with any other such outputs, and the intrinsic parameter value (the value the AudioParam would normally have without any audio connections), including any timeline changes scheduled for the parameter. Theref...
CSSStyleSheet.insertRule() - Web APIs
affecting where rules can be inserted. Violating them will likely raise a DOMException. If index > CSSRuleList.length, the method aborts with an IndexSizeError. If rule cannot be inserted at index 0 due to some CSS constraint, the method aborts with a HierarchyRequestError. If more than one rule is given in the rule parameter, the method aborts with a SyntaxError. If trying to insert an @im
port at-rule after a style rule, the method aborts with a HierarchyRequestError. If rule is @namespace and the rule-list has more than just @im
port at-rules and/or @namespace at-rules, the method aborts with an InvalidStateError. Examples Inserting a new rule This snippet pushes a new rule onto the top of my stylesheet. myStyle.insertRule('#blanc { color: white }', 0); Function to add a styles...
...ded for declarations and rules since ECMAScript does * not guarantee a predictable object iteration order, and since CSS is * order-dependent. ...
...ngth; i++) { var j = 1, rule = rules[i], selector = rule[0], propStr = ''; // If the second argument of a rule is an array of arrays, correct our variables. if (Array.isArray(rule[1][0])) { rule = rule[1]; j = 0; } for (var pl = rule.length; j < pl; j++) { var prop = rule[j]; propStr += prop[0] + ': ' + prop[1] + (prop[2] ? ' !im
portant' : '') + ';\n'; } // Insert CSS Rule styleSheet.insertRule(selector + '{' + propStr + '}', styleSheet.cssRules.length); } } Polyfill The below polyfill will correct the input of the arguments of insertRule() to standardize them in Internet Explorer 5-8. It supplements insertRule() with a function that separates the selector from the rules before sending the arguments to the de...
CSSStyleSheet.ownerRule - Web APIs
The read-only CSSStyleSheet property ownerRule returns the CSSIm
portRule corresponding to the @im
port at-rule which im
ported the stylesheet into the document. If the stylesheet wasn't im
ported into the document using @im
port, the returned value is null. Syntax var ownerRule = cssStyleSheet.ownerRule; Value A CSSIm
portRule corresponding to the @im
port rule which im
ported the stylesheet into the document. If the stylesheet wasn't im
ported into the document using @im
port, the returned value is null. Examples This snippet of code looks for rules which were not im
ported into the document using an @im
port at-rule. ...
... @im
port rule which im
ported the stylesheet into the document. If the stylesheet wasn't im
ported into the document using @im
port, the returned value is null. Examples This snippet of code looks for rules which were not im
ported into the document using an @im
port at-rule. ...
...rted into the document using @im
port, the returned value is null. Examples This snippet of code looks for rules which were not im
ported into the document using an @im
port at-rule. let ruleList = document.styleSheets[0].cssRules; for (let rule of ruleList) { if (!rule.ownerRule) { /* rule is not im
ported */ } } This snipped obtains a reference to the stylesheet associated with the @im
port and processes it in some manner: let ruleList = document.styleSheets[0].cssRules; for (let rule of ruleList) { if (rule.ownerRule) { checkStylesheet(rule.ownerRule.styleSheet); } } Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSStyleSheet.ownerRule' in that specification. Working Draft ...
CSS Object Model (CSSOM) - Web APIs
SS Object Model is a set of APIs allowing the manipulation of CSS from JavaScript. It is much like the DOM, but for the CSS rather than the HTML. It allows users to read and modify CSS style dynamically. ...
...S style dynamically. ...
... AnimationEvent CaretPosition CSS CSSCharsetRule CSSConditionRule CSSCounterStyleRule CSSFontFaceRule CSSFontFeatureValuesMap CSSFontFeatureValuesRule CSSGroupingRule CSSIm
portRule CSSKeyframeRule CSSKeyframesRule CSSMarginRule CSSMediaRule CSSNamespaceRule CSSPageRule CSSRule CSSRuleList CSSStyleDeclaration CSSStyleSheet CSSStyleRule CSSSup
portsRule CSSVariablesMap CSSView
portRule ElementCSSInlineStyle FontFace FontFaceSet FontFaceSetLoadEvent GeometryUtils GetStyleUtils LinkStyle MediaList MediaQueryList MediaQueryListEvent MediaQueryListListener Screen StyleSheet StyleSheetList TransitionEvent Several other interfaces are also extended by the CSSOM-related specifications: Document, Window, Element, HTMLElement, HTMLImageElement, Range, MouseEvent, a...
Using the CSS Painting API - Web APIs
ould any other <image> type, using the same string identifier we used in the paintworklet's registerPaint() function. .fancy { background-image: paint(headerHighlight); } Putting it together We can then add the fancy class to any element on the page to add a yellow box as a background: <h1 class="fancy">My Cool Header</h1> The following example will look like the image above in browsers sup
porting the CSS Painting API. While you can't play with the worklet's script, you can alter the background-size and background-position to change the size and location of the background image. PaintSize In the example above, we created a 20x200 unit box, painted 15 units from the top of the element it is the same regardless of the size of the element. If the text is small, the yellow box looks ...
... from the top of the element it is the same regardless of the size of the element. If the text is small, the yellow box looks like a huge underline. If the text is huge, the box might look like an bar above the first three letters. It would be better if the background image was relative to the size of the element -- we can use the element's paintSize property to ensure the background image is pro
portional to the size of the element's box model size. In the above image, the background pro
portional to the size of the element. The 3rd example has width: 50%; set on the block level element, making the element narrower and therefore the background image narrower. The code to do this looks like so: registerPaint('headerHighlight', class { static get contextOptions() { return { al...
...partTwo/header-highlight.js'); .fancy { background-image: paint(headerHighlight); } .half { width: 50%; } <h1 class="fancy">Largest Header</h1> <h6 class="fancy">Smallest Header</h6> <h3 class="fancy half">50% width header</h3> While you can't play with the worklet's script, you can alter the element's font-size and width to change the size of the background image. In browsers that sup
port the CSS Paint API, the example below should appear like the image above. Custom properties In addition to accessing the size of the element, the worklet can also have access to CSS custom properties and regular CSS properties. registerPaint('cssPaintFunctionName', class { static get inputProperties() { return ['PropertyName1', '--customPropertyName2']; } static get inputArguments()...
CanvasRenderingContext2D.drawWindow() - Web APIs
This API cannot be used by Web content. It is synchronous, and as such can't be compatible with Fission. If you're using it from an extension, you should switch to tabs.captureTab. If you're writing chrome code, you probably want WindowGlobalParent.drawSnapshot from the parent process. ...
...rol the drawWindow call. Flags can be ORed together. Constant Value Description DRAWWINDOW_DRAW_CARET 0x01 Show the caret if appropriate when drawing. DRAWWINDOW_DO_NOT_FLUSH 0x02 Do not flush pending layout notifications that could otherwise be batched up. DRAWWINDOW_DRAW_VIEW 0x04 Draw scrollbars and scroll the view
port if they are present. DRAWWINDOW_USE_WIDGET_LAYERS 0x08 Use the widget layer manager if available. This means hardware acceleration may be used, but it might actually be slower or lower quality than normal. It will, however, more accurately reflect the pixels rendered to the screen. DRAWWINDOW_ASYNC_DECODE_IMAGES 0x10 Do not synchronously decode images - dra...
...WINDOW_ASYNC_DECODE_IMAGES 0x10 Do not synchronously decode images - draw what we have. Example This method draws a snapshot of the contents of a DOM window into the canvas. For example, ctx.drawWindow(window, 0, 0, 100, 200, 'rgb(255,255,255)'); ... would draw the contents of the current window, in the rectangle (0,0,100,200) in pixels relative to the top-left of the view
port, on a white background, into the canvas. By specifying "rgba(255,255,255,0)" as the color, the contents would be drawn with a transparent background (which would be slower). It is usually a bad idea to use any background other than pure white "rgb(255,255,255)" or transparent, as this is what all browsers do, and many websites expect that transparent parts of their interface will be drawn on whi...
A basic ray-caster - Web APIs
This article provides an interesting real-world example of using the <canvas> element to do software rendering of a 3D environment using ray-casting. Open in new window Why? After realizing, to my delight, that the nifty <canvas> element I'd been reading about was not only soon to be sup
ported in Firefox, but was already sup
ported in the current version of Safari, I had to try a little experiment. The canvas overview and tutorial I found here at MDN are great, but nobody had written about animation yet, so I thought I'd try a
port of a basic raycaster I'd worked on a while ago, and see what sort of performance we can expect from a JavaScript-controlled pixel buffer. How? The basic idea is to use setInterval() at some arbitrary delay that corresponds to a desired frame rate. After ev...
...emory allocation or video modes or coding inner routines in assembler or anything. The code does attempt to be very efficient, using array look-ups of pre-computed values, but I'm no optimization guru, so things could probably be written faster. Also, it leaves a lot to be desired in terms of trying to be any sort of game engine--there are no wall textures, no sprites, no doors, not even any tele
porters to get to another level. But I'm pretty confident all those things could be added given enough time. The canvas API sup
ports pixel copying of images, so textures seem feasible. I'll leave that for another article, probably from another person. =) The ray-caster The nice people here have manually copied my files up so you can take a look, and for your hacking enjoyment I've posted the individ...
...l copying of images, so textures seem feasible. I'll leave that for another article, probably from another person. ...
Constraint validation API - Web APIs
enables checking values that users have entered into form controls, before submitting the values to the server. Concepts and usage Certain HTML form controls, such as <input>, <select> and <textarea>, can restrict the format of allowable values, using attributes like required and pattern to set basic constraints. However, you may want to impose more complex constraints, or to provide clearer re
porting of validation failures than the defaults. This can be done using the Constraint Validation API. Note: Client-side constraint validation doesn't remove the need for validation on the server side. Even though client-side validation can prevent many common kinds of invalid values, invalid ones can still be sent by older browsers or by attackers trying to trick your web application. Therefore, y...
...tion; and false otherwise. Elements with the HTMLObjectElement interface are never candidates for constraint validation. Others may be barred from constraint validation depending on specific conditions. Methods checkValidity() Checks the element's value against its constraints. If the value is invalid, it fires an invalid event at the element and returns false; otherwise it returns true. re
portValidity() HTMLFormElement method Checks the element's value against its constraints and also re
ports the validity status; if the value is invalid, it fires an invalid event at the element, returns false, and then re
ports the validity status to the user in whatever way the user agent has available. Otherwise, it returns true. setCustomValidity(message) Sets a custom error message string to be s...
... is valid, it will submit as you'd expect. For this to happen, the custom validity has to be cancelled, by invoking setCustomValidity() with an empty string value. We therefore do this every time the input event is raised. If you don't do this, and a custom validity was previously set, the input will register as invalid, even if it current contains a valid value on submission. Note: Firefox sup
ported a proprietary error attribute -- x-moz-errormessage -- for many versions, which allowed you set custom error messages in a similar way. This has been removed as of version 66 (see bug 1513890). Specifications Specification Status Comment HTML Living StandardThe definition of 'constraint validation API' in that specification. Living Standard HTML 5.1The...
CryptoKey - Web APIs
The CryptoKey interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods generateKey(), deriveKey(), im
portKey(), or unwrapKey(). For security reasons, the CryptoKey interface can only be used in a secure context. Properties CryptoKey.type String which may take one of the following values: "secret": This key is a secret key for use with a symmetric algorithm. "private": This key is the private half of an asymmetric algorithm's CryptoKeyPair. "public": This key is the public half of an asymmetric algorithm's CryptoKeyPair. CryptoKey.extractable Boolean indicating whether or not the key may be extracted using SubtleCrypto.ex
portKey() or SubtleCrypto.wrapKey(). true: The key may be extracted. false The ke...
...ithm. "private": This key is the private half of an asymmetric algorithm's CryptoKeyPair. "public": This key is the public half of an asymmetric algorithm's CryptoKeyPair. CryptoKey.extractable Boolean indicating whether or not the key may be extracted using SubtleCrypto.ex
portKey() or SubtleCrypto.wrapKey(). true: The key may be extracted. false The key may not be extracted. ex
portKey() or wrapKey() will throw an exception if used to extract this key. CryptoKey.algorithm An object describing the algorithm for which this key can be used and any associated extra parameters. AesKeyGenParams if the algorithm is any of the AES variants. RsaHashedKeyGenParams if the algorithm is any of the RSA variants. EcKeyGenParams if the algorithm is any of the EC variants. ...
... verify signatures. "deriveKey": The key may be used in deriving a new key. "deriveBits": The key may be used in deriving bits. "wrapKey": The key may be used to wrap a key. "unwrapKey": The key may be used to unwrap a key. Examples The examples for SubtleCrypto methods often use CryptoKey objects. For example: SubtleCrypto.generateKey() SubtleCrypto.deriveKey() SubtleCrypto.im
portKey() SubtleCrypto.ex
portKey() SubtleCrypto.wrapKey() SubtleCrypto.unwrapKey() SubtleCrypto.encrypt() SubtleCrypto.decrypt() SubtleCrypto.sign() SubtleCrypto.verify() Specifications Specification Status Comment Web Cryptography APIThe definition of 'CryptoKey' in that specification. Recommendation Initial definition. ...
CustomElementRegistry.define() - Web APIs
in element: These elements inherit from -- and extend -- built-in HTML elements. Syntax customElements.define(name, constructor, options); Parameters name Name for the new custom element. Note that custom element names must contain a hyphen. constructor Constructor for the new custom element. options Optional Object that controls how the element is defined. ...
...nt names must contain a hyphen. constructor Constructor for the new custom element. options Optional Object that controls how the element is defined. One option is currently sup
ported: extends: String specifying the name of a built-in element to extend. Used to create a customized built-in element. Return value Void. Exceptions Exception Description NotSup
portedError The CustomElementRegistry already contains an entry with the same name or the same constructor (or is otherwise already defined), or extends is specified and it is a valid custom element name, or extends is specified but the element it is trying to extend is an unknown element. SyntaxError The provided name is not a valid custom element name. TypeError The refere...
... name or the same constructor (or is otherwise already defined), or extends is specified and it is a valid custom element name, or extends is specified but the element it is trying to extend is an unknown element. SyntaxError The provided name is not a valid custom element name. TypeError The referenced constructor is not a constructor. Note: You'll often get NotSup
portedErrors thrown that seem like define() is failing, but instead it is likely a problem with Element.attachShadow(). Examples Autonomous custom element The following code is taken from our popup-info-box-web-component example (see it live also). // Create a class for the element class PopUpInfo extends HTMLElement { constructor() { // Always call super first in constructor super(); ...
Document - Web APIs
a list of elements with the given class name. Document.getElementsByTagName() Returns a list of elements with the given tag name. Document.getElementsByTagNameNS() Returns a list of elements with the given tag name and namespace. Document.hasStorageAccess() Returns a Promise that resolves with a boolean value indicating whether the document has access to its first-party storage. Document.im
portNode() Returns a clone of a node from an external document. Document.normalizeDocument() Replaces entities, normalizes text nodes, etc. Document.releaseCapture() Releases the current mouse capture if it's on an element in this document. Document.releaseEvents() See Window.releaseEvents(). Document.requestStorageAccess() Returns a Promise that resolves if the access to first-party...
...ns a document stream for writing. Document.queryCommandEnabled() Returns true if the formating command can be executed on the current range. Document.queryCommandIndeterm() Returns true if the formating command is in an indeterminate state on the current range. Document.queryCommandState() Returns true if the formating command has been executed on the current range. Document.queryCommandSup
ported() Returns true if the formating command is sup
ported on the current range. Document.queryCommandValue() Returns the current value of the current range for a formating command. Document.write() Writes text in a document. Document.writeln() Writes a line of text in a document. Methods included from DocumentOrShadowRoot The Document interface includes the following methods defined on the...
...cuments. Document.queryCommandText()Obsolete since Gecko 14 This method never did anything but throw an exception, and was removed in Gecko 14 (Firefox 14 / Thunderbird 14 / SeaMonkey 2.11). Internet Explorer notes Microsoft defines some non-standard properties: Document.fileSize* Returns size in bytes of the document. Starting with Internet Explorer 11, that property is no longer sup
ported. See MSDN. Internet Explorer does not sup
port all methods from the Node interface in the Document interface: Document.contains As a work-around, document.body.contains() can be used. Specifications Specification Status Comment DOMThe definition of 'Document' in that specification. Living Standard Intend to supersede DOM 3 HTML Living StandardT...
Element.clientTop - Web APIs
read-only, integer property of element. As it happens, all that lies between the two locations (offsetTop and client area top) is the element's border. ...
... Syntax var top = element.clientTop; Example In the following illustration, the client area is show in white. (The segments labeled "Top", "Right", etc. ...
...width". (Actually might be Math.round(parseFloat()).) For example, if the computed "border-top-width" is zero, then clientTop is also zero. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Gecko-based applications sup
port clientTop starting with Gecko 1.9 (Firefox 3, implemented in bug 111207). This property is not sup
ported in Firefox 2 and earlier. Syntax var top = element.clientTop; Example In the following illustration, the client area is show in white. (The segments labeled "Top", "Right", etc. have no significance regarding the client area.) The clientTop value is the distance from where the margin (yellow) area ends and the padding and content areas (white) begin. padding-top Lorem ipsum dolor sit a...
Element.closest() - Web APIs
= el.closest("div div"); // returns the closest ancestor which is a div in div, here it is the div-03 itself var r3 = el.closest("article > div"); // returns the closest ancestor which is a div and has a parent article, here it is the div-01 var r4 = el.closest(":not(div)"); // returns the closest ancestor which is not a div, here it is the outmost article Polyfill For browsers that do not sup
port Element.closest(), but carry sup
port for element.matches() (or a prefixed equivalent, meaning IE9+), a polyfill exists: if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; } if (!Element.prototype.closest) { Element.prototype.closest = function(s) { var el = this; do { if (Elemen...
... if (window.Element && !Element.prototype.closest) { Element.prototype.closest = function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i, el = this; d...
...{ Element.prototype.closest = function(s) { var el = this; do { if (Element.prototype.matches.call(el, s)) return el; el = el.parentElement || el.parentNode; } while (el !== null && el.nodeType === 1); return null; }; } However, if you really do require IE 8 sup
port, then the following polyfill will do the job very slowly, but eventually. However, it will only sup
port CSS 2.1 selectors in IE 8, and it can cause severe lag spikes in production websites. if (window.Element && !Element.prototype.closest) { Element.prototype.closest = function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i, el = this; do { i = matches.length; while (--i >= 0 && matches.item(i) !== el) {}; } while ((i < 0) ...
Element.getAttributeNS() - Web APIs
<!DOCTYPE html> <html> <body> <svg xmlns="http://www.w3.org/2000/svg" xmlns:test="http://www.example.com/2014/test" width="40" height="40"> <circle id="target" cx="12" cy="12" r="10" stroke="#444" stroke-width="2" fill="none" test:foo="Foo value"/> </svg> <script type="text/javascript"> var ns = 'http://www.example.com/2014/test'; var circle = document.getElementById( 'targe...
...HTML5 documents have to use getAttribute() instead. getAttributeNS() differs from getAttribute() in that it allows you to further specify the requested attribute as being part of a particular namespace, as in the example above, where the attribute is part of the fictional "specialspace" namespace on Mozilla. Prior to the DOM4 specification, this method was specified to retur...
...Attribute (DOM 1) removeAttributeNS removeAttributeNode - Specifications Specification Status Comment DOMThe definition of 'Element.getAttributeNS()' in that specification. Living Standard Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Element.getAttributeNS()' in that specification. Obsolete Specifies that a NOT_SUP
PORTED_ERR exception is thrown if the UA does not sup
port the "XML" feature. Also specifies that null must be passed to have no namespace. Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Element.getAttributeNS()' in that specification. Obsolete Initial definition ...
ExtendableEvent - Web APIs
Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableEvent' in that specification. Working Draft Initial d...
... Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableEvent' in that specification. Working Draft Initial definition. ...
...efetch, {mode: 'no-cors'}); })).then(function() { console.log('All resources have been fetched and cached.'); }); }).catch(function(error) { console.error('Pre-fetching failed:', error); }) ); }); Im
portant: When fetching resources, it's very im
portant to use {mode: 'no-cors'} if there is any chance that the resources are served off of a server that doesn't sup
port CORS. In this example, www.chromium.org doesn't sup
port CORS. Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableEvent' in that specification. Working Draft Initial definition. ...
ExtendableMessageEvent.source - Web APIs
Examples When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. ...
...rom which the message was sent. Syntax var mySource = extendableMessageEvent.source; Value A Client, ServiceWorker or Message
Port object. Examples When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. ...
...s When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. var
port; self.addEventListener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') {
port.postMessage(obj); } else if(obj.action === 'init' || obj.action === 'chatMsg') {
port.postMessage(obj); } }); self.onmessage = function(e) { console.log(e.source);
port = e.
ports[0]; } Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableMessageEvent.source' in that specification. Working Draft Initial definition. ...
File and Directory Entries API - Web APIs
The File and Directory Entries API simulates a local file system that web apps can navigate within and access files in. You can develop apps which read, write, and create files and/or directories in a virtual, sandboxed file system. Because this is a non-standard API, whose specification is not currently on a standards track, it's im
portant to keep in mind that not all browsers implement it, and those that do may implement only small
portions of it. Check the Browser compatibility section for details. Two very similar APIs exist depending on whether you desire asynchronous or synchronous behavior. The synchronous API is intended to be used inside a Worker and will return the values you desire. The asynchronous API will not block and functions and the API will not return values; instead,...
...nchronous behavior. The synchronous API is intended to be used inside a Worker and will return the values you desire. The asynchronous API will not block and functions and the API will not return values; instead, you will need to supply a callback function to handle the response whenever it arrives. ...
... Getting access to a file system There are two ways to get access to file systems defined in the current specification draft: When handling a drop event for drag and drop, you can call DataTransferItem.webkitGetAsEntry() to get the FileSystemEntry for a dropped item. ...
Using the Gamepad API - Web APIs
The Gamepad API is a way for developers and designers to access and use gamepads and other game controllers. The Gamepad API introduces new events on the Window object for reading gamepad and controller (hereby referred to as gamepad) state. ...
...l feedback to the user. index: An integer that is unique for each gamepad currently connected to the system. This can be used to distinguish multiple controllers. Note that disconnecting a device and then connecting a new device may reuse the previous index. mapping: A string indicating whether the browser has remapped the controls on the device to a known layout. Currently there is only one sup
ported known layout -- the standard gamepad. If the browser is able to map controls on the device to that layout the mapping property will be set to the string standard. connected: A boolean indicating whether the gamepad is still connected to the system. If this is so the value is True; if not, it is False. buttons: An array of GamepadButton objects representing the buttons present on the device. E...
...rs to determine if the axes and button data have been updated from the hardware. The value must be relative to the navigationStart attribute of the PerformanceTiming interface. Values are monotonically increasing, meaning that they can be compared to determine the ordering of updates, as newer values will always be greater than or equal to older values. Note that this property is not currently sup
ported in Firefox. Note: The Gamepad object is available on the gamepadconnected event rather than the Window object itself, for security reasons. Once we have a reference to it, we can query its properties for information about the current state of the gamepad. Behind the scenes, this object will be updated every time the gamepad's state changes. Using button information Let's look at a simple ...
Geolocation API - Web APIs
WebExtensions that wish to use the Geolocation object must add the "geolocation" permission to their manifest. The user's operating system will prompt the user to allow location access the first time it is requested. Concepts and usage You will often want to retrieve a user's location information in your web app, for example to plot their location on a map, or display personalized information relevant to their location. ...
...Represents the position of a user. A GeolocationPosition instance is returned by a successful call to one of the methods contained inside Geolocation, inside a success callback, and contains a timestamp plus a GeolocationCoordinates object instance. GeolocationCoordinates Represents the coordinates of a user's position; a GeolocationCoordinates instance contains latitude, longitude, and other im
portant related information. GeolocationPositionError A GeolocationPositionError is returned by an unsuccessful call to one of the methods contained inside Geolocation, inside an error callback, and contains an error code and message. Navigator.geolocation The entry point into the API. Returns a Geolocation object instance, from which all other functionality can be accessed. Dictionaries Posi...
...tude = position.coords.longitude; status.textContent = ''; mapLink.href = `https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`; mapLink.textContent = `Latitude: ${latitude} ?, Longitude: ${longitude} ?`; } function error() { status.textContent = 'Unable to retrieve your location'; } if(!navigator.geolocation) { status.textContent = 'Geolocation is not sup
ported by your browser'; } else { status.textContent = 'Locating...'; navigator.geolocation.getCurrentPosition(success, error); } } document.querySelector('#find-me').addEventListener('click', geoFindMe); Result Specifications Specification Status Comment Geolocation API Recommendation ...
HTMLCanvasElement.toBlob() - Web APIs
ng else, the default values 0.92 and 0.80 are used for image/jpeg and image/webp respectively. Other arguments are ignored. Return value None. Exceptions SecurityError The canvas's bitmap is not origin clean; at least some of its contents come from secure Examples Getting a file representing the canvas Once you have drawn content into a canvas, you can convert it into a file of any sup
ported image format. The code snippet below, for example, takes the image in the <canvas> element whose ID is "canvas", obtains a copy of it as a PNG image, then appends a new <img> element to the document, whose source image is the one created using the canvas. var canvas = document.getElementById('canvas'); canvas.toBlob(function(blob) { var newImg = document.createElement('img'), url = UR...
...ild(newImg); }); Note that here we're creating a PNG image; if you add a second parameter to the toBlob() call, you can specify the image type. For example, to get the image in JPEG format: canvas.toBlob(function(blob){...}, 'image/jpeg', 0.95); // JPEG at 95% quality A way to convert a canvas to an ico (Mozilla only) This uses -moz-parse to convert the canvas to ico. Windows XP doesn't sup
port converting from PNG to ico, so it uses bmp instead. A download link is created by setting the download attribute. The value of the download attribute is the name it will use as the file name. var canvas = document.getElementById('canvas'); var d = canvas.width; ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(d / 2, 0); ctx.lineTo(d, d); ctx.lineTo(0, d); ctx.closePath(); ctx.fillStyle...
...r canvas = document.getElementById('canvas'); var d = canvas.width; ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(d / 2, 0); ctx.lineTo(d, d); ctx.lineTo(0, d); ctx.closePath(); ctx.fillStyle = 'yellow'; ctx.fill(); function blobCallback(iconName) { return function(b) { var r = new FileReader(); r.onloadend = function () { // r.result contains the ArrayBuffer. ...
HTMLMediaElement - Web APIs
The HTMLVideoElement and HTMLAudioElement elements both inherit this interface. ...
...icating the audio volume, from 0.0 (silent) to 1.0 (loudest). Event handlers HTMLMediaElement.onencrypted Sets the EventHandler called when the media is encrypted. HTMLMediaElement.onwaitingforkey Sets the EventHandler called when playback is blocked while waiting for an encryption key. Obsolete attributes These attributes are obsolete and should not be used, even if a browser still sup
ports them. HTMLMediaElement.initialTime Read only Returns a double that indicates the initial playback position in seconds. HTMLMediaElement.mozChannels Read only Returns a double representing the number of channels in the audio resource (e.g., 2 for stereo). Obsolete event handlers HTMLMediaElement.onmozinterruptbegin Sets the EventHandler called when the media element is i...
...diaElement.setMediaKeys() Returns Promise. Sets the MediaKeys keys to use when decrypting media during playback. HTMLMediaElement.setSinkId() Sets the ID of the audio device to use for output and returns a Promise. This only works when the application is authorized to use the specified device. Obsolete methods These methods are obsolete and should not be used, even if a browser still sup
ports them. HTMLMediaElement.mozLoadFrom() This method, available only in Mozilla's implementation, loads data from another media element. This works similarly to load() except that instead of running the normal resource selection algorithm, the source is simply set to the other element's currentSrc. This is optimized so this element gets access to all of the other element's cached and buffere...
HTMLOutputElement - Web APIs
elements. Behaves like the Node.textContent property. HTMLOutputElement.willValidateRead only A Boolean indicating whether the element is a candidate for constraint validation. Methods This interface also inherits methods from its parent, HTMLElement. HTMLOutputElement.checkValidity() Checks the validity of the element and returns a Boolean holding the check result. ...
...e.textContent property. HTMLOutputElement.willValidateRead only A Boolean indicating whether the element is a candidate for constraint validation. Methods This interface also inherits methods from its parent, HTMLElement. HTMLOutputElement.checkValidity() Checks the validity of the element and returns a Boolean holding the check result. HTMLOutputElement.re
portValidity() This method re
ports the problems with the constraints on the element, if any, to the user. If there are problems, fires an invalid event at the element, and returns false; if there are no problems, it returns true. When the problem is re
ported, the user agent may focus the element and change the scrolling position of the document or perform some other action that brings the element to the user's attention. User ag...
...ems with the constraints on the element, if any, to the user. If there are problems, fires an invalid event at the element, and returns false; if there are no problems, it returns true. When the problem is re
ported, the user agent may focus the element and change the scrolling position of the document or perform some other action that brings the element to the user's attention. User agents may re
port more than one constraint violation if this element suffers from multiple problems at once. If the element is not rendered, then the user agent may re
port the error for the running script instead of notifying the user. HTMLOutputElement.setCustomValidity() Sets a custom validity message for the element. If this message is not the empty string, then the element is suffering from a custom validity...
HTMLTextAreaElement - Web APIs
Selects a range of text in the element (but does not focus it). checkValidity() Returns false if the element is a candidate for constraint validation, and it does not satisfy its constraints. In this case, it also fires a cancelable invalid event at the control. It returns true if the control is not a candidate for constraint validation, or if it satisfies its constraints. re
portValidity() This method re
ports the problems with the constraints on the element, if any, to the user. If there are problems, it fires a cancelable invalid event at the element, and returns false; if there are no problems, it returns true. setCustomValidity(DOMstring) Sets a custom validity message for the element. If this message is not the empty string, then the element is...
...ommodo lorem quis fringilla. Sed ac tellus eros. Sed consectetur eleifend felis vitae luctus. Praesent sagittis, est eget bibendum tincidunt, ligula diam tincidunt augue, a fermentum odio velit eget mi. Phasellus mattis, elit id fringilla semper, orci magna cursus ligula, non venenatis lacus augue sit amet dui. Pellentesque lacinia odio id nisi pulvinar commodo tempus at odio. Ut consectetur eros
porttitor nunc mollis ultrices. Aenean
porttitor, purus sollicitudin viverra auctor, neque erat blandit sapien, sit amet tincidunt massa mi ac nibh. Proin nibh sem, bibendum ut placerat nec, cursus et lacus. Phasellus vel augue turpis. Nunc eu mauris eu leo blandit mollis interdum eget lorem. </textarea></p> </form> Maximum length and number of lines example Create a textarea with a maximum numbe...
...reate a textarea with a maximum number of characters per line and a maximum number of lines: First, create a function that takes the text field and a key event as input and determines if any of the limits have been reached. If the limit has not been reached, it will return the key. ...
IDBCursorSync - Web APIs
It may however be reintroduced in the future if there is enough demand from web developers. The IDBCursorSync interface of the IndexedDB API represents a cursor for iterating over multiple records in a database. You can have only one instance of IDBCursorSync representing a cursor, but you can have an unlimited number of cursors at the same time. Operations are performed on the underlying index or object store. It enables an application to synchronously process all the records in the cursor's range. ...
... value any The value for the record at the cursor's position. Setting this attribute can raise an IDBDatabaseException with the following codes: DATA_ERR If the underlying object store uses in-line keys and the property at the key path does not match the key in this cursor's position. NOT_ALLOWED_ERR If the underlying index or object store does not sup
port updating the record because it is open in the READ_ONLY or SNAPSHOT_READ mode, or if an index record cannot be changed because the underlying index is auto-populated. SERIAL_ERR If the data being stored could not be serialized by the internal structured cloning algorithm. Constants Constant Value Description NEXT 0 This cursor includes ...
...tinue ( in optional any key ); Parameters key The key to which to move the cursor's position. remove() Deletes the record at the cursor's position, without changing the cursor's position void delete ( ) raises (DatabaseException); Exceptions This method can raise an IDBDatabaseException with the following code: NOT_ALLOWED_ERR If the underlying index or object store does not sup
port updating the record because it is open in the READ_ONLY or SNAPSHOT_READ mode. ...
Checking when a deadline is due - Web APIs
t, with a number of different representations. Recording the date information To provide a reasonable user experience on mobile devices, and to cut down on ambiguities, I decided to create an HTML form with: A text input for entering a title for your to-do list. This is the least avoidable bit of user typing. Number inputs for the hour and minute parts of the deadline. On browsers that sup
port type="number", you get a nice little up and down arrow number picker. On mobile platforms you tend to get a numeric keypad for entering data, which is helpful. On others you just get a standard text input, which is okay. <select> elements for inputting the day, month and year of the deadline. Because these values are the most ambiguous for users to enter (7, sunday, sun? 04, 4, April, Apr? 2013,...
...ar.value == null) { note.innerHTML += '<li>Data not submitted -- form incomplete.</li>'; return; } In this segment, we check to see if the form fields have all been filled in. If not, we drop a message into our developer notifications pane (see the bottom left of the app UI) to tell the user what is going on, and exit out of the function. ...
...Duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectStore = tra...
IntersectionObserver - Web APIs
When an IntersectionObserver is created, it's configured to watch for given ratios of visibility within the root. ...
... When an IntersectionObserver is created, it's configured to watch for given ratios of visibility within the root. ...
...bserver object which will execute a specified callback function when it detects that a target element's visibility has crossed one or more thresholds. Properties IntersectionObserver.root Read only The Element or Document whose bounds are used as the bounding box when testing for intersection. If no root value was passed to the constructor or its value is null, the top-level document's view
port is used. IntersectionObserver.rootMargin Read only An offset rectangle applied to the root's bounding box when calculating intersections, effectively shrinking or growing the root for calculation purposes. The value returned by this property may not be the same as the one specified when calling the constructor as it may be changed to match internal requirements. Each offset can be expressed in...
KeyboardEvent - Web APIs
enerated. Methods This interface also inherits methods of its parents, UIEvent and Event. KeyboardEvent.getModifierState() Returns a Boolean indicating if a modifier key such as Alt, Shift, Ctrl, or Meta, was pressed when the event was created. Obsolete methods KeyboardEvent.initKeyEvent() Initializes a KeyboardEvent object. This was implemented only by Firefox, and is no longer sup
ported even there; instead, you should use the KeyboardEvent() constructor. KeyboardEvent.initKeyboardEvent() Initializes a KeyboardEvent object. This is now deprecated. You should instead use the KeyboardEvent() constructor. Obsolete properties KeyboardEvent.char Read only Returns a DOMString representing the character value of the key. If the key corresponds to a printable character, th...
...es Some keys toggle the state of an indicator light; these include keys such as Caps Lock, Num Lock, and Scroll Lock. On Windows and Linux, these keys dispatch only the keydown and keyup events. On Linux, Firefox 12 and earlier also dispatched the keypress event for these keys. However, a limitation of the macOS event model causes Caps Lock to dispatch only the keydown event. Num Lock was sup
ported on some older laptop models (2007 models and older), but since then, macOS hasn't sup
ported Num Lock even on external keyboards. On older MacBooks with a Num Lock key, that key doesn't generate any key events. Gecko does sup
port the Scroll Lock key if an external keyboard which has an F14 key is connected. In certain older versions of Firefox, this key generated a keypress event; this inconsist...
...re not sent. Linux The event behavior depends on the specific platform. It will either behave like Windows or Mac depending on what the native event model does. Note: Manually firing an event does not generate the default action associated with that event. For example, manually firing a key event does not cause that letter to appear in a focused text input. In the case of UI events, this is im
portant for security reasons, as it prevents scripts from simulating user actions that interact with the browser itself. Example <!DOCTYPE html> <html> <head> <script> 'use strict'; document.addEventListener('keydown', (event) => { const keyName = event.key; if (keyName === 'Control') { // do not alert when only Control key is pressed. return; } if (event.ctrlKey) { // Even th...
LayoutShift - Web APIs
LayoutShift.hadRecentInput Returns true if there was a user input in the past 500 milliseconds. LayoutShift.lastInputTime Returns the time of the most recent user input. ...
... LayoutShift.hadRecentInput Returns true if there was a user input in the past 500 milliseconds. LayoutShift.lastInputTime Returns the time of the most recent user input. ...
...} Specifications Specification Status Comment Layout Instability APIThe definition of 'LayoutShift' in that specification. Editor's Draft Initial definition. ...
MediaDevices.getDisplayMedia() - Web APIs
The resulting stream can then be recorded using the MediaStream Recording API or transmitted as part of a WebRTC session. See Using the Screen Capture API for more details and an example. Syntax var promise = navigator.mediaDevices.getDisplayMedia(constraints); Parameters constraints Optional An optional MediaStreamConstraints object specifying requirements for the returned MediaStream. ...
...specifying requirements for the returned MediaStream. Since getDisplayMedia() requires a video track, the returned stream will have one even if no video track is expressly requested by the constraints object. Return value A Promise that resolves to a MediaStream containing a video track whose contents come from a user-selected screen area, as well as an optional audio track. Note: Browser sup
port for audio tracks varies, both in terms of whether or not they're sup
ported at all by the media recorder and in terms of the which audio source or sourcoes are sup
ported. Check the compatibility table for details for each browser. Exceptions Rejections of the returned promise are made by passing a DOMException error object to the promise's failure handler. Possible errors are: AbortError An...
...rce of screen data, but a hardware or operating system level error or lockout occurred, preventing the sharing of the selected source. OverconstrainedError After creating the stream, applying the specified constraints fails because no compatible stream could be generated. TypeError The specified constraints include constraints which are not permitted when calling getDisplayMedia(). These unsup
ported constraints are advanced and any constraints which in turn have a member named min or exact. Usage notes Privacy and security Because getDisplayMedia() could be used in nefarious ways, it can be a source of significant privacy and security concerns. For that reason, the specification details measures browsers are required to take in order to fully sup
port getDisplayMedia(). The specified...
MediaQueryList.onchange - Web APIs
The onchange property of the MediaQueryList interface is an event handler property representing a function that is invoked when the change event fires, i.e when the status of media query sup
port changes. The event object is a MediaQueryListEvent instance, which is recognised as a MediaListQuery instance in older browsers, for backwards compatibility purposes. Syntax MediaQueryList.onchange = function() { ... ...
...when the status of media query sup
port changes. The event object is a MediaQueryListEvent instance, which is recognised as a MediaListQuery instance in older browsers, for backwards compatibility purposes. Syntax MediaQueryList.onchange = function() { ... ...
...aListQuery instance in older browsers, for backwards compatibility purposes. Syntax MediaQueryList.onchange = function() { ... }; Example var mql = window.matchMedia('(max-width: 600px)'); mql.addEventListener( "change", (e) => { if (e.matches) { /* the view
port is 600 pixels wide or less */ console.log('This is a narrow screen -- less than 600px wide.') } else { /* the view
port is more than than 600 pixels wide */ console.log('This is a wide screen -- more than 600px wide.') } }) Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'onchange' in that specification. Working Draft Initial definition ...
Media Session action types - Web APIs
The following strings identify the currently available types of media session action: nexttrack Advances playback to the next track. ...
...ndler() method to establish a handler for that action. The specific type of media session action to be handled on a MediaSession is identified using a string from the MediaSessionAction enumerated type. Syntax A media session action's type is specified using a string from the MediaSessionAction enumerated type. Values Each of the actions is a common media session control request. Implement sup
port for each of these in order to allow that type of action to be performed. The following strings identify the currently available types of media session action: nexttrack Advances playback to the next track. pause Pauses playback of the media. play Begins (or resumes) playback of the media. previoustrack Moves back to the previous track. seekbackward Seeks backward through the media fr...
...ession.setActionHandler('seekforward', evt => { // User clicked "Seek Forward" media notification icon. audio.currentTime = Math.min(audio.currentTime + skipTime, audio.duration); }); navigator.mediaSession.setActionHandler('seekbackward', evt => { // User clicked "Seek Backward" media notification icon. ...
MediaSource.addSourceBuffer() - Web APIs
cifying the MIME type of the SourceBuffer to create and add to the MediaSource. Return value A SourceBuffer object representing the new source buffer that has been created and added to the media source. Exceptions InvalidAccessError The value specified for mimeType is an empty string rather than a valid MIME type. InvalidStateError The MediaSource is not in the "open" readyState. ...
...create and add to the MediaSource. Return value A SourceBuffer object representing the new source buffer that has been created and added to the media source. Exceptions InvalidAccessError The value specified for mimeType is an empty string rather than a valid MIME type. InvalidStateError The MediaSource is not in the "open" readyState. NotSup
portedError The specified mimeType isn't sup
ported by the user agent, or is not compatible with the MIME types of other SourceBuffer objects that are already included in the media source's sourceBuffers list. QuotaExceededError The user agent can't handle any more SourceBuffer objects, or creating a new SourceBuffer using the given mimeType would result in an unsup
ported configuration of SourceBuffers. Example The following snippet is from...
...xample The following snippet is from a simple example written by Nick Desaulniers (view the full demo live, or download the source for further investigation.) var assetURL = 'frag_bunny.mp4'; // Need to be specific for Blink regarding codecs // ./mp4info frag_bunny.mp4 | grep Codec var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; if ('MediaSource' in window && MediaSource.isTypeSup
ported(mimeCodec)) { var mediaSource = new MediaSource; //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsup
ported MIME type or codec: ', mimeCodec); } function sourceOpen (_) { //console.log(this.readyState); // open var mediaSource = this; var sourceBuffer ...
MediaStreamAudioSourceNode - Web APIs
o tracks on the stream is determined by taking the tracks whose kind is audio, then sorting the tracks by their id property's values, in Unicode code point order (essentially, in alphabetical or lexicographical order, for IDs which are simple alphanumeric strings). The first track, then, is the track whose id comes first when the tracks' IDs are all sorted by Unicode code point. However, it's im
portant to note that the rule establishing this ordering was added long after this interface was first introduced into the Web Audio API. As such, you can't easily rely on the order matching between any two browsers or browser versions. This is why it is typically wiser to use MediaStreamTrackAudioSourceNode, which provides similar capabilities but was better-defined upon being added to the specificat...
...ive, or view the source. ...
...So playing/pausing the stream can still be done through the media element API and the player controls. Specification Specification...
MediaTrackConstraints.aspectRatio - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.autoGainControl - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.channelCount - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.deviceId - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.facingMode - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.frameRate - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.groupId - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.height - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.latency - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.sampleRate - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.sampleSize - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
MediaTrackConstraints.width - Web APIs
However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
Media Source API - Web APIs
s when buffers are evicted. It lays the groundwork for adaptive bitrate streaming clients (such as those using DASH or HLS) to be built on its extensible API. Creating assets that work with MSE in modern browsers is a laborious process, taking significant time, computing power, and energy. The usage of external utilities to massage the content into a suitable format is required. While browser sup
port for the various media containers with MSE is spotty, usage of the H.264 video codec, AAC audio codec, and MP4 container format is a common baseline. MSE also provides an API for runtime detection of container and codec sup
port. If you do not require explicit control of video quality over time, the rate at which content is fetched, or the rate at which memory is evicted, then the <video> and <sou...
...n the <video> and <source> tags may well be a simple and adequate solution. DASH Dynamic Adaptive Streaming over HTTP (DASH) is a protocol for specifying how adaptive content should be fetched. It is effectively a layer built on top of MSE for building adaptive bitrate streaming clients. While there are other protocols available (such as HTTP Live Streaming (HLS)), DASH has the most platform sup
port. DASH moves lots of logic out of the network protocol and into the client side application logic, using the simpler HTTP protocol to fetch files. Indeed, one can sup
port DASH with a simple static file server, which is also great for CDNs. This is in direct contrast with previous streaming solutions that required expensive licenses for proprietary non-standard client/server protocol implementat...
...tocol implementations. The two most common use cases for DASH involve watching content "on demand" or "live." On demand allows a developer to take their time transcoding the assets into multiple resolutions of various quality. Live profile content can introduce latency due to its transcoding and broadcasting, so DASH is not suitable for real time communication like WebRTC is. It can however sup
port significantly more client connections than WebRTC. There are numerous available free and open source tools for transcoding content and preparing it for use with DASH, DASH file servers, and DASH client libraries written in JavaScript. Interfaces MediaSource Represents a media source to be played via an HTMLMediaElement object. SourceBuffer Represents a chunk of media to be passed into an ...
Media Capture and Streams API (Media Stream) - Web APIs
It provides the interfaces and methods for working with the streams and their constituent tracks, the constraints associated with data formats, the success and error callbacks when using the data asynchronously, and the events that are fired during the process. Concepts and usage The API is based on the manipulation of a MediaStream object representing a flux of audio- or video-related data. See an example in Get the video. ...
...u'll find the fundamental information you'll need to know about each of the interfaces that make up the Media Capture and Streams API. BlobEvent CanvasCaptureMediaStreamTrack InputDeviceInfo MediaDeviceKind MediaDeviceInfo MediaDevices MediaStream MediaStreamConstraints MediaStreamEvent MediaStreamTrack MediaStreamTrackEvent MediaTrackConstraints MediaTrackSettings MediaTrackSup
portedConstraints OverconstrainedError URL Early versions of the Media Capture and Streams API specification included separate AudioStreamTrack and VideoStreamTrack interfaces--each based upon MediaStreamTrack--which represented streams of those types. These no longer exist, and you should update any existing code to instead use MediaStreamTrack directly. Events addtrack ended muted o...
... The articles below provide additional guidance and how-to information that will help you learn to use the API, and how to perform specific tasks that you may wish to handle. Capabilities, constraints, and settingsThe twin concepts of constraints and capabilities let the browser and Web site or app exchange information about what constrainable properties the browser's implementation sup
ports and what values it sup
ports for each one. This article discusses capabilities and constraints, as well as media settings, and includes an example we call the Constraint Exerciser. ...
MessageChannel - Web APIs
Example In the following example, you can see a new channel being created using the MessageChannel.MessageChannel constructor. ...
... The MessageChannel interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two Message
Port properties. Note: This feature is available in Web Workers. Properties MessageChannel.
port1 Read only Returns
port1 of the channel. MessageChannel.
port2 Read only Returns
port2 of the channel. Constructor MessageChannel() Returns a new MessageChannel object with two new Message
Port objects. Example In the following example, you can see a new channel being created using the MessageChannel.MessageChannel constructor. When the IFrame has loaded, we register an onmessage handler for MessageChannel.
port1 and transfer MessageChannel.
port2 to the IFrame using the window.postMessage method along with a message. When a message is...
... method along with a message. When a message is received back from the IFrame, the onMessage function simply outputs the message to a paragraph. var channel = new MessageChannel(); var output = document.querySelector('.output'); var iframe = document.querySelector('iframe'); // Wait for the iframe to load iframe.addEventListener("load", onLoad); function onLoad() { // Listen for messages on
port1 channel.
port1.onmessage = onMessage; // Transfer
port2 to the iframe iframe.contentWindow.postMessage('Hello from the main page!', '*', [channel.
port2]); } // Handle messages received on
port1 function onMessage(e) { output.innerHTML = e.data; } For a full working example, see our channel messaging basic demo on Github (run it live too). Specifications Specification St...
MutationEvent - Web APIs
tion, as the API's design is flawed (see details in the "DOM Mutation Events Replacement: The Story So Far / Existing Points of Consensus" post to public-webapps). Mutation Observers are the proposed replacement for mutation events in DOM4. They are expected to be included in Firefox 14 and Chrome 18. The practical reasons to avoid the mutation events are performance issues and cross-browser sup
port. ...
... are performance issues and cross-browser sup
port. Performance Adding DOM mutation listeners to a document profoundly degrades the performance of further DOM modifications to that document (making them 1.5 - 7 times slower!). Moreover, removing the listeners does not reverse the damage. The performance effect is limited to the documents that have the mutation event listeners. Cross-browser sup
port These events are not implemented consistently across different browsers, for example: IE prior to version 9 didn't sup
port the mutation events at all and does not implement some of them correctly in version 9 (for example, DOMNodeInserted) WebKit doesn't sup
port DOMAttrModified (see webkit bug 8191 and the workaround) "mutation name events", i.e. DOMElementNameChanged and DOMAttributeNameCh...
...e not implemented consistently across different browsers, for example: IE prior to version 9 didn't sup
port the mutation events at all and does not implement some of them correctly in version 9 (for example, DOMNodeInserted) WebKit doesn't sup
port DOMAttrModified (see webkit bug 8191 and the workaround) "mutation name events", i.e. DOMElementNameChanged and DOMAttributeNameChanged are not sup
ported in Firefox (as of version 11), and probably in other browsers as well. ... Dottoro documents browser sup
port for mutation events. Mutation events list The following is a list of all mutation events, as defined in DOM Level 3 Events specification: DOMAttrModified DOMAttributeNameChanged DOMCharacterDataModified DOMElementNameChanged DOMNodeInserted DOMNodeInsertedIntoDocument DOMNo...
Navigator.registerProtocolHandler() - Web APIs
Navigator method registerProtocolHandler() lets web sites register their ability to open or handle particular URL schemes (aka protocols). For example, this API lets webmail sites open mailto: URLs, or VoIP sites open tel: URLs. Syntax navigator.registerProtocolHandler(scheme, url, title); Note: Recently updated to navigator.registerProtocolHandler(scheme, url), but no browsers currently sup
port this version. Parameters scheme A string containing the protocol the site wishes to handle. For example, you can register to handle SMS text message links by passing the "sms" scheme. url A string containing the URL of the handler. This URL must include %s, as a placeholder that will be replaced with the escaped URL to be handled. Note: The handler URL must us the https scheme. Older brow...
.... Parameters scheme A string containing the protocol the site wishes to handle. For example, you can register to handle SMS text message links by passing the "sms" scheme. url A string containing the URL of the handler. This URL must include %s, as a placeholder that will be replaced with the escaped URL to be handled. Note: The handler URL must us the https scheme. Older browsers also sup
ported http. title A human-readable title string for the handler. This will be displayed to the user, such as prompting "Allow this site to handle [scheme] links?" or listing registered handlers in the browser's settings. Note: The title has been removed from the spec due to spoofing concerns, but all current browsers still require it. It is recommended to always set the title, since browsers t...
.... title A human-readable title string for the handler. This will be displayed to the user, such as prompting "Allow this site to handle [scheme] links?" or listing registered handlers in the browser's settings. Note: The title has been removed from the spec due to spoofing concerns, but all current browsers still require it. It is recommended to always set the title, since browsers that sup
port the updated spec most likely will be backwards-compatible and still accept the title (but not use it). Exceptions SecurityError The user agent blocked the registration. This might happen if: The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:, etc.) The handler URL's origin does not match the origin of the page calling this API. ...
Node.setUserData() - Web APIs
The Node.setUserData() method allows a user to attach (or remove) data to an element, without needing to modify the DOM. Note that such data will not be preserved when im
ported via Node.im
portNode, as with Node.cloneNode() and Node.renameNode() operations (though Node.adoptNode does preserve the information), and equality tests in Node.isEqualNode() do not consider user data in making the assessment. This method offers the convenience of associating data with specific nodes without needing to alter the structure of a document and in a standard fashion, but it also means that extra steps may need to be taken if one wishes to serialize the information or include the information upon clone, im
port, or rename operations. The Node.getUserData and Node.setUserData methods are no longer availab...
...ds are no longer available from Web content. HTMLElement.dataset or WeakMap can be used instead. Syntax var prevUserData = someNode.setUserData(userKey, userData, handler); Parameters userKey is used as the key by which one may subsequently obtain the stored data. More than one key can be set for a given node. handler is a callback which will be called any time the node is being cloned, im
ported, renamed, as well as if deleted or adopted; a function can be used or an object implementing the handle method (part of the UserDataHandler interface). The handler will be passed five arguments: an operation type integer (e.g., 1 to indicate a clone operation), the user key, the data on the node, the source node (null if being deleted), the destination node (the newly created node or null if no...
... and UserDataHandler associated to userKey on this node will be removed. Example var d = document.implementation.createDocument('', 'test', null); d.documentElement.setUserData('key', 15, {handle:function (o, k, d, s, ds) {console.log(o+'::'+k+'::'+d+'::'+s+'::'+ds)}}); // 2::key::15::[object Element]::[object Element] console.log(d.documentElement.getUserData('key')); // 15 var e = document.im
portNode(d.documentElement, true); // causes handler to be called console.log(e.getUserData('key')); // null since user data is not copied Specifications Specification Status Comment Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.setUserData()' in that specification. Obsolete Initial definition ...
Node - Web APIs
Removes a child node from the current element, which must be a child of the current node. Node.replaceChild() Replaces one child Node of the current one with the second one given in parameter. Obsolete methods Node.getUserData() Allows a user to get some DOMUserData from the node. Node.hasAttributes() Returns a Boolean indicating if the element has any attributes, or not. Node.isSup
ported() Returns a Boolean flag containing the result of a test whether the DOM implementation implements a specific feature and this feature is sup
ported by the specific node. Node.setUserData() Allows a user to attach, or remove, DOMUserData to the node. Examples Remove all children nested within a node function removeAllChildren(element) { while (element.firstChild) { element.remov...
...mistakes) Specifications Specification Status Comment DOMThe definition of 'Node' in that specification. Living Standard Added the following methods: getRootNode() DOM4The definition of 'Node' in that specification. Obsolete Removed the following properties: attributes, namespaceURI, prefix, and localName. Removed the following methods: isSup
ported(), hasAttributes(), getFeature(), setUserData(), and getUserData(). Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node' in that specification. Obsolete The methods insertBefore(), replaceChild(), removeChild(), and appendChild() returns one more kind of error (NOT_SUP
PORTED_ERR) if called on a Document. The normalize() method has been modified so th...
...Added the following properties: baseURI and textContent. Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Node' in that specification. Obsolete The ownerDocument property was slightly modified so that DocumentFragment also returns null. Added the following properties: namespaceURI, prefix, and localName. Added the following methods: normalize(), isSup
ported() and hasAttributes(). Document Object Model (DOM) Level 1 SpecificationThe definition of 'Node' in that specification. Obsolete Initial definition. ...
Notification.permission - Web APIs
itly granted permission for the current origin to display system notifications. denied: The user has explicitly denied permission for the current origin to display system notifications. default: The user decision is unknown; in this case the application will act as if permission was denied. ...
...in this case the application will act as if permission was denied. Examples The following snippet could be used if you wanted to first check whether notifications are sup
ported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
...t could be used if you wanted to first check whether notifications are sup
ported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
Notification.requestPermission() - Web APIs
at resolves to a DOMString with the permission picked by the user. ...
...sible to send a notification as follows -- here we present a fairly verbose and complete set of code you could use if you wanted to first check whether notifications are sup
ported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
...of code you could use if you wanted to first check whether notifications are sup
ported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
Notification - Web APIs
tion object also inherits from the EventTarget interface. Notification.close() Programmatically closes a notification instance. ...
...sible to send a notification as follows -- here we present a fairly verbose and complete set of code you could use if you wanted to first check whether notifications are sup
ported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
...of code you could use if you wanted to first check whether notifications are sup
ported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
OVR_multiview2 - Web APIs
The OVR_multiview2 extension is part of the WebGL API and adds sup
port for rendering into multiple views simultaneously. This especially useful for virtual reality (VR) and WebXR. For more information, see also: Multiview on WebXR three.js multiview demo Multiview in babylon.js Optimizing Virtual Reality: Understanding Multiview Multiview WebGL Rendering for Oculus Browser 6.0+ WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: Sup
port depends on the system's graphics driver (Windows+ANGLE and Android are sup
ported; Windows+GL, Mac, Linux are not sup
ported). This extension is only available to WebGL 2 contexts as it needs GLSL 3.00 and texture arrays. Currently...
...See also this WebGL issue. Constants This extension exposes 4 constants that can be used in getParameter() or getFramebufferAttachmentParameter(). FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR Number of views of the framebuffer object attachment. ...
...BUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR Number of views of the framebuffer object attachment. FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR Base view index of the framebuffer object attachment. MAX_VIEWS_OVR The maximum number of views. Most VR headsets have two views, but there are prototypes of headset with ultra-wide FOV using 4 views which is currently the maximum number of views sup
ported by multiview. FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR If baseViewIndex is not the same for all framebuffer attachment points where the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is not NONE, the framebuffer is considered incomplete. Calling checkFramebufferStatus for a framebuffer in this state returns FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR. Methods framebufferTextureMultiviewOVR() Si...
Page Visibility API - Web APIs
eouts. Example View live example (video with sound). ...
...undefined") { hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; } var videoElement = document.getElementById("videoElement"); // If the page is hidden, pause the video; // if the page is shown, play the video function handleVisibilityChange() { if (document[hidden]) { videoElement.pause(); } else { videoElement.play(); } } // Warn if the browser doesn't sup
port addEventListener or the Page Visibility API if (typeof document.addEventListener === "undefined" || hidden === undefined) { console.log("This demo requires a browser, such as Google Chrome or Firefox, that sup
ports the Page Visibility API."); } else { // Handle page visibility change document.addEventListener(visibilityChange, handleVisibilityChange, false); // When the video pauses, set...
...user, either due to the document's tab being in the background or part of a window that is minimized, or because the device's screen is off. prerender The page's content is being prerendered and is not visible to the user. A document may start in the prerender state, but will never switch to this state from any other state, since a document can only prerender once. Note: Not all browsers sup
port prerendering. unloaded The page is in the process of being unloaded from memory. Note: Not all browsers sup
port the unloaded value. Document.onvisibilitychange An EventListener providing the code to be called when the visibilitychange event is fired. //startSimulation and pauseSimulation defined elsewhere function handleVisibilityChange() { if (document.hidden) { pauseSi...
PaymentRequest.show() - Web APIs
uest's show() method has been called, any other call to show() will by rejected with an AbortError until the returned promise has been concluded, either by being fulfilled with a PaymentResponse indicating the results of the payment request, or by being rejected with an error. Note: In reality, despite the fact that the specification says this can't be done, some browsers, including Firefox, sup
port multiple active payment requests at a time. If your architecture doesn't necessarily have all of the data ready to go at the moment it instantiates the payment interface by calling show(), specify the detailsPromise parameter, providing a Promise that is fulfilled once the data is ready. If this is provided, show() will not allow the user to interact with the payment interface until the promise...
...ng a payment panel. Only one payment panel may be visible at a time across all documents loaded by the user agent. The promise is also rejected with AbortError if the user cancels the payment request. InvalidStateError The promise rejects with an InvalidStateError if the same payment has already been shown for this request (its state is interactive because it is being shown already). NotSup
portedError The promise rejects with a NotSup
portedError if the user agent does not sup
port the payment methods specified when the PaymentRequest constructor was called. SecurityError The promise rejects with a SecurityError if the call to show() was not in response to a user action, such as a click or keyup event. Other reasons a SecurityError may be thrown are at the discretion of the user agent,...
... The following example shows how to update the payment sheet as it's being presented to the end-user. async function requestPayment() { // We start with AU$0 as the total. const initialDetails = { total: { label: "Total", amount: { value: "0", currency: "AUD" }, }, }; const request = new PaymentRequest(methods, initialDetails, options); // Check if the the user sup
ports the `methods` if (!await request.canMakePayment()) { return; // no, so use a web form instead. } // Let's update the total as the sheet is shown const updatedDetails = { total: { label: "Total", amount: { value: "20", currency: "AUD" }, }, }; const response = await request.show(updatedDetails); // Check response, etc... } document.getElementById("buyButton"...
performance.setResourceTimingBufferSize() - Web APIs
Workers. Syntax performance.setResourceTimingBufferSize(maxSize); Arguments maxSize A number representing the maximum number of performance entry objects the browser should hold in its performance entry buffer. Return value none This method has no return value. ...
...ufferSize(maxSize); Arguments maxSize A number representing the maximum number of performance entry objects the browser should hold in its performance entry buffer. Return value none This method has no return value. ...
...mber of performance entry objects the browser should hold in its performance entry buffer. Return value none This method has no return value. Example function setResourceTimingBufferSize(maxSize) { if (performance === undefined) { log("Browser does not sup
port Web Performance"); return; } var sup
ported = typeof performance.setResourceTimingBufferSize == "function"; if (sup
ported) { log("... Performance.setResourceTimingBufferSize() = Yes"); performance.setResourceTimingBufferSize(maxSize); } else { log("... Performance.setResourceTimingBufferSize() = NOT sup
ported"); } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'setResourceTimingBufferSize()' in that specification. Candidate Recom...
PerformanceEntry.entryType - Web APIs
ark DOMString The name used when the mark was created by calling performance.mark(). measure PerformanceMeasure DOMString name used when the measure was created by calling performance.measure(). paint PerformancePaintTiming DOMString Either 'first-paint' or 'first-contentful-paint'. ...
...e was created by calling performance.measure(). paint PerformancePaintTiming DOMString Either 'first-paint' or 'first-contentful-paint'. longtask PerformanceLongTaskTiming DOMString re
ports instances of long tasks Example The following example shows the use of the entryType property. ...
... Either 'first-paint' or 'first-contentful-paint'. longtask PerformanceLongTaskTiming DOMString re
ports instances of long tasks Example The following example shows the use of the entryType property. ...
PerformanceEventTiming - Web APIs
ics`; you can replace it with your own URL. function sendToAnalytics(data) { const body = JSON.stringify(data); // Use `navigator.sendBeacon()` if available, falling back to `fetch()`. (navigator.sendBeacon && navigator.sendBeacon('/analytics', body)) || fetch('/analytics', {body, method: 'POST', keepalive: true}); } // Use a try/catch instead of feature detecting `first-input` // sup
port, since some browsers throw when using the new `type` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { function onFirstInputEntry(entry) { // Only re
port FID if the page wasn't hidden prior to // the entry being dispatched. This typically happens when a // page is loaded in a background tab. if (entry.startTime < firstHiddenTime) { const fid = entry.processin...
... sendToAnalytics({fid}); } } // Create a PerformanceObserver that calls `onFirstInputEntry` for each entry. ...
...tEntry` for each entry. const po = new PerformanceObserver((entryList) => { entryList.getEntries().forEach(onFirstInputEntry); }); // Observe entries of type `first-input`, including buffered entries, // i.e. entries that occurred before calling `observe()` below. po.observe({ type: 'first-input', buffered: true, }); } catch (e) { // Do nothing if the browser doesn't sup
port this API. } Specifications Specification Status Comment UnknownThe definition of '[[Member]]' in that specification. Unknown Initial definition. ...
PerformanceResourceTiming.connectStart - Web APIs
C...
... Candidate Recommendation Initial definition. ...
... "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'connectStart' in that specification. Candidate Recommendation Initial definition. ...
PerformanceResourceTiming.domainLookupEnd - Web APIs
...
... Candidate Recommendation Initial definition...
... "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'domainLookupEnd' in that specification. Candidate Recommendation Initial definition. ...
PerformanceResourceTiming.fetchStart - Web APIs
Can...
... Candidate Recommendation Initial definition. ...
... "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'fetchStart' in that specification. Candidate Recommendation Initial definition. ...
PerformanceResourceTiming.redirectEnd - Web APIs
Ca...
... Candidate Recommendation Initial definition. ...
... "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'redirectEnd' in that specification. Candidate Recommendation Initial definition. ...
PerformanceResourceTiming.redirectStart - Web APIs
...
... Candidate Recommendation Initial definition. ...
... "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'redirectStart' in that specification. Candidate Recommendation Initial definition. ...
PerformanceResourceTiming.responseStart - Web APIs
...
... Candidate Recommendation Initial definition. ...
... "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'responseStart' in that specification. Candidate Recommendation Initial definition. ...
PerformanceResourceTiming.workerStart - Web APIs
Wo...
... Working Draft Initial definition. ...
...ponseStart", "responseEnd", "secureConnectionStart", "workerStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 2The definition of 'workerStart' in that specification. Working Draft Initial definition. ...
Performance Timeline - Web APIs
The extensions provide interfaces to retrieve performance entry metrics based on specific filter criteria. The standard also includes interfaces that allow an application to define performance observer callbacks that are notified when specific performance events are added to the browser's performance timeline. This document provides an overview of the standard's interfaces. For more details about the interfaces, see the reference pages and Using Performance Timeline. ...
...e Level 2 version of the standard and were not widely implemented. Implementation status A summary of the interfaces' implementation status is provided below, including a link to more detailed information. Performance interface extensions: As shown in the Performance interface's Browser Compatibility table, most of these interfaces are broadly implemented by desktop browsers and have less sup
port on mobile devices. PerformanceEntry: As shown in the PerformanceEntry interface's Browser Compatibility table, most of these interfaces are broadly implemented by desktop browsers and have less sup
port on mobile devices. Performance Observers : As shown in the PerformanceObserver interface's Browser Compatibility table, this interface has no shipping implementations. To test your browser's s...
...n mobile devices. PerformanceEntry: As shown in the PerformanceEntry interface's Browser Compatibility table, most of these interfaces are broadly implemented by desktop browsers and have less sup
port on mobile devices. Performance Observers : As shown in the PerformanceObserver interface's Browser Compatibility table, this interface has no shipping implementations. To test your browser's sup
port for these interfaces, run the perf-api-sup
port application. See Also A Primer for Web Performance Timing APIs ...
Permissions.revoke() - Web APIs
s.revoke(descriptor); Parameters descriptor An object based on the PermissionDescriptor dictionary that sets options for the operation consisting of a comma-separated list of name-value pairs. The available options are: name: The name of the API whose permissions you want to query. Valid values are 'geolocation', 'midi', 'notifications', and 'push'. userVisibleOnly: (Push only, not sup
ported in Firefox -- see the Browser compatibility section below) Indicates whether you want to show a notification for every message or be able to send silent push notifications. The default is false. sysex: (MIDI only) Indicates whether you need and/or receive system exclusive messages. The default is false. Note: As of Firefox 44, the permissions for Notifications and Push have been merged...
...t-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the Storage API. Returns A Promise that calls its fulfillment handler with a PermissionStatus object indicating the result of the request. ...
...ror Retrieving the PermissionDescriptor information failed in some way, or the permission doesn't exist or is currently unsup
ported (e.g. midi, or push with userVisibleOnly). Example This function can be used by an app to request that its own Geolocation API permission be revoked. ...
PointerEvent - Web APIs
instances that were coalesced into the dispatched pointermove event. PointerEvent.getPredictedEvents() Returns a sequence of PointerEvent instances that the browser predicts will follow the dispatched pointermove event's coalesced events. Pointer event types The PointerEvent interface has several event types. To determine which event fired, look at the event's type property. Note: It's im
portant to note that in many cases, both pointer and mouse events get sent (in order to let non-pointer-specific code still interact with the user). If you use pointer events, you should call event.preventDefault() to keep the mouse event from being sent as well. pointerover This event is fired when a pointing device is moved into an element's hit test boundaries. pointerenter This event is fire...
...ld call event.preventDefault() to keep the mouse event from being sent as well. pointerover This event is fired when a pointing device is moved into an element's hit test boundaries. pointerenter This event is fired when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown event from a device that does not sup
port hover (see pointerdown). This event type is similar to pointerover, but differs in that it does not bubble. pointerdown The event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes ...
...nt is fired when a pointer is no longer active. pointercancel A browser fires this event if it concludes the pointer will no longer be able to generate events (for example the related device is deactived). pointerout This event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not sup
port hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover range detectable by the digitizer. pointerleave This event is fired when a pointing device is moved out of the hit test boundaries of an element. For pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer. gotpointercapture This event...
PublicKeyCredentialCreationOptions.extensions - Web APIs
licKeyCredentialRequestOptions.extensions. Syntax extensions = publicKeyCredentialCreationOptions.extensions Value An object with various keys and values. Here is the current (as of March 2019) list of potential extensions which may be used during the registration operation. Warning! As of June 2020, only appId (used during creation with PublicKeyCredentialRequestOptions.extensions) is sup
ported by Chrome and Edge. Firefox does not seem to sup
port any extension. Also Chrome doesn't plan to sup
port any other extension in future Extension identifier Type Description authnSel Array of BufferSource Authenticator selection. Restricts the list of authenticator models which may be used. If no matching authenticator is available, the credential is still gene...
... uvi Boolean User verification index. If true, the client outputs an ArrayBuffer which contains a value uniquely identifying a user verification data record. ...
... uvi Boolean User verification index. ...
PublicKeyCredentialRequestOptions.allowCredentials - Web APIs
An Array whose elements are objects with the following properties: type A string describing type of public-key credential to be created. As of this writing (March 2019), only "public-key" may be used. id A BufferSource matching an existing public key credential identifier (PublicKeyCredential.rawId). This identifier is generated during the creation of the PublicKeyCredential instance. trans
ports Optional An Array of strings describing the possible trans
ports between the client and the authenticator. The value of the strings may be: "usb": the authenticator can be contacted via a removable USB link "nfc": the authenticator may be used over NFC (Near Field Communication) "ble": the authenticator may be used over BLE (Bluetooth Low Energy) "internal": the authenticator is specif...
...FC (Near Field Communication) "ble": the authenticator may be used over BLE (Bluetooth Low Energy) "internal": the authenticator is specifically bound to the client device (cannot be removed). If the authenticator does not contain any of these public key credentials, the client will throw a DOMException "NotAllowedError". ...
...or is specifically bound to the client device (cannot be removed). If the authenticator does not contain any of these public key credentials, the client will throw a DOMException "NotAllowedError". ...
RTCDataChannel.readyState - Web APIs
The read-only RTCDataChannel property readyState returns an enum of type RTCDataChannelState which indicates the state of the data channel's underlying data connection. Syntax var state = aDataChannel.readyState; Values A string which is one of the values in the RTCDataChannelState enum, indicating the current state of the underlying data trans
port. RTCDataChannelState enum The RTCDataChannelState enum defines string constants which reflect the current status of the RTCDataChannel's underlying data connection. Constant Description "connecting" The user agent (browser) is in the process of creating the underlying data trans
port; that is, whatever network level connection is used to link the two peers together is in the process of being set up. This...
...e user agent (browser) is in the process of creating the underlying data trans
port; that is, whatever network level connection is used to link the two peers together is in the process of being set up. This is the state of a new RTCDataChannel after being created by RTCPeerConnection.createDataChannel() (on the peer which started the connection process). "open" The underlying data trans
port has been established and data can be transferred bidirectionally across it. This is the default state of a new RTCDataChannel created by the WebRTC layer when the remote peer created the channel and delivered to the site or app in a datachannel event of type RTCDataChannelEvent. "closing" The process of closing the underlying data trans
port has begun. It is no longer possible to queue...
...e peer created the channel and delivered to the site or app in a datachannel event of type RTCDataChannelEvent. "closing" The process of closing the underlying data trans
port has begun. It is no longer possible to queue new messages to be sent, but previously queued messages may still be send or received before entering the "closed" state. "closed" The underlying data trans
port has closed, or the attempt to make the connection failed. Example var dataChannel = peerConnection.createDataChannel("File Transfer"); var sendQueue = []; function sendMessage(msg) { switch(dataChannel.readyState) { case "connecting": console.log("Connection not open; queueing: " + msg); sendQueue.push(msg); break; case "open": sendQueue.forEach((msg) =>...
RTCDataChannel.send() - Web APIs
Data sent before connecting is buffered if possible (or an error occurs if it's not possible), and is also buffered if sent while the connection is closing or closed. Different browsers have different limitations on the size of the message you can send. ...
...ted over time, but for now, if you have questions, see Understanding message size limits in Using WebRTC data channels. Syntax RTCDataChannel.send(data); Parameters data The data to transmit across the connection. This may be a USVString, a Blob, an ArrayBuffer, or an ArrayBufferView. Return value undefined. Exceptions InvalidStateError Since the data channel uses a separate trans
port channel from the media content, it must establish its own connection; if it hasn't finished doing so (that is, its readyState is "connecting"), this error occurs without sending or buffering the data. NetworkError The specified data would need to be buffered, and there isn't room for it in the buffer. In this scenario, the underlying trans
port is immediately closed. TypeError The specified da...
...The specified data would need to be buffered, and there isn't room for it in the buffer. In this scenario, the underlying trans
port is immediately closed. TypeError The specified data is too large for the other peer to receive. Since there are multiple techniques for breaking up large data into smaller pieces for transfer, it's possible to encounter scenarios in which the other peer does not sup
port the same ones. For example, if one peer is a modern browser that sup
ports using the EOR (End of Record) flag to indicate when a received message is the last piece of a multi-part object sent using send(). For more information about message size restrictions, see Understanding message size limits in Using WebRTC data channels. Example In this example, a routine called sendMessage() is created; ...
RTCDataChannel - Web APIs
wn.onclosing The RTCDataChannel.onclosing property is an EventHandler which specifies a function to be called by the browser when the closing event is received by the RTCDataChannel. This is a simple Event which indicates that the data channel is being closed, that is, RTCDataChannel transitions to "closing" state. For example, after RTCDataChannel.close() was called but the underlying data trans
port might not have been closed yet.onerror The RTCDataChannel.onerror property is an EventHandler which specifies a function to be called when the error event is received. When an error occurs on the data channel, the function receives as input an ErrorEvent object describing the error which occurred.onmessage The RTCDataChannel.onmessage property stores an EventHandler which specifies a function t...
...when the message event is fired on the channel. This event is represented by the MessageEvent interface. This event is sent to the channel when a message is received from the other peer.onopen The RTCDataChannel.onopen property is an EventHandler which specifies a function to be called when the open event is fired; this is a simple Event which is sent when the data channel's underlying data trans
port--the link over which the RTCDataChannel's messages flow--is established or re-established.MethodsAlso inherits methods from: EventTargetclose()The RTCDataChannel.close() method closes the RTCDataChannel. Either peer is permitted to call this method to initiate closure of the channel.send()The send() method of the RTCDataChannel interface sends data across the data channel to the remote peer. Eve...
...hannel.send()The send() method of the RTCDataChannel interface sends data across the data channel to the remote peer. Events bufferedamountlow Sent to the channel's onbufferedamountlow event handler when the number of bytes of data in the outgoing data buffer falls below the value specified by bufferedAmountLowThreshold. close Sent to the onclose event handler when the underlying data trans
port closes. error Sent to the onerror event handler when an error occurs on the data channel. message Sent to the onmessage event handler when a message has been received from the remote peer. The message contents can be found in the event's data property. open Sent to the onopen event handler when the data channel is first opened, or when an existing data channel's underlying connection re-ope...
RTCIceCandidate.relatedAddress - Web APIs
ip is in fact the real IP address of the remote peer), relatedAddress is null. The relatedAddress field's value is set when the RTCIceCandidate() constructor is used. You can't specify the value of relatedAddress in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-address field. The related address and
port (related
Port) are not used at all by ICE itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. Syntax var relAddress = RTCIceCandidate.relatedAddress; Value A DOMString which contains the candidate's related address. For both peer and server reflexive candidates, the related a...
...ot used at all by ICE itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. Syntax var relAddress = RTCIceCandidate.relatedAddress; Value A DOMString which contains the candidate's related address. For both peer and server reflexive candidates, the related address (and related
port) are the base for that server or peer reflexive candidate. For relay candidates, the related address and
port are set to the mapped address selected by the TURN server. For host candidates, relatedAddress is null, meaning the field is not included in the candidate's a-line. Usage notes The related address is included in ICE candidates despite not being used by ICE itself. relatedAddress can be...
...d for diagnostic purposes; by observing the relationships between the various types of candidates and their addresses and related addresses. relatedAddress can also be used by Quality-of-Service (QoS) mechanisms. Here's an SDP attribute line (a-line) describing an ICE candidate discovered by the STUN server: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 6502 typ srflx raddr 192.168.2.77 r
port 32768 generation 0 The remote address, relatedAddress, is the dotted quad (for IPv4) or colon-delineated 64-bit address (for IPv6) immediately following the text "raddr", or "192.168.2.77". Example In this example, the candidate's type is checked, and then debugging output is presented, based on the candidate type, including the candidate's ip and relatedAddress. switch(candidate.type) { ca...
RTCIceCandidate - Web APIs
based on an object based on the RTCIceCandidateInit dictionary. Note: For backward compatibility, the constructor also accepts as input a string containing the value of the candidate property instead of a RTCIceCandidateInit object, since the candidate includes all of the information that RTCIceCandidateInit does and more. Properties candidate Read only A DOMString representing the trans
port address for the candidate that can be used for connectivity checks. The format of this address is a candidate-attribute as defined in RFC 5245. This string is empty ("") if the RTCIceCandidate is an "end of candidates" indicator. component Read only A DOMString which indicates whether the candidate is an RTP or an RTCP candidate; its value is either "rtp" or "rtcp", and is derived from the "c...
...ceComponent enumerated type. foundation Read only Returns a DOMString containing a unique identifier that is the same for any candidates of the same type, share the same base (the address from which the ICE agent sent the candidate), and come from the same STUN server. This is used to help optimize ICE performance while prioritizing and correlating candidates that appear on multiple RTCIceTrans
port objects. ip Read only A DOMString containing the IP address of the candidate.
port Read only An integer value indicating the candidate's
port number. priority Read only A long integer value indicating the candidate's priority. protocol Read only A string indicating whether the candidate's protocol is "tcp" or "udp". The string is one of those in the enumerated type RTCIceProtocol. re...
...ndicating the candidate's priority. protocol Read only A string indicating whether the candidate's protocol is "tcp" or "udp". The string is one of those in the enumerated type RTCIceProtocol. relatedAddress Read only If the candidate is derived from another candidate, relatedAddress is a DOMString containing that host candidate's IP address. For host candidates, this value is null. related
Port Read only For a candidate that is derived from another, such as a relay or reflexive candidate, the related
Port is a number indicating the
port number of the candidate from which this candidate is derived. For host candidates, the related
Port property is null. sdpMid Read only A DOMString specifying the candidate's media stream identification tag which uniquely identifies the media stream wi...
RTCIceProtocol - Web APIs
This is the preferred protocol for media interactions because of its better performance profile. ...
...This is the preferred protocol for media interactions because of its better performance profile. ...
...This is the preferred protocol for media interactions because of its better performance profile. Usage notes The RTCIceProtocol type is used by the protocol property of RTCIceCandidate objects. ...
RTCIceTcpCandidateType - Web APIs
Usage notes The RTCIceTcpCandidateType type is used by the tcpType property of RTCIceCandidate objects. ...
... Usage notes The RTCIceTcpCandidateType type is used by the tcpType property of RTCIceCandidate objects. ...
... Usage notes The RTCIceTcpCandidateType type is used by the tcpType property of RTCIceCandidate objects. ...
RTCRtpCodecCapability - Web APIs
clockRate An unsigned long integer specifying the codec's clock rate in Hertz (Hz). The IANA maintains a list of codecs and their parameters, including their clock rates. ...
... clockRate An unsigned long integer specifying the codec's clock rate in Hertz (Hz). The IANA maintains a list of codecs and their parameters, including their clock rates. ...
... used by WebRTC for details about potential codecs that might be referenced here. sdpFmtpLine Optional A DOMString giving the format specific parameters field from the a=fmtp line in the SDP which corresponds to the codec, if such a line exists. If there is no parameters field, this property is left out. Description RTCRtpCodecCapabilities describes the basic parameters for a single codec sup
ported by the user's device. An array of objects of this type is returned in the codecs property of the RTCRtpCapabilities object returned in response to a call to either of the static functions RTCRtpSender.getCapabilities() or RTCRtpReceiver.getCapabilities(). Examples TBD Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe ...
RTCRtpReceiver.getCapabilities() static function - Web APIs
The static function RTCRtpReceiver.getCapabilities() returns an RTCRtpCapabilities object describing the codecs and capabilities sup
ported by RTCRtpReceivers on the current device. You can, similarly, obtain the capabilities of RTCRtpSenders by calling the static function RTCRtpSender.getCapabilities(). Syntax let rtpCapabilities = RTCRtpReceiver.getCapabilities(kind); Parameters kind A DOMString indicating the type of media for which you wish to get the device's capability to receive. All browsers sup
port the primary media kinds: audio and video. ...
...r.getCapabilities(kind); Parameters kind A DOMString indicating the type of media for which you wish to get the device's capability to receive. All browsers sup
port the primary media kinds: audio and video. Return value An RTCRtpCapabilities object stating what capabilities the browser has for receiving the specified media kind over an RTCPeerConnection. If the browser doesn't have any sup
port for the given media kind, the returned value is null. Description As a static function, this is always called using the form: capabilities = RTCRtpReceiver.getCapabilities("audio"); The returned set of capabilities is the most optimistic possible list. It is entirely possible that certain combinations of options may fail to work when you actually try to use them. Calling RTCRtpReceiver.getCa...
...ecs and the like very often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. For that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. Example The function below returns a Boolean indicating whether or not the device sup
ports receiving H.264 video on a WebRTC connection. Since RTCRtpReceiver.getCapabilities() actually only indicates probable sup
port, attempting to receive H.264 video might still fail even after getting a positive response from this function. function canReceiveH264() { let capabilities = RTCRtpReceiver.getCapabilities("video"); capabilities.codecs.forEach((codec) => { if (codec.mimeType ...
RTCRtpSender - Web APIs
obtain access to an RTCDTMFSender which can be used to send DTMF codes (to simulate the user pressing buttons on a telephone's dial pad) to the remote peer. Properties RTCRtpSender.dtmf Read only An RTCDTMFSender which can be used to send DTMF tones using telephone-event payloads on the RTP session represented by the RTCRtpSender object. If null, the track and/or the connection doesn't sup
port DTMF. Only audio tracks can sup
port DTMF. RTCRtpSender.track Read only The MediaStreamTrack which is being handled by the RTCRtpSender. If track is null, the RTCRtpSender doesn't transmit anything. RTCRtpSender.trans
port Read only The RTCDtlsTrans
port over which the sender is exchanging the RTP and RTCP packets used to manage transmission of media and control data. This value is null until ...
...ly audio tracks can sup
port DTMF. RTCRtpSender.track Read only The MediaStreamTrack which is being handled by the RTCRtpSender. If track is null, the RTCRtpSender doesn't transmit anything. RTCRtpSender.trans
port Read only The RTCDtlsTrans
port over which the sender is exchanging the RTP and RTCP packets used to manage transmission of media and control data. This value is null until the trans
port is established. When bundling is in use, more than transceiver may be sharing the same trans
port object. Obsolete properties rtcpTrans
port This property has been removed; the RTP and RTCP trans
ports have been combined into a single trans
port. Use the trans
port property instead. Methods RTCRtpSender.getParameters() Returns a RTCRtpParameters object describing the current configurat...
... RTCRtpSender.setParameters() Applies changes to parameters which configure how the track is encoded and transmitted to the remote peer. ...
RTCRtpTransceiver.setCodecPreferences() - Web APIs
e specified set of codecs and configurations will be used for all future connections including this transceiver until this method is called again. When preparing to open an RTCPeerConnection, you can change the codec parameters from the user agent's default configuration by calling setCodecParameters() before calling either RTCPeerConnection.createOffer() or createAnswer(). A guide to codecs sup
ported by WebRTC--and each codec's positive and negative characteristics--can be found in Codecs used by WebRTC. Syntax rtcRtpTransceiver.setCodecPreferences(codecs) Parameters codecs An array of RTCRtpCodecCapability objects, in order of preference, each providing the parameters for one of the transceiver's sup
ported codecs. If codecs is empty, the codec configurations are all returned to th...
...codecs. If codecs is empty, the codec configurations are all returned to the user agent's defaults. Note: Any codecs not included in codecs will not be considered during the process of negotiating a connection. This lets you prevent the use of codecs you don't wish to use. Return value undefined Exceptions InvalidAccessError The codecs list includes one or more codecs which are not sup
ported by the transceiver. Usage notes Getting a list of sup
ported codecs You can only include in the codecs list codecs which the transceiver actually sup
ports. That means that either the associated RTCRtpSender or the RTCRtpReceiver needs to sup
port every codec in the list. If any unsup
ported codecs are listed, the browser will throw an InvalidAccessError exception when you call this method. A ...
...he codecs list codecs which the transceiver actually sup
ports. That means that either the associated RTCRtpSender or the RTCRtpReceiver needs to sup
port every codec in the list. If any unsup
ported codecs are listed, the browser will throw an InvalidAccessError exception when you call this method. A good approach to setting codec preferences is to first get the list of codecs that are actually sup
ported, then modify that list to match what you want. Pass the altered list into setCodecPreferences() to specify your preferences. To determine which codecs are sup
ported by the transceiver, call the sender's getCapabilities() and the receiver's getCapabilities() methods and get the codecs list from the results of each. The following code snippet demonstrates how to get both the list of codecs supp...
Resize Observer API - Web APIs
ng delivered to the observer each time the size changes. Concepts and usage There are a whole raft of use cases for responsive design techniques (and others besides) that respond to changes in an element's size, but previously their implementations have often been hacky and/or brittle. For example, media queries / window.matchMedia are great for updating layouts at specific points when the view
port changes sizes, but what if you want to change layout in response to a specific element's size changing, which isn't the outer container? To achieve this, a limited solution would be to listen to changes to a suitable event that hints at the element you are interested in changing size (e.g. the window resize event), then figure out what the new dimensions or other features of the element after a ...
...erver Provides the ability to register new observers and to start and stop observing elements. ResizeObserverEntry Describes a single element which has been resized, identifying the element and its new size. Examples You find a couple of simple examples on our GitHub repo: resize-observer-border-radius.html (see source): A simple example with a green box, sized as a percentage of the view
port size. When the view
port size is changed, the box's rounded corners change in pro
portion to the size of the box. We could just implement this using border-radius with a percentage, but that quickly leads to ugly-looking elliptical corners, whereas the above solution gives you nice square corners that scale with the box size. resize-observer-text.html (see source): Here we use the resize observer ...
...s, whereas the above solution gives you nice square corners that scale with the box size. resize-observer-text.html (see source): Here we use the resize observer to change the font-size of a header and paragraph as a slider's value is changed causing the containing <div> to change width. This shows that you can respond to changes in an element's size, even if they have nothing to do with the view
port. The code will usually follow this kind of pattern (taken from resize-observer-border-radius.html): const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { if(entry.contentBoxSize) { entry.target.style.borderRadius = Math.min(100, (entry.contentBoxSize.inlineSize/10) + (entry.contentBoxSize.blockSize/...
SVGURIReference - Web APIs
Methods This interface does not provide any specific methods. Specifications Specification Status Comment ...
... Methods This interface does not provide any specific methods. ...
... Methods This interface does not provide any specific methods. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGURIReference' in that specification. Candidate Recommendation Replaced the deprecated xlink:href attribute reference by the href attribute and made the prior only be reflected where it's defined to be sup
ported. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGURIReference' in that specification. Recommendation Initial definition ...
ServiceWorkerContainer.register() - Web APIs
tor) { // Register a service worker hosted at the root of the // site using the default scope. navigator.serviceWorker.register('/sw.js').then(function(registration) { console.log('Service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('Service worker registration failed:', error); }); } else { console.log('Service workers are not sup
ported.'); } The following code, if included in example.com/index.html, at the root of a site, would apply to exactly the same pages as the example above. Remember the scope, when included, uses the page's location as its base. Alternatively, if this code were included in a page at example.com/product/description.html, with the Javascript file residing at example.com/product/sw.js, then the service ...
...ple.com/product. if ('serviceWorker' in navigator) { // declaring scope manually navigator.serviceWorker.register('/sw.js', {scope: './'}).then(function(registration) { console.log('Service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('Service worker registration failed:', error); }); } else { console.log('Service workers are not sup
ported.'); } There is frequent confusion surrounding the meaning and use of scope. Since a service worker can't have a scope broader than its own location, only use the scope option when you need a scope that is narrower than the default. The following code, if included in example.com/index.html, at the root of a site, would only apply to resources under example.com/product. if ('serviceWorker' in...
.../product. if ('serviceWorker' in navigator) { // declaring scope manually navigator.serviceWorker.register('/sw.js', {scope: '/product/'}).then(function(registration) { console.log('Service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('Service worker registration failed:', error); }); } else { console.log('Service workers are not sup
ported.'); } However, Servers can remove this restriction by setting a Service-Worker-Allowed header on the service worker script, and then you can specify a max scope for that service worker above the service worker's location. Specifications Specification Status Comment Service WorkersThe definition of 'ServiceWorkerContainer: register' in that specification. Working Dr...
ServiceWorkerMessageEvent - Web APIs
Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features. The ServiceWorkerMessageEvent interface of the ServiceWorker API contains information about an event sent to a ServiceWorkerContainer target. This extends the default message event to allow setting a ServiceWorker object as the source of a message. The event object is accessed via the handler function of a message event, when fired by a message received from a service worker. This interface inherits from the Event interface. Constructor ServiceWorkerMessageEvent.ServiceWorkerMessageEvent() Creates a new ServiceWorkerMessageEvent object instance. ...
...y data type. ServiceWorkerMessageEvent.origin Read only Returns the origin of the service worker's environment settings object. ServiceWorkerMessageEvent.lastEventId Read only Represents, in server-sent events, the last event ID of the event source. ServiceWorkerMessageEvent.source Read only Returns a reference to the service worker that sent the message. ServiceWorkerMessageEvent.
ports Read only Returns an array of Message
Port objects. Methods Inherits methods from its parent, Event. Examples When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... ...
...s When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... // set up a message channel to communicate with the SW var channel = new MessageChannel(); channel.
port1.onmessage = function(e) { console.log(e); handleChannelMessage(e.data); } mySW = reg.active; mySW.postMessage('hello', [channel.
port2]); }); ...
SharedWorker() - Web APIs
igin policy is violated. A NetworkError is raised if the MIME type of the worker script is incorrect. It should always be text/javascript. A SyntaxError is raised if aURL cannot be parsed. ...
...e MIME type of the worker script is incorrect. It should always be text/javascript. A SyntaxError is raised if aURL cannot be parsed. ...
... Examples The following code snippet shows creation of a SharedWorker object using the SharedWorker() constructor and subsequent usage of the object: var myWorker = new SharedWorker('worker.js'); myWorker.
port.start(); first.onchange = function() { myWorker.
port.postMessage([first.value,second.value]); console.log('Message posted to worker'); } second.onchange = function() { myWorker.
port.postMessage([first.value,second.value]); console.log('Message posted to worker'); } myWorker.
port.onmessage = function(e) { result1.textContent = e.data; console.log('Message received from worker'); } For a full example, see our Basic shared worker example (run shared worker.) Specifications Specification Status Comment HTML Living StandardThe definition of 'Shar...
SubtleCrypto.encrypt() - Web APIs
g exceptions are encountered: InvalidAccessError Raised when the requested operation is not valid for the provided key (e.g. invalid encryption algorithm, or invalid key for the specified encryption algorithm). OperationError Raised when the operation failed for an operation-specific reason (e.g. algorithm parameters of invalid sizes, or AES-GCM plaintext longer than 239-256 bytes). Sup
ported algorithms The Web Crypto API provides four algorithms that sup
port the encrypt() and decrypt() operations. One of these algorithms -- RSA-OAEP -- is a public-key cryptosystem. The other three encryption algorithms here are all symmetric algorithms, and they're all based on the same underlying cipher, AES (Advanced Encryption Standard). The difference between them is the mode. The Web Crypto...
...ithms The Web Crypto API provides four algorithms that sup
port the encrypt() and decrypt() operations. One of these algorithms -- RSA-OAEP -- is a public-key cryptosystem. The other three encryption algorithms here are all symmetric algorithms, and they're all based on the same underlying cipher, AES (Advanced Encryption Standard). The difference between them is the mode. The Web Crypto API sup
ports three different AES modes: CTR (Counter Mode) CBC (Cipher Block Chaining) GCM (Galois/Counter Mode) It's strongly recommended to use authenticated encryption, which includes checks that the ciphertext has not been modified by an attacker. Authentication helps protect against chosen-ciphertext attacks, in which an attacker can ask the system to decrypt arbitrary messages, and use the resul...
..."AES-CTR", counter, length: 64 }, key, encoded ); } let iv = new Uint8Array(16); let key = new Uint8Array(16); let data = new Uint8Array(12345); //crypto functions are wrapped in promises so we have to use await and make sure the function that //contains this code is an async function //encrypt function wants a cryptokey object const key_encoded = await crypto.subtle.im
portKey( "raw", key.buffer, 'AES-CTR' , false, ["encrypt", "decrypt"]); const encrypted_content = await window.crypto.subtle.encrypt( { name: "AES-CTR", counter: iv, length: 128 }, key_encoded, data ); //Uint8Array console.log(encrypted_content); AES-CBC This code fetches the contents of a text box, encodes it for encryption, and encrypts it using AES in...
SubtleCrypto.sign() - Web APIs
the data to be signed. Return value signature is a Promise that fulfills with an ArrayBuffer containing the signature. Exceptions The promise is rejected when the following exception is encountered: InvalidAccessError Raised when the signing key is not a key for the request signing algorithm or when trying to use an algorithm that is either unknown or isn't suitable for signing. Sup
ported algorithms The Web Crypto API provides four algorithms that can be used for signing and signature verification. Three of these algorithms -- RSASSA-PKCS1-v1_5, RSA-PSS, and ECDSA -- are public-key cryptosystems that use the private key for signing and the public key for verification. These systems all use a digest algorithm to hash the message to a short fixed size before signing. The choice ...
... that can be used for signing and signature verification. Three of these algorithms -- RSASSA-PKCS1-v1_5, RSA-PSS, and ECDSA -- are public-key cryptosystems that use the private key for signing and the public key for verification. These systems all use a digest algorithm to hash the message to a short fixed size before signing. The choice of digest algorithm is passed into the generateKey() or im
portKey() functions. The fourth algorithm -- HMAC -- uses the same algorithm and key for signing and for verification: this means that the verification key must be kept secret, which in turn means that this algorithm is not suitable for many signature use cases. It can be a good choice however when the signer and verifier are the same entity. RSASSA-PKCS1-v1_5 The RSASSA-PKCS1-v1_5 algorithm is spe...
...Digital Signature Algorithm) is a variant of the Digital Signature Algorithm, specified in FIPS-186, that uses Elliptic Curve Cryptography (RFC 6090). HMAC The HMAC algorithm calculates and verifies hash-based message authentication codes according to the FIPS 198-1 standard. The digest algorithm to use is specified in the HmacKeyGenParams object that you pass into generateKey(), or the HmacIm
portParams object that you pass into im
portKey(). Examples Note: You can try the working examples out on GitHub. RSASSA-PKCS1-v1_5 This code fetches the contents of a text box, encodes it for signing, and signs it with a private key. See the complete source code on GitHub. /* Fetch the contents of the "message" textbox, and encode it in a form we can use for the sign operation. */ function getM...
WebGLRenderingContext.depthRange() - Web APIs
Clamped to the range 0 to 1. The default value is 1. Return value None. ...
...Clamped to the range 0 to 1. The default value is 1. Return value None. ...
...Clamped to the range 0 to 1. The default value is 1. Return value None. ...
WebGLRenderingContext.getParameter() - Web APIs
gl.RENDERER DOMString gl.S...
... Constant Returned type Description gl.COPY_READ_BUFFER_BINDING WebGLBuffer or null See bindBuffer. gl.COPY_WRITE_BUFFER_BINDING WebGLBuffer or null See bindBuffer. gl.DRAW_BUFFERi GLenum gl.BACK, gl.N...
... GLuint64EXT EXT_disjoint_timer_query The current time. ext.GPU_DISJOINT_EXT GLboolean EXT_disjoint_timer_query Returns whether or not the GPU performed any disjoint operation. ext.MAX_VIEWS_OVR GLint OVR_multiview2 Maximum number of views. Examples gl.getParameter(gl.DITHER); gl.getParameter(gl.VERSION); gl.getParameter(gl.VIEW
PORT); Specifications Specification Status Comment WebGL 1.0The definition of 'getParameter' in that specification. Recommendation Initial definition. WebGL 2.0The definition of 'getParameter' in that specification. Editor's Draft Adds additional parameter names. OpenGL ES 2.0The definition of 'glGet' in that specification. Standard Man pa...
A basic 2D WebGL animation example - Web APIs
This starts by specifying the precision of the float type, as required. Then we set the global gl_FragColor to the value of the uniform uGlobalColor, which is set by the JavaScript code to the color being used to draw the square. HTML The HTML consists solely of the <canvas> that we'll obtain a WebGL context on. <canvas id="glcanvas" width="600" height="460"> Oh no! Your browser doesn't sup
port canvas! </canvas> JavaScript Globals and initialization First, the global variables. We won't discuss these here; instead, we'll talk about them as they're used in the code to come. let gl = null; let glCanvas = null; // Aspect ratio and coordinate system // details let aspectRatio; let currentRotation = [0, 1]; let currentScale = [1.0, 1.0]; // Vertex information let vertexArray; let ver...
... string to insert the correct shader type string into the message that gets generated. The actual error details are obtained by calling gl.getShaderInfoLog(). Finally, the compiled shader is returned to the caller (which is the buildShaderProgram() function. Drawing and animating the scene The animateScene() function is called to render each animation frame. ...
...tionFrame(function(currentTime) { let deltaAngle = ((currentTime - previousTime) / 1000.0) * degreesPerSecond; currentAngle = (currentAngle + deltaAngle) % 360; previousTime = currentTime; animateScene(); }); } The first thing that needs to be done in order to draw a frame of the animation is to clear the background to the desired color. In this case, we set the view
port based on the size of the <canvas>, call clearColor() to set the color to use when clearing content, then we clear the buffer with clear(). Next, the current rotation vector is computed by converting the current rotation in degrees (currentAngle) into radians, then setting the first component of the rotation vector to the sine of that value and the second component to the cosine. The currentRotat...
Basic scissoring - Web APIs
n outside which drawing will not occur. Clearing the drawing buffer when scissoring applies This is a simple demonstration of a rendering with scissor(). Although the clear() drawing command writes the clear color (set by clearColor()) to all pixels in the drawing buffer, scissor() defines a mask that only allows pixels inside the specified rectangular area to be updated. This is a good op
portunity to talk about the difference between pixels and fragments. A pixel is a picture element (in practice, a point) on the screen, or a single element of the drawing buffer, that area in memory that holds your pixel data (such as RGBA color components). A fragment refers to the pixel while it is being handled by the WebGL pipeline. The reason for this distinction is that fragment color (and othe...
... typical order of commands in WebGL. We first tweak WebGL state. In this case, enabling the scissor test and establishing a rectangular mask. Only when the WebGL state has been satisfactorily tweaked, we execute the drawing command (in this case, clear()) that starts the processing of fragments down the graphics pipeline. ...
... CSS pixels) of // the drawing buffer to be identical to the size of the // canvas HTML element, as determined by CSS. canvas.width = canvas.clientWidth; canvas.height = canvas.clientHeight; var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); if (!gl) { paragraph.innerHTML = "Failed to get WebGL context. " + "Your browser or device may not sup
port WebGL."; return; } gl.view
port(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); // Enable scissoring operation and define the position and // size of the scissoring area. gl.enable(gl.SCISSOR_TEST); gl.scissor(40, 20, 60, 130); // Clear the drawing buffer solid yellow. gl.clearColor(1.0, 1.0, 0.0, 1.0); gl.clear(gl.COLOR_BUFFER_BIT); }, false); The source code o...
Boilerplate 1 - Web APIs
. In case of error, it displays an error message and returns null. Finally, all JavaScript code will run within an immediate function, which is a common JavaScript technique (see Function). The function declaration and invocation will also be hidden. HTML <p>[ Some descriptive text about the example. ]</p> <button>[ Optional button element. ...
... << PreviousNext >> ...
... << PreviousNext >> ...
Canvas size and WebGL - Web APIs
size of the canvas Element in the browser window. The effect is clearly visible when using scissor() and clear() to draw a square in the center of the canvas, by specifying its position and size in pixels. In the first canvas, we get the desired result. In the second, the square has the wrong shape, size, and position. ...
... visible when using scissor() and clear() to draw a square in the center of the canvas, by specifying its position and size in pixels. In the first canvas, we get the desired result. In the second, the square has the wrong shape, size, and position. ...
...nvas")[1]; firstCanvas.width = firstCanvas.clientWidth; firstCanvas.height = firstCanvas.clientHeight; [firstCanvas, secondCanvas].forEach(function(canvas) { var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); if (!gl) { document.querySelector("p").innerHTML = "Failed to get WebGL context. " + "Your browser or device may not sup
port WebGL."; return; } gl.view
port(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); gl.enable(gl.SCISSOR_TEST); gl.scissor(30, 10, 60, 60); gl.clearColor(1.0, 1.0, 0.0, 1.0); gl.clear(gl.COLOR_BUFFER_BIT); }); }, false); The source code of this example is also available on GitHub. << PreviousNext >> ...
Clearing by clicking - Web APIs
he canvas or the button, the canvas is cleared with a new randomly chosen color. Note how we embed the WebGL function calls inside the event handler function. ...
...alse); button.addEventListener("click", switchColor, false); // A variable to hold the WebGLRenderingContext. var gl; // The click event handler. function switchColor () { // Referring to the externally defined gl variable. // If undefined, try to obtain the WebGLRenderingContext. // If failed, alert user of failure. ...
...ned gl variable. // If undefined, try to obtain the WebGLRenderingContext. // If failed, alert user of failure. // Otherwise, initialize the drawing buffer (the view
port). if (!gl) { gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); if (!gl) { alert("Failed to get WebGL context.\n" + "Your browser or device may not sup
port WebGL."); return; } gl.view
port(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); } // Get a random color value using a helper function. var color = getRandomColor(); // Set the clear color to the random color. gl.clearColor(color[0], color[1], color[2], 1.0); // Clear the context with the newly set color. This is // the function call th...
Clearing with colors - Web APIs
ommand) translates into output (in this case, all pixels are set to green). Finally, we note that color in WebGL is usually in RGBA format, that is four numerical components for red, green, blue and alpha (opacity). Therefore, clearColor() takes four arguments. ...
...els are set to green). Finally, we note that color in WebGL is usually in RGBA format, that is four numerical components for red, green, blue and alpha (opacity). Therefore, clearColor() takes four arguments. <p>A very simple WebGL program that shows some color.</p> <!-- Text within a canvas element is displayed only if canvas is not sup
ported. --> <canvas>Your browser does not seem to sup
port HTML5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } // Run everything inside window load event handler, to make sure // DOM is fully loaded and styled before trying to manipulate it, // and to not mess up the global scope. We are giving the event...
...istener(evt.type, setupWebGL, false); // References to the document elements. var paragraph = document.querySelector("p"), canvas = document.querySelector("canvas"); // Getting the WebGL rendering context. var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); // If failed, inform user of failure. Otherwise, initialize // the drawing buffer (the view
port) and clear the context // with a solid color. if (!gl) { paragraph.innerHTML = "Failed to get WebGL context. " + "Your browser or device may not sup
port WebGL."; return; } paragraph.innerHTML = "Congratulations! Your browser sup
ports WebGL. "; gl.view
port(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); // Set the clear color to darkish green. gl.clearColo...
Color masking - Web APIs
purples, crimsons, and so on), and masking only red would give shades of cyan (also sea greens, blues, and so on). Note that the calls to colorMask() only occur when the user clicks on one of the toggle buttons. But rendering is done every second, using the timer. The color mask state of WebGL is preserved, so we do not need to call colorMask() every frame to set up the color mask. This is an im
portant aspect of the WebGL state machine. It allows us to setup WebGL in a single initialization phase, and then just execute drawing commands for each frame. Color masking gives you fine control of updating pixel values on the screen. By limiting the color channels that are written by each drawing command, you can use each channel, for example, to store a different grayscale image. Alternatively, y...
...ch operation serves as the input of the next. So, for example, clearing operation sets the value of each pixel to the chosen clear color. Masking occurs later in the pipeline, and modifies the pixel color value, so the final result on the screen is that of the clear color, tinted by the color mask. ...
...stener("load", function setupAnimation (evt) { "use strict" window.removeEventListener(evt.type, setupAnimation, false); var canvas = document.querySelector("canvas"); var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); if (!gl) { document.querySelector("p").innerHTML = "Failed to get WebGL context." + "Your browser or device may not sup
port WebGL."; return; } gl.view
port(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); var timer = setInterval(drawAnimation, 1000); var mask = [true, true, true]; var redtoggle = document.querySelector("#red-toggle"), greentoggle = document.querySelector("#green-toggle"), bluetoggle = document.querySelector("#blue-toggle"); redtoggle.addEventListener("click", setColor...
Hello GLSL - Web APIs
t work in some mobile or older browsers. If the canvas remains blank, you can check the output of the next example, which draws exactly the same thing. But remember to read through the explanations and code on this page, before moving on to the next. Hello World program in GLSL A very simple first shader program. ...
... << PreviousNext >> ...
... << PreviousNext >> ...
Hello vertex attributes - Web APIs
s how to combine shader programming and user interaction by sending user input to the shader using vertex attributes. Hello World program in GLSL How to send input to a shader program by saving data in GPU memory. <p>First encounter with attributes and sending data to GPU. ...
... << PreviousNext >> ...
... << PreviousNext >> ...
Raining rectangles - Web APIs
state machine. In addition, the example demonstrates how to integrate the WebGL function calls within a game loop. The game loop is responsible for drawing the animation frames, and keeping the animation responsive to user input. Here, the game loop is implemented using timeouts. <p>You caught <strong>0</strong>. ...
... << PreviousNext >> ...
... << PreviousNext >> ...
Scissor animation - Web APIs
update only its position every frame. The clear color state of WebGL remains at the set value, until we change it again when a new square is created. ...
... << PreviousNext >> ...
... << PreviousNext >> ...
Textures from code - Web APIs
example provides a simple demonstration of procedural texturing with fragment shaders. That is, using code to generate textures for use in shading WebGL objects. Drawing textures with code Texturing a point sprite with calculations done per-pixel in the fragment shader. <p>Texture from code. ...
... << PreviousNext >> ...
... << PreviousNext >> ...
Matrix math for the web - Web APIs
These functions create a lot of new arrays, which can be particularly expensive for real-time operations due to garbage collection. In real production code it would be best to use optimized functions. glMatrix is an example of a library that has a focus on speed and performance. The focus in the...
...They can easily be shared around in programs. Different coordinate spaces can be described with matrices, and some matrix multiplication will move one set of data from one coordinate space to another coordinate space. Matrices effectively remember every part of the p...
...They can easily be shared around in programs. Different coordinate spaces can be described with matrices, and some matrix multiplication will move one set of data from one coordinate space to another coordinate space. Matrices effectively remember every part of the previous transforms that ...
Getting started with WebGL - Web APIs
WebGL programs consist of control code written in JavaScript and shader code (GLSL) that is executed on a computer's Graphics Processing Unit (GPU). WebGL elements can be mixed with other HTML elements and composited with other parts of the page or page background. This article will introduce you to the basics of using WebGL. ...
...pt is loaded. Its purpose is to set up the WebGL context and start rendering content. // // start here // function main() { const canvas = document.querySelector("#glCanvas"); // Initialize the GL context const gl = canvas.getContext("webgl"); // Only continue if WebGL is available and working if (gl === null) { alert("Unable to initialize WebGL. Your browser or machine may not sup
port it."); return; } // Set clear color to black, fully opaque gl.clearColor(0.0, 0.0, 0.0, 1.0); // Clear the color buffer with specified clear color gl.clear(gl.COLOR_BUFFER_BIT); } window.onload = main; The first thing we do here is obtain a reference to the canvas, assigning it to a variable named canvas. Once we have the canvas, we try to get a WebGLRenderingContext for it by...
...(0.0, 0.0, 0.0, 1.0); // Clear the color buffer with specified clear color gl.clear(gl.COLOR_BUFFER_BIT); } window.onload = main; The first thing we do here is obtain a reference to the canvas, assigning it to a variable named canvas. Once we have the canvas, we try to get a WebGLRenderingContext for it by calling getContext() and passing it the string "webgl". If the browser does not sup
port WebGL, getContext() will return null in which case we display a message to the user and exit. If the context is successfully initialized, the variable gl is our reference to it. In this case, we set the clear color to black, and clear the context to that color (redrawing the canvas with the background color). At this point, you have enough code that the WebGL context should successfully initia...
Using textures in WebGL - Web APIs
x and vertex math. You'll need to include it if you create your own project based on this code. Our sample loads a copy from a CDN in our HTML's <head>. Loading textures The first thing to do is add code to load the textures. In our case, we'll be using a single texture, mapped onto all six sides of our rotating cube, but the same technique can be used for any number of textures. Note: It's im
portant to note that the loading of textures follows cross-domain rules; that is, you can only load textures from sites for which your content has CORS approval. See Cross-domain textures below for details. The code that loads the texture looks like this: // // Initialize a texture and load an image. // When the image finished loading copy it into the texture. // function loadTexture(gl, url) { co...
...from secure contexts, you can't use textures loaded from file:/// URLs in WebGL. That means that you'll need a secure web server to test and deploy your code. For local testing, see our guide How do you set up a local testing server? for help. See this hacks.mozilla.org article for an explanation of how to use CORS-approved images as WebGL textures, with a self-contained example. Note: CORS sup
port for WebGL textures and the crossOrigin attribute for image elements is implemented in Gecko 8.0. Tainted (write-only) 2D canvases can't be used as WebGL textures. A 2D <canvas> becomes tainted, for example, when a cross-domain image is drawn on it. Note: CORS sup
port for Canvas 2D drawImage is implemented in Gecko 9.0. This means that using a cross-domain image with CORS approval does no long...
... (write-only) 2D canvases can't be used as WebGL textures. A 2D <canvas> becomes tainted, for example, when a cross-domain image is drawn on it. Note: CORS sup
port for Canvas 2D drawImage is implemented in Gecko 9.0. This means that using a cross-domain image with CORS approval does no longer taint the 2D canvas, so the 2D canvas remains usable as the source of a WebGL texture. Note: CORS sup
port for cross-domain videos and the crossorigin attribute for <video> elements is implemented in Gecko 12.0. << PreviousNext >> ...
A simple RTCDataChannel sample - Web APIs
st step is to create the "local" end of the connection. This is the peer that will send out the connection request. The next step is to create the RTCDataChannel by calling RTCPeerConnection.createDataChannel() and set up event listeners to monitor the channel so that we know when it's opened and closed (that is, when the channel is connected or disconnected within that peer connection). It's im
portant to keep in mind that each end of the channel has its own RTCDataChannel object. Set up the remote peer remoteConnection = new RTCPeerConnection(); remoteConnection.ondatachannel = receiveChannelCallback; The remote end is set up similarly, except that we don't need to explicitly create an RTCDataChannel ourselves, since we're going to be connected through the channel established above. Inst...
...h(handleCreateDescriptionError); Let's go through this line by line and decipher what it means. First, we call RTCPeerConnection.createOffer() method to create an SDP (Session Description Protocol) blob describing the connection we want to make. This method accepts, optionally, an object with constraints to be met for the connection to meet your needs, such as whether the connection should sup
port audio, video, or both. In our simple example, we don't have any constraints. If the offer is created successfully, we pass the blob along to the local connection's RTCPeerConnection.setLocalDescription() method. This configures the local end of the connection. The next step is to connect the local peer to the remote by telling the remote peer about it. This is done by calling remoteConnection.R...
...ing built. In a real application, this would require a signaling server to exchange the description object. That means it's time for the remote peer to reply. It does so by calling its createAnswer() method. This generates a blob of SDP which describes the connection the remote peer is willing and able to establish. This configuration lies somewhere in the union of options that both peers can sup
port. Once the answer has been created, it's passed into the remoteConnection by calling RTCPeerConnection.setLocalDescription(). That establishes the remote's end of the connection (which, to the remote peer, is its local end. This stuff can be confusing, but you get used to it). Again, this would normally be exchanged through a signalling server. Finally, the local connection's remote description ...
Improving compatibility using WebRTC adapter.js - Web APIs
fixes on some or all WebRTC APIs. While you can manually code around these issues, there is an easier way. The WebRTC organization provides on GitHub the WebRTC adapter to work around compatibility issues in different browsers' WebRTC implementations. The adapter is a JavaScript shim which lets your code to be written to the specification so that it will "just work" in all browsers with WebRTC sup
port. ...
...patibility issues in different browsers' WebRTC implementations. The adapter is a JavaScript shim which lets your code to be written to the specification so that it will "just work" in all browsers with WebRTC sup
port. There's no need to conditionally use prefixed APIs or implement other workarounds. Note: Since there is ongoing fluidity in functionality and naming of API terms in WebRTC and sup
porting browsers, use of this adapter is generally recommended. The adapter is provided under a BSD-style license. What adapter.js does For each version of each browser that sup
ports WebRTC, adapter.js implements the needed polyfills, establishes the non-prefixed names of APIs, and applies any other changes needed to make the browser run code written to the WebRTC specification. For example, on F...
... What adapter.js does For each version of each browser that sup
ports WebRTC, adapter.js implements the needed polyfills, establishes the non-prefixed names of APIs, and applies any other changes needed to make the browser run code written to the WebRTC specification. For example, on Firefox versions older than 38, the adapter adds the RTCPeerConnection.urls property; Firefox doesn't natively sup
port this property until Firefox 38, while on Chrome, the adapter adds sup
port for the Promise based API is added if it's not present. These are just a couple of examples; there are of course other adjustments made for you by the shim. The WebRTC adapter currently sup
ports Mozilla Firefox, Google Chrome, Apple Safari, and Microsoft Edge. Using adapter.js In order to use adapter.js, you need to incl...
Web Audio API best practices - Web APIs
are looking at either the grabbing the file from an HTMLMediaElement (i.e. an <audio> or <video> element), or you're looking to fetch the file and decode it into a buffer. Both are legitimate ways of working, however, it's more common to use the former when you are working with full-length tracks, and the latter when working with shorter, more sample-like tracks. Media elements have streaming sup
port out of the box. The audio will start playing when the browser determines it can load the rest of the file before playing finishes. You can see an example of how to use this with the Web Audio API in the Using the Web Audio API tutorial. You will, however, have more control if you use a buffer node. You have to request the file and wait for it to load (this section of our advanced article shows a...
...is good for WebRTC and situations where you might want to record or possibly analyse audio. The last way is to generate your own sound, which can be done with either an OscillatorNode or by creating a buffer and populating it with your own data. Check out the tutorial here for creating your own instrument for information on creating sounds with oscillators and buffers. Cross browser & legacy sup
port The Web Audio API specification is constantly evolving and like most things on the web, there are some issues with it working consistently across browsers. Here we'll look at options for getting around cross-browser problems. There's the standardised-audio-context npm package, which creates API functionality consistently across browsers, full holes as they are found. It's constantly in developm...
...ere's the standardised-audio-context npm package, which creates API functionality consistently across browsers, full holes as they are found. It's constantly in development and endeavours to keep up with the current specification. There is also the option of libraries, of which there are a few depending on your use case. For a good all-rounder, howler.js is a good choice. It has cross-browser sup
port and, provides a useful subset of functionality. Although it doesn't harness the full gamut of filters and other effects the Web Audio API comes with, you can do most of what you'd want to do. If you are looking for sound creation or a more instrument-based option, tone.js is a great library. It provides advanced scheduling capabilities, synths, and effects, and intuitive musical abstractions bui...
Background audio processing using AudioWorklet - Web APIs
turns a new AudioWorkletNode. Once you have that in hand, you connect it to other nodes and otherwise use it just like any other node. You can then create a new audio processor node by simply doing this: let newProcessorNode = createMyAudioProcessor(); If the returned value, newProcessorNode, is non-null, we have a valid audio context with its hiss processor node in place and ready to use. Sup
porting audio parameters Just like any other Web Audio node, AudioWorkletNode sup
ports parameters, which are shared with the AudioWorkletProcessor that does the actual work. Adding parameter sup
port to the processor To add parameters to an AudioWorkletNode, you need to define them within your AudioWorkletProcessor-based processor class in your module. This is done by adding the static getter parame...
... In the following implementation of parameterDescriptors(), the returned array has two AudioParam objects. The first defines gain as a value between 0 and 1, with a default value of 0.5. The second parameter is named frequency and defaults to 440.0, with a range from 275 to 4186.009, inclusively. ...
...These values are to be applied to the corresponding frames. K-rate parameters K-rate parameters, on the other hand, can only change once per block, so the parameter's array has only a single entry. Use that value for every frame in the block. In the code below, we see a process() function that handles a gain parameter which can be used as either an a-rate or k-rate parameter. Our node only sup
ports one input, so it just takes the first input in the list, applies the gain to it, and writes the resulting data to the first output's buffer. process(inputList, outputList, parameters) { const input = inputList[0]; const output = outputList[0]; const gain = parameters.gain; for (let channelNum = 0; channelNum < input.length; channel++) { const inputChannel = input[channel]; cons...
Window: beforeunload event - Web APIs
beforeunload This event enables a web page to trigger a confirmation dialog asking the user if they really want to leave the page. If the user confirms, the browser navigates to the new page, otherwise it cancels the navigation. According to the specification, to show the confirmation dialog an event handler should call preventDefault() on the event. ...
... To combat unwanted pop-ups, browsers may not display prompts created in beforeunload event handlers unless the page has been interacted with, or may even not display them at all. ...
...e Firefox's Back-Forward cache or WebKit's Page Cache. The HTML specification states that calls to window.alert(), window.confirm(), and window.prompt() methods may be ignored during this event. See the HTML specification for more details. Examples The HTML specification states that authors should use the Event.preventDefault() method instead of using Event.returnValue. However, this is not sup
ported by all browsers. window.addEventListener('beforeunload', (event) => { // Cancel the event as stated by the standard. event.preventDefault(); // Chrome requires returnValue to be set. event.returnValue = ''; }); Specifications Specification Status Comment HTML Living StandardThe definition of 'beforeunload' in that specification. Living Standard ...
window.postMessage() - Web APIs
The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it. Normally, scripts on different pages are allowed to access each other if and only if the pages they originate from share the same protocol,
port number, and host (also known as the "same-origin policy"). window.postMessage() provides a controlled mechanism to securely circumvent this restriction (if used properly). Broadly, one window may obtain a reference to another (e.g., via targetWindow = window.opener), and then dispatch a MessageEvent on it with targetWindow.postMessage(). The receiving window is then free to handle this event as needed. The arguments passed to window.postMessage() (i.e...
...ne algorithm. This means you can pass a broad variety of data objects safely to the destination window without having to serialize them yourself. [1] targetOrigin Specifies what the origin of targetWindow must be for the event to be dispatched, either as the literal string "*" (indicating no preference) or as a URI. If at the time the event is scheduled to be dispatched the scheme, hostname, or
port of targetWindow's document does not match that provided in targetOrigin, the event will not be dispatched; only if all three match will the event be dispatched. This mechanism provides control over where messages are sent; for example, if postMessage() was used to transmit a password, it would be absolutely critical that this argument be a URI whose origin is the same as the intended receiver of ...
... receiveMessage(event) { if (event.origin !== "http://example.org:8080") return; // ... } The properties of the dispatched message are: data The object passed from the other window. origin The origin of the window that sent the message at the time postMessage was called. This string is the concatenation of the protocol and "://", the host name if one exists, and ":" followed by a
port number if a
port is present and differs from the default
port for the given protocol. Examples of typical origins are https://example.org (implying
port 443), http://example.net (implying
port 80), and http://example.com:8080. Note that this origin is not guaranteed to be the current or future origin of that window, which might have been navigated to a different location since postMessage was cal...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
t before it happens</button> JavaScript var timeoutID; function delayedAlert() { timeoutID = window.setTimeout(window.alert, 2*1000, 'That was really slow!'); } function clearAlert() { window.clearTimeout(timeoutID); } Result See also clearTimeout() example. Polyfill If you need to pass one or more arguments to your callback function, but need it to work in browsers which don't sup
port sending additional arguments using either setTimeout() or setInterval() (e.g., Internet Explorer 9 and below), you can include this polyfill to enable the HTML5 standard arguments-passing functionality. Just add this code to the top of your script: /*\ |*| |*| Polyfill which enables the passage of arbitrary arguments to the |*| callback functions of JavaScript timers (HTML5 standard syntax). |...
...ds, which comes into effect 30 seconds after a document has first loaded. The prefs that control this behaviour are: dom.min_tracking_timeout_value: 4 dom.min_tracking_background_timeout_value: 10000 dom.timeout.tracking_throttling_delay: 30000 Late timeouts In addition to "clamping", the timeout can also fire later when the page (or the OS/browser itself) is busy with other tasks. One im
portant case to note is that the function or code snippet cannot be executed until the thread that called setTimeout() has terminated. For example: function foo() { console.log('foo has been called'); } setTimeout(foo, 0); console.log('After setTimeout'); Will write to the console: After setTimeout foo has been called This is because even though setTimeout was called with a delay of zero, it's p...
...t cannot be executed until the thread that called setTimeout() has terminated. For example: function foo() { console.log('foo has been called'); } setTimeout(foo, 0); console.log('After setTimeout'); Will write to the console: After setTimeout foo has been called This is because even though setTimeout was called with a delay of zero, it's placed on a queue and scheduled to run at the next op
portunity; not immediately. Currently-executing code must complete before functions on the queue are executed, thus the resulting execution order may not be as expected. Deferral of timeouts during pageload Starting in Firefox 66, Firefox will defer firing setTimeout and setInterval timers while the current tab is loading. Firing is deferred until the MainThread is deemed idle (similar to window.r...
WorkerLocation - Web APIs
lsReadOnly.href Read only Is a stringifier that returns a DOMString containing the whole URL of the script executed in the Worker. URLUtilsReadOnly.protocol Read only Is a DOMString containing the protocol scheme of the URL of the script executed in the Worker, including the final ':'. ...
... URLUtilsReadOnly.pathname Read only Is a DOMString containing an initial '/' followed by the path of the URL of the script executed in the Worker. ...
... URLUtilsReadOnly.pathname Read only Is a DOMString containing an initial '/' followed by the path of the URL of the script executed in the Worker. URLUtilsReadOnly.search Read only Is a DOMString containing a '?' followed by the parameters of the URL of the script executed in the Worker. ...
XMLHttpRequest.sendAsBinary() - Web APIs
Syntax XMLHttpRequest.sendAsBinary(binaryString); Parameters binaryString A DOMString which encodes the binary content to be sent. You can create the binary string using the FileReader method readAsBinaryString(). ...
... Syntax XMLHttpRequest.sendAsBinary(binaryString); Parameters binaryString A DOMString which encodes the binary content to be sent. You can create the binary string using the FileReader method readAsBinaryString(). ...
... Parameters binaryString A DOMString which encodes the binary content to be sent. You can create the binary string using the FileReader method readAsBinaryString(). The string is converted to binary for transfer by removing the high-order byte of each character. Return value undefined. Polyfill Since sendAsBinary() is an experimental feature, here is a polyfill for browsers that don't sup
port the sendAsBinary() method but sup
port typed arrays. /*\ |*| |*| :: XMLHttpRequest.prototype.sendAsBinary() Polyfill :: |*| |*| https://developer.mozilla.org/docs/DOM/XMLHttpRequest#sendAsBinary() |*| \*/ if (!XMLHttpRequest.prototype.sendAsBinary) { XMLHttpRequest.prototype.sendAsBinary = function (sData) { var nBytes = sData.length, ui8Data = new Uint8Array(nBytes); for (var nIdx =...
XRViewerPose - Web APIs
ayer in a MMORPG might have an instance of XRViewerPose to provide a way to calculate what they can see; if the game provides a mechanism that tells the player if another player sees them, or that they see another player, this information becomes crucial. An XRViewerPose is always obtained and referenced relative to an existing XRReferenceSpace. ...
...nformation becomes crucial. An XRViewerPose is always obtained and referenced relative to an existing XRReferenceSpace. This ensures that positions and orientations are re
ported using the expected relative coordinate system. To render a scene using the XRViewerPose representing the user's head, one would iterate over the views in the views array, rendering them one after another. By calling view
port() on the WebGL context, specifying the XRView as input, you can get the view
port to use when rendering in order to draw the frame for that eye into the correct part of the drawing surface. Also, when rendering the scene for spectators or other players in a multiplayer game, the transform of the XRViewerPose can be used to determine both placement and facing direction of the other players in the ...
...ews in the pose; these are most likely the views for the left and right eyes. let pose = frame.getViewerPose(xrReferenceSpace); if (pose) { let glLayer = xrSession.renderState.baseLayer; gl.bindFrameBuffer(gl.FRAMEBUFFER, glLayer.framebuffer); gl.clearColor(0, 0, 0, 1); gl.clearDepth(1); gl.clear(gl.COLOR_BUFFER_BIT, gl.DEPTH_BUFFER_BIT); for (let view of pose.views) { let view
port = glLayer.getView
port(view); gl.view
port(view
port.x, view
port.y, view
port.width, view
port.height); /* render the scene for the eye view.eye */ } } Passing each view to getView
port() returns the WebGL view
port to apply in order to cause the rendered output to be positioned correctly in the framebuffer for renderijng to the corresponding eye on the output device. This code is derived ...
XRWebGLLayer.antialias - Web APIs
Otherwise, this property is false. ...
...Otherwise, this property is false. ...
...Otherwise, this property is false. When the WebXR compositor is enabled, this value corresponds to the value of the antialias property on the object returned by the WebGL context's getContentAttributes() method. ...
XRWebGLLayer.framebuffer - Web APIs
ing rendered, or null if the XR compositor is disabled for the session. Usage notes How opaque framebuffers are special The framebuffer represented by the framebuffer property is opaque. As such, its behavior is different in several ways from a standard WebGL context. These differences cause the opaque framebuffer to behave more like the default WebGL framebuffer: Opaque framebuffers may sup
port anti-aliasing, even under WebGL 1.0, which don't normally do so. Opaque framebuffers' attachments (buffers and the like) can't be inspected or changed. Calling functions such as framebufferTexture2D(), framebufferRenderbuffer(), deleteFramebuffer(), or getFramebufferAttachmentParameter() on an opaque framebuffer results in the WebGL error INVALID_OPERATION (0x0502). Opaque framebuffers are cons...
...paque framebuffers are considered incomplete and are not available for rendering other than while executing the requestAnimationFrame() callback. Attempting to clear, draw to, or read from the framebuffer results in a WebGL INVALID_FRAMEBUFFER_OPERATION error (0x0506). Calling checkFramebufferStatus() on the WebGL context from outside the animation frame callback causes the WebGL FRAMEBUFFER_UNSUP
PORTED error (0x8CDD) to be re
ported. Opaque framebuffers initialized with the depth property set to false will not have a depth buffer and will rely on the coordinates alone to determine distance. Opaque framebuffers initialized without specifying a stencil will not have a stencil buffer. Opaque framebuffers will not have an alpha channel available unless the alpha property is true when creating t...
...not have a stencil buffer. Opaque framebuffers will not have an alpha channel available unless the alpha property is true when creating the layer. The XR compositor assumes that opaque framebuffers use colors with premultiplied allpha, regardless of whether or not the WebGL context's premultipliedAlpha context attribute is set. Note: The depth and stencil properties are not required to be sup
ported in order for a browser to be construed as having full WebGL sup
port. The default configuration of a new framebuffer Upon creating a new XRWebGLLayer, its new framebuffer is initialized just like the default framebuffer for any WebGL interface: The color buffer is configured with its clear value set to the color (0, 0, 0, 0) (meaning transparent black). The depth buffer's clear value is t...
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
y XRWebGLLayer.getNativeFramebufferScaleFactor() will be 2.0. This method of dividing the frame buffer between views is shown in the following diagram. Now the width and height of the frame buffer are 50% what they were before, resulting in a total frame buffer size of 1280 by 720 pixels, with each eye's half of the buffer being 640x720 pixels. ...
... following diagram. Now the width and height of the frame buffer are 50% what they were before, resulting in a total frame buffer size of 1280 by 720 pixels, with each eye's half of the buffer being 640x720 pixels. Now we can see the coordinates of each of the view
ports representing these two views: Since each eye gets half of the frame buffer, the result is that the left eye gets a 640x720
portion of the buffer with the view
port's x and y at 0, the width at 640, and the height set to 720. The right eye gets the other half of the frame buffer, with its view
port's x set at 639. While rendering a frame for this scene, we get the view
port for the view and apply it to WebGL, then render the scene. This ensures that the scene we render will not only match the viewpoint we need to express (wh...
...the frame buffer, with its view
port's x set at 639. While rendering a frame for this scene, we get the view
port for the view and apply it to WebGL, then render the scene. This ensures that the scene we render will not only match the viewpoint we need to express (which is defined by the position and orientation data in the pose), but that the rendered output will be constrained within the correct
portion of the frame buffer for the eye we're drawing, regardless of any scaling that is being performed. Examples In this example, we request a frame buffer at the device's native resolution, regardless of any performance concerns: function requestNativeScaleWebGLLayer(gl, xrSession) { return gl.makeXRCompatible().then(() => { let scaleFactor = XRWebGLLayer.getNativeFramebufferScaleFactor(xr...
XSL Transformations in Mozilla FAQ - Web APIs
instruction instead of the non-standard xml:stylesheet. The most common cause is the MIME type handling. To find out which MIME type your server sends, look at Page Info, use extensions like LiveHTTPHeaders or a download manager like wget. Mozilla won't load XSLT stylesheets from a different domain for security reasons. Note: Starting in Gecko 7.0, both text/xsl and application/xslt+xml are sup
ported MIME types for XSLT media stylesheets. Note that Firefox will override your XSLT stylesheet if your XML is detected as an RSS or Atom feed. A known workaround is to add a sufficiently long XML comment to the beginning of your XML file in order to "push" the <feed> or <rss> tag out of the first 512 bytes, which is analyzed by Firefox to determine if it's a feed or not. See the discussion on bu...
...sable-output-escaping? This is actually pretty close to the question above. And in short, no. Disabling output escaping requires us to add a parsing step to our output generation, which we don't. In most cases, there are pretty easy workarounds. The only use cases we have seen are bad XML or bad XSLT. And RSS feeds. The latter is pretty much the only issue to us, and we're sorry that we can't sup
port it. But mixing parsing with XSLT is brittle and we rather not sup
port d-o-e than either crash or be even slower. What about document.write? Just like for XHTML, document.write is not sup
ported during XSLT transformations. Sadly, current builds don't error, but just give unexpected results, like crashes (bug 202765). In most cases, there is no need to actually use it, though. If you need platfor...
...ee Using the Mozilla JavaScript interface to XSL Transformations. Why does Internet Explorer require a different XSLT namespace than Mozilla? IE up to version 6 required a deprecated namespace of a XSLT working draft, please update to Mozilla ;-), IE6+ or MSXML3+, as it is fixed there. As the differences between XSLT1.0 and the IE implementation of that WD are significant, we offer no legacy sup
port. How do I build the standalone version of TransforMiiX? See the Building TransforMiiX standalone page. Original Document Information Author(s): Axel Hecht Last Updated Date: February 2, 2005 Copyright Information:
Portions of this content are (C) 1998-2006 by individual mozilla.org contributors; content available under a Creative Commons license ...
Using the alert role - Accessibility
When this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it. ...
...ive="polite" or other live region roles. Possible effects on user agents and assistive technology When the alert role is added to an element, or such an element becomes visible, the user agent should do the following: Expose the element as having an alert role in the operating system's accessibility API. Fire an accessible alert event using the operating system's accessibility API if it sup
ports it. Assistive technology products should listen for such an event and notify the user accordingly: Screen readers may interrupt current output (whether it's speech or braille) and immediately announce or display the alert message. Screen magnifiers may visually indicate that an alert occurred and what the alert text was. Note: Opinons may differ on how assistive technology should handle...
... of where keyboard focus is currently located. ...
ARIA annotations - Accessibility
and role="deletion" above). role="comment" -- semantically denotes a comment/reaction to some content on the page, or to a previous comment. To provide a semantic association between the document content being annotated and the annotation, an aria-details attribute can be set on the annotated content that contains the ID of the annotated element. aria-details has been updated so that it can sup
port multiple IDs -- this makes sense, for example you can easily envisage having multiple comments relating to the same bit of text. ARIA annotation roles and objects are currently exposed in: Firefox from version 75 onwards, on Windows and Linux (on macOS, we are first waiting for Apple to define what Safari will expose as Apple-dialect attributes to VoiceOver, and will then follow suit.) Chrom...
... Associating annotated elements with their details There are a number of different ways in which you can associate UI features with text labels or descriptions for accessibility purposes. It is...
...on 81 onwards, currently behind the #enable-accessibility-expose-aria-annotations flag (go to chrome://flags to enable this.) Unfortunately, you won't be able to use any of these yet, as screenreader sup
port is currently not there. For the moment, you can see the annotations data being exposed with tools like Firefox Accessibility Inspector. The annotations should just work once screenreader sup
port is added. Associating annotated elements with their details There are a number of different ways in which you can associate UI features with text labels or descriptions for accessibility purposes. It is useful to know when to use each. You'll see examples of most of these later on in the article, but briefly: aria-label="" can be set on an element to provide a brief descriptive label when it...
ARIA: alert role - Accessibility
The alert role can be used to tell the user an element has been dynamically updated. Screen readers will instantly start reading out the updated content when the role is added. If the user is expected to close the alert, then the alertdialog role should be used instead. Description One of the five live region roles, the alert role is used to provide the user with im
portant, and usually time-sensitive, information, and often to tell the user an element has been dynamically updated. The alert role is added to the node containing an alert message, not the element causing the alert to be triggered. Alerts are assertive live regions. Setting role="alert" is equivalent to setting aria-live="assertive" and aria-atomic="true". They don't receive focus, and therefore focus does not need to be manag...
...been dynamically updated. The alert role is added to the node containing an alert message, not the element causing the alert to be triggered. Alerts are assertive live regions. Setting role="alert" is equivalent to setting aria-live="assertive" and aria-atomic="true". They don't receive focus, and therefore focus does not need to be managed and no user interaction should be required. The most im
portant thing to know about the alert role is that it is for dynamic content. It is perfect for situations such as when a user fills out a form and JavaScript is used to add an error message - the alert would immediately read out the message. It should not be used on HTML where the user hasn't interacted with it. For example, if a page loads with multiple visible alerts scattered throughout, none woul...
...t has display: none; by default. When the display value is changed with CSS or JavaScript, it would automatically trigger the screen reader to read out the content. <p role="alert" style="display: none;">The alert will trigger when the element becomes visible.</p> While triggering an alert via CSS alone is possible, it is better to rely on JavaScript because it has more browser/screen reader sup
port and is often more appropriate as part of a larger user interaction such as inside an event handler or form validation. With JavaScript, developers control the adding and removing of alerts as appropriate. <button type="button" onclick="triggerAlert">Trigger alert</button> <p class="alert">The alert will trigger when the button is pressed.</p> function triggerAlert() { var alertEl = document...
Accessibility: What users can do to browse more safely - Accessibility
Taking advantage of personalization settings can help prevent exposure to content leading to seizures and / or other physical reactions. Personalization and accessibility settings From the article, "Understanding Success Criterion 2.3.1: Three Flashes or Below Threshold" "Flashing can be caused by the display, the computer rendering the image or by the content being rendered. The author has no control of the first two. ...
...settings can actually be a money-saving endeavor. One work station can be set up to acommodate both a low-vision individual (needs high-contrast) and to accomodate an individual with photosensitive susceptibilities, by simply, adjusting personalization and accessiblity settings. Use modern browers. Learn personalization and accessibility settings Firefox 73 and above (Dekstop) Firefox added sup
port for CSS prefers-reduced-motion in October 2018. Chrome 74 and above (Desktop) Chrome 74 added sup
port for reduced-motion-query, it has even added sup
port to detect whether the user has requested a reduced motion experience. The user would access this through an accessibility interface, as seen below. CSS Transition events are now sup
ported. Examples include: transitionrun transitionstart...
...access this through an accessibility interface, as seen below. CSS Transition events are now sup
ported. ...
Architecture - Accessibility
s to find its position within that text, because the hyperlink interface exposes a start and end index. In fact, the end index will always be 1 larger than the start index, because the object is always represented by a single '\xfffc' character. If you want to know that something is really a link, check to see if it is ROLE_LINK. HTML containers are implemented by nsHyperTextAccessible. They sup
port the nsIAccessibleHyperText is implemented on any container element that has both text and embedded objects for accessible children. Why HyperLink is often not a link As explained above, anything that is embedded in text implements the Hyperlink interface. While it is odd to call non-link objects a link, this was a necessary compromise in the newatk design because it is necessary to know where ob...
...e have an exact mirror to the dom, but text lives in the parents instead of in the leaves, which now don't really provide additional useful information. They are only provided under MSAA/IA2 for backward compatibility. Implementation classes Here are some notes on the classes we use: nsHyperTextAccessible is for any container that may wrap both text and embedded object: nsIAccessibleText is sup
ported if there is potentially any text in the container nsIAccessibleHyperText is sup
ported if there is potentially text and embedded objects together in the container. nsIAccessibleEditableText is sup
ported if the area is potentially editable. If it's actually editable it will also provide STATE_EDITABLE. nsAccessible still represents any node in the tree. If the node is embedded in a parent th...
...rent accessible when the point of regard reaches the end of text in the corresponding child accessible for the embed. See http://svn.gnome.org/viewcvs/lsr/tru...py?view=markup for a BSD implementation. (E) To grab a subtree of content: Although under Windows text content is still exposed in leaf nodes of ROLE_TEXT, it is no longer necessary to visit those nodes. Therefore for parent nodes that sup
port the HyperText interface, it is more performant to grab the text from the AccessibleText interface and then only visit the link children. The HyperLink interface can be used to grab the children. Using this technique is about twice as fast as visiting all nodes in the tree, according to tests run by the developers of NVDA. (F) To get the line of text at the caret: Many editors, including the Mozil...
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
This article provides a set of mixins for those who want to mess around with flexbox using the native sup
port of current browsers. This set uses: Fallbacks using 2009 'box' syntax (FF and Older WebKit) and prefixed syntaxes (IE10, WebKit browsers without flex wrapping) Final standards syntax (FF, Safari, Chrome, IE11+, Edge, Opera) This was inspired by: http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/ With help from: http://w3.org/tr/css3-flexbox/ http://the-echoplex.net/flexyboxes/ http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx http://css-tricks.com/using-flexbox/ A Complete Guide to Flexbox | CSS-Tricks Visual Guide to CSS3 Flexbox: Flexbox Playground | Note: Mixins are not currently sup
ported natively in browsers. Instead, you will...
... consulted instead of the main size property to determine the main size of the element. If an element is not a flex item, flex has no effect. Values: See the flex reference for values and default Spec: https://drafts.csswg.org/css-flexbox/#flex-property @mixin flex($fg: 1, $fs: 0, $fb: auto) { // Set a variable to be used by box-flex properties $fg-boxflex: $fg; // Box-Flex only sup
ports a flex-grow value so lets grab the // first item in the list and just return that. @if type-of($fg) == 'list' { $fg-boxflex: nth($fg, 1); } -webkit-box: $fg-boxflex; -moz-box: $fg-boxflex; -webkit-flex: $fg $fs $fb; -ms-flex: $fg $fs $fb; flex: $fg $fs $fb; } Flexbox justify content The justify-content property aligns flex items along the main axis of the current line of ...
...rrent line of the flex container. This is done after any flexible lengths and any auto margins have been resolved. Typically, it helps to distribute extra free space leftover when either all the flex items on a line are inflexible, or are flexible but have reached their maximum size. It also exerts some control over the alignment of items when they overflow the line. Note: space-* values not sup
ported in older syntaxes. Values: flex-start (default) | flex-end | center | space-between | space-around Spec: https://drafts.csswg.org/css-flexbox/#justify-content-property @mixin justify-content($value: flex-start) { @if $value == flex-start { -webkit-box-pack: start; -moz-box-pack: start; -ms-flex-pack: start; } @else if $value == flex-end { -webkit-box-pack: end; -...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
div> <div class="box box4"><a href="">Four</a></div> <div class="box box5"><a href="">Five</a></div> </div> The specification says that in this scenario, if box 1 really makes sense logically in that position, we should go back to our source and make the change there rather than reordering using grid layout. This is what is meant by visual versus logical reordering, logical ordering is im
portant for the meaning and structure of our document, and we should make sure that we preserve that structure. How should we approach accessibility for grid layout? From the specification we know that we need to ensure our document maintains the logical order of our content. How should we approach our development to make sure that we maintain accessibility for the different users and the ways that ...
...a grid item participate in the overall grid layout by declaring the ul element a subgrid. Currently the only way to do this is to use display: contents to cause the box generated by the ul to disappear from the DOM. For more information about this interaction see the guide on the Relationship of Grid Layout to other layout methods and the section on display: contents. Given that interoperable sup
port for display: contents is limited and we do not yet have subgrids, there is a definite temptation when developing a site using CSS Grid Layout to flatten out the markup, to remove semantic elements in order to make it simpler to create a layout. An example would be where some content was semantically marked up as a list but you decide to use a set of <div> elements instead as then you can have the...
... ...
Using CSS gradients - CSS: Cascading Style Sheets
as in backgrounds. Because gradients are dynamically generated, they can negate the need for the raster image files that traditionally were used to achieve similar effects. In addition, because gradients are generated by the browser, they look better than raster images when zoomed in, and can be resized on the fly. We'll start by introducing linear gradients, then introduce features that are sup
ported in all gradient types using linear gradients as the example, then move on to radial, conic and repeating gradients Using linear gradients A linear gradient creates a band of colors that progress in a straight line. A basic linear gradient To create the most basic type of gradient, all you need is to specify two colors. These are called color stops. You must have at least two, but you can h...
...The backgrounds are stacked from top to bottom, with the first specified being on top. <div class="layered-image"></div> div { width: 300px; height: 150px; } .layered-image { background: linear-gradient(to right, transparent, mistyrose), url("https://mdn.mozillademos.org/files/15525/critter...
...However, the repeating-linear-gradient(), repeating-radial-gradient(), and repeating-conic-gradient() functions are available to offer this functionality. The size of the gradient line or arc that repeats is the length between the first color stop value and the last color stop length value. If the first color stop just has a color and no color stop length, the...
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
lock dimension is the other dimension, and the direction in which blocks -- such as paragraphs -- display one after the other. In English and Arabic these run vertically, whereas in any vertical writing mode these run horizontally. ...
...ne after the other. In English and Arabic these run vertically, whereas in any vertical writing mode these run horizontally. The below diagram shows the inline and block directions in a horizontal writing mode: This diagram shows block and inline in a vertical writing mode: Browser sup
port Logical Properties and Values can be thought of as a couple of groups in terms of current browser sup
port. Some of the properties are essentially mappings from the physical versions, for example inline-size for width or margin-inline-start rather than margin-left. These mapped properties are starting to see good browser sup
port, and if you look at the individual pages for the properties in the reference here on MDN you will see that Edge is the only modern browser currently missing these. There are ...
...ecide what to do about the four-value shorthands for logical properties, for example the equivalents to setting four physical properties at once, like margins with the margin property. We would need some kind of modifier if we were to reuse margin for flow-relative properties. If you would like to read the suggestions or comment on them the relevant GitHub issue is #1282. Testing for browser sup
port You can test for sup
port of logical properties and values using feature queries. For example you could set a width, test for inline-size and, if it is sup
ported, set the width to auto and the inline-size to the original width value. ...
The stacking context - CSS: Cascading Style Sheets
HTML elements occupy this space in priority order based on element attributes. The stacking context In the previous part of this article, Using z-index, the rendering order of certain elements is influenced by their z-index value. This occurs because these elements have special properties which cause them to form a stacking context. ...
...ng value touch. Element with a will-change value specifying any property that would create a stacking context on non-initial value (see this post). Element with a contain value of layout, or paint, or a composite value that includes either of them (i.e. contain: strict, contain: content). Within a stacking context, child elements are stacked according to the same rules previously explained. Im
portantly, the z-index values of its child stacking contexts only have meaning in this parent. Stacking contexts are treated atomically as a single unit in the parent stacking context. In summary: Stacking contexts can be contained in other stacking contexts, and together create a hierarchy of stacking contexts. Each stacking context is completely independent of its siblings: only descendant elem...
...at do not create their own stacking contexts are assimilated by the parent stacking context. The example In this example, every positioned element creates its own stacking context, because of their positioning and z-index values. The hierarchy of stacking contexts is organized as follows: Root DIV #1 DIV #2 DIV #3 DIV #4 DIV #5 DIV #6 It is im
portant to note that DIV #4, DIV #5 and DIV #6 are children of DIV #3, so stacking of those elements is completely resolved within DIV#3. Once stacking and rendering within DIV #3 is completed, the whole DIV #3 element is passed for stacking in the root element with respect to its sibling's DIV. Notes: DIV #4 is rendered under DIV #1 because DIV #1's z-index (5) is valid within the stacking conte...
CSS values and units - CSS: Cascading Style Sheets
the value specified as the property's initial value. The inherit keyword represents the computed value of the property on the element's parent, provided it is inherited. The unset keyword acts as either inherit or initial, depending on whether the property is inherited or not. A fourth value of revert was added in the Cascade Level 4 specification, but it does not currently have good browser sup
port. URLs A <url> type uses functional notation, which accepts a <string> that is a URL. This may be an absolute URL or a relative URL. For example, if you wanted to include a background image, you might use either of the following. .box { background-image: url("images/my-background.png"); } .box { background-image: url("https://www.exammple.com/images/my-background.png"); } The parameter f...
... all covered in subsections below. Distance units Where a distance unit, also known as a length, is allowed as a value for a property, this is described as the <length> type. There are two types of lengths in CSS: relative and absolute. Relative length units specify a length in relation to something else. For example, em is relative to the font size on the element and vh is relative to the view
port height. Relative length units Unit Relative to em Font size of the element. ex x-height of the element's font. cap Cap height (the nominal height of capital letters) of the element's font. ch Average character advance of a narrow glyph in the element's font, as represented by the "0" (ZERO, U+0030) glyph. ic Average...
... a narrow glyph in the element's font, as represented by the "0" (ZERO, U+0030) glyph. ic Average character advance of a full width glyph in the element's font, as represented by the "?" (CJK water ideograph, U+6C34) glyph. rem Font size of the root element. lh Line height of the element. rlh Line height of the root element. vw 1% of view
port's width. vh 1% of view
port's height. vi 1% of view
port's size in the root element's inline axis. vb 1% of view
port's size in the root element's block axis. vmin 1% of view
port's smaller dimension. vmax 1% of view
port's larger dimension. Absolute length units are fixed to a physical length: either an inch or a centimeter. Many of t...
Layout and the containing block - CSS: Cascading Style Sheets
context (such as a table container, flex container, grid container, or the block container itself). If the position property is absolute, the containing block is formed by the edge of the padding box of the nearest ancestor element that has a position value other than static (fixed, absolute, relative, or sticky). If the position property is fixed, the containing block is established by the view
port (in the case of continuous media) or the page area (in the case of paged media). If the position property is absolute or fixed, the containing block may also be formed by the edge of the padding box of the nearest ancestor element that has the following: A transform or perspective value other than none A will-change value of transform or perspective A filter value other than none or...
...form or perspective value other than none A will-change value of transform or perspective A filter value other than none or a will-change value of filter (only works on Firefox). A contain value of paint (e.g. contain: paint;) Note: The containing block in which the root element (<html>) resides is a rectangle called the initial containing block. It has the dimensions of the view
port (for continuous media) or the page area (for paged media). Calculating percentage values from the containing block As noted above, when certain properties are given a percentage value, the computed value depends on the element's containing block. The properties that work this way are box model properties and offset properties: The height, top, and bottom properties compute percentage values...
...Thus, the paragraph's dimensions change based on the size of the browser window. <body> <section> <p>This is a paragraph!</p> </section> </body> body { background: beige; } section { width: 400px; height: 480px; margin: 30px; padding: 15px; background: lightgray; } p { position: fixed; width: 50%; /* == (50vw - (width of vertical scrollbar)) */ height: 50%; /...
Mozilla CSS extensions - CSS: Cascading Style Sheets
These extensions are prefixed with -moz-. Mozilla-only properties and pseudo-classes (avoid using on websites) Note: These properties and pseudo-classes will only work in Mozilla applications such as Firefox, and are not on a standards track. Some of them apply only to XUL elements. ...
...Once a given...
...:-moz-table-row-group :-moz-tree-cell :-moz-tree-cell-text :-moz-tree-cell-text(hover) :-moz-tree-checkbox :-moz-tree-column :-moz-tree-drop-feedback :-moz-tree-image :-moz-tree-indentation :-moz-tree-line :-moz-tree-progressmeter :-moz-tree-row :-moz-tree-row(hover) :-moz-tree-separator :-moz-tree-twisty U - X :-moz-ui-invalid :-moz-ui-valid :-moz-user-disabled ::-moz-view
port ::-moz-view
port-scroll :-moz-window-inactive ::-moz-xul-anonymous-block At-rules @-moz-document Media features -moz-mac-graphite-theme -moz-maemo-classic -moz-device-pixel-ratio -moz-os-version -moz-scrollbar-end-backward -moz-scrollbar-end-forward -moz-scrollbar-start-backward -moz-scrollbar-start-forward -moz-scrollbar-thumb-pro
portional -moz-touch-enabled -moz-window...
Selector list - CSS: Cascading Style Sheets
tors in a single line using a comma-separated lists. h1, h2, h3, h4, h5, h6 { font-family: helvetica; } Multi Line Grouping Grouping selectors in a multiple lines using a comma-separated lists. #main, .content, article { font-size: 1.1em; } Selector list invalidation A downside to using selector lists is that the following aren't equivalent: h1 { font-family: sans-serif } h2:maybe-unsup
ported { font-family: sans-serif } h3 { font-family: sans-serif } h1, h2:maybe-unsup
ported, h3 { font-family: sans-serif } This is because a single unsup
ported selector in a selector list invalidates the whole rule. A way to remedy this us to use the :is() selector, which simply ignores invalid selectors in its arguments, but at the cost of all selectors having the same specificity, because of how ...
... Working Draft Renamed to "selector list" CSS Level 1The definition of 'grouping' in that specification. ...
...r in a selector list invalidates the whole rule. A way to remedy this us to use the :is() selector, which simply ignores invalid selectors in its arguments, but at the cost of all selectors having the same specificity, because of how :is() calculates specificity. h1 { font-family: sans-serif } h2:maybe-unsup
ported { font-family: sans-serif } h3 { font-family: sans-serif } :is(h1, h2:maybe-unsup
ported, h3) { font-family: sans-serif } Specifications Specification Status Comment Selectors Level 4The definition of 'Selector Lists' in that specification. Working Draft Renamed to "selector list" CSS Level 1The definition of 'grouping' in that specification. Recommendation Initial definition ...
animation - CSS: Cascading Style Sheets
When parsed, keywords that are valid for properties other than animation-name, and whose values were not found earlier in the shorthan...
...n-play-state> an optional name for the animation, which may be none, a <custom-ident>, or a <string> zero, one, or two <time> values The order of values within each animation definition is im
portant: the first value that can be parsed as a <time> is assigned to the animation-duration, and the second one is assigned to animation-delay. The order within each animation definition is also im
portant for distinguishing animation-name values from other keywords. When parsed, keywords that are valid for properties other than animation-name, and whose values were not found earlier in the shorthand, must be accepted for those properties rather than for animation-name. Furthermore, when serialized, default values of other properties must be output in at least the cases necessary to distinguish ...
... <number <a href="/docs/CSS/Value_definition_syntax#Brackets" title="Brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-position> = jump-start | jump-end | jump-none | jump-both | start | end Examples Cylon Eye <div class="view_
port"> <div class="polling_message"> Listening for dispatches </div> <div class="cylon_eye"></div> </div> .polling_message { color: white; float: left; margin-right: 2%; } .view_
port { background-color: black; height: 25px; width: 100%; overflow: hidden; } .cylon_eye { background-color: red; background-image: linear-gradient(to right, rgba(0, 0, 0, .9) 25%, ...
attr() - CSS: Cascading Style Sheets
The attr() CSS function is used to retrieve the value of an attribute of the selected element and use it in the stylesheet. It can also be used on pseudo-elements, in which case the value of the attribute on the pseudo-element's originating element is returned. ...
... Editor's Draft Changed it to ...
... validation of the attribute value is deferred to computed value time. CSS Values and Units Module Level 3The definition of 'attr()' in that specification. Candidate Recommendation Added two optional parameters; can be used on all properties; may return values other than <string>. These changes are experimental and may be dropped during the CR phase if browser sup
port is too small. CSS Level 2 (Revision 1)The definition of 'attr()' in that specification. Recommendation Limited to the content property; always returns a <string>. ...
background-attachment - CSS: Cascading Style Sheets
The background-attachment CSS property sets whether a background image's position is fixed within the view
port, or scrolls with its containing block. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ background-attachment: scroll; background-attachment: fixed; background-attachment: local; /* Global values */ background-attachment: inherit; background-attachment: initial; background-attachment: unset; The background-attachment property is specified as one of the keyword values from the list below. Values fixed The background is fixed relative to the view
port. Even if an element has...
...nd the hall, but they were all locked; and when Alice had been all the way down one side and up the other, trying every door, she walked sadly down the middle, wondering how she was ever to get out again. </p> CSS p { background-image: url("https://mdn.mozillademos.org/files/12057/starsolid.gif"); background-attachment: fixed; } Result Multiple background images This property sup
ports multiple background images. You can specify a different <attachment> for each background, separated by commas. Each image is matched with the corresponding attachment type, from first specified to last. HTML <p> There were doors all round the hall, but they were all locked; and when Alice had been all the way down one side and up the other, trying every door, she walked sadly down the mi...
...lademos.org/files/12059/startransparent.gif"); background-attachment: fixed, scroll; background-repeat: no-repeat, repeat-y; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'background-attachment' in that specification. Candidate Recommendation The shorthand property has been extended to sup
port multiple backgrounds and the local value. CSS Level 2 (Revision 1)The definition of 'background-attachment' in that specification. Recommendation No significant change. CSS Level 1The definition of 'background-attachment' in that specification. Recommendation No significant change. ...
cross-fade() - CSS: Cascading Style Sheets
The specification syntax is explained first. ...
...ge>, <percentage> ) The specification for the cross-fade() function allows for multiple images and for each image to have transparency values independent of the other values. This was not always the case. The original syntax, which has been implemented in some browsers, only allowed for two images, with the sum of the transparency of those two images being exactly 100%. The original syntax is sup
ported in Safari and sup
ported with the -webkit- prefix in Chrome, Opera, and other blink-based browsers. cross-fade(url(white.png), url(black.png), 0%); /* fully black */ cross-fade(url(white.png), url(black.png), 25%); /* 25% white, 75% black */ cross-fade(url(white.png), url(black.png), 50%); /* 50% white, 50% black */ cross-fade(url(white.png), url(black.png), 75%); /* 75% white, 25% black *...
...tracted from 100%, with the difference being the opacity of the second image. The green/red example (with the percentages totalling 150%) and the yellow/red/blue example (with three images) from the specification syntax section, are not possible in this implementation. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is im
portant primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. When using background images, make sure the contrast in color is great enough that any text is legible over the image as well a...
font-stretch - CSS: Cascading Style Sheets
t-stretch specification, the property accepts only the nine keyword values. CSS Fonts Level 4 extends the syntax to accept a <percentage> value as well. This enables variable fonts to offer something more like a continuum of character widths. For TrueType or OpenType variable fonts, the "wdth" variation is used to implement varying widths. However, note that the <percentage> syntax is not yet sup
ported by all browsers: check the Browser compatibility table for details. Keyword to numeric mapping The table below shows the mapping between keyword values and numeric percentages: Keyword Percentage ultra-condensed 50% extra-condensed 62.5% condensed 75% semi-condensed 87.5% normal 100% semi-expanded 112.5% ...
...hich the characters are narrower than the normal face (condensed faces) or wider than the normal face (expanded faces). You can use font-stretch to select a condensed or expanded face from such fonts. If the font you are using does not offer condensed or expanded faces, this property has no effect. Font face selection The face selected for a given value of font-stretch depends on the faces sup
ported by the font in question. If the font does not provide a face that exactly matches the given value, then values less than 100% map to a narrower face, and values greater than or equal to 100% map to a wider face. The table below demonstrates the effect of supplying various different percentage values of font-stretch on two different fonts: 50% 62.5% 75% 87.5% 100% 1...
... HTML <div class="container"> <p class="condensed">an elephantine lizard</p> <p class="normal">an elephantine lizard</p> <p class="expanded">an elephantine lizard</p> </div> CSS /* This example uses the League Mono Variable font, developed by Tyler Finck (https://www.tylerfinck.com/) and used here under the terms of the SIL Open Font License, Version 1.1: http...
font-variant-east-asian - CSS: Cascading Style Sheets
ruby This keyword forces the use of special glyphs for ruby characters. As these...
... jp83 jis90 JIS X 0208:1990 jp90 jis04 JIS X 0213:2004 jp04 simplified None, use the simplified Chinese glyphs smpl traditional None, use the traditional Chinese glyphs trad <east-asian-width-values> These values control the sizing of figures used for East Asian characters. Two values are possible: pro
portional-width activating the set of East Asian characters which vary in width. It corresponds to the OpenType values pwid. full-width activating the set of East Asian characters which are all of the same, roughly square, width metric. It corresponds to the OpenType values fwid. Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.In...
...finition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]where <east-asian-variant-values> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]<east-asian-width-values> = [ full-width | pro
portional-width ] Examples Setting East Asian glyph variants This example require font "Yu Gothic" installed in your OS, other fonts may not sup
port OpenType features. HTML <table> <thead></thead> <tbody style="border:0;"> <tr> <th>normal/jis78:</th> <td>??</td> <td class="jis78">??</td> </tr> <tr> <th>normal/ruby:</th> <td>??????</td> <td class="ruby">??????</td> ...
font-variant-numeric - CSS: Cascading Style Sheets
to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... lining-nums activating the set of figures where numbers are all lying on the baseline. It corresponds to the OpenType values lnum. oldstyle-nums activating the set of figures where some numbers, like 3, 4, 7, 9 have descenders. It corresponds to the OpenType values onum. <numeric-spacing-values> These values controls the sizing of figures used for numbers. Two values are possible: pro
portional-nums activating the set of figures where numbers are not all of the same size. It corresponds to the OpenType values pnum. tabular-nums activating the set of figures where numbers are all of the same size, allowing them to be easily aligned like in tables. It corresponds to the OpenType values tnum. <numeric-fraction-values> These values controls the glyphs used to display fractions.
...ormal definition Initial valuenormalApplies toall elements. ...
hyphens - CSS: Cascading Style Sheets
/ hyphens: inherit; hyphens: initial; hyphens: unset; The hyphens property is specified as a single keyword value chosen from the list below. Values none Words are not broken at line breaks, even if characters inside the words suggest line break points. Lines will only wrap at whitespace. manual Words are broken for line-wrapping only where characters inside the word suggest line break op
portunities. See Suggesting line break op
portunities below for details. auto The browser is free to automatically break words at appropriate hyphenation points, following whatever rules it chooses. However, suggested line break op
portunities (see Suggesting line break op
portunities below) will override automatic break point selection when present. Note: The auto setting's behavior depends on the ...
...Even if the line is not actually broken at that point, the hyphen is still rendered. U+00AD (SHY) An invisible, "soft" hyphen. ...
...Even if the line is not actually broken at that point, the hyphen is still rendered. U+00AD (SHY) An invisible, "soft" hyphen. ...
ime-mode - CSS: Cascading Style Sheets
ations or to undo the property if it was previously set by legacy code. Syntax The ime-mode property is specified using one of the keyword values listed below. Values auto No change is made to the current input method editor state. This is the default. normal The IME state should be normal; this value can be used in a user style sheet to override the page's setting. This value is not sup
ported by Internet Explorer. active The input method editor is initially active; text entry is performed through it unless the user specifically dismisses it. Not sup
ported on Linux. inactive The input method editor is initially inactive, but the user may activate it if they wish. Not sup
ported on Linux. disabled The input method editor is disabled and may not be activated by the user. Descrip...
... Unlike Internet Explorer, Firefox's implementation of ime-mode allows this property on <input type="password">. However, this makes for a bad user experience, and password fields should not enable the IME. Users may correct the inappropriate behavior of sites that don't follow this recommendation by placing the following CSS into their user stylesheet: input[type=password] { ime-mode: auto !im
portant; } The Mac version of Gecko 1.9 (Firefox 3) can't recover the previous state of the IME when a field for which it is disabled loses focus, so Mac users may get grumpy when you use the disabled value. Formal definition Initial valueautoApplies totext fieldsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | normal | active | inactive | disabled Examples Disab...
...on of Gecko 1.9 (Firefox 3) can't recover the previous state of the IME when a field for which it is disabled loses focus, so Mac users may get grumpy when you use the disabled value. Formal definition Initial valueautoApplies totext fieldsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | normal | active | inactive | disabled Examples Disabling input method sup
port This example disables input method sup
port for a form field. In the past, this was commonly used on fields that entered data into databases which didn't sup
port extended character sets. <input type="text" name="name" value="initial value" style="ime-mode: disabled"> Note: You shouldn't rely on disabling IME to prevent extended characters from passing through your form. Even with IME disabled,...
mask-border-outset - CSS: Cascading Style Sheets
ponding border-width. ...
...0Applies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typediscrete Formal syntax [ <length> | <number> ]{1,4} Examples Basic usage This property doesn't appear to be sup
ported anywhere yet. ...
... [ <length> | <number> ]{1,4} Examples Basic usage This property doesn't appear to be sup
ported anywhere yet. When it eventually starts to be sup
ported, it will serve to move the mask away from the inner edge of the element's border box -- you can use it to make the mask start from part way across the border, rather than the inside of it. mask-border-outset: 1rem; Chromium-based browsers sup
port an outdated version of this property -- mask-box-image-outset -- with a prefix: -webkit-mask-box-image-outset: 1rem; Note: The mask-border page features a working example (using the out-of-date prefixed border mask properties sup
ported in Chromium), so you can get an idea of the effect. Specifications Specification Status Comment CSS Masking Module Level 1The def...
mask-border-repeat - CSS: Cascading Style Sheets
ll be distributed in between tiles to achieve the proper fit. ...
... fit. Formal definition Initial valuestretchApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ stretch | repeat | round | space ]{1,2} Examples Basic usage This property doesn't appear to be sup
ported anywhere yet. ...
...nd | space ]{1,2} Examples Basic usage This property doesn't appear to be sup
ported anywhere yet. When it eventually starts to be sup
ported, it will serve to define how the border mask slice will repeat around the border -- i.e. will it just repeat, or be scaled slightly so a whole number of slices fits, or be stretched so one slice fits? mask-border-repeat: round; Chromium-based browsers sup
port an outdated version of this property -- mask-box-image-repeat -- with a prefix: -webkit-mask-box-image-repeat: round; Note: The mask-border page features a working example (using the out-of-date prefixed border mask properties sup
ported in Chromium), so you can get an idea of the effect. Specifications Specification Status Comment CSS Masking Module Level 1The de...
scroll-snap-type - CSS: Cascading Style Sheets
x The scroll container snaps to snap positions in its horizontal axis only. y The scroll container snaps to snap positions in its vertical axis only. block The scroll container snaps to snap positions in its block axis only. inline The scroll container snaps to snap positions in its inline axis only. both The scroll conta...
...The scroll container snaps to snap positions in its vertical axis only. block The scroll container snaps to snap positions in its block axis only. inline The scroll container snaps to snap positions in its inline axis only. both The scroll container snaps to snap positions in both of its axes independently (potentially snapping to different elements in each axis). ...
...If content is added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. ...
Getting Started - Developer guides
erver Step 1 - How to make an HTTP request In order to make an HTTP request to the server with JavaScript, you need an instance of an object with the necessary functionality. This is where XMLHttpRequest comes in. Its predecessor originated in Internet Explorer as an ActiveX object called XMLHTTP. Then, Mozilla, Safari, and other browsers followed, implementing an XMLHttpRequest object that sup
ported the methods and properties of Microsoft's original ActiveX object. Meanwhile, Microsoft implemented XMLHttpRequest as well. // Old compatibility code, no longer needed. if (window.XMLHttpRequest) { // Mozilla, Safari, IE7+ ... httpRequest = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE 6 and older httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } Note: For illu...
...se here. }; Next, after declaring what happens when you receive the response, you need to actually make the request, by calling the open() and send() methods of the HTTP request object, like this: httpRequest.open('GET', 'http://www.example.org/some.file', true); httpRequest.send(); The first parameter of the call to open() is the HTTP request method - GET, POST, HEAD, or another method sup
ported by your server. Keep the method all-capitals as per the HTTP standard, otherwise some browsers (like Firefox) might not process the request. For more information on the possible HTTP request methods, check the W3C specs. The second parameter is the URL you're sending the request to. As a security feature, you cannot call URLs on 3rd-party domains by default. Be sure to use the exact domain nam...
... an array at each newline character (\n -- basically where each line break is in the text file), and then print the complete list of timestamps, and the last timestamp, onto the page. This is repeated every 5 seconds, using a setInterval() call. The idea would be that a server-side script of some kind would continually update the text file with new timestamps, and our XHR code would be used to re
port the latest timestamp on the client-side. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>XHR log time</title> <style> </style> </head> <body> <p id="writeData" class="data">Off-Line</p> <p id="lastStamp">No Data yet</p> <script> const fullData = document.getElementById('writeData'); const lastData = document.getElementById('lastStamp'); ...
Mutation events - Developer guides
tion, as the API's design is flawed (see details in the "DOM Mutation Events Replacement: The Story So Far / Existing Points of Consensus" post to public-webapps). Mutation Observers are the proposed replacement for mutation events in DOM4. They are expected to be included in Firefox 14 and Chrome 18. The practical reasons to avoid the mutation events are performance issues and cross-browser sup
port. ...
... are performance issues and cross-browser sup
port. Performance Adding DOM mutation listeners to a document profoundly degrades the performance of further DOM modifications to that document (making them 1.5 - 7 times slower!). Moreover, removing the listeners does not reverse the damage. The performance effect is limited to the documents that have the mutation event listeners. Cross-browser sup
port These events are not implemented consistently across different browsers, for example: IE prior to version 9 didn't sup
port the mutation events at all and does not implement some of them correctly in version 9 (for example, DOMNodeInserted) WebKit doesn't sup
port DOMAttrModified (see webkit bug 8191 and the workaround) "mutation name events", i.e. DOMElementNameChanged and DOMAttributeNameCh...
...e not implemented consistently across different browsers, for example: IE prior to version 9 didn't sup
port the mutation events at all and does not implement some of them correctly in version 9 (for example, DOMNodeInserted) WebKit doesn't sup
port DOMAttrModified (see webkit bug 8191 and the workaround) "mutation name events", i.e. DOMElementNameChanged and DOMAttributeNameChanged are not sup
ported in Firefox (as of version 11), and probably in other browsers as well. ... Dottoro documents browser sup
port for mutation events. Mutation events list The following is a list of all mutation events, as defined in DOM Level 3 Events specification: DOMAttrModified DOMAttributeNameChanged DOMCharacterDataModified DOMElementNameChanged DOMNodeInserted DOMNodeInsertedIntoDocument DOMNo...
Touch events (Mozilla experimental) - Developer guides
This API allowed you to track the movement of the user's finger on a touch screen, monitoring the raw touch events generated by the system. ...
...This API allowed you to track the movement of the user's finger on a touch screen, monitoring the raw touch events generated by the system. ...
...This API allowed you to track the movement of the user's finger on a touch screen, monitoring the raw touch events generated by the system. ...
Constraint validation - Developer guides
is triggered. Note that most input types don't have intrinsic constraints, as some are simply barred from constraint validation or have a sanitization algorithm transforming incorrect values to a correct default. Validation-related attributes In addition to the type attribute described above, the following attributes are used to describe basic constraints: Attribute Input types sup
porting the attribute Possible values Constraint description Associated violation pattern text, search, url, tel, email, password A JavaScript regular expression (compiled with the ECMAScript 5 global, ignoreCase, and multiline flags disabled) The value must match the pattern. patternMismatch constraint violation min range, number A valid number The ...
... number of characters (code points) must not exceed the value of the attribute. tooLong constraint violation Constraint validation process Constraint validation is done through the Constraint Validation API either on a single form element or at the form level, on the <form> element itself. The constraint validation is done in the following ways: By a call to the checkValidity() or re
portValidity() method of a form-associated DOM interface, (HTMLInputElement, HTMLSelectElement, HTMLButtonElement, HTMLOutputElement or HTMLTextAreaElement), which evaluates the constraints only on this element, allowing a script to get this information. The checkValidity() method returns a Boolean indicating whether the element's value passes its constraints. (This is typically done by the user-agent...
...onElement, HTMLOutputElement or HTMLTextAreaElement), which evaluates the constraints only on this element, allowing a script to get this information. The checkValidity() method returns a Boolean indicating whether the element's value passes its constraints. (This is typically done by the user-agent when determining which of the CSS pseudo-classes, :valid or :invalid, applies.) In contrast, the re
portValidity() method re
ports any constraint failures to the user. By a call to the checkValidity() or re
portValidity() method on the HTMLFormElement interface. By submitting the form itself. Calling checkValidity() is called statically validating the constraints, while calling re
portValidity() or submitting the form is called interactively validating the constraints. Note: If the novalidate ...
Introduction to HTML5 - Developer guides
HTML5 is the fifth revision and newest version of the HTML standard. It offers new features that provide not only rich media sup
port but also enhance sup
port for creating web applications that can interact with users, their local data, and servers more easily and effectively than was previously possible. Some HTML5 features remain unsup
ported by some browsers. However, Gecko, and by extension, Firefox, has very good sup
port for HTML5, and work continues toward sup
porting more of its features. Gecko began sup
porting some HTML5 features in version 1.8.1. You can find a list of all of the HTML5 features that Gecko currently sup
ports on the main HTML5 page. For detailed information about multiple browsers' sup
port of HTML5 features, refer to the CanIUse website. Declaring that the docume...
... This is much simpler than the former doctypes, and shorter, making it easier to remember and reducing the amount of bytes that must be downloaded. ...
... This is much simpler than the former doctypes, and shorter, making it easier to remember and reducing the amount of bytes that must be downloaded. ...
Mobile Web Development - Developer guides
ections, designing for mobile devices and cross-browser compatibility. Also see Jason Grlicky's guide to mobile-friendliness for web developers. Designing for mobile devices Mobile devices have quite different hardware characteristics compared with desktop or laptop computers. Their screens are usually smaller, obviously, but they also usually automatically switch the screen orientation between
portrait and landscape mode as the user rotates the device. They usually have touch screens for user input. APIs like geolocation or orientation are either not sup
ported on desktops or are much less useful, and these APIs give mobile users new ways to interact with your site. Working with small screens Responsive Web Design is a term for a set of techniques that enables your web site to adapt its la...
...f techniques that enables your web site to adapt its layout as its viewing environment -- most obviously, the size and orientation of the screen -- changes. It includes techniques such as: fluid CSS layouts, to make the page adapt smoothly as the browser window size changes the use of media queries to conditionally include CSS rules appropriate for the device screen width and height The view
port meta tag instructs the browser to display your site at the appropriate scale for the user's device. Working with touch screens To use a touch screen you'll need to work with DOM Touch events. You won't be able to use the CSS :hover pseudo-class, and will need to design clickable items like buttons to respect the fact that fingers are fatter than mouse pointers. See this article on designing for...
...eolocation. Cross-browser development Write cross-browser code To create web sites that will work acceptably across different mobile browsers: Try to avoid using browser-specific features, such as vendor-prefixed CSS properties. If you do need to use these features, check whether other browsers implement their own versions of these features, and target them too. For browsers that don't sup
port these features, provide an acceptable fallback. For example, if you set a gradient as a background for some text using a vendor-prefixed property like -webkit-linear-gradient, it's best to include the other vendor-prefixed versions of the linear-gradient() property. If you don't do that, at least make sure that the default background contrasts with the text: that way, the page will at least be ...
User input and controls - Developer guides
anage events across devices by normalizing the handling of each one. A pointer can be any point of contact on the screen made by a mouse cursor, pen, touch (including multi-touch), or other pointing input device. The events for handling generic pointer input look a lot like those for mouse: pointerdown, pointermove, pointerup, pointerover, pointerout, etc. Note: Pointer Events are not widely sup
ported yet, but a pointer.js polyfill is available on Mozilla Github. Implement controls Pointer lock In some cases, typically game development, you might need to access mouse events even when the cursor goes past the boundary of the browser or screen: the Pointer_Lock_API gives you full control of the pointing device. This is the code to request pointer lock on an element: element.requestPointe...
...ing device. This is the code to request pointer lock on an element: element.requestPointerLock(); Note: For a full tutorial and reference, read our Pointer_Lock_API page. Screen Orientation When screen orientation matters for your application, you can read the screen orientation state, be informed when this state changes, and able to lock the screen orientation to a specific state (usually
portrait or landscape) through the Screen Orientation API. Orientation data can be retrieved through the screen.orientation attribute or through the orientation media feature. When screen.orientation changes, the screen.orientationchange event is fired on the screen object. Locking the screen orientation is made possible by invoking the screen.lockOrientation method, while the screen.unlockOrientatio...
...teditable="true">? This text can be edited by the user. </div> Note: Compatibility information, examples and other resources can be found in the Content Editable guide. Examples Tracking multiple touch points at a time This example tracks multiple touch points at a time, allowing the user to draw in a <canvas> with more than one finger at a time. It will only work on a browser that sup
ports touch events. Simple pointer lock demo We've written a simple pointer lock demo to show you how to use it to set up a simple control system. The demo uses JavaScript to draw a ball inside a <canvas> element. When you click the canvas, pointer lock is then used to remove the mouse pointer and allow you to move the ball directly using the mouse. contentEditable demo This is a working example s...
The HTML autocomplete attribute - HTML: Hypertext Markup Language
level fields (address-level1 through address-level4) describe the address in terms of increasing levels of precision within the country in which the address is located. Each country has its own system of administrative levels, and may arrange the levels in different orders when addresses are written. address-level1 always represents the broadest administrative division; it is the least-specific
portion of the address short of the country name. Form layout flexibility Given that different countries write their address in different ways, with each field in different places within the address, and even different sets and numbers of fields entirely, it can be helpful if, when possible, your site is able to switch to the layout expected by your users when presenting an address entry form, given...
...nting an address entry form, given the country the address is located within. Variations The way each administrative level is used will vary from country to country. Below are some examples; this is not meant to be an exhaustive list. United States A typical home address within the United States looks like this: 432 Anywhere St Exampleville CA 95555 In the United States, the least-specific
portion of the address is the state, in this case "CA" (the official US Postal Service shorthand for "California"). Thus address-level1 is the state, or "CA" in this case. The second-least specific
portion of the address is the city or town name, so address-level2 is "Exampleville" in this example address. United States addresses do not use levels 3 and up. United Kingdom Address input forms in th...
...actually use just the postcode and address-line1 to sucessfully deliver mail in the UK, so they should be the only mandatory items, but usually people tend to provide more details. China China can use as many as three administrative levels: the province, the city, and the district. Japan An address in Japan is typically written in one line, in an order from the least-specific to more-specific
portions (in reverse order to the United States). There are two or three administrative levels in an address. Additional line can be used to show building names and room numbers. The postal code is separate. For example: ?381-0000 ????????123 "?" and following seven digits shows the postal code. address-level1 is used for prefectures or the Tokyo Metropolis; "???" (Nagano Prefecture) is in this ca...
disabled - HTML: Hypertext Markup Language
ith the form. The user can neither edit nor focus on the control, nor it's form control descendants. If the disabled attribute is specified on a form control, the element and its form control descendants do not participate in constraint validation. Often browsers grey out such controls and it won't receive any browsing events, like mouse clicks or focus-related ones. The disabled attribute is sup
ported by <button>, <command>, <fieldset>, <keygen>, <optgroup>, <option>, <select>, <textarea> and <input>. This Boolean disabled attribute indicates that the user cannot interact with the control or it's descendant controls. If this attribute is not specified, the control inherits its setting from the containing element, for example fieldset; if there is no containing element with the disabled attr...
...d attribute set, and the control itself does not have the attribute, then the control is enabled. If declared on an <optgroup>, the select is still interactive (unless otherwise disabled), but none of the items in the option group are selectable. Note: If a <fieldset> is disabled, the descendant form controls are all disabled, with the exception of form controls within the <legend>. When a sup
porting element has the disabled attribute applied, the :disabled pseudo-class also applies to it. Conversely, elements that sup
port the disabled attribute but don't have the attribute set match the :enabled pseudo-class. This Boolean attribute prevents the user from interacting with the button. If this attribute isn't set, the button can still be disabled from a containing element, for example <fiel...
...ch as pattern, have no effect, until the control is enabled. Note: The required attribute is not permitted on inputs with the disabled attribute specified. Usability Browsers display disabled form controls greyed as disabled form controls are immutable, won't receive focus or any browsing events, like mouse clicks or focus-related ones, and aren't submitted with the form. If present on a sup
porting elements, the :disabled pseudo class will match. If the attribute is not included, the :enabled pseudo class will match. If the element doesn't sup
port the disabled attribute, the attribute will have no effect, including not leading to being matched by the :disabled and :enabled pseudo classes. Constraint validation If the element is disabled, then the element's value can not receive focus a...
HTML attribute: readonly - HTML: Hypertext Markup Language
The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control. If the readonly attribute is specified on an input element, because the user can not edit the input, the element does not participate in constraint validation. The readonly attribute is sup
ported by text, search, url, tel, email, password, date, month, week, time, datetime-local, and number<input> types and the <textarea> form control elements. ...
...raint validation. The readonly attribute is sup
ported by text, search, url, tel, email, password, date, month, week, time, datetime-local, and number<input> types and the <textarea> form control elements. If present on any of these input types and elements, the :read-only pseudo class will match. If the attribute is not included, the :read-write pseudo class will match. The attribute is not sup
ported or relevant to <select> or input types that are already not mutable, such as checkbox and radio or cannot, by definition, start with a value, such as the file input type. range and color, as both have default values. It is also not sup
ported on hidden as it can not be expected that a user to fill out a form that is hidden. Nor is it sup
ported on any of the button types, including image. Note...
... Attribute interactions The difference between disabled and readonly is that read-only controls can still function and are still focusable, whereas disabled controls can not receive focus and are not submitted with the form and generally do not function as controls until they are enabled. ...
HTML attribute reference - HTML: Hypertext Markup Language
Elements in HTML have attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want. Attribute list Attribute Name Elements Description accept <form>, <input> List of types the server accepts, typically a file type. accept-charset <form> List of sup
ported charsets. accesskey Global attribute Keyboard shortcut to activate or add focus to the element. action <form> The URI of a program that processes the information submitted via the form. align <applet>, <caption>, <col>, <colgroup>, <hr>, <iframe>, <img>, <table>, <tbody>, <td>, <tfoot> , <th>, <thead>, <tr> Specifies the horizontal alignment of the element. ...
...by the browser. autofocus <button>, <input>, <keygen>, <select>, <textarea> The element should be automatically focused after the page loaded. autoplay <audio>, <video> The audio or video should play as soon as possible. background <body>, <table>, <td>, <th> Specifies the URL of an image file. Note: Although browsers and email clients may still sup
port this attribute, it is obsolete. Use CSS background-image instead. bgcolor <body>, <col>, <colgroup>, <marquee>, <table>, <tbody>, <tfoot>, <td>, <th>, <tr> Background color of the element. Note: This is a legacy attribute. Please use the CSS background-color property instead. border <img>, <object>, <table> The border width. ...
...he URL of a linked resource. hreflang <a>, <area>, <link> Specifies the language of the linked resource. http-equiv <meta> Defines a pragma directive. icon <command> Specifies a picture which represents the command. id Global attribute Often used with CSS to style a specific element. The value of this attribute must be unique. im
portance <iframe>, <img>, <link>, <script> Indicates the relative fetch priority for the resource. integrity <link>, <script> Specifies a Subresource Integrity value that allows browsers to verify what they fetch. intrinsicsize <img> This attribute tells the browser to ignore the actual intrinsic size of the image and pretend it's the size specified in ...
Date and time formats used in HTML - HTML: Hypertext Markup Language
the year 1582 (replacing the similar Julian calendar), for HTML's purposes, the Gregorian calendar is extended back to the year 1 C.E. Make sure any older dates account for this. For the purposes of HTML dates, years are always at least four digits long; years prior to the year 1000 are padded with leading zeroes ("0"), so the year 72 is written as 0072. Years prior to the year 1 C.E. are not sup
ported, so HTML doesn't sup
port years 1 B.C.E. (1 B.C.) or earlier. A year is normally 365 days long, except during leap years. Leap years A leap year is any year which is divisible by 400 or the year is divisible by 4 but not by 100. Although the calendar year is normally 365 days long, it actually takes the planet Earth approximately 365.2422 days to complete a single orbit around the sun. Leap y...
...our is always specified using the 24-hour clock, with 00 being midnight and 11 PM being 23. No values outside the range 00-23 are permitted. The minute must be a two-digit number between 00 and 59. No values outside that range are allowed. If the number of seconds is omitted (to specify a time accurate only to the minute), no colon should follow the number of minutes. If specified, the integer
portion of the number of seconds must be between 00 and 59. You cannot specify leap seconds by using values like 60 or 61. If the number of seconds is specified and is an integer, it must not be followed by a decimal point. If a fraction of a second is included, it may be from one to three digits long, indicating the number of milliseconds. It follows the decimal point placed after the seconds compo...
...ether with either the letter "T" or a space character separating them. No information about the time zone is included in the string; the date and time is presumed to be in the user's local time zone. When you set the value of a datetime-local input, the string is normalized into a standard form. Normalized datetime strings always use the letter "T" to separate the date and the time, and the time
portion of the string is as short as possible. This is done by leaving out the seconds component if its value is :00. Examples of valid datetime-local strings Date/time string Normalized date/time string Actual date and time 1986-01-28T11:38:00.01 1986-01-28T11:38:00.01 January 28, 1986 at 11:38:00.01 AM 1986-01-28 11:38:00.010 1986-01-28T11:38:00.011 ...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
The <applet> element was removed in Gecko 56 and Chrome 47. Removal is being considered in WebKit and Edge. The obsolete HTML Applet Element (<applet>) embeds a Java applet into the document; this element has been deprecated in favor of <object>. Use of Java applets on the Web is deprecated; most browsers no longer sup
port use of plug-ins, including the Java plug-in. Content categories Flow content, phrasing content, embedded content, interactive content, palpable content. Permitted content Zero or more <param> elements, then transparent. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts embedded content. DOM interface HTMLAppletElement Attributes align Th...
...g tag are mandatory. Permitted parents Any element that accepts embedded content. DOM interface HTMLAppletElement Attributes align This attribute is used to position the applet on the page relative to content that might flow around it. The HTML 4.01 specification defines values of bottom, left, middle, right, and top, whereas Microsoft and Netscape also might sup
port absbottom, absmiddle, baseline, center, and texttop. alt This attribute causes a descriptive text alternate to be displayed on browsers that do not sup
port Java. Page designers should also remember that content enclosed within the <applet> element may also be rendered as alternative text. archive This attribute refers to an archived or compressed version of the applet and its associated class...
...is attribute specifies the URL of the applet's class file to be loaded and executed. Applet filenames are identified by a .class filename extension. The URL specified by code might be relative to the codebase attribute. codebase This attribute gives the absolute or relative URL of the directory where applets' .class files referenced by the code attribute are stored. datafld This attribute, sup
ported by Internet Explorer 4 and higher, specifies the column name from the data source object that supplies the bound data. This attribute might be used to specify the various <param> elements passed to the Java applet. datasrc Like datafld, this attribute is used for data binding under Internet Explorer 4. It indicates the id of the data source object that supplies the data that is bound to the <...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ontent. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Use the <b> for cases like keywords in a summary, product names in a review, or other spans of text whose typical presentation would be boldfaced (but not including any special im
portance). Do not confuse the <b> element with the <strong>, <em>, or <mark> elements. The <strong> element represents text of certain im
portance, <em> puts some emphasis on the text and the <mark> element represents text of certain relevance. The <b> element doesn't convey such special semantic information; use it only when no others fit. Similarly, do not mark titles and headings using the <b> ele...
<input type="submit"> - HTML: Hypertext Markup Language
<input> elements of type submit are rendered as buttons. When the click event occurs (typically because the user clicked the button), the user agent attempts to submit the form to the server. <input type="submit" value="Send Request"> Value A DOMString used as the button's label Events click Sup
ported common attributes type and value IDL attributes value Methods None Value An <input type="submit"> element's value attribute contains a DOMString which is displayed as the button's label. Buttons do not have a true value otherwise. <input type="submit" value="Send Request"> If you don't specify a value, the button will have a default label, chosen by the user agent. This label is likely to be something along the lines...
...est"> If you don't specify a value, the button will have a default label, chosen by the user agent. This label is likely to be something along the lines of "Submit" or "Submit Query." Here's an example of a submit button with a default label in your browser: <input type="submit"> Additional attributes In addition to the attributes shared by all <input> elements, submit button inputs sup
port the following attributes: Attribute Description formaction The URL to which to submit the form's data; overrides the form's action attribute, if any formenctype A string specifying the encoding type to use for the form data formmethod The HTTP method (get or post) to use when submitting the form. formnovalidate A Boolean which, if p...
...ype or the form's enctype attribute. This URL is then sent to the server using an HTTP get request. This method works well for simple forms that contain only ASCII characters and have no side effects. This is the default value. post The form's data is included in the body of the request that is sent to the URL given by the formaction or action attribute using an HTTP post method. This method sup
ports complex data and file attachments. dialog This method is used to indicate that the button simply closes the dialog with which the input is associated, and does not transmit the form data at all. This attribute is also available on <input type="image"> and <button> elements. formnovalidate A Boolean attribute which, if present, specifies that the form should not be validated before submissi...
<input type="text"> - HTML: Hypertext Markup Language
text create basic single-line text fields. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Value A DOMString representing the text contained in the text field. Events change and input Sup
ported Common Attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size IDL attributes list, value Methods select(), setRangeText() and setSelectionRange(). Value The value attribute is a DOMString that contains the current value of the text entered into the text field. You can retrieve this using the value property in Jav...
...f the text entered into the text field. You can retrieve this using the value property in JavaScript. let theText = myTextInput.value; If no validation constraints are in place for the input (see Validation for more details), the value may be an empty string (""). ...
... A Safari extension, the autocorrect attribute is a string which indicates whether or not to activate automatic correction while the user is editing this field. Permitted values are: on Enable automatic correction of typos, as well as processing of text substitutions if any are configured. off Disable automatic correction and text substitutions. mozactionhint A Mozilla extension, sup
ported by Firefox for Android, which provides a hint as to what sort of action will be taken if the user presses the Enter or Return key while editing the field. This information is used to decide what kind of label to use on the Enter key on the virtual keyboard. Note: This has been standardized as the global attribute enterkeyhint, but is not yet widely implemented. To see the status of the change...
<isindex> - HTML: Hypertext Markup Language
<isindex> is removed HTML Standard. It was deprecated in HTML 4.01. The same behaviour can be achieved with an HTML form. All major browsers have now removed <isindex>. ...
...making queries is mentioned in reference to Dynatext browser: "The browser displays toggle buttons, text fields etc. The user fills in the fields, clicks OK, and the query results come up in the table of contents window." A thread about isindex in November 1992, Kevin Hoadley questioned the need for an isindex element and proposed to drop it. He proposed to have instead an input element (idea sup
ported by Steve Putz). Tim Berners-Lee explains the purpose of isindex resulting in aggregated search results. Kevin replies that he doesn't like the boolean nature of isindex and would prefer a system where everything is searchable and proposes to extend the current WWW Framework with a specific httpd configuration and defined that some URIs mapping create search queries. In 2016, after it was remov...
...index and would prefer a system where everything is searchable and proposes to extend the current WWW Framework with a specific httpd configuration and defined that some URIs mapping create search queries. In 2016, after it was removed from Edge and Chrome, it was proposed to remove isindex from the standard; this removal was completed the next day, after which Safari and Firefox also removed sup
port. HTML Reference The HTML Standard classifies it as a obsolete and non-conforming feature. ISINDEX element deprecated in HTML 4.01 ISINDEX in HTML 3.2 ISINDEX in HTML 2.0 as well the description of the behavior in Queries and Indexes (HTML 2.0) ISINDEX in HTML+ ...
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
One <rp> element should enclose each of the opening and closing parentheses that wrap the <rt> element that contains the annotation's text. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None. ...
...it ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Ruby annotations are for showing pronunciation of East Asian characters, like using Japanese furigana or Taiwanese bopomofo characters. The <rp> element is used in the case of lack of <ruby> element sup
port; the <rp> content provides what should be displayed in order to indicate the presence of a ruby annotation, usually parentheses. Examples This example uses ruby annotations to display the Romaji equivalents for each character. <ruby> ? <rp>(</rp><rt>Kan</rt><rp>)</rp> ? <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> CSS body { font-size: 22px; } The result looks like this in your browse...
...er to indicate the presence of a ruby annotation, usually parentheses. Examples This example uses ruby annotations to display the Romaji equivalents for each character. <ruby> ? <rp>(</rp><rt>Kan</rt><rp>)</rp> ? <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> CSS body { font-size: 22px; } The result looks like this in your browser: The HTML above rendered by a browser without ruby sup
port might look like this: ? (Kan) ? (ji) body { font-size: 22px; } See the article about the <ruby> element for further examples. Specifications Specification Status Comment HTML Living StandardThe definition of '<rp>' in that specification. Living Standard HTML5The definition of '<rp>' in that specification. Recommendation ...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
The obsolete HTML Teletype Text element (<tt>) creates inline text which is presented using the user agent's default monospace font face. This element was created for the purpose of rendering text as it would be displayed on a fixed-width display such as a teletype, text-only screen, or line printer. The terms non-pro
portional, monotype, and monospace are used interchangeably and have the same general meaning: they describe a typeface whose characters are all the same number of pixels wide. This element is obsolete, however. You should use the more semantically helpful <code>, <kbd>, <samp>, or <var> elements for inline text that needs to be presented in monospace type, or the <pre> tag for content that should be presented as a separate block. If none of the semantic elements are appropr...
... wide. This element is obsolete, however. You should use the more semantically helpful <code>, <kbd>, <samp>, or <var> elements for inline text that needs to be presented in monospace type, or the <pre> tag for content that should be presented as a separate block. If none of the semantic elements are appropriate for your use case (for example, if you simply need to show some content in a non-pro
portional font), you should consider using the <span> element, styling it as desired using CSS. The font-family property is a good place to start. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that a...
...You can override this using CSS by creating a rule using the tt selector, as seen in the example Overriding the default font above. User-configured changes to the default monospace font setting may take precedence over your CSS. Although this element wasn't officially deprecated in HTML 4.01, its use was discouraged in favor of the semantic elements and/or CSS. The <tt> element is ...
accesskey - HTML: Hypertext Markup Language
hat can be generated by the keyboard). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: In the WHATWG spec, it says you can specify multiple space-separated characters, and the browser will use the first one it sup
ports. However, this does not work in most browsers. IE/Edge uses the first one it sup
ports without problems, provided there are no conflicts with other commands. The way to activate the accesskey depends on the browser and its platform: Windows Linux Mac Firefox Alt + Shift + key On Firefox 57 or newer: Control + Option + key or Control + Alt + key On Firefox ...
...What may work for one combination of operating system, assistive technology, and browser may not work with other combinations. Certain accesskey values may not be present on certain keyboards, especially when internationa...
...f 'accesskey' in that specification. Recommendation No change from HTML5. ...
Microdata - HTML: Hypertext Markup Language
ata within existing content on web pages. Search engines and web crawlers can extract and process microdata from a web page and use it to provide a richer browsing experience for users. Search engines benefit greatly from direct access to this structured data because it allows search engines to understand the information on web pages and provide more relevant results to users. Microdata uses a sup
porting vocabulary to describe an item and name-value pairs to assign values to its properties. Microdata is an attempt to provide a simpler way of annotating HTML elements with machine-readable tags than the similar approaches of using RDFa and classic microformats. At a high level, microdata consists of a group of name-value pairs. The groups are called items, and each name-value pair is a property...
...a high level, microdata consists of a group of name-value pairs. The groups are called items, and each name-value pair is a property. Items and properties are represented by regular elements. To create an item, the itemscope attribute is used. To add a property to an item, the itemprop attribute is used on one of the item's descendants. Vocabularies Google and other major search engines sup
port the Schema.org vocabulary for structured data. This vocabulary defines a standard set of type names and property names, for example, Schema.org Music Event indicates a concert performance, with startDate and location properties to specify the concert's key details. In this case, Schema.org Music Event would be the URL used by itemtype and startDate and location would be itemprop's that Schema.org...
...lts. For some purposes, an ad-hoc vocabulary is adequate. For others, a vocabulary will need to be designed. Where possible, authors are encouraged to re-use existing vocabularies, as this makes content re-use easier. Localization In some cases, search engines covering specific regions may provide locally-specific extensions of microdata. For example, Yandex, a major search engine in Russia, sup
ports microformats such as hCard (company contact information), hRecipe (food recipe), hReview (market reviews) and hProduct (product data) and provides its own format for the definition of the terms and encyclopedic articles. This extension was made to solve transliteration problems between the Cyrillic and Latin alphabets. Due to the implementation of additional marking parameters of Schema's vocabu...
Using the application cache - HTML: Hypertext Markup Language
Introduction HTML5 provides an application caching mechanism that lets web applications run offline. This Application Cache (AppCache) interface lists resources that browsers should cache to be available offline. ...
... adding AddType text/cache-manifest .appcache to a .htaccess file within either the root directory, or the same directory as the application. Entries in a cache manifest file The cache manifest file is a simple text file that lists the resources the browser should cache for offline access. Resources are identified by URI. Entries listed in the cache manifest must have the same scheme, host, and
port as the manifest. Example 1: a simple cache manifest file The following is a simple cache manifest file, example.appcache, for an imaginary web site at www.example.com. CACHE MANIFEST # v1 - 2011-08-13 # This is a comment. http://www.example.com/index.html http://www.example.com/header.png http://www.example.com/blah/blah A cache manifest file can include three sections (CACHE, NETWORK, and F...
...cation cache when the manifest file changes, byte for byte. If you change a cached resource (for example, you update the header.png image with new content), you must also change the content of the manifest file in order to let browsers know that they need to refresh the cache. You can make any change you want to the manifest file, but revising a version number is the recommended best practice. Im
portant: Do not specify the manifest itself in the cache manifest file, otherwise it will be nearly impossible to inform the browser a new manifest is available. Sections in a cache manifest file: CACHE, NETWORK, and FALLBACK A manifest can have three distinct sections: CACHE, NETWORK, and FALLBACK. CACHE: This is the default section for entries in a cache manifest file. Files listed under the C...
HTTP caching - HTTP
This achieves several goals: it eases the load of the server that doesn't need to serve all clients itself, and it improves performance by being closer to the client, i.e., it takes less time to transmit the resource back. For a web site, it is a major component in achieving high performance. On the other side, it has to be configured properly as not all resources stay identical forever: it is im
portant to cache a resource only until it changes, not longer. There are several kinds of caches: these can be grouped into two main categories: private or shared caches. A shared cache is a cache that stores responses for reuse by more than one user. A private cache is dedicated to a single user. This page will mostly talk about browser and proxy caches, but there are also gateway caches, CDN, rever...
...This can be useful if pages with HTTP authentication, or response status codes that aren't normally cacheable, should now be cached. On the other hand, "private" indicates that the response is intended for a single user only and must not be stored by a shared cache. A private browser cache may store the response in this case. Cache-Control: private Cache-Control: public Expiration The most im
portant directive here is "max-age=<seconds>" which is the maximum amount of time a resource will be considered fresh. Contrary to Expires, this directive is relative to the time of the request. For the files in the application that will not change, you can usually add aggressive caching. This includes static files such as images, CSS files and JavaScript files, for example. For more details, see als...
...ly variable resources change they induce an additional change to often variable resources. When these are read, the new versions of the others are also read. This technique has an additional benefit: updating two cached resources at the same time will not lead to the situation where the out-dated version of one resource is used in combination with the new version of the other one. This is very im
portant when web sites have CSS stylesheets or JS scripts that have mutual dependencies, i.e., they depend on each other because they refer to the same HTML elements. The revision version added to revved resources doesn't need to be a classical revision string like 1.1.3, or even a monotonously growing suite of number. It can be anything that prevent collisions, like a hash or a date. Cache valida...
Firefox user agent string reference - HTTP
tive platform the browser is running on (e.g. Windows, Mac, Linux or Android), and whether or not it's a mobile phone. Firefox OS phones simply say "Mobile"; the web is the platform. Note that platform can consist of multiple "; "-separated tokens. See below for further details and examples. Though fixed in Firefox 69, previous 32-bit versions of Firefox running on 64-bit processors would re
port that the system is using a 32-bit CPU. rv:geckoversion indicates the release version of Gecko (such as "17.0"). In recent browsers, geckoversion is the same as firefoxversion. Gecko/geckotrail indicates that the browser is based on Gecko. On Desktop, geckotrail is the fixed string "20100101" Firefox/firefoxversion indicates the browser is Firefox, and provides the version (such as "17.0"...
... Phone Mozilla/5.0 (Android; Mobile; rv:40.0) Gecko/40.0 Firefox/40.0 Tablet Mozilla/5.0 (Android; Tablet; rv:40.0) Gecko/40.0 Firefox/40.0 Android (version 41 and above) Beginning in version 41, Firefox for Android will contain the Android version as part of the platform token. For increased interoperability, if the browser is running on a version below 4 it will re
port 4.4. Android versions 4 and above will re
port the version accurately. Note that the same Gecko--with the same capabilities--is shipped to all versions of Android. Form factor Gecko user agent string Phone Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0 Tablet Mozilla/5.0 (Android 4.4; Tablet; rv:41.0) Gecko/41.0 Firefox/41.0 Focus...
...extensions added user agent parts to notify sites they were installed. ...
X-Frame-Options - HTTP
The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>. Sites can use this to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites. The added security is provided only if the user accessing the document is using a browser that sup
ports X-Frame-Options. Note: The Content-Security-Policy HTTP header has a frame-ancestors directive which obsoletes this header for sup
porting browsers. Header type Response header Forbidden header name no Syntax There are two possible directives for X-Frame-Options: X-Frame-Options: DENY X-Frame-Options: SAMEORIGIN Directives If you specify DENY, not only will attempts to l...
...ting to do so. SAMEORIGIN The page can only be displayed in a frame on the same origin as the page itself. The spec leaves it up to browser vendors to decide whether this option applies to the top level, the parent, or the whole chain, although it is argued that the option is not very useful unless all ancestors are also in the same origin (see bug 725490). Also see Browser compatibility for sup
port details. ALLOW-FROM uri This is an obsolete directive that no longer works in modern browsers. Don't use it. In sup
porting legacy browsers, a page can be displayed in a frame only on the specified origin uri. Note that in the legacy Firefox implementation this still suffered from the same problem as SAMEORIGIN did -- it doesn't check the frame ancestors to see if they are in the same origin. ...
...or location configuration: add_header X-Frame-Options SAMEORIGIN always; Configuring IIS To configure IIS to send the X-Frame-Options header, add this to your site's Web.config file: <system.webServer> ... <httpProtocol> <customHeaders> <add name="X-Frame-Options" value="SAMEORIGIN" /> </customHeaders> </httpProtocol> ... </system.webServer> Or see this Microsoft sup
port article on setting this configuration using the IIS Manager user interface. Configuring HAProxy To configure HAProxy to send the X-Frame-Options header, add this to your front-end, listen, or backend configuration: rspadd X-Frame-Options:\ SAMEORIGIN Alternatively, in newer versions: http-response set-header X-Frame-Options SAMEORIGIN Configuring Express To configure Express to send the ...
X-XSS-Protection - HTTP
nternet Explorer, Chrome and Safari that stops pages from loading when they detect reflected cross-site scripting (XSS) attacks. Although these protections are largely unnecessary in modern browsers when sites implement a strong Content-Security-Policy that disables the use of inline JavaScript ('unsafe-inline'), they can still provide protections for users of older web browsers that don't yet sup
port CSP. Chrome has removed their XSS Auditor Firefox have not, and will not implement X-XSS-Protection Edge have retired their XSS filter This means that if you do not need to sup
port legacy browsers, it is recommended that you use Content-Security-Policy without allowing unsafe-inline scripts instead. Header type Response header Forbidden header name no Synt...
...ection Edge have retired their XSS filter This means that if you do not need to sup
port legacy browsers, it is recommended that you use Content-Security-Policy without allowing unsafe-inline scripts instead. Header type Response header Forbidden header name no Syntax X-XSS-Protection: 0 X-XSS-Protection: 1 X-XSS-Protection: 1; mode=block X-XSS-Protection: 1; re
port=<re
porting-uri> 0 Disables XSS filtering. 1 Enables XSS filtering (usually default in browsers). If a cross-site scripting attack is detected, the browser will sanitize the page (remove the unsafe parts). 1; mode=block Enables XSS filtering. ...
...de=block X-XSS-Protection: 1; re
port=<re
porting-uri> 0 Disables XSS filtering. 1 Enables XSS filtering (usually default in browsers). If a cross-site scripting attack is detected, the browser will sanitize the page (remove the unsafe parts). 1; mode=block Enables XSS filtering. Rather than sanitizing the page, the browser will prevent rendering of the page if an attack is detected. 1; re
port=<re
porting-URI> (Chromium only) Enables XSS filtering. If a cross-site scripting attack is detected, the browser will sanitize the page and re
port the violation. This uses the functionality of the CSP re
port-uri directive to send a re
port. Example Block pages from loading when they detect reflected XSS attacks: X-XSS-Protection: 1; mode=block PHP header("X-XSS-Protection: 1; mode=block"); ...
HTTP Messages - HTTP
nts: An HTTP method, a verb (like GET, PUT or POST) or a noun (like HEAD or OPTIONS), that describes the action to be performed. For example, GET indicates that a resource should be fetched or POST means that data is pushed to the server (creating or modifying a resource, or generating a temporary document to send back). The request target, usually a URL, or the absolute path of the protocol,
port, and domain are usually characterized by the request context. The format of this request target varies between different HTTP methods. It can be An absolute path, ultimately followed by a '?' and query string. This is the most common form, known as the origin form, and is used with GET, POST, HEAD, and OPTIONS methods. POST / HTTP/1.1 GET /background.png HTTP/1.0 HEAD /test.html...
...PTIONS methods. POST / HTTP/1.1 GET /background.png HTTP/1.0 HEAD /test.html?query=alibaba HTTP/1.1 OPTIONS /anypage.html HTTP/1.0 A complete URL, known as the absolute form, is mostly used with GET when connected to a proxy. GET http://developer.mozilla.org/docs/Web/HTTP/Messages HTTP/1.1 The authority component of a URL, consisting of the domain name and optionally the
port (prefixed by a ':'), is called the authority form. It is only used with CONNECT when setting up an HTTP tunnel. CONNECT developer.mozilla.org:80 HTTP/1.1 The asterisk form, a simple asterisk ('*') is used with OPTIONS, representing the server as a whole. OPTIONS * HTTP/1.1 The HTTP version, which defines the structure of the remaining message, acting as an indicator of the expect...
... HTTP/1.x messages into frames which are embedded in a stream. Data and header frames are separated, this allows header compression. Several streams can be combined together, a process called multiplexing, allowing more efficient underlying TCP connections. HTTP frames are now transparent to Web developers. This is an additional step in HTTP/2, between HTTP/1.1 messages and the underlying trans
port protocol. No changes are needed in the APIs used by Web developers to utilize HTTP frames; when available in both the browser and the server, HTTP/2 is switched on and used. Conclusion HTTP messages are the key in using HTTP; their structure is simple, and they are highly extensible. The HTTP/2 framing mechanism adds a new intermediate layer between the HTTP/1.x syntax and the underlying transp...
JSON.stringify() - JavaScript
nd potentially an object as value), you will have to keep track of the iteration count (if it is beyond the first iteration, it is a genuine empty string key). Example replacer, as a function function replacer(key, value) { // Filtering out properties if (typeof value === 'string') { return undefined; } return value; } var foo = {foundation: 'Mozilla', model: 'box', week: 45, trans
port: 'car', month: 7}; JSON.stringify(foo, replacer); // '{"week":45,"month":7}' Example replacer, as an array If replacer is an array, the array's values indicate the names of the properties in the object that should be included in the resulting JSON string. JSON.stringify(foo, ['week', 'month']); // '{"week":45,"month":7}', only keep "week" and "month" properties The space argument The space...
...}'`; else return this; } }; JSON.stringify(obj); // '{"data":"data"}' JSON.stringify({ obj }); // Shorthand property names (ES2015). ...
...cycle.js by Douglas Crockford) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values. Issue with plain JSON.stringify for use as JavaScript Historically, JSON was not a completely strict subset of JavaScript. ...
String.prototype.codePointAt() - JavaScript
t value of the character at the given pos. If there is no element at pos, returns undefined. Description If there is no element at the specified position, undefined is returned. If no UTF-16 surrogate pair begins at pos, the code unit at pos is returned. Polyfill The following extends Strings to include the codePointAt() function as specified in ECMAScript 2015 for browsers without native sup
port. ...
...osition, undefined is returned. If no UTF-16 surrogate pair begins at pos, the code unit at pos is returned. Polyfill The following extends Strings to include the codePointAt() function as specified in ECMAScript 2015 for browsers without native sup
port. ...
...ed. Polyfill The following extends Strings to include the codePointAt() function as specified in ECMAScript 2015 for browsers without native sup
port. ...
String.prototype.localeCompare() - JavaScript
a" are equivalent yielding a neutral value of zero 'a'.localeCompare('a'); // 0 Sort an array localeCompare() enables case-insensitive sorting for an array. ...
... // 0 Sort an array localeCompare() enables case-insensitive sorting for an array. let items = ['reserve', 'Premier', 'Cliche', 'communique', 'cafe', 'Adieu']; items.sort( (a, b) => a.localeCompare(b, 'fr', {ignorePunctuation: true})); // ['Adieu', 'cafe', 'Cliche', 'communique', 'Premier', 'reserve'] Check browser sup
port for extended arguments The locales and options arguments are not sup
ported in all browsers yet. ...
...ting for an array. let items = ['reserve', 'Premier', 'Cliche', 'communique', 'cafe', 'Adieu']; items.sort( (a, b) => a.localeCompare(b, 'fr', {ignorePunctuation: true})); // ['Adieu', 'cafe', 'Cliche', 'communique', 'Premier', 'reserve'] Check browser sup
port for extended arguments The locales and options arguments are not sup
ported in all browsers yet. To check whether an implementation sup
ports them, use the "i" argument (a requirement that illegal language tags are rejected) and look for a RangeError exception: function localeCompareSup
portsLocales() { try { 'foo'.localeCompare('bar', 'i'); } catch (e) { return e.name === 'RangeError'; } return false; } Using locales The results provided by localeCompare() vary between languages. In order to get the sort order of t...
String.prototype.replaceAll() - JavaScript
It will become available in Chrome 85. The replaceAll() method returns a new string with all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. The original string is left unchanged. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...he global ("g") flag will throw a TypeError: "replaceAll must be called with a global RegExp". substr A String that is to be replaced by newSubstr. It is treated as a literal string and is not interpreted as a regular expression. newSubstr (replacement) The String that replaces the substring specified by the specified regexp or substr parameter. A number of special replacement patterns are sup
ported; see the "Specifying a string as a parameter" section below. function (replacement) A function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. The arguments supplied to this function are described in the "Specifying a function as a parameter" section below. Return value A new string, with all matches of a pattern replaced by a repl...
...atches of a pattern replaced by a replacement. Description This method does not change the calling String object. It simply returns a new string. Specifying a string as a parameter The replacement string can include the following special replacement patterns: Pattern Inserts $$ Inserts a "$". $& Inserts the matched substring. $` Inserts the
portion of the string that precedes the matched substring. $' Inserts the
portion of the string that follows the matched substring. $n Where n is a positive integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a RegExp object. Note that this is 1-indexed. Specifying a function as a parameter You can specify a function as ...
Lexical grammar - JavaScript
when you try to run the script in Unix/Linux. So use UTF-8 without BOM if you want to run scripts directly from shell. You must only use the #! comment style to specify a JavaScript interpreter. In all other cases just use a // comment (or mulitiline comment). Keywords Reserved keywords as of ECMAScript 2015 break case catch class const continue debugger default delete do else ex
port extends finally for function if im
port in instanceof new return super switch this throw try typeof var void while with yield Future reserved keywords The following are reserved as future keywords by the ECMAScript specification. They have no special functionality at present, but they might at some future time, so they cannot be used as identifiers. These are always reserv...
...ar double final float goto int long native short synchronized throws transient volatile Additionally, the literals null, true, and false cannot be used as identifiers in ECMAScript. Reserved word usage Reserved words actually only apply to Identifiers (vs. IdentifierNames) . As described in es5.github.com/#A.1, these are all IdentifierNames which do not exclude ReservedWords. a.im
port a['im
port'] a = { im
port: 'test' }. On the other hand the following is illegal because it's an Identifier, which is an IdentifierName without the reserved words. Identifiers are used for FunctionDeclaration, FunctionExpression, VariableDeclaration and so on. IdentifierNames are used for MemberExpression, CallExpression and so on. function im
port() {} // Illegal. Identifiers with special meani...
...so template strings for more information. `string text` `string text line 1 string text line 2` `string text ${expression} string text` tag `string text ${expression} string text` Automatic semicolon insertion Some JavaScript statements must be terminated with semicolons and are therefore affected by automatic semicolon insertion (ASI): Empty statement let, const, variable statement im
port, ex
port, module declaration Expression statement debugger continue, break, throw return The ECMAScript specification mentions three rules of semicolon insertion. 1. A semicolon is inserted before, when a Line terminator or "}" is encountered that is not allowed by the grammar. { 1 2 } 3 // is transformed by ASI into { 1 2 ;} 3; 2. A semicolon is inserted at the end, when the end of the...
JavaScript typed arrays - JavaScript
e more and more powerful, adding features such as audio and video manipulation, access to raw data using WebSockets, and so forth, it has become clear that there are times when it would be helpful for JavaScript code to be able to quickly and easily manipulate raw binary data. This is where typed arrays come in. Each entry in a JavaScript typed array is a raw binary value in one of a number of sup
ported formats, from 8-bit integers to 64-bit floating-point numbers. However, typed arrays are not to be confused with normal arrays, as calling Array.isArray() on a typed array returns false. Moreover, not all methods available for normal arrays are sup
ported by typed arrays (e.g. push and pop). Buffers and views: typed array architecture To achieve maximum flexibility and efficiency, JavaScript ...
...ter methods. Web APIs using typed arrays These are some examples of APIs that make use of typed arrays; there are others, and more are being added all the time. FileReader.prototype.readAsArrayBuffer() The FileReader.prototype.readAsArrayBuffer() method starts reading the contents of the specified Blob or File. XMLHttpRequest.prototype.send() XMLHttpRequest instances' send() method now sup
ports typed arrays and ArrayBuffer objects as argument. ImageData.data Is a Uint8ClampedArray representing a one-dimensional array containing the data in the RGBA order, with integer values between 0 and 255 inclusive. Examples Using views with buffers First of all, we will need to create a buffer, here with a fixed length of 16-bytes: let buffer = new ArrayBuffer(16); At this point, we have ...
...te: The data structure alignment in a C structure is platform-dependent. Take precautions and considerations for these padding differences. Conversion to normal arrays After processing a typed array, it is sometimes useful to convert it back to a normal array in order to benefit from the Array prototype. This can be done using Array.from(), or using the following code where Array.from() is unsup
ported. let typedArray = new Uint8Array([1, 2, 3, 4]), normalArray = Array.prototype.slice.call(typedArray); normalArray.length === 4; normalArray.constructor === Array; Specifications Specification ECMAScript (ECMA-262)The definition of 'TypedArray Objects' in that specification. ...
JavaScript
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, sup
porting object-oriented, imperative, and declarative (e.g. ...
...d, imperative, and declarative (e.g. functional programming) styles. Read more about JavaScript. This section is dedicated to the JavaScript language itself, and not the parts that are specific to Web pages or other host environments. For information about API specifics to Web pages, please see Web APIs and DOM. The standard for JavaScript is ECMAScript. As of 2012, all modern browsers fully sup
port ECMAScript 5.1. Older browsers sup
port at least ECMAScript 3. On June 17, 2015, ECMA International published the sixth major version of ECMAScript, which is officially called ECMAScript 2015, and was initially referred to as ECMAScript 6 or ES6. Since then, ECMAScript standards are on yearly release cycles. This documentation refers to the latest draft version, which is currently ECMAScript 2020.
...", along with discussing key JavaScript features such as variables, strings, numbers, and arrays. JavaScript building blocks Continues our coverage of JavaScript's key fundamental features, turning our attention to commonly-encountered types of code blocks such as conditional statements, loops, functions, and events. Introducing JavaScript objects The object-oriented nature of JavaScript is im
portant to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've provided this module to help you. Asynchronous JavaScript Discusses asynchronous JavaScript, why it is im
portant, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. Client-side web APIs Explores what API...
Installing and uninstalling web apps - Progressive web apps (PWAs)
ble and convenient than a typical web site. By reducing the user experience differential between the web app and native apps on the user's device, you reduce both the loss of any muscle memory they have revolving around the native interface of the device and the sensation of "something isn't quite right" that users can experience when switching between native and web-based apps. What browsers sup
port installation? Installation is sup
ported by Chrome for Android and Android WebView version 31 and later, Opera for Android 32 onward, Samsung Internet from version 4 onward, and Firefox for Android version 58 and later. Safari on iOS is a little different. Some parts of the PWA ecosystem are sup
ported, while others are not. iOS 13 introduced a much more comparable install experience, which is al...
...nd also see the source code) that doesn't do much, but was developed with the necessary code to allow it to be installed, as well as a service worker to enable it to be used offline. The example displays a series of fox pictures.If you have a web application compatible device available, use it to navigate to our demo at https://mdn.github.io/pwa-examples/a2hs/. You'll see fox pictures, but more im
portantly, some form of user interface will be available to let you install the site as a web app. The UI for this varies from browser to browser, but the general idea is the same. Unfortunately, there isn't a standard for icons and symbols used for operations such as this. Firefox for Android On an Android device using Firefox, you'll see a "home" icon with a plus (+) icon inside it--this is the...
...creen. Note: You can find out a lot more about Chrome install banners from the article Web App Install Banners. If you choose not to add it to your Home screen at this point, you can do so later using the "Add to Home Screen" icon in the main Chrome menu. Safari for iOS / iPhoneOS / iPadOS On Apple's iOS (including iPhoneOS and iPadOS), the Safari browser built into the device has some sup
port for web applications, including sup
port for the add to home screen feature. To add a web app to the home screen (also known as the launcher or springboard), tap the sharing button () at the bottom of the screen: This calls up the sharing panel. Among the options should be the "Add to Home Screen" option, unless it's been specifically removed from the list by the user editing the optons display...
How to make PWAs installable - Progressive web apps (PWAs)
The installed web app can then be launched by users just as if it were any native app. This article explains how to achieve this using the web app's manifest. ...
...t reference for details. Add to home screen "Add to home screen" (or a2hs for short) is a feature implemented by mobile browsers that takes the information found in an app's web manifest and uses them to represent the app on the device's home screen with an icon and name. This only works if the app meets all the necessary requirements, as described above. When the user visits the PWA with a sup
porting mobile browser, it should display a notification (such as a banner or dialog box) indicating that it's possible to install the app as a PWA. After the user indicates they wish to proceed with installation, the install banner is shown. That banner is automatically created by the browser, based on the information from the manifest file. For instance, the prompt includes the app's name and ico...
...ded started up. The icon and the theme and background colors are used to create this screen. Summary In this article, we learned about how we can make PWAs installable with a properly-configured web manifest, and how the user can then install the PWA with the "add to home screen" feature of their browser. For more information on a2hs, be sure to read our Add to Home screen guide. Browser sup
port is currently limited to Firefox for Android 58+, Mobile Chrome and Android Webview 31+, and Opera for Android 32+, but this should improve in the near future. Now let's move to the last piece of the PWA puzzle: using push notifications to share announcements with the user, and to help the user re-engage with your app. Previous Overview: Progressive Next ...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
as they can take control over network requests, modify them, serve custom responses retrieved from the cache, or synthesize responses completely. Security Because they are so powerful, Service Workers can only be executed in secure contexts (meaning HTTPS). If you want to experiment first before pushing your code to production, you can always test on a localhost or setup GitHub Pages -- both sup
port HTTPS. Offline First The "offline first" -- or "cache first" -- pattern is the most popular strategy for serving content to the user. If a resource is cached and available offline, return it first before trying to download it from the server. If it isn't in the cache already, download it and cache it for future usage. "Progressive" in PWA When implemented properly as a progressive enhancement...
...ttern is the most popular strategy for serving content to the user. If a resource is cached and available offline, return it first before trying to download it from the server. If it isn't in the cache already, download it and cache it for future usage. "Progressive" in PWA When implemented properly as a progressive enhancement, service workers can benefit users who have modern browsers that sup
port the API by providing offline sup
port, but won't break anything for those using legacy browsers. Service workers in the js13kPWA app Enough theory -- let's see some source code! Registering the Service Worker We'll start by looking at the code that registers a new Service Worker, in the app.js file: NOTE : We're using the es6 arrow functions syntax in the Service Worker Implementation if('se...
...Its contents reside in the sw.js file, and can be executed after the registration is successful. It's the only piece of Service Worker code that sits inside the app.js file; everything else that is Service Worker-specific is written in the sw.js file itself. Lifecycle of a Service Worker When...
Content type - SVG: Scalable Vector Graphics
.5s = 500 milliseconds 00:00.005 = 5 milliseconds Color <color> The basic type <color> is a CSS2 compatible specification for a color in the sRGB color space. <color> applies to SVG's use of the color attribute and is a component of the definitions of attributes fill, stroke, stop-color, flood-color, and lighting-color, which also offer optional ICC-based color specifications. SVG sup
ports all of the syntax alternatives for <color> defined in CSS2 syntax and basic data types, and (depend on the implementation) in the future CSS Color Module Level 3. A <color> is either a keyword or a numerical RGB specification. In addition to these color keywords, users may specify keywords that correspond to the colors used by objects in the user's environment. The normative definition of th...
...oth absolute and relative, to other objects. For example, to fill a rectangle with a linear gradient, you first define a <linearGradient> element and give it an ID, as in: <linearGradient xml:id="MyGradient">...</linearGradient> You then reference the linear gradient as the value of the fill attribute for the rectangle, as in the following example: <rect fill="url(#MyGradient)"/> SVG sup
ports two types of IRI references: local IRI references, where the IRI reference does not contain an <absoluteIRI> or <relativeIRI> and thus only contains a fragment identifier (i.e., #<elementID> or #xpointer(id<elementID>)). non-local IRI references, where the IRI reference does contain an <absoluteIRI> or <relativeIRI>. For the full specification of IRI references in SVG, see SVG 1.1 (2n...
...| "pt" | "pc" | "%")? The unit identifiers in such <length> values must be in lower case. Note that the non-property <length> definition also allows a percentage unit identifier. The meaning of a percentage length value depends on the attribute for which the percentage length value has been specified. Two common cases are: when a percentage length value represents a percentage of the view
port width or height when a percentage length value represents a percentage of the bounding box width or height on a given object. In the SVG DOM, <length> values are represented using SVGLength or SVGAnimatedLength objects. List-of-Ts <list-of-Ts> (Where T is some type.) A list consists of a separated sequence of values. Unless explicitly described differently, lists within SVG's XML ...
<svg> - SVG: Scalable Vector Graphics
It is used as the outermost element of SVG documents, but it can also be used to embed an SVG fragment inside an SVG or HTML document. Note: The xmlns attribute is only required on the outermost svg element of SVG documents. It is unnecessary for inner svg elements or inside HTML documents. ...
... no contentScriptType Deprecated since SVG 2 The default scripting language used by the SVG fragment. Value type: <string> ; Default value: application/ecmascript; Animatable: no contentStyleType Deprecated since SVG 2 The default style sheet language used by the SVG fragment. Value type: <string> ; Default value: text/css; Animatable: no height The displayed height of the rectangular view
port. (Not the height of its coordinate system.) Value type: <length>|<percentage> ; Default value: auto; Animatable: yes preserveAspectRatio How the svg fragment must be deformed if it is displayed with a different aspect ratio. Value type: (none| xMinYMin| xMidYMin| xMaxYMin| xMinYMid| xMidYMid| xMaxYMid| xMinYMax| xMidYMax| xMaxYMax) (meet|slice)? ; Default value: xMidYMid meet; Animatable: yes...
...t is displayed with a different aspect ratio. Value type: (none| xMinYMin| xMidYMin| xMaxYMin| xMinYMid| xMidYMid| xMaxYMid| xMinYMax| xMidYMax| xMaxYMax) (meet|slice)? ; Default value: xMidYMid meet; Animatable: yes version Deprecated since SVG 2 Which version of SVG is used for the inner content of the element. Value type: <number> ; Default value: none; Animatable: no viewBox The SVG view
port coordinates for the current SVG fragment. Value type: <list-of-numbers> ; Default value: none; Animatable: yes width The displayed width of the rectangular view
port. (Not the width of its coordinate system.) Value type: <length>|<percentage> ; Default value: auto; Animatable: yes x The displayed x coordinate of the svg container. No effect on outermost svg elements. Value type: <length>|<p...
SVG and CSS - SVG: Scalable Vector Graphics
--segment-fill-fill: azure; --segment-fill-stroke: lightsteelblue; --segment-fill-stroke-width: 1; --segment-edge-fill: none; --segment-edge-stroke: deepskyblue; --segment-edge-stroke-width: 3; --segment-fill-fill-hover: plum; --segment-fill-stroke-hover: none; --segment-edge-stroke-hover: slateblue; } /* Non-standard way of styling elements referenced via <use> elements, sup
ported by some older browsers */ #outer-petals .segment-fill { fill: azure; stroke: lightsteelblue; stroke-width: 1; } #outer-petals .segment-edge { fill: none; stroke: deepskyblue; stroke-width: 3; } #outer-petals .segment:hover > .segment-fill { fill: plum; stroke: none; } #outer-petals .segment:hover > .segment-edge { stroke: slateblue; } /* inner petals */ #inner-petals { -...
...s { --segment-fill-fill: yellow; --segment-fill-stroke: yellow; --segment-fill-stroke-width: 1; --segment-edge-fill: none; --segment-edge-stroke: yellowgreen; --segment-edge-stroke-width: 9; --segment-fill-fill-hover: darkseagreen; --segment-fill-stroke-hover: none; --segment-edge-stroke-hover: green; } /* Non-standard way of styling elements referenced via <use> elements, sup
ported by some older browsers */ #inner-petals .segment-fill { fill: yellow; stroke: yellow; stroke-width: 1; } #inner-petals .segment-edge { fill: none; stroke: yellowgreen; stroke-width: 9; } #inner-petals .segment:hover > .segment-fill { fill: darkseagreen; stroke: none; } #inner-petals .segment:hover > .segment-edge { stroke: green; } Open the document in your SVG-enabled br...
...heet so that the inner petals all turn pink when the mouse pointer is over any one of them, without changing the way the outer petals work. See a solution to this challenge. Simplified structure The SVG structure shown above could be written much more concise by referencing the individual parts of the flower via <use> elements. This behavior is standardized, though only a few browsers sup
port the :hover pseudo-class and other more complex CSS selectors on elements referenced via <use> elements, at the moment. There is some discussion about what rules apply to such referenced elements. See below how the structure then looks like. <svg width="600px" height="600px" viewBox="-300 -300 600 600" xmlns="http://www.w3.org/2000/svg"> <title>SVG demonstration</title> <desc>Mozilla CS...
Mixed content - Web security
assive content, the threat is lower (the page may contain misleading content, or the user's cookies may be stolen). In the case of active content, the threat can lead to phishing, sensitive data disclosure, redirection to malicious sites, etc. Mixed passive/display content Mixed passive/display content is content served over HTTP that is included in an HTTPS webpage, but that cannot alter other
portions of the webpage. For example, an attacker could replace an image served over HTTP with an inappropriate image or message to the user. The attacker could also infer information about the user's activities by watching which images are served to the user; often images are only served on a specific page within a website. If the attacker observes HTTP requests to certain images, they could determin...
...for example). The risk involved with mixed content does depend on the type of website the user is visiting and how sensitive the data exposed to that site may be. The webpage may have public data visible to the world or private data visible only when authenticated. If the webpage is public and has no sensitive data about the user, using mixed active content still provides the attacker with the op
portunity to redirect the user to other HTTP pages and steal HTTP cookies from those sites. Active content examples This section lists some types of HTTP requests which are considered active content: <script> (src attribute) <link> (href attribute) (this includes CSS stylesheets) <iframe> (src attribute) XMLHttpRequest requests fetch() requests All cases in CSS where a <url> value is used (@...
...hrome. Warnings in Web Console The Firefox Web Console displays a mixed content warning message in the Net pane when a page on your website has this issue. The mixed content resource that was loaded via HTTP will show up in red, along with the text "mixed content", which links to this page. As well as finding these warnings in the Web Console, you could use Content Security Policy (CSP) to re
port issues. You could also use an online crawler like SSL-check or Missing Padlock that will check your website recursively and find links to insecure content. Starting in Firefox 23, mixed active content is blocked by default (and mixed display content can be blocked by setting a preference). To make it easier for web developers to find mixed content errors, all blocked mixed content requests are l...
Web security
om attacks and data theft. Content security Content security policy (CSP) Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross-Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft to site defacement to the distribution of malware. Connection security Trans
port security layer (TLS) The Trans
port Layer Security (TLS) protocol is the standard for enabling two networked applications or devices to exchange information privately and robustly. Applications that use TLS can choose their security parameters, which can have a substantial impact on the security and reliability of data. This article provides an overview of TLS and the kinds of decisions you need ...
...LS and the kinds of decisions you need to make when securing your content. HTTPS HTTPS (HyperText Transfer Protocol Secure) is an encrypted version of the HTTP protocol. It uses SSL or TLS to encrypt all communication between a client and a server. This secure connection allows clients to be sure that they are connected with the intended server, and to exchange sensitive data. HTTP Strict-Trans
port-Security The Strict-Trans
port-Security: HTTP header lets a website specify that it may only be accessed using HTTPS. Certificate Transparency Certificate Transparency is an open framework designed to protect against and monitor for certificate misissuances. Newly issued certificates are 'logged' to publicly run, often independent CT logs which maintain an append-only, cryptographically assured...
...oss-site scripting Cryptanalysis Cryptographic hash function Cryptography CSP CSRF Decryption Digital certificate DTLS Encryption Forbidden header name Forbidden response header name Hash HMAC HPKP HSTS HTTPS Key MitM OWASP Preflight request Public-key cryptography Re
porting directive Robots.txt Same-origin policy Session hijacking SQL injection Symmetric-key cryptography TOFU TLS ...
Functions - XPath
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The following is an annotated list of core XPath functions and XSLT-specific additions to XPath, including a description, syntax, a list of arguments, result-type, source in the appropriate W3C Recommendation, and degree of present Gecko sup
port. For further information on using XPath/XSLT functions, please see the For Further Reading page. ...
...endation, and degree of present Gecko sup
port. For further information on using XPath/XSLT functions, please see the For Further Reading page. ...
...ailable() generate-id() XSLT-specific id() (partially sup
ported) key() XSLT-specific lang() last() local-name() name() namespace-uri() normalize-space() not() number() position() round() starts-with() string() string-length() substring() substring-after() substring-before() sum() system-property() XSLT-specific translate() true() unparsed-entity-url() XSLT-specific (not sup
ported) ...
Converting WebAssembly text format to wasm - WebAssembly
t works, and how to use available tools to convert text format files to the .wasm assembly format. Note: Text format files are usually saved with a .wat extension. Historically, a .wast extension was also used, however that's now used for the scripting language used by the WebAssembly testsuite. A first look at the text format Let's look at a simple example of this -- the following program im
ports a function called im
ported_func from a module called im
ports, and ex
ports a function called ex
ported_func: (module (func $i (im
port "im
ports" "im
ported_func") (param i32)) (func (ex
port "ex
ported_func") i32.const 42 call $i ) ) The WebAssembly function ex
ported_func is ex
ported for use in our environment (e.g. the web app in which we are using our WebAssembly module). When it is ...
... Converting the text .wat into a binary .wasm file Let's have a go at converting the above .wat text representation example into .wasm assembly format. To start with, make a copy of the above listing inside a text file; call it simple.wat. ...
... Converting the text .wat into a binary .wasm file Let's have a go at converting the above .wat text representation example into .wasm assembly format. To start with, make a copy of the above listing inside a text file; call it simple.wat. ...
Communicating With Other Scripts - Archive of obsolete content
Content Scripts Content scripts loaded into the same document at the same time using the same method can interact with each other directly as well as with the web content itself. However, content scripts which have been loaded into different documents cannot interact directly with each other...
... other content scripts loaded by your add-on page scripts (that is, scripts embedded in the web page or included using <script> tags) main.js Your content scripts can communicate with your add-on's "main.js" (or any other modules you're written for your add-on) by sending it messages, using either the
port.emit() API or the postMessage() API. See the articles on using postMessage() and using
port for details. Content Scripts Content scripts loaded into the same document at the same time using the same method can interact with each other directly as well as with the web content itself. However, content scripts which have been loaded into different documents cannot interact directly with each other. Content scripts that have been loaded into the same document by different methods, or the...
Cross-domain Content Scripts - Archive of obsolete content
script "panel-script.js" to it sends the panel a "show" message when it is shown adds a button which shows the panel when it is clicked // main.js var data = require("sdk/self").data; var forecast_panel = require("sdk/panel").Panel({ height: 50, contentURL: data.url("panel.html"), contentScriptFile: data.url("panel-script.js") }); forecast_panel.on("show", function(){ forecast_panel.
port.emit("show"); }); require("sdk/ui/button/action").ActionButton({ id: "get-forecast", label: "Get the forecast", icon: "./icon-16.png", onClick: function() { forecast_panel.show(); } }); The "panel.html" just includes a <div> block for the forecast: <!DOCTYPE html> <!-- panel.html --> <html> <head></head> <body> <div id="forecast_summary"></div> </body> </html> The "...
...e "panel.html" just includes a <div> block for the forecast: <!DOCTYPE html> <!-- panel.html --> <html> <head></head> <body> <div id="forecast_summary"></div> </body> </html> The "panel-script.js" uses XMLHttpRequest to fetch the latest forecast: // panel-script.js var url = "http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/json/500?key=YOUR-API-KEY"; self.
port.on("show", function () { var request = new XMLHttpRequest(); request.open("GET", url, true); request.onload = function () { var jsonResponse = JSON.parse(request.responseText); var summary = getSummary(jsonResponse); var element = document.getElementById("forecast_summary"); element.textContent = summary; }; request.send(); }); function getSummary(forecast) { return f...
Reddit Example - Archive of obsolete content
Finally, it registers a listener to the user-defined click event which in turn passes the URL into the open function of the tabs module. This is the panel.js content sc...
...A") return; // Don't intercept the click if it was on one of the links in the header // or next/previous footer, since those links should load in the panel itself. if ($(t).parents('#header').length || $(t).parents('.nextprev').length) return; // Intercept the click, passing it to the addon, which will load it in a tab. event.stopPropagation(); event.preventDefault(); self.
port.emit('click', t.toString()); }); This script uses jQuery to interact with the DOM of the page and the self.
port.emit function to pass URLs back to the add-on script. To run this example you'll also have to have an icon file named "icon-16.png" saved in your add-on's "data" directory. You could download this icon: . ...
self - Archive of obsolete content
Note that the self object in content scripts is completely different from the self module, which provides an API for an add-on to access its data files and ID. self Properties options Content-scripting APIs such as tab.attach(), page-mod, and page-worker let you pass read-only data to the content script as a JSON object via the contentScriptOptions option. ...
...tions option. If you do this, the data is available to the content script in the options property of self: // main.js const tabs = require("sdk/tabs"); tabs.open({ url: "./page.html", onReady: function(tab) { tab.attach({ contentScriptFile: "./content-script.js", contentScriptOptions: { a: "blah" } }); } }); // content-script.js alert(self.options.a);
port You can use
port to receive messages from, and send messages to, the main add-on code. See the documentation for
port. Methods The self object has four methods, which enable the content script to send messages to, and receive messages from, the main add-on code. This is an older API than the API provided by
port, and for most purposes the
port API is a better choice. The exception is the con...
Classes and Inheritance - Archive of obsolete content
re initialized to a given value when the class is instantiated. Data members are properties that allow each instance to have their own state, whereas member functions are properties that allow instances to have behavior. Inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. Unlike languages like C++ and Java, JavaScript does not have native sup
port for classical inheritance. Instead, it uses something called prototypal inheritance. As it turns out, it is possible to emulate classical inheritance using prototypal inheritance, but not without writing a significant amount of boilerplate code. Classes in JavaScript are defined using constructor functions. Each constructor function has an associated object, known as its prototype, which is shar...
... function () { throw Error("not yet implemented"); } let shape = Shape(2, 3); Shape.draw(); // => Error: not yet implemented Inheritance and Constructors Suppose we want to create a new class, Circle, and inherit it from Shape. Since every Circle is also a Shape, the constructor for Shape must be called every time we call the constructor for Circle. Since JavaScript does not have native sup
port for inheritance, it doesn't do this automatically. Instead, we need to call the constructor for Shape explicitly. The resulting constructor looks as follows: function Circle(x, y, radius) { if (!this) return new Circle(x, y, radius); Shape.call(this, x, y); this.radius = radius; } Note that the constructor for Shape is called as an ordinary function, and reuses the object creat...
Private Properties - Archive of obsolete content
A private property is a property that is only accessible to member functions of instances of the same class. Unlike other languages, JavaScript does not have native sup
port for private properties. People have come up with several ways to emulate private properties using existing language features. This article discusses two common techniques: one using prefixes, the other closures. Both approaches have drawbacks, they are either not restrictive enough or too restrictive, respectively. A better alternative is to use WeakMap objects, which solve both these problems. However, note that WeakMaps might not be sup
ported by all implementations yet. Also shown here is how to generalize the idea of using WeakMaps, from associating one or more private properties with an object, to associating one or m...
...ept members of Point, effectively implements private properties. Moreover, because members of Point have a reference to the internal namespace, they can access private properties on other instances of Point. Namespaces in the Add-on SDK The Add-on SDK is built on top of XPCOM, the interface between JavaScript and C++ code. Since XPCOM allows the user to do virtually anything, security is very im
portant. Among other things, add-ons should not be able to access variables that are supposed to be private. The SDK uses namespaces internally to ensure this. As always with code that is heavily reused, the SDK defines a helper function to create namespaces. It's defined in the module "core/namespace", and it's use is straightforward. To illustrate this, the following reimplements the class Point usi...
Contributor's Guide - Archive of obsolete content
re initialized to a given value when the class is instantiated. Data members are properties that allow each instance to have their own state, whereas member functions are properties that allow instances to have behavior. Inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. Unlike languages like C++ and Java, JavaScript does not have native sup
port for classical inheritance. Instead, it uses something called prototypal inheritance. As it turns out, it is possible to emulate classical inheritance using prototypal inheritance, but not without writing a significant amount of boilerplate code. Content Processes A content process was supposed to run all the code associated with a single tab. Conversely, an add-on process was supposed to run al...
... Getting Started Learn how to contribute to the Add-on SDK. Modules A module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface. The use of modules greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them. Unfortunately, JavaScript does not yet have native sup
port for modules: it has to rely on the host application to provide it with functionality such as loading subscripts, and ex
porting/ im
porting names. We will show how to do each of these things using the built-in Components object provided by Xulrunner application such as Firefox and Thunderbird. Private Properties People have come up with several ways to emulate private properties using existing la...
Two Types of Scripts - Archive of obsolete content
. Add-on Code This is the place where the main logic of your add-on is implemented. Your add-on is implemented as a collection of one or more CommonJS modules. Each module is supplied as a script stored under the lib directory under your add-on's root directory. Minimally you'll have a single module implemented by a script called "main.js", but you can include additional modules in lib, and im
port them using the require() function. To learn how to implement and im
port your own modules, see the tutorial on Implementing Reusable Modules. Content Scripts While your add-on will always have a "main.js" module, you will only need to write content scripts if your add-on needs to manipulate web content. Content scripts are injected into web pages using APIs defined by some of the SDK's modules s...
...d the Working with Content Scripts guide. API Access for Add-on Code and Content Scripts The table below summarizes the APIs that are available to each type of script. API Add-on code Content script The global objects defined in the core JavaScript language, such as Math, Array, and JSON. See the reference at MDN. ? ? The require() and ex
ports globals defined by version 1.0 of the CommonJS Module Specification. You use require() to im
port functionality from another module, and ex
ports to ex
port functionality from your module. If require() is available, then so are the modules supplied in the SDK. ? ? The console global supplied by the SDK. ? ? Globals defined by the HTML5 specification, such as window...
Guides - Archive of obsolete content
t the built-in SDK module loader, known as Cuddlefish. Classes and Inheritance Learn how classes and inheritance can be implemented in JavaScript, using constructors and prototypes, and about the helper functions provided by the SDK to simplify this. Private Properties Learn how private properties can be implemented in JavaScript using prefixes, closures, and WeakMaps, and how the SDK sup
ports private properties by using namespaces (which are a generalization of WeakMaps). Content Processes The SDK was designed to work in an environment where the code to manipulate web content runs in a different process from the main add-on code. This article highlights the main features of that design. Testing the Add-on SDK Learn how to run the Add-on SDK test suites. SDK infrastructure ...
...K's event emitting framework. Content scripts guide An overview of content scripts, including: what they are, what they can do, how to load them, how to communicate with them. Two Types of Scripts This article explains the differences between the APIs available to your main add-on code and those available to content scripts. XUL migration XUL Migration Guide Techniques to help
port a XUL add-on to the SDK. XUL versus the SDK A comparison of the strengths and weaknesses of the SDK, compared to traditional XUL-based add-ons.
Porting Example A walkthrough of
porting a relatively simple XUL-based add-on to the SDK. ...
clipboard - Archive of obsolete content
Examples Set and get the contents of the clipboard. var clipboard = require("sdk/clipboard"); clipboard.set("Lorem ipsum dolor sit amet"); var contents = clipboard.get(); Set the clipboard contents to some HTML. ...
... Examples Set and get the contents of the clipboard. var clipboard = require("sdk/clipboard"); clipboard.set("Lorem ipsum dolor sit amet"); var contents = clipboard.get(); Set the clipboard contents to some HTML. ...
context-menu - Archive of obsolete content
abs, since tabs aren't related to the page or the node the user clicked to open the menu. The page context First of all, you may not need to specify a context at all. When a top-level item does not specify a context, the page context applies. An item that is in a submenu is visible unless you specify a context. The page context occurs when the user invokes the context menu on a non-interactive
portion of the page. Try right-clicking a blank spot in this page, or on text. Make sure that no text is selected. The menu that appears should contain the items "Back", "Forward", "Reload", "Stop", and so on. This is the page context. The page context is appropriate when your item acts on the page as a whole. It does not occur when the user invokes the context menu on a link, image, or other non-tex...
...ction API. var selection = require("sdk/selection"); and within the contentScript, reference the selected text as selection.text Private windows If your add-on has not opted into private browsing, then any menus or menu items that you add will not appear in context menus belonging to private browser windows. To learn more about private windows, how to opt into private browsing, and how to sup
port private browsing, refer to the documentation for the private-browsing module. More examples For conciseness, these examples create their content scripts as strings and use the contentScript property. In your own add-on, you will probably want to create your content scripts in separate files and pass their URLs using the contentScriptFile property. See Working with Content Scripts for more infor...
l10n - Archive of obsolete content
ring A identifier for the localization of a particular string in the current locale. count : integer Optional parameter. If you're supplying different localizations for a string for singular or plural forms, this parameter is the number of items there are in this case. var _ = require("sdk/l10n").get; console.log(_("child_id", 1)); console.log(_("child_id", 2)); See the tutorial on plural sup
port for more information. Note that if you use this parameter, you can't supply any placeholders. placeholder1...n : string Optional parameters. If you do not include the count parameter, you can supply one or more placeholder strings that are to be inserted into the translated string at locations defined by the translator. If you supply multiple placeholders, each one is a separate string parame...
... Optional parameters. If you do not include the count parameter, you can supply one or more placeholder strings that are to be inserted into the translated string at locations defined by the translator. If you supply multiple placeholders, each one is a separate string parameter. var _ = require("sdk/l10n").get; console.log(_("home_town", "Alan", "Norwich")); See the tutorial on placeholder sup
port for more information. Returns string : The localized string referenced by the identifier parameter passed in, or the identifier itself if no referent for the identifier can be found. ...
notifications - Archive of obsolete content
Here's a typical example. When the message is clicked, a string is logged to the console. var notifications = require("sdk/notifications"); notifications.notify({ title: "Jabberwocky", text: "'Twas brillig, and the slithy toves", data: "did gyre and gimble in the wabe", onClick: function (data) { console.log(data); // console.log(this.data) would produce the same result. } }); This one displays an icon that's stored in the add-on's data directory. ...
... From Firefox 34, you can use "./myIcon.png" as an alias for self.data.url("myIcon.png"). So you can rewrite the above code like this: var notifications = require("sdk/notifications"); var myIconURL = "./myIcon.png"; notifications.notify({ text: "I have an icon!", iconURL: myIconURL }); This module depends on the underlying system's notification service. If the user's system does not sup
port desktop notifications or if its notifications service is not running: if Firefox was started normally, notifications are logged to Firefox's error console if the user launched Firefox from the command line, notifications are logged to the terminal. Globals Functions notify(options) Displays a transient notification to the user. Parameters options : object Optional options: N...
simple-prefs - Archive of obsolete content
s code will still be able to access and modify it, just like any other preference you define. Type-Specific Attributes These are settings that are only applicable to certain preference types. They are documented along with the preference types themselves. Preference Types The setting types map to the inline settings types used by the Add-on Manager. All the inline preferences are sup
ported. Type Description Example Specification bool Displayed as a checkbox and stores a boolean. { "description": "Does it have tentacles?", "type": "bool", "name": "hasTentacles", "value": true, "title": "Tentacles" } boolint Displayed as a checkbox and stores an integer. A boolint is presented to the user as a checkbo...
...e('sdk/self').id, 'somePreference'].join('.')) This would give you the same value as: require('sdk/simple-prefs').prefs['somePreference'] The ability to change the default preferences branch is new in Add-on SDK 1.15. The branch of the preferences tree under which simple-prefs are stored is, by default, the add-on ID. Sometimes you might need to use a different branch, especially if you are
porting an add-on to the SDK. You can change the sub-branch of extensions using the preferences-branch key in your add-on's package.json file. Globals Functions on(prefName, listener) Registers an event listener that will be called when a preference is changed. The event listener may take an optional parameter that specifies the name of the property which changed. Preference change events are t...
ui - Archive of obsolete content
This page just provides a quick overview. ActionButton An action button is a button in the main Firefox toolbar. ...
...r at the top right of the browser window: ToggleButton A toggle button is a special kind of button that's for representing a binary on/off state, like a checkbox. So they have a checked property which is toggled when the user clicks the button, and the icon gets a "pressed" look when the button is checked. It's otherwise identical to the action button. Attaching panels to buttons is only sup
ported from Firefox 30 onwards. From Firefox 30 onwards, you can attach panels to toggle buttons, by passing the button into the panel's constructor or its show() method: Frame A frame enables you to create an HTML iframe, using bundled HTML, CSS and JavaScript. This can then be added to a designated area of the Firefox user interface. At the moment you can only add frames to a toolbar. You ini...
core/namespace - Archive of obsolete content
ecret; One namespace may be used with multiple objects: let { ns } = require('sdk/core/namespace'); let dom = ns(); function View(element) { let view = Object.create(View.prototype); dom(view).element = element; // .... } View.prototype.destroy = function destroy() { let { element } = dom(this); element.parentNode.removeChild(element); // ... }; // ... ex
ports.View = View; // ... Also, multiple namespaces can be used with one object: // ./widget.js let { Cu } = require('chrome'); let { ns } = require('sdk/core/namespace'); let { View } = require('./view'); // Note this is completely independent from View's internal Namespace object. let sandboxes = ns(); function Widget(options) { let { element, contentScript } = options; ...
...ltView); // ... } Widget.prototype = Object.create(View.prototype); Widget.prototype.postMessage = function postMessage(message) { let { sandbox } = sandboxes(this); sandbox.postMessage(JSON.stringify(JSON.parse(message))); ... }; Widget.prototype.destroy = function destroy() { View.prototype.destroy.call(this); // ... delete sandboxes(this).sandbox; }; ex
ports.Widget = Widget; In addition access to the namespace can be shared with other code by just handing them a namespace accessor function. let { dom } = require('./view'); Widget.prototype.setInnerHTML = function setInnerHTML(html) { dom(this).element.innerHTML = String(html); }; ...
loader/sandbox - Archive of obsolete content
XPCOM components. Optionally the sandbox function can be passed a second argument (See sandbox documentation on MDN for details). Evaluate code Module provides evaluate function that lets you execute code in the given sandbox: evaluate(scope, 'var a = 5;'); evaluate(scope, 'a + 2;'); //=> 7 More details about evaluated script may be passed via optional arguments that may improve exception re
porting: // Evaluate code as if it was loaded from 'http://foo.com/bar.js' and // start from 2nd line. evaluate(scope, 'a ++', 'http://foo.com/bar.js', 2); Version of JavaScript can be also specified via an optional argument: evaluate(scope, 'let b = 2;', 'bar.js', 1, '1.5'); // throws cause `let` is not defined in JS 1.5. Load scripts This module provides a limited API for loading scripts from l...
...it was loaded from 'http://foo.com/bar.js' and // start from 2nd line. evaluate(scope, 'a ++', 'http://foo.com/bar.js', 2); Version of JavaScript can be also specified via an optional argument: evaluate(scope, 'let b = 2;', 'bar.js', 1, '1.5'); // throws cause `let` is not defined in JS 1.5. Load scripts This module provides a limited API for loading scripts from local URLs. data: URLs are sup
ported. load(scope, 'resource://path/to/my/script.js'); load(scope, 'file:///path/to/script.js'); load(scope, 'data:,var a = 5;'); Globals Functions sandbox(source) Make a new sandbox that inherits principals from source. Parameters source : string|window|null An object that determines the privileges that will be given to the sandbox. This argument can be: a URI string, giving the sandbox t...
places/bookmarks - Archive of obsolete content
save() and search() are both asynchronous functions: they synchronously return a PlacesEmitter object, which then asynchronously emits events as the operation progresses and completes. Each retrieved bookmark item represents only a snapshot of state at a specific time. ...
...ookmark group within its group. updated A Unix timestamp indicating when the bookmark was last updated on the platform. Separator Properties group The group instance that the bookmark group lives under. index The index of the bookmark group within its group. updated A Unix timestamp indicating when the bookmark was last updated on the platform. PlacesEmitter The PlacesEmitter is not ex
ported from the module, but returned from the save and search functions. The PlacesEmitter inherits from event/target, and emits data, error, and end. data events are emitted for every individual operation (such as: each item saved, or each item found by a search query), whereas end events are emitted as the aggregate of an operation, passing an array of objects into the handler. Events data The d...
Chrome Authority - Archive of obsolete content
equire statements, with a single static string, one per line of code. If the scanner fails to see a require entry, the manifest will not include that entry, and (once the implementation is complete) the runtime code will get an exception. ...
... var one = require("one"); var two = require("two"); The intention is that developers use require() statements for two purposes: to declare (to security reviewers) what sorts of powers the module wants to use, and to control how those powers are mapped into the module's local namespace. Their statements must therefore be clear and easy to parse. A future manifest format may move the declaration
portion out to a separate file, to allow for more fine-grained expression of authority. Commands that build a manifest, like "jpm xpi" or "jpm run", will scan all included modules for use of Cc/Ci aliases (or the expanded Components.classes forms). It will emit a warning if it sees the expanded forms, or if it sees a use of e.g. "Cc" without a corresponding entry in the require("chrome") statement. T...
Add-on SDK - Archive of obsolete content
Create user interface components Create user interface components such as toolbar buttons, context menus, menu items, and dialogs. Modify web pages Modify pages matching a URL pattern or dynamically modify a particular tab. Putting it together Walkthrough of the Annotator example add-on. Guides Contributor's guide Learn how to start contributing to the SDK and about the most im
portant idioms used in the SDK code such as modules, classes and inheritance, private properties, and content processes. SDK infrastructure Aspects of the SDK's underlying technology: modules, the Program ID and the rules defining Firefox compatibility. Content scripts A detailed guide to working with content scripts. SDK idioms The SDK's event framework and the distinction between add-on s...
...s and inheritance, private properties, and content processes. SDK infrastructure Aspects of the SDK's underlying technology: modules, the Program ID and the rules defining Firefox compatibility. Content scripts A detailed guide to working with content scripts. SDK idioms The SDK's event framework and the distinction between add-on scripts and content scripts. XUL migration A guide to
porting XUL add-ons to the SDK. This guide includes a comparison of the two toolsets and a working example of
porting a XUL add-on. Reference High-Level APIs Reference documentation for the high-level SDK APIs. Tools reference Reference documentation for the jpm tool used to develop, test and package add-ons, the console global used for logging, and the package.json file. Low-Level ...
Forms related code snippets - Archive of obsolete content
r: pointer; } td.zdp-empty-cell { cursor: not-allowed; } </style> </head> <body> <form name="myform"> <p> From: <input type="text" readonly class="date-picker" name="date-from" /> To: <input type="text" readonly class="date-picker" name="date-to" /> </p> </form> </body> </html> Note: The current implementation of const (constant statement) is not part of ECMAScript 5. It is sup
ported in Firefox & Chrome (V8) and partially sup
ported in Opera 9+ and Safari. It is not sup
ported in Internet Explorer 6-9, or in the preview of Internet Explorer 10. const is going to be defined by ECMAScript 6, but with different semantics. Similar to variables declared with the let statement, constants declared with const will be block-scoped. We used it only for didactic purpose. If you want a f...
...typing. Insert some custom text in a <textarea> This example shows how to insert some HTML tags or smiles or any custom text in a textarea. Image preview before upload The FileReader.prototype.readAsDataURL() method can be useful, for example, to get a preview of an image before uploading it.[article] This example shows how to use it in this way. Note: The FileReader() constructor was not sup
ported by Internet Explorer for versions before 10. For a full compatibility code you can see our crossbrowser possible solution for image preview. Filter the digitation into a form field This example shows the use of the onkeypress event during a digitation into a form field in order to match some rules. ...
IsDefaultNamespace - Archive of obsolete content
This function is not necessary for Gecko-based browsers (though the function will quickly return the standard value for Mozilla browsers). ...
...This function is not necessary for Gecko-based browsers (though the function will quickly return the standard value for Mozilla browsers). ...
LookupPrefix - Archive of obsolete content
This function is not necessary for Gecko-based browsers when used in XHTML. ...
...alElement.prefix) === namespaceURI) { return originalElement.prefix; } if (originalElement.attributes && originalElement.attributes.length) { for (var i=0; i < originalElement.attributes.length; i++) { var att = originalElement.attributes[i]; xmlnsPattern.lastIndex = 0; var localName = att.localName || att.name.substr(att.name.indexOf(':')+1); // latter test for IE which doesn't sup
port localName if (localName.indexOf(':') !== -1) { // For Firefox when in HTML mode localName = localName.substr(att.name.indexOf(':')+1); } if ( xmlnsPattern.test(att.name) && att.value === namespaceURI && lookupNamespaceURI(originalElement, localName) === namespaceURI ) { return localName; } } } if (originalElement.parentNode) { // EntityReferences may have ...
Progress Listeners - Archive of obsolete content
istener for all tabs, selected and not: Listening to events on all tabs. ...
...() { gBrowser.removeProgressListener(this); }, processNewURL: function(aURI) { if (aURI.spec == this.oldURL) return; // now we know the url is new... ...
View Source for XUL Applications - Archive of obsolete content
Method overview gViewSourceUtils exposes several methods, but the only one you should be using directly is the viewSource method. The rest of those methods should be considered private, and might become inaccessible in the future. void viewSource(aObject); Methods viewSource Opens a viewer to the source code for some document or URI. ...
... Method overview gViewSourceUtils exposes several methods, but the only one you should be using directly is the viewSource method. The rest of those methods should be considered private, and might become inaccessible in the future. void viewSource(aObject); Methods viewSource Opens a viewer to the source code for some document or URI. ...
Custom about: URLs - Archive of obsolete content
his page describes how to register a new about: URL for your extension. Setup for Firefox 4+ This is a simple example of a custom about page for bootstrapped addons. This example creates an about page with url about:myaboutpage which takes a user to a page that writes some text out. Make sure to generate a unique aboutPage_id, see this page to learn more about generating UUID's: UUID. It is im
ported to QueryInterface the Components.manager otherwise this will not work. This example can be easily modified, just modify the global const at in the // globals section. In Bug 1254752 things changed for Firefox 48 and up. Services.io.newChannel was deprecated, and the signature of the newChannel method changed. This change is reflected in the code below. This code will work for all versions o...
...ngs changed for Firefox 48 and up. Services.io.newChannel was deprecated, and the signature of the newChannel method changed. This change is reflected in the code below. This code will work for all versions of Firefox 4 and up. ...
Displaying web content in an extension without security issues - Archive of obsolete content
nt/template.html", false); request.send(null); frame.setAttribute("src", "data:text/html," + encodeURIComponent(request.responseText)); That way you can have the template in your extension but still strip it off all privileges when it is loaded in a frame. Restricting what documents that contain untrusted data can do There are several restrictions that can be applied per frame. Here it is most im
portant to disable JavaScript and plugins. It won't harm disabling everything else as well unless it is really required: frame.docShell.allowAuth = false; frame.docShell.allowImages = false; frame.docShell.allowJavascript = false; frame.docShell.allowMetaRedirects = false; frame.docShell.allowPlugins = false; frame.docShell.allowSubframes = false; But what about interactivity, for example if you want...
...cloneNode() always creates a copy and textContent only manipulates text. So there is no chance of accidentally adding new elements or attributes. But what if you have to display HTML rather than only text, e.g. an RSS feed entry? Extension authors will often come up with flawed attempts to sanitize HTML...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
ownloads), and a toString function which will allow this code to work with versions of Firefox 0.8 and earlier. You could also use the old style parameter block ({ "Foo": aEvent.target.href }) if you wanted - and didn't have an Icon to use for the confirmation dialog. InstallTrigger.install is then called to install the item with the parameter block. return false; This last part is the most im
portant - the install function must return false so that when the link is clicked, only the script is run, and the link href is not navigated to. If you omit this step, the user may see two installation dialogs--since you've effectively invoked two install requests, one from the InstallTrigger, one from trying to load the XPI file directly. Available Parameters for the install object The InstallTrig...
...everal properties on that object used to affect the install. URL The URL property specifies the URL of the XPI to install. This property is required. IconURL The IconURL property specifies an icon to be displayed in the installation dialog. This property is optional. If you do not specify an icon, the default icon will be used, usually a green puzzle piece. The icon can be any image format sup
ported by Firefox, and should be 32x32 pixels in size. Hash The Hash property specifies a cryptographic hash of the XPI file contents. This is used to verify the downloaded file, to protect against a corrupted file being served by a mirror download server, for example. You can use any hash function sup
ported by nsICryptoHash. The hash is specified as hash function:hash value, for example, sha1:28857...
Migrating raw components to add-ons - Archive of obsolete content
these components don't have a mechanism for specifying the versions of Firefox with which they are compatible, leading to poor integration and instability as users upgrade their Firefox installations. The Firefox extension mechanism allows you to do everything that you could do through direct component drops, but also gives you and your users extra flexibility and more sophisticated versioning sup
port. As we roll this new behavior out, this document will be updated with additional information addressing scenarios we see developers encountering. Simple migration If your goal is just to get your raw component working properly as an extension, you can do this in three steps: Create a new add-on using the instructions here. As you'll see, add-ons give you much more flexibility than simply loading...
...ons in an automated, programmatic way, we have documented a set of best practices. JavaScript C-Types Some add-on authors create binary components not because they want to interact with Firefox at the C++ level, but strictly so that they can make use of third party DLLs. If this is the only reason you are using a binary component instead of JavaScript, take a look at the new JavaScript C-Types sup
port introduced in Firefox 3.6. It allows JavaScript code to load functions from DLLs on windows, and should allow you to eliminate your dependence on binary components entirely. This leads to a better compatibility path as new versions of Firefox are released. ...
Chapter 1: Introduction to Extensions - Archive of obsolete content
Opera or Safari. What features are considered standard for web browsers these days? Perhaps things like fine-grained tab controls, mouse gestures, extensive toolbars and buttons, a feed reader, integration with a variety of web applications, or sophisticated tools to assist with web design. But we didn't set out to create an all-in-one browser that can satisfy everyone. Instead, Firefox can sup
port these features through extensions. The core browser is limited to basic features, so it's something that a beginner can be comfortable with, but users who want something beyond that can install extensions. About extensions Management using the Add-ons Manager Firefox's Add-ons Manager is an excellent way to manage extensions, and is a great step up in ease of use. The Add-ons Manager handle...
...Add-ons Manager handles the following tasks: Safely installs and uninstalls add-ons Makes sure add-ons are compatible with the version of Firefox you're using Manages a whitelist of sites trusted for installing add-ons Helps troubleshoot add-ons by disabling them and offering a safe mode Confirms and runs updates Provides access to add-ons' settings dialogs Provides access to add-ons' sup
port sites Development environment amenities Initially, there wasn't adequate documentation available, and extension developers were largely left to fend for themselves1; however, now there's a considerable store of knowledge. Because Firefox and its extensions are designed to sup
port multiple languages, excellent extensions come from all over the world, and can be quickly localized by anyone inte...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
at means only one instance in memory. For instance, this is the case for the bookmarks component, which is actually a service. It lets you access and manipulate the user's bookmarks. Those should be accessed with getService(). For other components, you can create as many instances as you need. For instance, this is the case for files (nsILocalFile). Those are created with createInstance(). It's im
portant to know whether a component should be created with getService() or createInstance(), because using one instead of the other can cause problems. Listing 1: Calling XPCOM functions using XPConnect <?xml version="1.0" encoding="UTF-8"?> <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript"><![CDATA[ var ioService = Components.cla...
...depending on your system. On Windows Vista, it will be located at C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\random number.default\ ; On Windows XP or 2000, it will be C:\Documents and Settings\username\Application Data\Mozilla\Firefox\Profiles\random number.default\ ; On Linux, it will be ~/.mozilla/firefox/random number.default/ ; On Mac OS X, it will be ~/Library/Application Sup
port/Firefox/Profiles/random number.default/ In the interests of security, delete these lines from prefs.js after finishing these tests. Note that Firefox itself and its extensions have privileges set by default after installation and registration. Extensions don't need special code like that in Listing 2 in order to get privileges. FIXME: We should advise against using such method FIXME: Figure 1...
Adding windows and dialogs - Archive of obsolete content
entify the window, and the last is an optional comma-separated list of features, which describe the behavior and appearance of the window. If this value is null or empty, the default toolbars of the main window will be added to the new one, which is rarely what you want. The window.open page has a detailed description of the features you can use and their values. The following features are very im
portant and you should always keep them in mind: chrome. This can only be used from the chrome, not from regular HTML JavaScript. It indicates that a chrome document is being opened, not a web page. This means that the document defines the whole window, and not only the inner content area. You should always include it when opening a XUL window or dialog. modal. Modal windows block their parent win...
... User actions can change the state of your windows, such as selecting an option in a listbox, or entering text in a textbox. If the user closes and then reopens your window, all the controls are reset to their defaults, which may not be what you want. You need some way of remembering the user-manipulated attribute values so that the window reloads it last state when opened. Most XUL elements sup
port the persist attribute, which has this exact function. You set the persist attribute with a space-separated list of attribute names, indicating which attribute values must be persisted across window "sessions". <checkbox id="xulschoolhello-some-checkbox" label="&xulschoolhello.someText.label;" checked="false" persist="checked" /> Setting the id attribute of the element is mandatory if yo...
Appendix A: Add-on Performance - Archive of obsolete content
e URL of the page, since most add-ons are limited to one or a few domains. Use regular expressions if you need to. Make sure your comparison code is as efficient as possible. Finally, make sure all of your page load code is as efficient as possible. This can be tricky for some add-ons, like ad or script blockers that need to check a whitelist or blacklist. Nevertheless, loading pages is pretty im
portant in Firefox, and users expect it to be fast. Try your best to keep it that way. Other Recommendations Always clean up after yourself. Event listeners, observers and other handlers normally have both an add and a remove function. Don't forget to remove what you don't need anymore! Even if you need something during the whole existence of the window, you should clean everything up in the unloa...
...mmendations Always clean up after yourself. Event listeners, observers and other handlers normally have both an add and a remove function. Don't forget to remove what you don't need anymore! Even if you need something during the whole existence of the window, you should clean everything up in the unload event handler. Even the unload event should be handled efficiently. Even if it is not as im
portant as other areas, Firefox shutdown can also be slowed down because of add-ons. If there's anything you can unload before shutdown, or if there's anything you can do to unload things more efficiently, then it's im
portant that you do. Never use XMLHttpRequest in synchronous mode. If your add-on needs to perform a heavy operation like sorting or a complex mathematical calculation, you should use ...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
o host your add-on with Mozilla it is crucial to minimize or completely eliminate eval use in order to receive a positive review and have your add-on made public. If it cannot be easily proven that an eval() call is benign and necessary because there are no viable alternatives, a Mozilla Add-ons Gallery reviewer will generally reject the submission! Parsing JSON Mozilla provides native JSON sup
port since Firefox 3. There is simply no need to parse JSON using eval. Additionally, parsing JSON retrieved from a remote location becomes a security vulnerability when parsed with the eval function. Basically, you are executing remote code with full chrome access; that is, introducing a remote code execution vulnerability. Even if you trust the remote server; for example, because it is one you rent ...
...t; setTimeout(function() { alert(response); }, 100); } Alternative: Use Function.bind() Introduced in JavaScript 1.8.5 Function.bind is a new utility function that you may use to (partially) bind parameters to functions. addEventListener("load", myAddon.init.bind(myAddon), true); setTimeout(alert.bind(null, xhr.responseText), 100); Function.bind() returns a new function. This is im
portant to know in particular when you later want to call removeEventListener: You'll have to pass the resulting function from the first .bind() call. Calling .bind() again with removeEventListener will not work. Also, calling .bind() in a tight (inner) loop should be avoided for performance reasons, as calling .bind() does require some work and memory. Overriding/Extending/Amending existing functio...
Custom XUL Elements with XBL - Archive of obsolete content
tion xbl:inherits="value=greeting" /> </xul:vbox> <xul:vbox> <xul:button label="&xulshoolhello.remove.label;" accesskey="&xulshoolhello.remove.accesskey;" oncommand="document.getBindingParent(this).remove(event);" /> </xul:vbox> </xul:hbox> </content> Our element is very simple, displaying an image, a couple of text lines and a button. Here are a couple of im
portant things to notice: The "xul:" namespace must be used for all XUL tags you have in your content. The xbl:inherits attribute lets your inner XUL use the attributes that are set on the node. So, if you have this: <xshelloperson name="Pete" greeting="Good morning" image="" />, then those attribute values are "inherited" to the content nodes that have this special attribute. The value attribute ...
...s and properties. In this case we're calling the remove method, which we will discuss later on. If you need to create a container element, or any other element that has child nodes, you can use the XBL children tag in your content to indicate the place where the child nodes will be inserted. The includes attribute gives you a little more flexibility with children, but it's rarely needed. One im
portant thing to take into account is that you shouldn't use the id attribute in any content nodes. These nodes are part of the XUL DOM just like any other, and having an id attribute is bound to cause problems, given that you could have more than instance of your element in the same document and then multiple inner items with the same id. In order to work around this problem, the anonid attribute is ...
Getting Started with Firefox Extensions - Archive of obsolete content
lick "allow" in the pop-up bubble. You should see another pop-up telling you that you are installing an unverified add-on. Click "install". After the extension is installed, you'll be asked to restart Firefox. Installing, uninstalling, enabling and disabling add-ons require a restart to complete, with the exception of NPAPI plugins, Add-ons SDK extensions and bootstrapped extensions. This is an im
portant point to keep in mind if you're building an extension that manipulates other extensions or themes. After installing, look at the main Firefox window and see if you notice anything different. Did you see it? There's a new menu on the main menu, labeled "Hello World!". If you open the menu and then the menu item below, you'll see a nice alert message (for some definitions of 'nice'). Click ...
...nice alert message (for some definitions of 'nice'). Click on the OK button to close it. That's all the extension does. Now let's take a closer look at it. Extension Contents You may have noticed that the extension file you installed is named xulschoolhello1.xpi. XPI (pronounced "zippy") stands for Cross-Platform Installer, because the same installer file can work on all platforms Firefox sup
ports. XPIs are simply ZIP files, but Firefox recognizes the XPI extension and triggers the installation process when an XPI file is loaded. To look into the XPI file you need to download it first, not install it. If the server triggers an install when clicking on a link or button, what you need to do is right click on the install link, and choose the Save Link As... option. Decompress the XPI file ...
Handling Preferences - Archive of obsolete content
y heart; if doing task X requires some preference, then it's better to look for an explanation on how to do X rather than diving into the preferences list and see if you can find the preference you need. MDC articles and other guides are usually good at specifying the preferences you'll need to use. Adding preferences to an extension Extensions can read and write Firefox preferences and, most im
portantly, create and manage their own. The Preferences System provides a simple, unified storage facility for name / value mappings. When your storage needs are more complicated than this, you'll need more advanced APIs that will be discussed in a section further ahead. To add preferences to your extension you should first create a JS preferences file that describes the preferences and their default...
...mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); // ... get count() { return this._prefService.getIntPref("extensions.xulschoolhello.message.count"); }, increment : function() { let currentCount = this._prefService.getIntPref("extensions.xulschoolhello.message.count"); this._prefService.setIntPref("extensions.xulschoolhello.message.count", currentCount + 1); } One im
portant thing to keep in mind is that the "get" methods of the service can throw an exception if the preference is not found. If you are going to use XPCOM, you should always set a default value to your preferences, or use a try / catch block to prevent unhandled errors. Preference listeners The XPCOM way to add a listener was mentioned in the XPCOM section when describing the QueryInterface method:...
Intercepting Page Loads - Archive of obsolete content
here apply only to content loaded in the main browser area, while others detect content being loaded in other XUL windows, or even detect XUL content being loaded. Also, the different techniques tap into different steps of the load process. Which one you should use solely depends on your needs. We will start with the simplest one, which is also the most common to use. Note: Performance is very im
portant when it comes to add-ons and page loads. Read the recommendations in Appendix A regarding performance if you're planning on implementing any of these. The Easy Way: Load Events This comes from the tabbrowser code snippets page. In a nutshell, from the chrome code in the overlay we add an event listener for the load event. this._loadHandler = function() {that._onPageLoad(); }; gBrowser.addE...
...junction with nsITraceableChannel to get and modify the response text before it gets to the original requester. You won't be able to make DOM modifications like with the load events, since these notifications are triggered before the response arrives and is parsed into DOM tree, so this is not the best approach for the typical Greasemonkey-style extensions. Notes on usage: Efficiency is very im
portant when adding HTTP observers. Remember that your observe method will be called for every HTTP request made by Firefox, usually several dozen per page visit. In the previous example, one of the first things we do is check if the URL is of interest to us, otherwise we let it go. Avoid heavy, time-consuming operations, or the user's browsing experience will become exasperating. . You have to take...
Mozilla Documentation Roadmap - Archive of obsolete content
sive, and its underlying Wiki technology makes it easy to expand and evolve with the help of the community. Having said that, there are a few problems with it. First of all, the in-site search is not reliable, so we recommend using a search engine like Google, with queries such as "MDC Javascript Code Modules" or "Javascript code modules site:developer.mozilla.org". Secondly, there are several im
portant articles that are very lacking in information, like the Preferences System page. And finally, what we mentioned in our XPCOM section: almost no documentation on XPCOM components. The documentation on interfaces is very complete, but it isn't nearly as useful as the documentation that existed at XULPlanet and was later taken down. XULPlanet allowed you to navigate between interfaces and their r...
...mation. Mozilla Blogs Several Mozilla community members maintain blogs that are updated frequently, often including information on API changes, bug fixes, useful tools and future release plans. Many of the tips and tricks included in this tutorial were discovered by reading these blogs. There are several useful feeds that you can follow using a feed reader, such as Thunderbird. Here are some im
portant feeds you should consider following: Planet Mozilla. This is the ultimate source for everything related to Mozilla. It brings together the feeds of most Mozilla employees, as well as several other members of the Mozilla community. Feeds are added frequently, so the information available through it will only grow with time. It can be hard to follow due of the sheer mass of information coming...
Setting up an extension development environment - Archive of obsolete content
ges logged before the automatic restart happens. To see them, prevent the automatic restart by setting the environment NO_EM_RESTART to 1 before starting the application.) nglayout.debug.disable_xul_fastload = true. For Gecko 2.0+ (Firefox 4.0+). See this bug for more information. Although the bug has been closed, it is believed that this pref is still relevant. You might also want to set dom.re
port_all_js_exceptions = true. See Exception logging in JavaScript for details. devtools.errorconsole.deprecation_warnings = true. Detect deprecated code use. Warning: Never set nglayout.debug.disable_xul_fastload to true in a production environment; it exists solely to aid in debugging. In particular, add-ons should never change this preference. Note: The Error Console is disabled by default s...
...However, it is usually easier to place extension ...
Firefox addons developer guide - Archive of obsolete content
class name If you want to add a FIXME, add: FIXME: a message Notes: The original document is in Japanese and distributed via the xuldev.org website. So there may be still some reference to the xuldev website (we want to host source code on MDC, not on xuldev), and to Japanese things (like some specific locales, which have been translated to French since non-latin characters are not well sup
ported). There are a few things that could be done to make this fit the site better, and for general cleaning up: Tables should use the "standard-table" CSS class so they're styled the same as those on the rest of MDC. There should be some introductory text on the table of contents page at https://developer.mozilla.org/En/Firefox_addons_developer_guide Obviously there are a number of FIXME items...
... and good practices (leaks, global scopes, ...); Add external resources (mozdev.org/community/books.html); Add to chapter 3 or 5 more informations about overlay (how to overlay some interesting part of Firefox like status bar, menus or toolbar) Add previous/next at the end of each chapter Questions: OpenSource appendix. Should we keep this part ? Gen's opinion: yes, because it is im
portant for developers to make informed decisions regarding OSS licenses and it was a part of the original guide. Opinions: I think we should be careful about adding new contents to this guide. The original version of this guide was written as a first step guide for beginners. If we add too much topics, they possibly make learners weary. An alternative idea: writing a "next step" guide for i...
Using Dependent Libraries In Extension Components - Archive of obsolete content
The basic strategy of the stub is to dynamically load the dependent libraries, then load the component library and continue registration. ...
...pend on other libs, the subdependencies // should be listed first. }; // component.dll on windows, libcomponent.so on linux, libcomponent.dylib on Mac static char kRealComponent[] = MOZ_DLL_PREFIX "component" MOZ_DLL_SUFFIX; // Forward declaration of a convienience method to look up a function symbol. static void* LookupSymbol(const mach_header* aLib, const char* aSymbolName); extern "C" NS_EX
PORT nsresult NSGetModule(nsIComponentManager* aCompMgr, nsIFile* aLocation, nsIModule* *aResult) { nsresult rv; // This is not the real component. We want to load the dependent libraries // of the real component, then the component itself, and call NSGetModule on // the component. // Assume that we're in <extensiondir>/components, and we want to find // <extensiondir>/libraries nsCOMPtr<...
MozOrientation - Archive of obsolete content
You should use that API instead. An event that is repeatedly fired on the window as accelerator data is provided to the browser. Note: This below describes how these values worked for the now obsolete MozOrientation. The X axis represents the amount of right-to-left tilt. This value is 0 if the device is level along the X axis, and approaches 1 as the device is tilted toward the left, and -1 as the device is tilted toward the right. ...
...increase. The value is 0 if the device is being thrust upward. In free fall (weightless or falling as a result of a drop), the value remains -1. In weightlessness, all values would be zero when the device is not moving, regardless of orientation, and would only change when being accelerated. In Firefox versions 3.6, 4, and 5 Gecko utilized MozOrientation which was also built to sup
port orientation data but with different APIs from the specified DeviceOrientationEvent. To normalize between the two you can do something like this: function orientationhandler(evt){ // For FF3.6+ if (!evt.gamma && !evt.beta) { evt.gamma = -(evt.x * (180 / Math.PI)); evt.beta = -(evt.y * (180 / Math.PI)); } // use evt.gamma, evt.beta, and evt.alpha // according to ...
JXON - Archive of obsolete content
ng:dong>binnen</ding:dong>), due to their special case (they are often used in order to represents an XML Schema, which is meta-information concerning how to organize the information of the document, reserved for the XML parser). You can include them removing the string && !oNode.prefix from our algorithms (by doing so the whole tag will become the property name: { "ding:dong": "binnen" }). An im
portant consideration is that, when using the third or the fourth algorithm, an XML Document can be used to create any type of JavaScript object. For example, If you want to create an object like the following: { "myboolean": true, "myarray": ["Cinema", "Hot dogs", false], "myobject": { "nickname": "Jack", "registration_date": new Date(1995, 11, 25), "privileged_user": true }, "...
...e || "", oDocumentType || null); loadObjTree(oNewDoc, oNewDoc, oObjTree); return oNewDoc; }; const sValProp = "keyValue", sAttrProp = "keyAttributes", sAttrsPref = "@", /* you can customize these values */ aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i; })(); Note: The current implementation of const (constant statement) is not part of ECMAScript 5. It is sup
ported in Firefox & Chrome (V8) and partially sup
ported in Opera 9+ and Safari. It is not sup
ported in Internet Explorer 6-9, or in the preview of Internet Explorer 10. const is going to be defined by ECMAScript 6, but with different semantics. Similar to variables declared with the let statement, constants declared with const will be block-scoped. We used it only for didactic purpose. If you want a f...
List of Former Mozilla-Based Applications - Archive of obsolete content
eed reader Switched to WebKit in version 1.8.6 Boxee Media center software Switched to WebKit in version 1.0 Epiphany Browser Switched from Gecko to Webkit Flock Social browsing Flock switched from being Firefox-based to Chromium-based when it released a new beta on June 16, 2010 Jolicloud web operating system As of March 2010, RW/W re
ports Jolicloud is on Chrome/Chrome OS Joost TV over Internet Switched from XULRunner-based client to a web application Liferea News aggregator Switched to WebKit in version 1.6 ManyOne Browser Browser Originally Mozilla-based but now I believe the have a web-based tool (need reference for that) Miro (formerly Democracy Player) Video Switched...
...discontinued this product. ...
cert_override.txt - Archive of obsolete content
DD:CC:BB:AA:99:88:77:66:55:44:33:22:11:00 U AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAA== Fields Fields are separated by a tab character. Each line is terminated by a line feed character (UNIX format). ...
...B:AA:99:88:77:66:55:44:33:22:11:00 U AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAA== Fields Fields are separated by a tab character. Each line is terminated by a line feed character (UNIX format). ...
Installing plugins to Gecko embedding browsers on Windows - Archive of obsolete content
This document presents the Windows Registry keys plugin installers can parse to determine where to install a given plugin (for Mozilla browsers) on Windows. Since the prospect of embedded Gecko browsers raises the scenario of more than one Gecko-based browser that a Netscape-style plugin can work with, it becomes im
portant to let plugin developers know how to discover these browsers on a Windows machine. This information applies to Mozilla based browsers that pull the Mozilla codebase after the Mozilla 0.9.1 milestone release. None of the Registry keys mentioned here are written by browsers before the Mozilla 0.9.1 timeframe. For example, Netscape 6.0 and 6.01 do not write any of these keys into the Registry, and thus these keys are not available for plugin vendors to parse for these t...
...s Folders"="C:\\Program Files\\Common Files\\csshare\\plugins0942" "Product"="CompuServe" "Version"="7.0" "DisplayName"="CompuServe 7.0" The Product, Version, and DisplayName string values are currently only written by CompuServe 7.0, and they are written alongside the GeckoVer string value. Original Document Information Last Updated Date: June 18, 2002 Copyright Information:
Portions of this content are (C) 1998-2006 by individual mozilla.org contributors; content available under a Creative Commons license ...
Notes on HTML Reflow - Archive of obsolete content
pagated recursively to the entire subtree beneath the target frame. ReflowDirty indicates that container frame has decided to coalesce several incremental reflows targeted at its children into a single reflow. The container frame maintains the necessary state to determine which children must be reflowed. UserDefined, for "special situations". Currently, this is only used by the view
port frame to schedule a reflow to reflow all of the view
port's fixed-position frames. We should probably try to eliminate it. An incremental reflow may damage other parts of the frame hierarchy; for example, changing the size of the font used in a specific paragraph may cause the paragraph to grow or shrink. A container must therefore propagate any damage that the incremental reflow of ...
... nsBoxFrame nsBoxFrame is an HTML frame that "wraps" a XUL box. Its purpose is to convert HTML reflows their box analog. nsBoxToBlockAdaptor nsBoxToBlockAdaptor is a XUL box that wraps an HTML block frame, used to convert changes in the box layout into HTML reflows. Original Document Information Author(s): Chris Waterson Last Updated Date: December 4, 2004 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Source Navigator - Archive of obsolete content
this is wrong..) It can generate a class hierarchy quite easily (unfortunately, not for classnames which are defined by macro.) Installing Source Navigator In Ubuntu Execute the following line in a terminal window: sudo apt-get install sourcenav This should install source-navigator. One can check whether the installation is complete by executing: $ which snavigator /usr/bin/snavigator Im
porting the source Execute the following: snavigator. This triggers a splash screen, followed by a "Source-Navigator Projects" dialog as the following: I've already created a new project bin.proj before documenting this. If this is your first time to open source navigator, the big white box on the left of the dialog should contain no lines. Click "New Project". This shows the "Auto-Create Project" ...
... I've already created a new project bin.proj before documenting this. If this is your first time to open source navigator, the big white box on the left of the dialog should contain no lines. Click "New Project". This shows the "Auto-Create Project" dialog: which allows you to decide your filename of the project file (which ends in .proj) and your source directory/directories that you want to im
port into the project. (You can always include more by pressing the "More" button.) In my case, I inputted the followings: Project File: <tt>~/snav-mozilla</tt> Add Directory (where your source files reside in -- I understand that the label here is not so self-explanatory...): <tt>~/moz1.9/mozilla</tt> (because I saved my source at ~/moz1.9/mozilla.) Remember to ensure that "Include Subdirectorie...
Working with BFCache - Archive of obsolete content
Q: What is the BFCache exactly? A: BFCache stands for back-forward cache. For more info about this, read how to use Firefox caching. Q: When a user clicks a link that replaces the view in the current tab with a new page, what is the fate of the nsIDOMWindow sup
porting the view they click on? Or: what happens when they hit the 'back' button? A: The outer nsIDOMWindow (the |window| object in content JS, aka the <browser>'s contentWindow object in the parent document) stays right where it is. It just has its inner window and document replaced. The inner nsIDOMWindow (the global scope object in content JS) is either thrown away when GC happens, or frozen and placed in the bfcache. When the user hits the 'back' button, either the window in bfcache is thawed or a new inner window is created...
...ow tells you whether it's coming from bfcache. Note that just because a page went into bfcache doesn't mean it'll ever come out again, like any other cache. Q: Hmm, so what event tells me "you'll never get a pageshow so you can drop the megabytes of info you've saved in Firebug side table for that page?" A: An observer notification with the topic "inner-window-destroyed" whose subject is an nsISup
portsPRUint64 containing the window id of the inner window being destroyed. ...
Tinderbox - Archive of obsolete content
The tool enables mozilla.org to be immediately notified of changes to the code that prevent Mozilla from compiling and running (or compromise performance and footprint) so they can get someone to fix the problem or reverse the changes. Mozilla engineers regularly check Tinderbox before changing the code because changes are prohibited while the codebase is broken. ...
...hether or not any clients have failed. By checking for build failures first and test failures second, we make sure to show users the worst possible situation, i.e. if any clients have failed to build, we will display a red icon that signifies a build failure; if all clients built successfully but some failed tests we will display an orange icon that signifies a test failure. Only if all clients re
ported both successful builds and successful tests will we display a green icon that signifies all is well with the code. << PreviousNext >> ...
Creating a Microsummary - Archive of obsolete content
Web pages can reference generators via <link rel="microsummary"> elements in their <head> elements. Generators can also be independently downloaded and installed by users if they include a list of pages to which they apply. In this tutorial we're going to create a microsummary generator for the Spread Firefox home page that displays the current Firefox download count along with the label Fx downloads; for example: 174475447 Fx downloads. ...
...We might do so via the following code: <script> const warning = "Sorry, you need a microsummary-enabled browser like Firefox 2.0 to install and use microsummary generators."; function addGenerator(url) {...
Getting Started - Archive of obsolete content
ines correctly. Changing Borders and Colours This is the part where knowing CSS comes in handy. To find all of the CSS files that we're going to be modifying, we must first understand the directory structure. Directories In \mozilla\chrome\classic\skin\classic there are a number of different directories which contain the skin information for the default packages that come with Mozilla. ...
...You'll be able to change the bookmark manager and the profile migration window here. The three remaining directories are pretty self-explanatory. They contain the images/styles for the browser, email client, or html editor. ...
DTrace - Archive of obsolete content
DTrace is Sun Microsystem's dynamic tracing framework that allows developers to instrument a program with probes that have little to no effect on performance when not in use and very little when active. Probe data can be collected with scripts written in D (no, not that one). Mozilla DTrace sup
port has been added by the Sun DTrace team and can be used on Solaris 10 and Mac OS X 10.5. DTrace has been largely supplanted by the Gecko Profiler and other tools, so this documentation has been archived. If you find that there are still use cases of consequence, you're welcome to file a documentation bug. The DTrace probes currently built into the codebase may be enabled by default in the future, but for now you'll need to create a build with --enable-dtrace (on Mac OS X you also have to ...
... use cases of consequence, you're welcome to file a documentation bug. The DTrace probes currently built into the codebase may be enabled by default in the future, but for now you'll need to create a build with --enable-dtrace (on Mac OS X you also have to use at least the 10.5 SDK for --with-macos-sdk, unlike the common configuration that uses the 10.4 SDK). Trunk nightly builds with shark sup
port (*-mac-shark.dmg here) are built with --enable-dtrace. Documentation Writing Scripts A general introduction to writing D scripts and using the built-in Mozilla probes. Optimizing JavaScript with DTrace A guide on profiling JavaScript code using DTrace. Adding Probes A guide on creating probes and the build system magic needed to add probes to you...
Dehydra Function Reference - Archive of obsolete content
is accomplished by recording every included file into the _includedArray in the current namespace. Include Example include("map.js") // includes map.js into toplevel var Map = {} include("map.js", Map) // includes map.js into the Map object require({version:, strict:, werror:, gczeal:}) require is used to set runtime execution flags. It also returns the current values of these flags. require sup
ports optional named arguments via JavaScript object where each parameter is a property. If a property is not specified then it will not be passed to the runtime. version integer: this sets js version similar to version() in JS 1.7. strict boolean: Controls JS strict mode werror boolean: Turns JS warnings into errors gczeal int: This is a write-only parameter to set turn on frequent garbage collectio...
...nings to be enabled(-Wfoo) and disabled(-Wno-) on the GCC commandline. This parameter is used when the first argument to warning() is an integer. It is not possible to define new warnings in Dehydra, thus one has to figure out a warning code from an existing warning and hijack it for ulterior purposes. msg is a string to be presented as a gcc warning Optional: loc is the location that should be re
ported for the warning. If no location is provided, the location is inferred from the last process_type or process_function. error(msg [, loc]) Print an error message using the GCC error mechanism. This will cause compilation to fail. msg is a string to be presented as a gcc error Optional: loc is the location that should be re
ported for the warning. If no location is provided, the location is infer...
Installing Dehydra - Archive of obsolete content
Building SpiderMonkey It is recommended that you use SpiderMonkey revision AURORA_BASE_20110705 when building Dehydra. ...
...ake make install Building Dehydra and Treehydra Building Dehydra requires SpiderMonkey development headers from the previous step. CXX should point to your copy of GCC 4.5. It is recommended to get the latest Dehydra sources by checking out from Mercurial. (Obsolete Dehydra releases can be found on the Mozilla ftp site.) hg clone http://hg.mozilla.org/rewriting-and-analysis/dehydra/ cd dehydra ex
port CXX=/usr/bin/g++ ./configure \ --js-headers=$HOME/obj-js/dist/include \ --js-libs=$HOME/obj-js make # run dehydra and treehydra tests make check Usage Dehydra checking can be performed directly within the Mozilla build. To enable static checking of a Mozilla build, see Building with static checking. To run Dehydra manually using G++, add the -fplugin and -fplugin-arg-gcc_dehydra-script/-f...
Error Console - Archive of obsolete content
The Error Console is deprecated in Firefox, and is now only made available if you set the devtools.errorconsole.enabled preference to true. Use the Web Console instead, for web content, or the Browser Console for chrome content. The Error Console is a tool available in most Mozilla-based applications that is used for re
porting errors in the application chrome and in web pages user opens. It re
ports JavaScript-related errors and warnings, CSS errors and arbitrary messages from chrome code. In Firefox, the Error Console can be opened from the tools menu or by Ctrl-Shift-J. For information about what JavaScript exceptions get logged into the Error Console, and how to make all exceptions get logged, read the article Exception logging in JavaScript. See Setting up extension development ...
...g usually lets the program compile but warns of bad coding and suggests design flaws. Message very similar to warning, used very rarely. Manipulating data displayed in Error Console Information displayed in Error Console can be accessed and manipulated through the Console service. Extensions can write to the Error Console from JavaScript using Components.utils.re
portError, or if you're fine with logging to the OS-provided console, dump(). To bring up Error Console from within a browser or mail window, use the function toJavaScriptConsole(). Alternatives Console2 This extension provides a replacement for Error Console, fixing many of its bugs and implementing long-wanted enhancement requests. Firebug The extension for...
Block and Line Layout Cheat Sheet - Archive of obsolete content
ls of block and line layout are tricky; this document serves as a "cheat sheet" that describes how the vagary of different state flags control what's going on. It's a work-in-progress, with questions in red highlight. If you know the answer, please pass it along to me so I can update the document. Objects This section presents some of the classes involved in block and line reflow, along with im
portant members of each object that control reflow processing. nsFrame The base class for all frames. mFlags Flags set on the frame to indicate its state. These flags can be grouped into two categories: flags which affect all frames ("public" flags), and flags that are reserved for an individual frame's private use ("private" flags). NS_FRAME_IN_REFLOW This bit is set when the frame is being ...
... frames are pushed from one line to the next. mFrame The PerFrameData of the inline frame that "owns" the span, or null if this is the root span. mFrame is initialized to the containing inline frame's PerFrameData when a new PerSpanData is pushed in nsLineLayout::BeginSpan. Original Document Information Author(s): Chris Waterson Last Updated Date: December 4, 2004 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Gecko Coding Help Wanted - Archive of obsolete content
Take a look through LXR, and you'll realize that Mozilla's source code is a big place. Huge, actually. Overwhelmingly large. You could spend years in it and still get lost. You're up for some adventure, though, and you're set to take the plunge. But where? Where's a good place to start? Someplace easy and straightforward, so you can get a feel for the lay of the code. Re
ports in Bugzilla can be deceptive, deceptively hard... or deceptively easy. So we've compiled a list of pointers --from the experts. There's plenty to do, and we sure could use the help. Here are some fixes that are straightforward; they just need some time and attention: deCOMtamination Convert weird, ugly and inefficient method signatures to more natural C++ method signatures. It's really improved code readabili...
...debase. We've done a lot, but there's a lot more to do. roc is willing to work closely with anyone with reasonable C++ experience to get them started on this. Just send him mail. Not up for coding yet? Join the Gecko BugAThon and help save Gecko engineers from imminent doom! Original Document Information Author(s): fantasai Last Updated Date: May 4, 2004 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
HTTP Class Overview - Archive of obsolete content
HttpHandler implements nsIProtocolHandler manages preferences owns the authentication cache holds references to frequently used services nsHttpChannel implements nsIHttpChannel talks to the cache initiates http transactions processes http response codes intercepts progress notifications nsHttpConnection implements nsIStreamListener & nsIStreamProvider talks to the socket trans
port service feeds data to its transaction object routes progress notifications nsHttpConnectionInfo identifies a connection nsHttpTransaction implements nsIRequest encapsulates a http request and response parses incoming data nsHttpChunkedDecoder owned by a transaction strips chunked transfer encoding nsHttpRequestHead owns a nsHttpHeaderArray knows how to fill a request buf...
... ...
Java in Firefox Extensions - Archive of obsolete content
irefox extension, you can make use of LiveConnect. LiveConnect gives your extension's JavaScript code (linked from or contained in XUL code) access to 2 objects: java and Packages (note that per this thread, although the new documentation for the LiveConnect reimplementation states that these globals will be deprecated (in the context of applets), "Firefox and the Java Plug-In will continue to sup
port the global java/Packages keywords, in particular in the context of Firefox extensions."). These 2 objects let you make use of the standard JDK classes, e.g., var aJavaList = new java.util.LinkedList(); If you want to load your own JARs, then you can create your own Java class loader. The following technique only works in JavaScript code linked from or contained in XUL files. If you wish to call...
...One example seems to be the fact that the "java" global is not immediately available if the extension operates in a sidebar (usin...
Basics - Archive of obsolete content
You can find the console in the Extra Menu of Firefox. The namespace for this API is console. Methods info()This method does stuff. log(stringstring)This method writes a notification message to the console. stringThe message to add to the consolestring console.log("hello world!"); arn()This method does stuff. error()This method does stuff. exception()This method does stuff. ...
...stuff. log(stringstring)This method writes a notification message to the console. stringThe message to add to the consolestring console.log("hello world!"); arn()This method does stuff. error()This method does stuff. exception()This method does stuff. logFromCaller()This method does stuff. Class Notifications The Notification Box appears at the bottom right corner of the browser and displays im
portant information to the user. The namespace for this class is jetpack.notificaitons. Methods show(titlestringbodystringiconstring)Draws a notification box. titleThe head of the notification message.string bodyThe messagestringfalse iconThe URL of an .ico file.string jetpack.notifications.show("hello world");var myBody = " My first message body on Jetpack";var myIcon = "http://www.mozilla.com/fav...
Clipboard Test - Archive of obsolete content
Jetpack's clipboard sup
port API provides a standardized way for features to access the clipboard. Features can get and set the clipboard in various flavors of data type. The namespace associated with this API is jetpack.clipboard which provides both read and write access to the clipboard. The API is fairly straightforward; examples can be found here. This API currently lives in the future and must be im
ported for use. ...
... standardized way for features to access the clipboard. Features can get and set the clipboard in various flavors of data type. ...
Notifications - Archive of obsolete content
The namespace for this class is jetpack.notifications. Methods show(titlestring, [body as string] iconstring)Draws a notification box. ...
... The namespace for this class is jetpack.notifications. Methods show(titlestring, [body as string] iconstring)Draws a notification box. ...
Makefile.mozextension.2 - Archive of obsolete content
OJECT).jar ~/.mozilla/default/32p27fdr.slt/chrome/ #################################### ###### define CHROME_MANIFEST content $(PROJECT) content/ overlay chrome://browser/content/browser.xul chrome://$(PROJECT)/content/overlay.xul locale $(PROJECT) en-US locale/ skin $(PROJECT) classic/1.0 skin/ style chrome://global/content/customizeToolbar.xul chrome://$(PROJECT)/skin/overlay.css endef ex
port CHROME_MANIFEST chrome.manifest: @echo Generating $(PROJECT)/chrome.manifest @echo "$$CHROME_MANIFEST" > $(PROJECT)/chrome.manifest ###### #Firefox {ec8030f7-c20a-464f-9b0e-13a3a9e97384} #Thunderbird {3550f703-e582-4d05-9a08-453d09bdfdc6} #Nvu {136c295a-4a5a-41cf-bf24-5cee526720d5} #Mozilla Suite {86c18b42-e466-45a9-ae7a-9b95ba6f5640} #SeaMonkey {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} #S...
...$(PROJECT)/content/about.xul</abouturl> <iconurl>chrome://$(PROJECT)/skin/mainicon.png</iconurl> <updateurl>http://$(PROJECT).mozdev.org/update.rdf</updateurl> <type>2</type> <targetapplication> <description> <id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id> <minversion>2.0</minversion> <maxversion>9.0</maxversion> </description> </targetapplication> </description> </rdf> endef ex
port INSTALL_RDF install.rdf: @echo Generating $(PROJECT)/install.rdf @echo "$$INSTALL_RDF" > $(PROJECT)/install.rdf ###### define OVERLAY_XUL <overlay id="$(PROJECT)-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><script src="overlay.js"/></overlay> ...
Monitoring downloads - Archive of obsolete content
like this: logTransferCompleted: function(aDownload) { var endTime = new Date(); // Current time is the end time // Issue the REPLACE sqlite command to update the record. We find a // record for the same source URI and start time, then update the end // time, size, and speed entries in the record. By matching on both // source URI and start time, we sup
port logging multiple downloads of // the same file. var dbConn = this.storageService.openDatabase(this.dbFile); var statement = dbConn.createStatement("UPDATE items SET size=?1, " + "endTime=?2, speed=?3, status=?4 WHERE source=?5 and startTime=?6"); statement.bindInt64Parameter(0, aDownload.size); statement.bindInt64Parameter(1, endTime.getTime()); statement.b...
...t64Parameter(5, aDownload.startTime); statement.execute(); statement.reset(); dbConn.close(); }, This simply opens the database and builds and executes a UPDATE sqlite command that finds the download item whose source URI and start time match the download that has completed and updates its information. By looking for a record with both the same URI and start time, we properly sup
port the case where the user downloads the same file multiple times. Displaying the download log The download log window's code is encapsulated in an object called downloadlogger_dlwindow. Since this is a simple example, it's a one-shot log window; it doesn't monitor for further changes to the log. It simply displays the state of downloads at the moment the window was opened. That means all its wor...
New Security Model for Web Services - Archive of obsolete content
rom scripts loaded from the domain with host name containing mozilla.org. That is, http://www.mozilla.org/, http://lxr.mozilla.org, http://komodo.mozilla.org, etc. will be granted access. Implementation nsIWebScriptsAccessService This interface provides a way to check whether the running script has access to the server that the script wishes to communicate. boolean canAccess(in nsIURI aTrans
portURI, in AString aType); aTrans
portURI - The service URI aType - Type requested by the script ( ex. soapv, soap, load, etc. ) return PR_TRUE if access granted else PR_FALSE void invalidateCache(in string aTrans
portURI); Invalidate cached entry for the given trans
port uri. Empty the cache by passing in a empty string nsWebScriptsAccess(Implements nsIWebScriptsAccess...
...e's prefix are compared to the allowed type and prefix in order to determine access. An entry is created if and only if the declaration file is considered valid (validation based on the syntax described above); an invalid document will result in access denial. Denies script access in the event of an xml-wellformedness error, or validation error, or if the declaration file does not grant access. Re
ports errors (validation, wellformedness, file not found, etc.) to the console via nsIConsoleService. Note: Script access is checked via declaration file only if the script security manager denies access. Summary Advantages The proposed declaration file places the server operator, not the client in control of access to his server by untrusted scripts. The access hole is no bigger than the servic...
FAQ - Archive of obsolete content
ided by Prism becomes a product or is integrated into other products (like Firefox), then it won't necessarily continue to be called by this codename. Is Prism a platform? No, Prism is not a platform. Prism is built on top of the Mozilla platform and its Gecko rendering engine, just like Mozilla Firefox, so it provides the same capabilities to web applications that Firefox provides, including sup
port for HTML, JavaScript, CSS, and <canvas>. At the same time, we're also working to increase the capabilities of those apps by adding features to the Web itself, like sup
port for offline data storage and access to 3D graphics hardware, that will be available to web applications in both Prism and Firefox. How is Prism different from XULRunner? Prism is built on top of XULRUnner. Prism is a simple XU...
...anvas>. At the same time, we're also working to increase the capabilities of those apps by adding features to the Web itself, like sup
port for offline data storage and access to 3D graphics hardware, that will be available to web applications in both Prism and Firefox. How is Prism different from XULRunner? Prism is built on top of XULRUnner. Prism is a simple XULRunner application with the main
portion of the UI consisting of a XUL <browser> element. How does Prism render web pages? Prism uses Gecko, the same browser rendering system found in Firefox. What operating systems does Prism sup
port? Microsoft Windows 2000 XP Vista Mac OS X 10.3.9+ (Panther) 10.4 (Tiger) 10.5 (Leopard) Linux kernel 2.2.14+ with glibc 2.3.2, XFree86-3.3.6, gtk+2.0, fontconfig/xft, and libstdc++5 ...
Prism - Archive of obsolete content
so benefit from operating system tools that lets us view the memory/CPU consumption of a specific application. Minimal user interface: A general-purpose browser UI is not necessary or appropriate for most web apps. It is more efficient to provide a UI that is specific to the application. This also cuts down on UI clutter (hence the term distraction-free browser). Basic desktop integration: Sup
port of desktop features can make using the app more natural and convenient for end users. This includes the ability to create desktop shortcuts, to place the application icon in the tray or dock and to display pop-up notifications. Customization: Apps can be run using a shared browser runtime and customized using client-side script (similar to Greasemonkey). Custom stylesheets can be used to tweak ...
... webapp bundle should contain a webapp.ini configuration file. The configuration file is a simple, INI-style text file that specifies some parameters about a web application. Styling One of Prism's goals is to make web applications feel more like desktop applications. One way to make the illusion seem more real is to use styling (or theming). Prism sup
ports a simple styling system that allows the user to add CSS files to the webapp bundle. Scripting Prism allows for some client-side web application customization. Some simple objects and utilities are exposed to webapp scripts. Host Window Prism provides a simple, scaled down browser window for running web ap...
Reading textual data - Archive of obsolete content
h the data: var str = {}; while (is.readString(4096, str) != 0) { processData(str.value); } Don't forget to close the stream when you're done with it (is.close()). Not doing so can cause problems if you try to rename or delete the file at a later time on some platforms. Note that you may get less characters than you asked for, especially (but not only) at the end of the file (stream). Unsup
ported byte sequences You can specify what should happen with byte sequences that do not correspond to a valid character. The last (4th) argument to init specifies which character they get replaced with; nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER is U+FFFD REPLACEMENT CHARACTER, which is often a good choice. If you do not want any replacement, you can specify 0x0000 as replacement charact...
...ences that do not correspond to a valid character. The last (4th) argument to init specifies which character they get replaced with; nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER is U+FFFD REPLACEMENT CHARACTER, which is often a good choice. If you do not want any replacement, you can specify 0x0000 as replacement character; that way, readString will throw an exception when reaching unsup
ported bytes. Reading lines The nsIUnicharLineInputStream interface provides an easy way to read entire lines from a unichar stream. It can be used like nsILineInputStream, except that it sup
ports non-ASCII characters, and has no problems with charsets with embedded nulls (like UTF-16 and UTF-32). It can be used like this: var charset = /* Need to find out what the character encoding is. Using UTF...
Table Layout Regression Tests - Archive of obsolete content
e dumped to separate files in a baseline or verify directory for all URL's in rtest.lst (see: nsRegressionTester::DumpFrameModel). Their name is generated by replacing the old extension .html or .xml with .rgd. For appendCells1.html a file appendCells1.rgd will be created in the baseline or verify subdirectory. ...
...de your file. Additional Notes There is a special type of frame dumps - the printing regression tests, they are invoked by the -Prt command line argument to the viewer and include first a display then a frame dump taking into account the printer pages. Please contact if you need help with running those tests. I would like to thank Chris Karnaze for his guidance and fantasai for her language sup
port. Original Document Information Author(s): Bernd Mielke Other Contributors: Boris Zbarsky Last Updated Date: February 5, 2007 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Cmdline tests - Archive of obsolete content
by coding scripts in python allowing any executable to run, sending commands to stdin, and asserting output using regular expressions. See test/cmdline/README document for more information. ...
...ger locals', '%s -d testdata/debug.abc'%r.avmrd, input='break 53\ncontinue\nnext\ninfo locals\nnext\ninfo locals\nquit\n', expectedout=['local1 = undefined','local2 = 10','local2 = 15'] ) Use case 2: test -memstats returns memory logs to stdout Test contents: start avmshell -memstats test.abc, assert stdout contains 'gross stats', 'sweep m reclaimed n pages.' from cmdutils im
port * def run(): r=RunTestLib() r.run_test(name='memstats', command="%s -memstats testdata/memstats.abc" % r.avm, expectedout=[ 'gross stats', 'managed fragmentation', 'gross stats end', 'sweep\\([0-9]+\\) reclaimed [0-9]+ whole pages' ...
Event Handlers - Archive of obsolete content
cument to write events that potentially suppress the default actions taken by the XBL handlers. Within an XBL inheritance chain, event handlers always fire first on the derived binding and then on the base binding in the chain. A derived handler then has a way of preventing the event from flowing to its base binding handlers. Mouse and key handlers have certain additional properties that are sup
ported by XBL. Additional attributes can be used to impose a filter on the event handler. When a filter is imposed, additional conditions must be met before the event handler will fire. For both mouse and key events, modifier keys can be specified using the modifiers attribute. This attribute is a comma-separated list of modifier keys that must be down at the time the key or mouse event occurs in ord...
...ndler to execute. Examples of common keys in the list are shift and control. For more details, see the XBL Element Reference for <handler>. In addition, mouse events can specify the button and the clickcount. This allows XBL authors to easily define handlers for right-click, or for left double-click, without having to write script on the same handler to differentiate those cases. Key events sup
port the charcode and keycode attributes. When set, the corresponding fields in the event object must match for the event to fire. [Editor's Note: Should we have section on error-handling? Probably.] ...
confirm - Archive of obsolete content
rmation dialog. Method of Install object Syntax int confirm( String aText ); int confirm( String aText, String aDialogTitle, Number aButtonFlags, String aButton0Title, String aButton1Title, String aButton2Title, String aCheckMsg, Object aCheckState ); Parameters The second, extended confirm() method is sup
ported starting with Gecko 1.8. It accepts any number of parameters up to 8. Previous Gecko versions only sup
port the first, one-parameter method and will throw an error on occuring the extended form. See the notes at the end of this document for a safe way to implement a fallback. aText The string to be displayed in the confirmation dialog. This string is typically in the form of a pro...
... 0 'Cancel' or button 1. Also: user closed the dialog window 1 'OK' or button 0 2 The third button Previous versions of the XPInstall API stated the return value of confirm() to be a Boolean. That is incorrect, confirm() always returned a plain integer (in pre-Gecko-1.8 versions either 0 or 1). Notes The preferred method for detecting sup
port for custom dialog boxes is querying the existence of the button constants. Other approaches (e.g. buildID comparisons) are not recommended. if ("BUTTON_POS_0" in Install) { // Use extended confirm() method } else { // Use classic confirm() method } ...
initInstall - Archive of obsolete content
displayed to the user. package The Client Version Registry pathname for the software (for example: Plugins/Adobe/Acrobat or /royalairways/RoyalPI/). It is an error to supply a null or empty name. The name can be absolute or relative. A relative pathname is relative to the Netscape 6 namespace. A relative pathname must start with plugins/, to be relative to the plug-ins
portion of that namespace or java/download/, to be relative to the Java
portion. All other parts of the Netscape 6 area of the registry are reserved for use by Netscape. The Client Version Registry is a hierarchical description of the software registered for use with Netscape 6. The registry name provided here is not the location of the software on the machine, it is the location of information...
... version An InstallVersion object or a String representing the version of the package being installed. When version is a String it should be up to four integer values delimited by periods, such as "1.17.1999.1517". flags An optional field; reserved for future use. Pass 0 as the default value. ...
Getting File Information - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. The nsIFile object has a number of useful attrib...
... ...
Uploading and Downloading Files - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. The IO object and stream objects can be used to ...
...ta(); formData.append(fieldName, new File(filePath)); var req = new XMLHttpRequest(); req.open("POST", postUrl); req.onload = function(event) { alert(event.target.responseText); }; req.send(formData); } HTTP PUT You can also upload a file using an HTTP PUT operation. This is simpler but it doesn't allow sending additional data and web servers usually need special configuration to sup
port PUT operations. function uploadPut(postUrl, filePath) { var req = new XMLHttpRequest(); req.open("PUT", postUrl); req.setRequestHeader("Content-type", "text/plain"); req.onload = function(event) { alert(event.target.responseText); } req.send(new File(filePath)); } In this example, a new input stream is created for a file, and is passed to the XMLHttpRequest's send method. Fetch Uplo...
Writing to Files - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. To write to a file, an output stream is used. An...
...nt to write using a different encoding, you can specify a third argument to nsIScriptableIO.newOutputStream() which specifies the encoding. This example opens a file using the UTF-16 encoding. var stream = IO.newInputStream(file, "text", "UTF-16"); This third argument is not needed to write using UTF-8. As UTF-8 can store all characters, you will usually always use this default. For a list of sup
ported character encodings, see Sup
ported Character Sets. The files can be written using the writeString method whichever character encoding is used. The difference is handled internally so you don't need to write any other part of the code differently. Writing Binary Data In addition to text, binary values may be written to a file either as bytes or as numbers. A number of methods are available which...
Moving, Copying and Deleting Files - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. There are several methods of the nsIFile object ...
...ion must be a directory or an error will occur. In this case, we assume that 'source.txt' is a file. If the item to copy is a directory, it can be copied in the same manner as above without changes. This allows an entire directory and its contents to be copied from one location to another. You might use this to make a backup of a directory of files for instance. var file = IO.newFile("Home", "im
portantData"); var destination = IO.newFile("Desktop", ""); destination.append("backups"); file.copyTo(destination, ""); This example copies an item called 'im
portantData' into a directory called 'backups' within the desktop directory. nsIFile.append() is used to retrieve the 'backups' subdirectory. This method is used to navigate into subdirectories. For more information about nsIFile.append(), see...
Menus - Archive of obsolete content
Instead of creating a standard button, this will create a button with a small arrow or other indicator. Clicking the button will display the menu, allowing a command to be selected. This type of menu would be used when you want to have a set of commands yet don't want to use a menu bar, for example in a dialog box. See Menu Buttons for more information. toolbarbutton Toolbar buttons can also sup
port menus. This works just like it does for other buttons. See Menu Buttons for more information. menulist A menulist is used when you wish the user to select from a list of items. For this type of menu, one of the items within it is selected. When another item is selected, the label of the item is set as the label of the menulist. Other user interfaces call this type of widget a combobox. You ma...
... document, in this case 'cmd_open'. The command event will be fired on the command element instead of the menuitem. This is useful when you wish to have several elements performing the same action, for example a menuitem on a menubar, a context menu, and a toolbar button, because you can place the code to execute only once on the command and hook each element up to the command. Menuitems also sup
port displaying shortcuts associated with the menuitem, as well as icons beside the label. For details about adding shortcut keys to menus, see Adding Shortcut Keys to Menu Items. For details about adding icons to menus, see Adding Icons to Menu Items. For details about creating checkbox menu items or radio menu items see Checkbox Menu Items or Radio Menu Items. Menu items can be disabled by setting...
OpenClose - Archive of obsolete content
"/> <menuitem label="Copy"/> <menuitem label="Paste"/> </menupopup> </menu> This technique may be used for both menupopups that use the menu tag, the button tag and the toolbarbutton tag. For menupopups attached to other elements using the popup or context attributes, see Opening a Popup below. As with other ways of opening a menu, the popupshowing event will be fired to provide an op
portunity to customize the commands that appear on the menu. There are several situations when opening a menu is not allowed. These are: if the menu is already open, or already in the process of being opened. Naturally, attempting to open a menu that is already open doesn't have any effect. if the menu is a child of another menu and the parent menu is not open. In this case, the parent menu must ...
...context menu. Pass true if so, or false if not. It should be obvious from how you are calling openPopup what to set this argument to. Note that the same menu can be opened in either manner so this flag doesn't affect how the popup appears. What it does do is affect how the focus and highlighting of the menu is handled. As long as you pass the right value depending on the situation, it isn't too im
portant to know the specifics of the difference between both cases. However, you can see the effect of the flag when using the Firefox bookmarks. Try opening a submenu of a bookmark (a bookmark folder) and note how the highlighting still changes as the mouse is moved over other menus, and the submenu is closed when the mouse is moved away. Now try opening a context menu on the same bookmark and note ...
Tooltips - Archive of obsolete content
ver top of a toolbar button and waiting for a second can display a small popup label containing text describing the button's function. When the mouse is moved again, the tooltip disappears. This is a useful means of providing additional details about a user interface without cluttering up the main interface. Note that tooltips can only be activated using the mouse, so they should never contain im
portant information that isn't available elsewhere. The tooltiptext attribute In most cases, the tooltip will display only a single label. For this, the tooltiptext attribute may be used, which is valid for all XUL elements. The value of this attribute should be the text to appear in the tooltip. <toolbarbutton label="Back" tooltiptext="Go back one page"/> In this example, a Back button on a tool...
...s styled to look different. Elements that use the tooltiptext attribute display the tooltip in a default tooltip element, which typically looks like a small yellow box large enough to fit the text inside it. This default tooltip is created automatically, so you don't normally need to use a tooltip element. However, it is possible to use another tooltip element that looks differently, or which sup
ports other elements besides a single text label. The tooltip can be created using the tooltip element, the contents of which appear inside the tooltip. <tooltip id="iconic"> <image src="help.png"/> <label value="Save a file to a remote site"/> </tooltip> <button label="Save" tooltip="iconic"/> In this example, a tooltip with the id 'iconic' contains an image and a label. A button is associat...
Introduction - Archive of obsolete content
rned from the query, generate some content. The template syntax allows for different rules to generate different content based on particular criteria as well as set attribute values from returned results. Some other systems call this databinding. Effectively, XUL templates are the XUL way of doing databinding. Each template retrieves its data from a datasource. Several types of datasources are sup
ported by default, RDF, XML and SQLite databases, however, processors may be written to sup
port other types of datasources. In XUL, the datasource is specified by placing the datasources attribute on an element. Typically, the value will be a URI that identifies the location of the data. For example, for an XML datasource, the URL of an XML file is specified. When the XUL parser sees an element with t...
...template> </listbox> This template uses an XML datasource to generate a listbox. Although we'll look at the details of this later, the simple result here is that a listitem will be generated for each child node in the XML data, setting the label to the name attribute for each XML node. For SQLite datasources, the datasources attribute specifies the URI of a database file. Only local files are sup
ported, so a file URL should be used. If the datasource type sup
ports it, the template builder can also use multiple datasources which are all combined into a single datasource as if they were all in one datasource to begin with. Only the built-in RDF type sup
ports this mechanism; the XML and SQLite types do not. When multiple datasources are used, an nsIRDFCompositeDataSource is created to hold all o...
Template Logging - Archive of obsolete content
<< Previous Debugging problems with a template can be difficult as many problems are logic errors that are often not possible to determine automatically. For example, if you spell a value wrong, no data may be returned, but the template system won't know that that this was because of a spelling error, or simply that there shouldn't be any data anyway. Fortunately, some debugging and logging sup
port is provided with templates that may help. Logging Template Results There are two main ways in which template errors may be detected. The first debugging method involves logging all new results that apply to the template due to the data changing as well as logging results that are changed or removed. In addition, each result generated when the template is first created and initialized is logged. T...
...ber> element is different. The first example generates no error and is a common template query pattern. The second example, however, has an error. The triple refers to two variables (?person and ?name) that aren't used in earlier tags. It's likely that the author here had meant to use the first example, or had meant to change the value of the subject attribute to ?human to match. However, it is im
portant to note that an error will not be printed simply if data didn't exist for a particular result. In the above example, some people may not have names. These people will not match the query but it will not cause an error. Thus, if no error is logged, it generally indicates an issue with the data or that the data does not match the query being used. We could debug this by removing parts of the que...
XML Templates - Archive of obsolete content
When an XML source is desired, specify a querytype attribute on the root node of the template to the value xml. This indicates to the template builder that an XML source is being used as that the queries use syntax that is specific to XML. The datasources attribute should be set to the URL of an XML document, either a local file or a remote web site. ...
...box datasources="people.xml" ref="*" querytype="xml"> <template> ... </template> <listbox> The URL in the datasources attribute may be a relative URL or an absolute URL. Note: If you want to have the state of the disclosure triangles ("twisties") be persistent, be sure to give each node a unique "id" attribute. These are used to track the current state of the disclosure triangles. Sup
port for this was introduced in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4). For this and the following examples, we are going to use the following XML document containing a list of people: <people> <person name="Napoleon Bonaparte" gender="male"/> <person name="Cleopatra" gender="female"/> <person name="Julius Caesar" gender="male"/> <person name="Ferdinand Magellan" gender="m...
Tree Widget Changes - Archive of obsolete content
attribute. <treecell/> <treecell value="true"/> You need to specify the checkbox image with CSS for the checkbox to display. (Do NOT set id of the column to be 'checked' it will cause problems with the CSS) treechildren::-moz-tree-checkbox(checked) { /* css for checked cells */ list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif"); } In addition, checkmark columns sup
port editing: <tree editable="true"> <treecols> <treecol type="checkbox" editable="true"> ... </treecol> </treecols> </tree> If the column is editable, the user can click the cell to change the state of the checkbox. When the user clicks the cell, the view's setCellValue method will be called with either the value true or false. Note that the tree must also be marked as editable ...
...er for this to work. This is shown in the example above. Sometimes, you might have a particular row or cell which you do not want to be editable. In this case, disable editing for that cell by setting editable to false for that cell, as in the following: <treecell value="true" editable="false"/> Or, for custom views, return false from the isEditable method. Currently, only checkbox columns sup
port editing, although the content-based tree handles the nsITreeView.setCellValue() and nsITreeView.setCellText() functions to change the tree content with a script for other types of cells. For instance: var col = tree.columns.getPrimaryColumn(); treecell.setCellText(5, col, "Banana"); This will change the label of the cell in row 5 and the primary column to Banana. However, this paves the way in...
Box Objects - Archive of obsolete content
displayed, instead of their order as they are stored in the DOM. Retrieving Position and Size The box object provides six read only properties, x, y, screenX, screenY, width and height, for determining the currently displayed position and size of an element. All values returned are in pixels. x, y The x and y coordinates are referenced from the top left corner of the document in the window (that
portion which excludes the window border and title bar) and refer to the top left corner of the element, including CSS padding. CSS margins and borders* are excluded. The top left corner of the document is that which is obtained from screen.mozInnerScreenX, screen.mozInnerScreenY screenX, screenY The screenX and screenY coordinates are referenced from the absolute top left corner of the screen (scre...
...rom the absolute top left corner of the screen (screen.top,screen.left) and refer to the top left corner of the element, including CSS padding and borders. CSS margins are excluded. width, height The width and height properties are also measured in pixels and return the width and height of the element, including CSS padding and borders. CSS margins are excluded. *Note that x, y refers to the
portion of the element that is just inside any borders, which is inconsistent with the other four boxObject position and size references, which include borders as part of the element. The values are always the position and sizes as currently displayed, so the values will be different if the element is moved or resized. For example, a flexible element will change in size and the box object dimensions w...
Features of a Window - Archive of obsolete content
rowsing context.">Window.open() function to open the second window. This function will return a reference to the newly opened window. You can use this reference to call functions of the other window. The open function takes three arguments. The first is the URL of the file you wish to open. The second is an internal name of the window. The third is a list of display flags. The flag 'chrome' is im
portant to open the window as a chrome file. If you do not add the 'chrome' flag, the file will open up as the content in a browser window. For example: var myWin = window.open("chrome://findfile/content/findfile.xul", "findfile", "chrome"); Specifying the Width and Height You should have noticed that whenever elements were added to a window, the window's width expanded to fit the new elements. Th...
...set to 0. To have the window set its size automatically, leave both the width and height out. The width and height only specify the initial size of the window. The user may still resize the window to another size, assuming that the window is resizable. Other Window Features The flags below can be passed as part of the third argument to the window.open function. Your operating system may not sup
port all of them. You can also use any of the pre-existing flags, which you should find in a JavaScript reference. You may disable a feature by setting it to 'no', for example 'dialog=no'. alwaysLowered The window will always appear behind other windows. alwaysRaised The window will always appear above other windows. centerscreen The window will be centered on the screen when it is opened. de...
Install Scripts - Archive of obsolete content
the Install object's functions will be described below. The install script should take the following steps: Initialize the installation by specifying what package and version is being installed. Use the Install functions to indicate what files and directories need to be installed. You can also set files to be moved and deleted. Start the process of installing the necessary files. It is im
portant to note that during step two, you only indicate which files should be installed and any other operations you wish to have happen. No files get copied until step three. Because of this, you can easily specify a number of files to be installed, come across some kind of error, and abort the whole process without modifying the user's system. The Component Registry Mozilla maintains a file which is...
...second method allows you to assign a destination on a per-file (or directory) basis. The first method is described below. The function setPackageFolder() assigns an installation directory. For the find files dialog, we will install the files into the chrome directory. (We could actually put them anywhere though.) The setPackageFolder() takes one argument, the directory to install to. For maximum
portability, you can't specify a string name for the directory. Instead, you specify an identifier of a known directory and get subdirectories of it. Thus, if your application needed to install some system libraries, you don't need to know the name of those directories. The directory identifiers are listed on this page. For the chrome directory, the directory identifier is 'Chrome'. The getFolder() fu...
Localization - Archive of obsolete content
tity is replaced with its value, which can be a string of text. Entities may be used whenever text occurs, including the values of attributes. The example below demonstrates the use of an entity in a button. <button label="&findLabel;"/> The text that will appear on the label will be the value that the entity &findLabel; has. A file is created which contains the entity declarations for each sup
ported language. In English, the &findLabel; entity will probably be declared to have the text "Find". DTD Files Entities are declared in Document Type Definition (DTD) files. Files of this type are normally used to declare the syntax and semantics of a particular XML file, but they also let you declare entities. In the Mozilla chrome system, you will find DTD files located in the locales subdirecto...
... oncommand="window.close();"/> </hbox> </vbox> </window> Each text string has been replaced by an entity reference. A DTD file has been included near the beginning of the XUL file. Each entity that was added should be declared in the DTD file. The window will not be displayed if an entity is found in the XUL file that hasn't been declared. Note that the name of the entity is not im
portant. In the example above, words in entities have been separated with periods. You don't have to do this. The entity names here follow similar conventions as the rest of the Mozilla code. You might notice that the text '2520 bytes' has been replaced by two entities. This is because the phrase structure may be different in another locale. For example, the number might need to appear before the equ...
Manifest Files - Archive of obsolete content
er into the application chrome directory or the user specific chrome directory. This latter chrome directory is normally the one used since the application directory might not have sufficient permissions to write into it. Note: Starting in Gecko 2.0, only the file named chrome.manifest is read automatically; if you need to read multiple manifest files, use the manifest command in that file to im
port additional manifests. Use manifest flags to configure the scenarios in which the secondary manifest is im
ported. If you just want to try testing privileged XUL code in the Firefox browser, you can do this easily by just using a manifest with only one line in it: Create a new directory somewhere. For example, on a Windows machine, you might use C:\testfiles Create a new ASCII1 file called test...
... Delete the file <mozilla-directory>/chrome/chrome.rdf. Start Mozilla. You should be able to view any XUL files you put into the directory using a URL of the form: chrome://applicationid/content/file.xul where file.xul is the filename. Your main XUL file should be applicationid.xul which you can load using the shortcut URL chrome://applicationid/content/. If you are creating skin and/or locale
portions, repeat the steps above, except that the format of the contents.rdf file is slightly different. Look at the contents.rdf files in other applications for details. Troubleshooting Creating a chrome package can often be tricky and it is difficult to diagnose problems. Here are a few tips in case you get stuck. Open the file <mozilla-directory>/chrome/chrome.rdf. You should find references to y...
Property Files - Archive of obsolete content
get something like "50% Off" returned), escape the percentage character with another percentage character, like this: my.percentage.string = %S%% Off Not escaping the percentage character will generate an incorrect string that strips the space character between the percentage character and the next word of the string ("50%Off"). Non-ASCII Characters, UTF-8 and escaping Gecko 1.8.x (or later) sup
ports property files encoded in UTF-8. You can and should write non-ASCII characters directly without escape sequences, and save the file as UTF-8 without BOM. Double-check the save options of your text editor, because many don't do this by default. See Localizing extension descriptions for more details. In some cases, it may be useful or needed to use escape sequences to express some characters. Prop...
...es encoded in UTF-8. You can and should write non-ASCII characters directly without escape sequences, and save the file as UTF-8 without BOM. Double-check the save options of your text editor, because many don't do this by default. See Localizing extension descriptions for more details. In some cases, it may be useful or needed to use escape sequences to express some characters. Property files sup
port escape sequences of the form: \uXXXX , where XXXX is a Unicode character code. For example, to put a space at the beginning or end of a string (which would normally be stripped by the properties file parser), use \u0020 . In the next section, we will look at XBL, which can be used to define the behavior of an element. << PreviousNext >> See Also How to localize html pages, xul files, a...
Styling a Tree - Archive of obsolete content
using the example from a previous section. We'll need to add code to the getCellProperties() function, to add a property 'makeItBlue' for cells in every fourth row. (We don't use getRowProperties() as the text color will not be inherited into each cell.) Prior to Gecko 22 the properties object that is passed as the last argument to the getCellProperties() is an XPCOM object that implements nsISup
portsArray. It is really just an XPCOM version of an array. It contains a function AppendElement() which can be used to add an element to the array. We can use the interface nsIAtomService to construct string atoms for the properties. getCellProperties: function(row,col,props){ if ((row %4) == 0){ var aserv=Components.classes["@mozilla.org/atom-service;1"]. getService(Components.i...
...s. We create them using the XPCOM interface nsIAtomService and add them to the array using the AppendElement() function. Here, we create an atom 'makeItBlue'. You can call AppendElement() again to add additional properties. From Gecko 22 your function should return a string containing the property. getCellProperties: function(row,col){ if ((row %4) == 0){ return "makeItBlue"; } } To sup
port Gecko versions before and after this change use. getCellProperties: function(row,col,props){ if ((row %4) == 0){ if (props) { var aserv=Components.classes["@mozilla.org/atom-service;1"]. getService(Components.interfaces.nsIAtomService); props.AppendElement(aserv.getAtom("makeItBlue")); } else { return "makeItBlue"; } } } This function would be ...
Tree View Details - Archive of obsolete content
ossibly be. Imagine a situation where a row had subrows and those subrows had child rows of their own and several are open. It could take a while in some implementations to determine what the next sibling's row index would be in such a case. Example of Hierarchical Custom View Let's put this together into a simple example that takes an array and constructs a tree from it. This tree will only sup
port a single parent level with an inner child level, but it could be extended to sup
port additional levels without too much effort. We'll examine it piece by piece. <window onload="init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <tree id="elementList" flex="1"> <treecols> <treecol id="element" label="Element" primary="true" flex="1"/> </treecols> <t...
... here with no data in the treechildren. The 'init' function is called when the window is loaded to initialize the tree. It simply sets the custom view by retrieving the tree and setting its 'view' property. We will define 'treeView' next. function init() { document.getElementById("elementList").view = treeView; } The custom tree view will need to implement a number of methods, of which the im
portant ones will be examined individually. First we'll define two structures to hold the data for the tree, the first will hold a map between parents and the children they contain, and the second will hold an array of the visible items. Remember that a custom view must keep track of which items are visible itself. var treeView = { childData : { Solids: ["Silver", "Gold", "Lead"], Liquids: ...
Trees - Archive of obsolete content
ed into a hierarchy. A tree also allows the user to rearrange, resize and hide individual columns. Some examples of trees include the list of messages in a mail application, or the Bookmarks window in Mozilla. In some ways, a tree has some similarities with the listbox. Both can be used to create tables of data with multiple rows and columns, and both may contain column headers. The tree also sup
ports nested rows, whereas the listbox does not. However, listboxes may contain any type of content, whereas trees may only contain text and images. (Using advanced features, progress meters or checkboxes also can be added to the tree) A tree consists of two parts, the set of columns, and the tree body. The set of columns is defined by a number of treecol elements, one for each column. Each column...
...an array or JavaScript data structure, or load the data from an XML file. Since the entire body of the tree is a single widget, you can't change the style of individual rows or cells in the normal way. This is because there are no elements that display the individual cells, like there is with the listbox. Instead, all drawing is done by the tree body using data supplied by the view. This is an im
portant point and many XUL developers have trouble understanding this aspect. To modify the appearance of a tree cell, the view must instead associate a set of keywords for a row and cell. A special CSS syntax is used which styles components of the tree body with those keywords. In a sense, it is somewhat like using CSS classes. Tree styling will be discussed in detail in a later section. Tree Elemen...
Using Visual Studio as your XUL IDE - Archive of obsolete content
indow element uses the correct XUL namespace http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul. 3. XBL If you are writing your own elements in XBL, you can download a XBL schema from mozilla.doslash.org/xblschema. Grab the XSD version and add it in the same way, you added the XUL schema. To combine both, you can also add your own XBL elements to the XUL schema to get autocompletion-sup
port and validation for those in your XUL files. Mihailo posted some instructions in this Codeplex discussion. 4. Visual Assist and file extensions Since version 10.5, Visual Assist sup
ports Javascript and XML. As it does not work out of the box with unknown file extensions (like .xul, .xbl and .jsm), you have to do some registry tricks, so that VA knows how to treat these file types. All VA options...
...ies that are declared in this file. 5.2 Text preprocessor The Mozilla Build System includes a Text preprocessor. As preprocessor directives are not valid XML, Visual Studio will mark them as errors in your XUL files. 5.3 Javascript related You will get validation errors for Javascript code whenever using the keywords "const" and "let". These keywords are Mozilla-specific at the moment. VS just sup
ports ECMAScript 3rd Edition and thus doesn't know these keywords. ...
XUL Accesskey FAQ and Policies - Archive of obsolete content
letter? Accesskey attribute is case sensitive! Notice that the difference between the button examples above is the case of the accesskey specified. Mozilla's accesskey implementation will first try to underline a letter of the same case, but if there isn't one it will fall back on a letter of the opposite case. Our preference is to underline the first letter of one of the words, so it's im
portant to be aware of this quirk. Avoid duplicates Don't use the same accesskey letter twice in the same window. Be especially careful of drop down menus in the same window. For example, in the Manage Bookmarks dialog, don't use F, E, V, T or H (File, Edit, View, Tasks, Help). Help wanted: it would be useful to have an automated tool to check for duplicate and missing accesskeys in ...
...bel. Use a distinctive consonant or a vowel in the label. Use letters with wide widths, such as w, m, and capital letters. Avoid: Letters with descenders, such as p, g, q, or y. Example: p, g, q, y. Letters next to a letter with a descender. Letters that are only one pixel wide, such as i or l. Example: i, l. Make it easy to remember Do the most im
portant prompts first, so that they get the best accesskeys. See if a similar prompt has an accesskey elsewhere in Mozilla, and use the same accesskey. There are standard accesskeys used in Windows as well, like Properties. If not, try the first letter of the first word in the prompt. Next, try the first letter of another word in the prompt. Finally, use any non-silent letter in an action ...
XULBrowserWindow - Archive of obsolete content
See the linked interfaces for the definition of the implemented methods. You may also wish to refer to the implementation of XULBrowserWindow in browser/base/content/browser.js. ...
...See the linked interfaces for the definition of the implemented methods. You may also wish to refer to the implementation of XULBrowserWindow in browser/base/content/browser.js. ...
The Implementation of the Application Object Model - Archive of obsolete content
lications, and the other for describing documents that can be used by those applications. It does not make sense to confuse or obscure the purpose of HTML by adding in a whole slew of new functionality that hasnothing to do with the display of Web pages. What content developers want from the next release of Mozilla is a standards-compliant browser. If we ship a browser that does not have 100% sup
port for CSS2, for example, but we've extended HTML by adding 20-30 new tags, people are going to put down their blinders and see only the fact that we were off adding a whole slew of new stuff to HTML when we could have been firming up our standards story. By making XUL a separate beast, this is less of an issue. Since an AOM tree cannot be placed inside a DOM tree, XUL applications don't ever occur ...
... for instantiating our different content nodes. But now let's consider one of these nodes, e.g., nsMailElement. Let's look at the set of interfaces that nsMailElement needs to implement in order to exist in a XUL tree as fully scriptable content. nsIContent, nsIDOMNode, nsIDOMElement, and nsIXMLElement must be implemented at a minimum. Four interfaces with over 100 methods combined, a significant
portion of which are redundant. Every new kind of content node would have to implement all of these interfaces. Several of the implemented functions would even have identical implementations, i.e. duplicate code that would be doing the same thing in the function bodies. Here's another problem. The various interfaces, nsIContent et.al., are not yet solidified. They are likely to change following the fi...
button - Archive of obsolete content
the menu. menu-button You can also use the value menu-button to create a button with a menu. Unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed. panel Similar to the menu type, this opens a popup. Place a panel element inside the button. panel elements are popups that sup
port any type of content. radio The button acts like a radio button. Only one button in the group can be on a once. repeat This button will fire its command event repeatedly while the mouse button is held down. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value in...
...ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIAccessibleProvider, nsIDOMXULButtonElement ...
grid - Archive of obsolete content
<grid> <columns> <column flex="1"/> <column flex="2"/> </columns> <rows> <row> <label value="User name"/> <textbox id="user"/> </row> <row> <label value="Group"/> <menulist> <menupopup> <menuitem label="Accounts"/> <menuitem label="Sales" selected="true"/> <menuitem label="Sup
port"/> </menupopup> </menulist> </row> </rows> </grid> </groupbox> Attributes Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, ...
... ...
iframe - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] An inner frame that works much like the HTML <iframe> element. The src attribute can be used to specify the content of the frame. This content is a separate document. The children of the iframe are ignored. Currently, XUL iframes running in remote processes are not sup
ported. If you want to run content in a remote process, use a XUL browser element. Warning: When used in chrome-privileged documents (either HTML or XUL) such as Firefox addons, the contents of the frame may have the same permissions as Firefox itself. This can be a serious security vulnerability, for example if you use src="http://...". When used in this case, please see Displaying web content in an extension without security ...
...ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related nsIAccessibleProvider ...
image - Archive of obsolete content
like the HTML img element. The src attribute can be used to specify the URL of the image. More information is available in the XUL tutorial. Note: Prior to Gecko 8.0, images did not shrink down with the same ratio in both directions when specifying maximum sizes using maxheight or maxwidth. The new behavior aligns more with the HTML <img> element and shrinks both the width and height down pro
portionally. Attributes onerror, onload, src, validate Properties accessibleType, src Style classes alert-icon, error-icon, message-icon, question-icon Examples <image src='Firefoxlogo.png' width='135' height='130'/> Attributes onerror Type: script code This event is sent to an image element when an error occurs loading the image. image.onload Type: script code ...
...This typically looks like an...
menupopup - Archive of obsolete content
...
...d_before, end_after, overlap, and after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values. x, y For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the view
port of the document containing the popup node. In this case, the position and attributesOverride arguments are ignored. isContextMenu The isContextMenu argument should be true for context menus and false for all other types of popups. It affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesO...
notification - Archive of obsolete content
oup without affecting other notifications. priority Type: integer Numeric value that specifies the order in which the notifications appear. Should be one of the constants described in the notificationbox's appendNotification method. type Type: one of the values below Indicates the type of notification, determined from the priority. info a notification that is of lesser im
portance. warning a normal warning notification. critical a critical notification. value Type: string The string attribute allows you to associate a data value with an element. It is not used for any specific purpose, but you can access it with a script for your own use. Be aware, however, that some elements, such as textbox will display the value visually, so in order to merely a...
...ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData close() Return type: no return value Closes the notification or findbar and removes it from its ...
preferences - Archive of obsolete content
persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods void fireChangedEvent(in DOMElement preference); Creates and dispatches a changed (non-bubbling) event to the specified preference element. Also executes code specified in onchanged attribute of the element. See also the description of change event of <preference>. void observe(in nsISup
ports aSubject, in string aTopic, in wstring aData); nsIObserver method used internally to react to changes to preferences listed as children of this element. Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(...
...ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Preferences System documentation: Introduction: Getting Started | Examples | Trouble...
prefwindow - Archive of obsolete content
to openDialog to open a specific pane by default. You can also set the lastSelected attribute on the prefwindow tag to the id of the pane to start with. Normally, you would not set this attribute as it will be set automatically such that the default pane is the same as the one showing when the preferences dialog was last closed. More information is available in the Preferences System article. Im
portant note for XULrunner-based applications: the Preferences System - part of the toolkit - still relies on two browser.* preferences. The first one is browser.preferences.instantApply, a boolean preference. The preference window will not run correctly if you do not set this preference in your application's defaults (see bug 485150 for more information). A true value for this preference makes the...
...ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData acceptDialog() Return type: no return value Accepts the dialog and closes it, s...
richlistbox - Archive of obsolete content
Firefox 3 introduced multiple selection to rich list boxes. ...
...ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addItemToSelection( item ) Return type: no return value Selects the given item, without desel...
richlistitem - Archive of obsolete content
accessible Type: nsIAccessible Returns the accessibility object for the element. control Type: element id Gets and sets the value of the control attribute. disabled Type: boolean Gets and sets the value of the disabled attribute. label Type: string Gets the concatentation of text from any child label elements. Does not sup
port setting label values. Use the child elements directly to set label text. searchLabel Type: string Gets and sets the value of the searchlabel attribute. selected Type: boolean This property's value is true if this element is selected, or false if it is not. This property is read only. This property is available for menuitem and menuseparator elements in Firefox 3. ...
...ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIAccessibleProvider, nsIDOMXULSelectControlItemElement ...
toolbar - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A container which typically contains a row of buttons. It is a type of box that defaults to horizontal orientation. It can be collapsed with a grippy when the toolbar is placed inside a toolbox. The toolbar should always have an id attribute. Note: Gecko 2.0 adds sup
port for external toolbars. These are toolbars that are not children of a toolbox element. You can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. The chromeclass-toolbar class may be used to create a toolbar where its visibility depends on the toolbar flag when opening the window with the window interface's open() method loads the specified resource ...
...ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes chromeclass-toolbar When this class is used, the toolbar will be hidden ...
toolbox - Archive of obsolete content
of box but defaults to vertical orientation. If a toolbar is placed inside a toolbox, a grippy is displayed on its left or upper edge. The user may click the grippy to collapse the toolbar. If multiple toolbars are placed in the same toolbox, they will all collapse into the same row. The Firefox browser does not have grippies so toolbars cannot be collapsed and expanded. Note: Gecko 2.0 adds sup
port for external toolbars. These are toolbars that are not children of a toolbox. You can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. The external toolbars associated with a toolbox are listed in the array of elements provided by the toolbox's externalToolbars property. More information is available in the ...
...ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData appendCustomToolbar( name, currentset ) Firefox only Return type: element Adds a custom toolbar...
tooltip - Archive of obsolete content
...
...d_before, end_after, overlap, and after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values. x, y For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the view
port of the document containing the popup node. In this case, the position and attributesOverride arguments are ignored. isContextMenu The isContextMenu argument should be true for context menus and false for all other types of popups. It affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesO...
tree - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData startEditing( row, column ) Return type: no return value Activates user editing of the given cell...
... { background-color: #FFFFAA; } treechildren::-moz-tree-row(odd) { background-color: #EEEEEE; } treechildren::-moz-tree-row(odd, selected) { background-color: #FFFFAA; } treechildren::-moz-tree-cell-text(selected) { color: #000000; } treechildren::-moz-tree-cell-text(odd, selected) { color: #000000; } treechildren::-moz-tree-row(hover) {background-color: #FFFFAA !im
portant;} treechildren:-moz-tree-column { border-right:1px solid rgb(220,220,220) !im
portant; } The JavaScript to get the text for the selected row/rows: function getrowcellvalues() { var tree = document.getElementById('mytree'); for (var i = 0; i < tree.view.rowCount; i++) { if (tree.view.getCellValue(i, tree.columns.getColumnAt(0)) == 'true'){ alert(tree.view.getCellText(i, tree...
Building XULRunner with Python - Archive of obsolete content
"application/x-python" attribute. DOM scripting is pretty much as with Java Script. For example def onLoad(): btnTest = document.getElementById("btnTest") btnTest.addEventListener('command', onTest, False) def onTest(): window.alert('Button activated') window.addEventListener('load', onLoad, False) One possible gotcha is that the default python path used to find modules that areim
ported explicitly includes the xulrunner executable directory and the directory that is current when XULRunner launches. However it does not include any path related to the XUL application being run. Some work around will need to be found. Unhandled exceptions are displayed in the JavaScript Error Console which can be opened usingxulrunner -jsconsole. One solution is to puttry .... except: print_exc(...
...A zombie will keep old code open and cause confusion when you make changes and run xulrunner again. Deploying Python must be installed on the target machine. Perhaps eventually a XULRunner with a minimal Python installation can be generated with something like py2exe or pyInstaller. Untill...
Custom app bundles for Mac OS X - Archive of obsolete content
ents/ Info.plist (Application bundle properties are specified in this XML file.) PkgInfo (This is a simple text file and is created along with the Info.plist file) MacOS/ (The MacOS folder will contain your XULRunner executable) xulrunner (This is the xulrunner stub) Resources/ (This is where you place your XUL Application code and sup
port files) application.ini (XULRunner-related application settings) example.icns (This is the icon which will be used by your application bundle) chrome/ content/ example.xul (This directory contains your application's chrome) example.manifest defaults/ pre...
... designates the whole package as an application bundle. The first sub-directory is called Contents and within that directory you will place several files and folders that are needed by your application bundle. Info.plist and PkgInfo must exist in the Contents directory. The content of these files is covered in the article Deploying XULRunner 1.8. Examples These example files are taken from a
port of WebRunner which was created to illustrate one method of Mac OS X application packaging. Top-level directory Info.plist PkgInfo See also XULRunner - Tips XULRunner - Mac FAQ External Links Inside Application Bundles Property List Key Reference xrtemplate ...
XULRunner FAQ - Archive of obsolete content
n or ...)? The goal of XULRunner is to facilitate development and deployment of Internet applications. It is not meant to be a full-featured runtime; this allows XULRunner to maintain a smaller footprint and simpler deployment strategy than generic full-featured runtimes. If I use XULRunner do I have to write my application in XUL? No! You can write your application in any language sup
ported by the Mozilla web platform, including HTML, XHTML, SVG, or XUL. So why is it called XULRunner, instead of HTMLRunner or something? XUL was always the original language of choice for UI in mozilla applications and the main library is called libXUL, mostly the name is a hangover from that that has now stuck. When will Firefox be based on XULRunner? There is no intention to do thi...
...ng XULRunner and applications based on XULRunner will be available in future releases. I'm writing a XUL application, how can I deploy that application to my users? Right now Mozilla recommends that XULRunner should be deployed privately with each application. See Deploying XULRunner 1.8 for more information. Where is the source code? Here. I think I've found a bug, how do I re
port it? bugzilla.mozilla.org is used to track bugs in all Mozilla products. Please search to make sure that your bug has not already been re
ported. How can I help? If you want to help with XULRunner but don't know where to start, visit the XULRunner:Community page and ask questions on the newsgroups or the IRC channel. ...
XULRunner Hall of Fame - Archive of obsolete content
See also Featured Mozilla-based applications, many of which use XULRunner. XULRunner 5+ based applications These applications use XULRunner 5 or greater. AZARDI Free Win/Mac/Linux ePub 2/ePub 3 desktop reader using HTML5 and latest CSS features of Gecko for interactive e-books. Version updates match the rapid release cycle. Now available with XULRunner 30 with I18N sup
port. MathML sup
port is significant. Includes SMIL audio overlays and IDPF Fixed Layout. celtx All-in-one media pre-production software. Source ChatZilla A standalone version of the ChatZilla IRC client. Conkeror A highly programmable web browser with a leopard-oriented design inspired by Emacs. Source Evergreen - Staff Client Evergreen is an open source library system. Source ...
....9 or earlier Buzzbird XUL-based desktop twitter client. GitHub BlueGriffon The next-generation Web Editor based on the rendering engine of Firefox. Build instructions Convertigo Enterprise Mashup Server A Web integrator and Web clipper tool to build enterprise mashups Nightingale Nightingale is a communtiy fork of the Songbird media player, bringing back Linux sup
port and much more. Build instructions Kirix Strata A new specialty browser for accessing and manipulating data from the web TeleKast An open source teleprompter and script editor. Source TomTom HOME 2 PC application to manage TomTom GPS devices Understanding Faith (Desktop Version) A Multimedia Religious Education Resource for Catholic Secondary Schools in Australia. ...
Using SOAP in XULRunner 1.9 - Archive of obsolete content
native SOAP interface was removed from Gecko 1.9, those stuck speaking to SOAP APIs need a new place to turn. After some experimentation, the following seems to be the best way to speak SOAP in XULRunner. Several alternatives were considered: soapclient 2.4 - This library contains a few JavaScript mistakes but nevertheless seems (fairly) widely used, mature and tested. It requires servers to sup
port WSDL which took it out of the running. XULRunner 1.8.* - Using an old XULRunner is certainly an option but brings up a host of speed, stability and memory issues. Manual implementation - The author doesn't know enough about SOAP to implement a robust client in an afternoon. The best solution proved to be jqSOAPClient. This library doesn't require a WSDL. Though jQuery is listed as a dependency, ...
...y doesn't require a WSDL. Though jQuery is listed as a dependency, it can be worked around easily. ...
Windows and menus in XULRunner - Archive of obsolete content
plication, you'll notice that XULRunner gives your windows a default icon (top left corner on Windows). You'll most likely want to specify your own icons. You can learn how to do it in the article Window icons. Menus and toolbars Most desktop applications are complex enough to require some sort of menu and/or toolbar to structure the application's available commands. XUL provides elements to sup
port both menus and toolbars. Building on the simple window code, here is what XUL menus and toolbars look like: <?xml version="1.0"?> <?xml-stylesheet href="chrome://basicapp/skin/main.css" type="text/css"?> <!DOCTYPE window SYSTEM "chrome://basicapp/locale/main.dtd"> <window id="main" title="&title;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="ma...
...em command="cmd_open"/> <menuitem command="cmd_save"/> ... <toolbarbutton id="open" command="cmd_open"/> <toolbarbutton id="save" command="cmd_save"/> ... We can add images to the toolbar buttons through the CSS file. We could hard-code the images in the XUL file itself, but CSS is a better practice. Here's the CSS file: /* global skin --------------------------------------------------- */ @im
port url(chrome://global/skin/); /* toolbar ------------------------------------------------------- */ #open { list-style-image: url(chrome://basicapp/skin/open.png); -moz-box-orient: vertical; } #save { list-style-image: url(chrome://basicapp/skin/save.png); -moz-box-orient: vertical; } Of course, you need to make sure the PNG files are included in the application. There are quite a few ...
calICalendarViewController - Archive of obsolete content
oller allows for these actions to be performed in a manner consistent with the rest of the application in which the calICalendarView is included. calendar/base/public/calICalendarViewController.idlScriptable Please add a summary to this article. ...
...the user regarding the deleting of recurring calIItems, in the case where aOccurrence is a single occurrence of a recurring calIItem. ...
2006-11-10 - Archive of obsolete content
shes refereed articles addressing issues of computing as it impacts the lives of people with disabilities." Read more... Publication for the first issue is expected in Fall 2007. W4A 2007 First Call for Papers The Fourth International Cross-Disciplinary Cofnerence on Web Accessibility (W4A 2007) Co-Located with the Sixteenth International World Wide Web Conference (WWW2007), in Banff, Canada. ...
... Firefox, details IBM's involvement and addresses some AJAX accessibility concerns. The article closes with a glimpse at the future of Firefox accessibility. Read more... Access Keys in Firefox 2 Previous versions of Firefox used the <alt> key as a modifier. This has been changed to Alt+Shift for content accesskeys due to the "conflicts with UI mnemonics" according to Aaron Leventhal. This is re
ported to have broken accesskeys using numeric values. See bug 349716. Currently there is a work-around extension available at bug 357101 to temporarily solve this problem. Accessibility in ChatZilla Gijs Kruitbosch and Aaron Leventhal have proposed an accessibility project involving ChatZilla. Ideas include: Adding standardized shortcuts CLC-4-TTS and/or other screenreader integration Screenreader ...
2006-11-10 - Archive of obsolete content
Summary: mozilla.dev.platform - November 4th - November 10th, 2006 Announcements No announcements this week Traffic beaufour moves the discussion about XulRunner unit-tests like xpcshell from mozilla.dev.platform to mozilla.dev.quality. Benjamin Smedberg crossposted a notice about Unit Testing For the Mozilla Toolkit, letting developers know about the im
portance of testing for the improvement of Mozilla 2, and asks for complete coverage. Several community members comment, backing up Benjamin's post. William VanderPol asks, regarding Remote XUL Applications, if is it possible (or does it exist?) to have an extension that will allow chrome access to certain specified URL's? James Leigh points out that resources are available at O'Reily, in the Creating Applications with Mozilla sectio...
...ons, if is it possible (or does it exist?) to have an extension that will allow chrome access to certain specified URL's? James Leigh points out that resources are available at O'Reily, in the Creating Applications with Mozilla section. Benjamin Smedberg has been "working on some xptcall refactoring which will allow us to expose XPTCall via a frozen API (and C linkage)". He is looking for xptcall
port maintainers to submit patches to bug 349002. Matthew Gertner wants to know if anyone has written code to paste images from the clipboard on platforms other than Windows? As of the end of the week, there is no reply. Harry is looking for help with Create Thread in javascript using nsIThread. He wants to know how to create new threads using javascript for background download operations. Neil Deakin...
2006-09-29 - Archive of obsolete content
back in working order. Litmus should be back up and running soon. Discussions Extension Based Testing - Someone is in the process of writing a small extension that tests Firefox's help in terms of table-of-contents and search Looking for Firefox triagers to evaluate a triage tool - A PhD student is working on a way to assist triagers. He is looking for an approach to recommend to whom a bug re
port should be assigned (i.e. which developer(s) has/have the correct expertise for a particular bug re
port). He has a working web-based tool called Sibyl for providing both developer and component recommendations for bug re
ports. He is looking for triagers to try it and give him feedback. Help testing helper extension - Someone made a new extension. He needs help testing it out and wants to know ho...
... for a particular bug re
port). He has a working web-based tool called Sibyl for providing both developer and component recommendations for bug re
ports. He is looking for triagers to try it and give him feedback. Help testing helper extension - Someone made a new extension. He needs help testing it out and wants to know how to make an iframe loads not go into the history. He also created a bug re
port to get rid of the help hooks in page info that lead nowhere. Meetings None Authors Mark D'Souza (mdsouza) Mohamed Attar (mojo) ...
NPN_InvalidateRect - Archive of obsolete content
invalidRect The area to invalidate, specified in a coordinate system that originates at the top left of the plug-in's content area. ...
... invalidRect The area to invalidate, specified in a coordinate system that originates at the top left of the plug-in's content area. Description Before a windowless plug-in can repaint or refresh part of its drawing area, the plug-in must first invalidate the area with either NPN_InvalidateRect() or NPN_InvalidateRegion(). ...
NPN_SetValueForURL - Archive of obsolete content
<< Gecko Plugin API Reference << Browser Side Plug-in API Summary Allows a plugin to change the stored information associated with a URL, in particular its cookies. (While the API theoretically allows the preferred proxy for a given URL to be changed, doing so does not have much meaning given how proxies are configured, and is not sup
ported.) Syntax #include <npapi.h> typedef enum { NPNURLVCookie = 501, NPNURLVProxy } NPNURLVariable; NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len); Parameters This function has the following parameters: instance Pointer to the current plug-in instance. variable Selects the typ...
...rror NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len); Parameters This function has the following parameters: instance Pointer to the current plug-in instance. variable Selects the type of information to be changed. The only sup
ported type is NPNURLVCookie. url The URL for which to change information. value The new associated information for the URL. Note: the value may have internal NULL bytes and may not be NULL-terminated. len The length of the value buffer. Returns If successful, the function returns NPERR_NO_ERROR. If unsuccessful, the function returns an error code. For possible values, see Error Codes. Descri...
NPP_HandleEvent - Archive of obsolete content
responsible for delivering to the plug-in, see the NPEvent structure. MS Windows The browser gives each windowed plug-in its own native window, often a child window of the browser window, to draw into. The plug-in has complete control over drawing and event handling within that window. Mac OS The browser does not give a windowed plug-in a native window, because the Mac OS platform does not sup
port child windows. Instead, the windowed plug-in draws into the graphics
port associated with the the browser window, at the offset that the browser specifies. For this reason, NPP_HandleEvent is only way the plug-in can receive events from its host application on Mac OS. When NPP_HandleEvent is called, the current
port is set up so that its origin matches the top-left corner of the plug-in. A plug-i...
...plug-in draws into the graphics
port associated with the the browser window, at the offset that the browser specifies. For this reason, NPP_HandleEvent is only way the plug-in can receive events from its host application on Mac OS. When NPP_HandleEvent is called, the current
port is set up so that its origin matches the top-left corner of the plug-in. A plug-in does not need to set up the current
port for mouse coordinate translation. See Also NPEvent ...
NPP_SetWindow - Archive of obsolete content
dow is an NPWindow object, which contains the coordinates of the instance's area and various platform-specific data. This window is valid for the life of the instance, or until NPP_SetWindow is called again with a different value. For windowed plug-ins on Windows and Unix, the window parameter contains a handle to a subwindow of the browser window hierarchy. On Mac OS, this field points to an NP_
Port structure. For windowless plug-ins, it is a platform-specific handle to a drawable. Before setting the window parameter to point to a new window, it is a good idea to compare the information about the new window to the previous window (if one existed) to account for any changes. For windowless plugins, NPP_SetWindow is called with a clipRect of 0,0,0,0 to signal that the plugin is not visible. ...
... window to the previous window (if one existed) to account for any changes. For windowless plugins, NPP_SetWindow is called with a clipRect of 0,0,0,0 to signal that the plugin is not visible. NOTE: NPP_SetWindow is useful only for embedded (NP_EMBED) or full-screen (NP_FULL) plug-ins, which are drawn into windows. It is irrelevant for hidden plug-ins. See Also NPP_HandleEvent, NPWindow, NP_
Port ...
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
ce the plugin into the plugins directory, or place it into your own directory and modify the Windows registry to let Firefox know where to find the plugin. The downside to this method is that once the plugin is installed, it might be difficult for users to upgrade, uninstall, or disable the plugin. As of Firefox 3 (and any Gecko 1.9 based application) the use of install.js scripts is no longer sup
ported and plugins must either be shipped as an executable installer or in a bundle as described here. Bundle structure Toolkit bundles can be used for all add-ons including extensions, themes and plugins. Plugin packages should only need to package a small set of files in the following structure in the xpi file: install.rdf plugins/ pluginlib.dll plugintypes.xpt The install.rdf file contains...
... single xpi bundle. In the XPI you can use the following structure: platform/ Linux_x86-gcc3/ plugins/ libplugin.so Darwin_ppc-gcc3/ plugins/ libplugin.dylib More specific information can be found in the platform-specific subdirectories documentation. Gecko 2.0 (Firefox 4) and later Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) removed sup
port for platform-specific subdirectories. Instead, you need to place the different plugin libraries into the plugins directory. For example: plugins/ libplugin.so libplugin.dylib Install Manifest The install manifest describes the plugin to the user. For a plugin the manifest only needs to be very simple: <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.o...
The First Install Problem - Archive of obsolete content
imetype description that apears when you type "about:plugins" as a URL in Mozilla's location bar. Example: [HKEY_LOCAL_MACHINE\Software\MozillaPlugins\]\@mycompany.com/MyApplication,version=5.01\MimeTypes\application/x-myapp] Description=MyApplication Plugin for App Files "Suffixes" -- This will be a semi-colon concatenated list of sup
ported suffixes. This information is also stored under the Suffixes subkey (see below), but that key doesn't link suffixes to a particular mimetype. Example: [HKEY_LOCAL_MACHINE\Software\MozillaPlugins\]\@mycompany.com/MyApplication,version=5.01\MimeTypes\application/x-myapp] Suffixes=app Suffixes -- a subkey ...
...that key doesn't link suffixes to a particular mimetype. Example: [HKEY_LOCAL_MACHINE\Software\MozillaPlugins\]\@mycompany.com/MyApplication,version=5.01\MimeTypes\application/x-myapp] Suffixes=app Suffixes -- a subkey containing string values (REG_SZ) representing all the suffixes (3 digit extensions) sup
ported by this module. Example: [HKEY_LOCAL_MACHINE\Software\MozillaPlugins\]\@mycompany.com/MyApplication,version=5.01\Suffixes] Inside this subkey, string values might look like: app typ avi Note that these string values (REG_SZ) don't actually have values affiliated with them. "Description" -- string value describing the m...
Writing a plugin for Mac OS X - Archive of obsolete content
. Info.plist The plugin communicates its MIME and filename extension information using the Info.plist file, which is packaged in the plugin bundle. The plugin also communicates its bundle type in that file, under the key CFBundlePackageType; the type is 'BRPL'. If the type isn't an NPAPI plugin type, the bundle won't load as an NPAPI plugin. You can always just use 'BRPL'. XP_MACOSX It's im
portant to define the GCC preprocessor definition XP_MACOSX to 1; this is used by the NPAPI headers to build properly on Mac OS X. If you don't define it, they won't be interpreted correctly. This is easy to miss in the sample project's build settings. Symbol visibility Symbol visibility is a common problem for people trying to get NPAPI plugins working. Some symbols must be visible as standard C...
...scation that is generated by the C++ compiler. The three symbols that must always be visible are: NP_Initialize() NP_GetEntryPoints() NP_Shutdown() The sample plugin is written entirely in C, using a standard Xcode build configuration, so by default all of its symbols are C-style and visible. ...
Plugins - Archive of obsolete content
Flash usage is also set to be phased out in the future. Note: Plugins are now a legacy technology. They are not available on most mobile devices. Mozilla encourages website developers to avoid using plugins wherever possible and use standard Web APIs instead. If there are plugin features which are not available in the web platform, we encourage developers to post their use cases to mozilla.dev.platform project list, so that Mozilla can prioritize web platform work to make those use cases possible. For more information about plugin roadmap, see non-archived plugin information. ...
... Firefox click-to-activate feature. Scripting plugins (npruntime) This reference describes the new cross-browser NPAPI extensions that let plugins be scriptable and also let them access the script objects in the browser. Shipping a plugin as a Toolkit bundle Plugins can be shipped as a Toolkit bundle, allowing a user to easily install, uninstall and manage their personal plugins. Sup
porting private browsing in plugins Firefox 3.5 introduced sup
port for private browsing; learn how to make your plugin respect the user's privacy wishes. Multi-Process Plugin Architecture How Firefox loads plugins into a separate process. Firefox 3.6.4 introduced out-of-process plugins which execute in a separate process so that a crashing plugin does not crash the browser. Logging and Debugging f...
SAX - Archive of obsolete content
Below is an example ...
...Below is an example of parsing from a string: xmlReader.parseFromString("<f:a xmlns:f='g' d='1'><BBQ/></f:...
Solaris 10 Build Prerequisites - Archive of obsolete content
r versions of SXDE. Fortunately, it also isn't necessary, so you can fix this problem by simply removing the reference to that package from the installer script (cbe-install). The installer may tell you your C compiler is not the recommended compiler, but the compiler you installed will work fine, so you should tell the installer to use the compiler anyway. Run . ...
...the compiler anyway. Run . /opt/jdsbld/bin/env.sh to im
port the JDS CBE settings into your environment. Build Environment 1. Install Sun Studio 12 or Sun Studio 11 with a patch to avoid a compiler bug. 2. Install CBE. Make some changes to /opt/jdsbld/bin/env.sh. --- env.sh.orig Tue Jul 1 02:38:35 2008 +++ env.sh Tue Jun 24 01:08:01 2008 @@ -95,7 +95,8 @@ echo Setting LD=$LD ex
port LD -PATH="$CBE_PREFIX/bin:/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/bin:/usr /sfw/bin:$CCDIR" +PATH="/opt/sfw/bin:$CBE_PREFIX/bin:/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/s bin:/bin:/usr/sfw/bin:$CCDIR" test "x$JDS_CBE_ENV_QUIET" != x1 && \ echo Setting PATH=$PATH ex
port PATH +ex
port PKG_CONFIG_PATH=/opt/sfw/lib/pkgconfig:/usr/lib/pkgconfig 3. Replace the commands in CBE that d...
Table Reflow Internals - Archive of obsolete content
Overview Review of reflow Table frames Table reflow Intro to paginated reflow Table paginated reflow Review of Reflow Reflow process starts when An html document starts loading (the frame tree contains only view
port, scroll(s), canvas, html, body). The initial chunk of an xml doc is loaded. The initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. The container posts a dirty reflow command with itself as the target. Content is inserted, appended, or deleted through the DOM. ...
...The container posts a dirty reflow command with itself as the target. Content is inserted, appended, or deleted through the DOM. The container posts a dirty reflow command with itself as the target. Style changes through the DOM - javascript, browser change font (CTRL+/-), a preference changes, etc. Review of Reflow Reflow starts with pres shell Which reflows the reflow root (usually the view
port frame), Which reflows it children, etc. Ususally it starts when the pres shell processes its queue of reflow commands. The reflower Positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positioned elements) Reflows reflowee and passes a reflow state (in) and a reflow metrics (in/out) Review of Reflow The reflow state: Is a node in a tree stru...
Theme changes in Firefox 3.5 - Archive of obsolete content
cted element. browser.xul Bug 463189 added a new attribute on the XUL window element of browser.xul named browsingmode. The value of this attribute is normal when the Private Browsing mode is inactive, and private when it's active. This attribute can be used to style different parts of the browser window inside the Private Browsing mode. See this blog post for an example. ...
... See Private browsing for theme designers for details. ...
::-ms-check - Archive of obsolete content
Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-check in its selector. Other properties are ignored. ...
...e button is checked. */ color: green; /* This will make the checkmark green when the button is checked. */ } Result Below is an example for you to try. The screenshot to the left shows what will happen when you check the buttons if you don't have access to Internet Explorer or Edge. ScreenshotLive sample Specifications Not part of any specification. Browser compatibility Historically sup
ported in Internet Explorer and Edge before version 79. ...
::-ms-fill-lower - Archive of obsolete content
A slider control is one possible representation of <input type="range">. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-fill-lower in its selector. Other properties are ignored. ...
... ...
::-ms-fill-upper - Archive of obsolete content
A slider control is one possible representation of <input type="range">. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-fill-upper in its selector. Other properties are ignored. ...
... See also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-progress CSS-Tricks: Styling Cross-Browser Compatible Range Inputs with CSS QuirksMode: Styling and scripting sliders ...
E4X - Archive of obsolete content
since it could be removed at any time. Try to avoid using it. Warning: E4X is obsolete. It has been disabled by default for webpages (content) in Firefox 17, disabled by default for chrome in Firefox 20, and has been removed in Firefox 21. Use DOMParser/DOMSerializer or a non-native JXON algorithm instead. ECMAScript for XML (E4X) is a programming language extension that adds native XML sup
port to JavaScript. It does this by providing access to the XML document in a form that feels natural for ECMAScript programmers. The goal is to provide an alternative, simpler syntax for accessing XML documents than via DOM interfaces. A valid alternative to E4X is a non-native JXON algorithm. E4X is standardized by Ecma International in ECMA-357 standard (currently in its second edition, December 2...
... hiding trick, and CDATA sections (<![CDATA[...]]>) are not parsed as CDATA literals (which leads to a JS syntax error in HTML since HTML's <script> element produces an implicit CDATA section, and therefore cannot contain explicit CDATA sections). someone verify the above Known bugs and limitations It is not currently possible to access a DOM object through E4X (bug 270553). E4X doesn't sup
port parsing XML declaration. <?xml version=...?>) (see bug 336551). You may get SyntaxError "xml is a reserved identifier" (despite the XML being in a string). Workaround: var response = xmlhttprequest.responseText; // bug 270553 response = response.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551 var e4x = new XML(response); Resources E4X Tutorial Processing XML ...
Date.getVarDate() - Archive of obsolete content
Warning: This method is sup
ported in Internet Explorer only. The getVarDate method returns a VT_DATE value from a Date object. Syntax dateObj.getVarDate() Parameters The required dateObj reference is a Date object. Return Value Returns a VT_DATE value. Remarks The getVarDate() method is used when JavaScript code interacts with COM objects, ActiveX objects, or other objects that accept and return date values in VT_DATE format. These include objects in Visual Basic and Visual Basic Scripting Edition (VBScript). The actual format of the returned value depends on regional settings. ...
...object. Return Value Returns a VT_DATE value. Remarks The getVarDate() method is used when JavaScript code interacts with COM objects, ActiveX objects, or other objects that accept and return date values in VT_DATE format. These include objects in Visual Basic and Visual Basic Scripting Edition (VBScript). The actual format of the returned value depends on regional settings. Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, and Internet Explorer 10 standards. Not sup
ported in Windows 8.x Store apps. Applies To: Date Object See Also Date.getDate() Date.parse() ...
Enumerator - Archive of obsolete content
The Enumerator object enables enumeration of items in a collection. Syntax enumObj = new Enumerator([collection]) Parameters enumObj The variable name to which the Enumerator object is assigned. collection Optional Any Collection object. Remarks Collections differ from arrays in that the members of a collection are not directly accessible. Instead of using indexes, as you would with arrays, you can move the current item pointer only to the first or next element of a collection. ...
... Enumerator object has no properties. Methods Enumerator.atEnd Returns a Boolean value indicating if the enumerator is at the end of the collection. Enumerator.item Returns the current item in the collection. Enumerator.moveFirst Resets the current item in the collection to the first item. Enumerator.moveNext Moves the current item to the next item in the collection. Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, and Internet Explorer 10 standards. Not sup
ported in Windows 8.x Store apps. ...
Error.description - Archive of obsolete content
The Error.description property returns or sets the descriptive string associated with a specific error. Syntax object .description [= stringExpression] Parameters object Required. Any instance of an Error object. stringExpression Optional. A string expression containing a description of the error. Remarks The description property contains the error message string associated with a specific error. Use the value contained in this property to alert a user to an error. ...
...escription property. try { // Cause an error: x = y } catch(e) { // Prints "[object Error]": document.write(e) document.write (" "); // Prints 5009: document.write((e.number & 0xFFFF)) document.write (" "); // Prints "'y' is undefined": document.write(e.description); document.write (" "); // Prints "'y' is undefined": document.write(e.message) } Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). Applies To: Error Object See Also number Property (Error) message Property (Error) name Property ...
Error.number - Archive of obsolete content
The Error.number property returns or sets the numeric value associated with a specific error. The Error object's default property is number. Syntax object .number [= errorNumber] Parameters Object Any instance of the Error object. errorNumber An integer representing an error. Remarks An error number is a 32-bit value. The upper 16-bit word is the facility code, and the lower word is the error code. To determine the error code, use the & (bitwise And) operator to combine the number property with the hexadecimal number 0xFFFF. ...
...); document.write (e.number & 0xFFFF) document.write ("<br />"); document.write ("Facility Code: ") document.write(e.number>>16 & 0x1FFF) document.write ("<br />"); document.write ("Error Message: ") document.write (e.message) } Example The output of this code is as follows. Error Code: 5009 Facility Code: 10 Error Message: 'y' is undefined Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). Applies To: Error Object See Also description Property (Error) message Property (Error) name Prop...
ScriptEngineBuildVersion - Archive of obsolete content
Non-standard. Do not use! ...
...n() Remarks The return value corresponds directly to the version information contained in the dynamic-link library (DLL) for the scripting language in use. Example The following example illustrates the use of the ScriptEngineBuildVersion function: if(window.ScriptEngineBuildVersion) { console.log(window.ScriptEngineBuildVersion()); } // Output: <current build version> Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). ScriptEngine Function ScriptEngineMajorVersion Function ScriptEngineMinorVersion Function ...
ScriptEngineMajorVersion - Archive of obsolete content
Non-standard. Do not use! ...
...ineMajorVersion() Remarks The return value corresponds directly to the version information contained in the dynamic-link library (DLL) for the scripting language in use. Example The following example illustrates the use of the ScriptEngineMajorVersion function: if (window.ScriptEngineMajorVersion) { console.log(window.ScriptEngine()); } Output: <current major version> Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). ...
ScriptEngineMinorVersion - Archive of obsolete content
Non-standard. Do not use! ...
...() Remarks The return value corresponds directly to the version information contained in the dynamic-link library (DLL) for the scripting language in use. Example The following example illustrates the use of the ScriptEngineMinorVersion function. if (window.ScriptEngineMinorVersion) { console.log(window.ScriptEngineMinorVersion()); } //Output: <current minor version> Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). ...
VBArray - Archive of obsolete content
The VBArray object provides access to Visual Basic safe arrays. Syntax varName = new VBArray(safeArray) Parameters varName The variable name to which the VBArray is assigned. safeArray A VBArray value. Remarks VBArrays are read-only, and cannot be created directly. The safeArray argument must have obtained a VBArray value before being passed to the VBArray constructor. This can only be done by retrieving the value from an existing ActiveX or other object. VBArrays can have multiple dimensions. The indices of each dimension can be different. ...
... Returns the number of dimensions in a VBArray. VBArray.getItem Returns the item at the specified location. VBArray.lbound Returns the lowest index value used in the specified dimension of a VBArray. VBArray.toArray Returns a standard JavaScript array converted from a VBArray. VBArray.ubound Returns the highest index value used in the specified dimension of the VBArray. Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, and Internet Explorer 10 standards. Not sup
ported in Windows 8.x Store apps. ...
New in JavaScript 1.5 - Archive of obsolete content
compare JavaScript 1.5 to JScript version 5.5 and Internet Explorer 5.5, which was released in July 2000. The corresponding ECMA standard is ECMA-262 Edition 3 (from December 1999). New features in JavaScript 1.5 Number.prototype.toExponential() Number.prototype.toFixed() Number.prototype.toPrecision() const is now a reserved word. Multiple catch clauses in a try...catch statement are sup
ported. JavaScript authors can now add getters and setters to their objects. Changed functionality in JavaScript 1.5 Runtime errors are now re
ported as exceptions. Regular Expression changes: Quantifiers -- +, *, ? and {} -- can now be followed by a ? to force them to be non-greedy. Non-capturing parentheses, (?:x) can be used instead of capturing parentheses, (x). When non-capturing p...
...Both assert a match depending on what follows the string being matched. The m flag has been added to specify that the regular expression should match over multiple lines. Functions can now be declared inside an if clause. Functions can now be declared inside an expression. ...
New in JavaScript 1.8.5 - Archive of obsolete content
function in the context provided (with a given sequence of arguments). bug 429507 New ECMAScript5 features get and set operators now allows the identifier to be numeric or a string. bug 520696 Function.apply() can accept any array-like object as the arguments list, instead of only true arrays. strict mode sup
port Array.toString() now works even on non-arrays by either returning the result of calling its join() method if one is available or by calling its toString() method. Other standardization work Various non-standard syntaxes for defining getters and setters have been removed; ECMAScript 5 defined syntax has not been changed. These were all pretty esoter...
...es for defining getters and setters have been removed; ECMAScript 5 defined syntax has not been changed. These were all pretty esoteric and rarely used; if this affects you, see this blog post for details. New objects Object Description Old Proxy API Offers sup
port for creating Object and Function proxies that enable meta-programming in JavaScript. Changed functionality in JavaScript 1.8.5 ISO 8601 sup
port in Date: The Date object's parse() method now sup
ports simple ISO 8601 format date strings. Global objects made read only: The NaN, Infinity, and undefined global objects have...
New in JavaScript - Archive of obsolete content
This chapter contains information about JavaScript's version history and implementation status for Mozilla/SpiderMonkey-based JavaScript applications, such as Firefox. ECMAScript versions Language resources Learn more about the ECMAScript standards on which the JavaScript language is based on. ECMAScript 5 sup
port Implementation status for the current standard ECMA-262 Edition 5.1 in Mozilla-based engines and products. ECMAScript 2015 sup
port Implementation status for the draft ECMA-262 Edition 6 (ES2015) in Mozilla-based engines and products. ECMAScript Next sup
port Implementation status for upcoming ECMA-262 features as per the yearly (ES2016/ES2017/ES2018/...) release schedule in Mozilla-based engines and products. JavaScript versions Deprecated ( ). The explicit versioning a...
... in Firefox 2. Released in October 2006. Includes generators, iterators, array comprehensions, let expressions, and destructuring assignment. JavaScript 1.8 Version shipped in Firefox 3. Released in June 2008. Includes expression closures, generator expressions and Array.reduce() JavaScript 1.8.1 Version shipped in Firefox 3.5. Released on June 30, 2009. Includes the TraceMonkey JIT and sup
ports native JSON. JavaScript 1.8.2 Version shipped in Firefox 3.6. Released June 22, 2009. Includes only minor changes. JavaScript 1.8.5 Version shipped in Firefox 4. Released July 27, 2010. Includes many new features for ECMA-262 Edition 5 compliance. This is the last JavaScript version. ...
Archived JavaScript Reference - Archive of obsolete content
yteLength of the oldBuffer is used. This operation leaves oldBuffer in a detached state.Date.prototype.toLocaleFormat()The non-standard toLocaleFormat() method converts a date to a string using the specified formatting. Intl.DateTimeFormat is an alternative to format dates in a standards-compliant way. See also the newer version of Date.prototype.toLocaleDateString().ECMAScript 2016 to ES.Next sup
port in MozillaExpression closuresExpression closures are a shorthand function syntax for writing simple functions.for each...inThe for each...in statement iterates a specified variable over all values of object's properties. For each distinct property, a specified statement is executed.Function.arityNot part of any standard.Function.prototype.isGenerator()The non-standard isGenerator() method used to...
... legacy generator functions with the specified parameters.Legacy generator function expressionThe function keyword can be used to define a legacy generator function inside an expression. ...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
s abandoned fairly quickly, the class name stuck, kind of like a barnacle. Giving the Fish Some Style With the markup all set, it was time to style. The idea was to have the fish listed in a side-by-side arrangement, sort of like a two-column table, only without the table. This was most easily accomplished by floating the div elements themselves. Since I wanted them to be side by side, it was im
portant to be sure the total width of the element boxes (including margins) was less than 50%, so the first step was this: div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} By making the content of each card 45% the width of the containing element, and adding 2% margin to both the left and right sides, each card's element box is 49% as wide as the parent. Two of them side by side will take ...
...3 {margin: 0 0 0 4px; padding: 0.2em 0 1px 150px; border: 1px solid #339; border-left: 5px double #339; background: #EEC url(body-bg-tan.jpg) bottom left no-repeat fixed; color: #339;} div.card p {margin: 0.5em 0.5em 0.5em 160px;} And voila! The cards are done. Conclusion Redesigning a classic is something like being asked to reviseMoby Dick for modern audiences: you're thrilled at the op
portunity, but afraid of doing injustice to the original. I'd like to think that the final result was in keeping with the original spirit of the Amazing Netscape Fish Cam page while giving it a nice new CSS-driven look. I hope that our little cruise through this aspect of the redesign has gotten you hooked on the idea of using simple markup and CSS to create interesting effects, if you weren't alread...
Requests For Enhancement - Archive of obsolete content
component of the 'Core' product. An additional way to attract the XForms team's attention to an enhancement request you are promoting is to vote for the bug that is related with the feature request (if there is no bug yet then please feel free to file it). Then you can give a vote by clicking on the 'vote' link on the bug page. The XForms team looks at votes to help determine which bug is more im
portant for our XForms users. RFE categories XForms API This section contains RFE to the XForms API. Custom Controls I think that XForms is a great way to show that 14 year old HTML hacks CAN build really powerful web apps and reduce the need for JavaScript by 90%. Now we need to start teaching XForms to web newcomers before they are brainwashed into believing that the only way to build cool w...
...ild really powerful web apps and reduce the need for JavaScript by 90%. Now we need to start teaching XForms to web newcomers before they are brainwashed into believing that the only way to build cool web apps is to do DOM surgery with Javascript! Dan McCreary. One of the outstanding features of XForms is that it can work with any XML host language. Natively, the Mozilla XForms implementation sup
ports XForms elements being hosted in XHTML and XUL documents. But a form author is not restricted to only those XML languages that Gecko knows. A lot of the XForms capabilities are reachable by using our Custom Controls interfaces. Our Custom Control interfaces allows for the exchange of data between any XML element and and an XForms model. This means that an author can write powerful Mozilla-based a...
XForms Input Element - Archive of obsolete content
The default value is 'false'. ...
...sed xforms element to show and change the instance data to which this xforms control is bound (see the spec). Attributes UI Common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control accesskey - used to specify the keyboard shortcut for focusing this control Single-Node Binding Special inputmode - not sup
ported for this control incremental - sup
ported. The default value is 'false'. Mozilla Extensions labelposition - only for boolean types: show the label before or after the checkbox (see below) Type restrictions The input element can be bound to a node containing simple content of any data type except xsd:base64Binary, xsd:hexBinray or any data type derived from these. Representations The xforms...
XForms Repeat Element - Archive of obsolete content
l serve as the context node for any relative xpath expressions in that set of repeated markup. Attributes UI Common appearance - the value of this attribute gives a hint to the XForms processor as to which type of widget(s) to use to represent this control. Node Set Binding Special startindex - optional 1-based initial value of the repeat index. The default value is 1. number - isn't sup
ported Type restrictions The repeat element can be bound to a nodeset. Representations The repeat element doesn't have a visual representation. However, it can influence the layout of generated controls depending on its appearance attribute. default layout Each generated control set is placed vertically. compact layout Each generated control set is placed horizontally. Occurs when the rep...
... repeat-number Additionally, when using XForms Action setindex, its repeat attribute (which contains an IDREF) can point to any element carrying these repeat attributes. Similarly, the index function can be used with the repeating structures created via these repeat-attributes. The id of the element that contains the repeat attributes can be used as the argument to index. Note, we don't fully sup
port attribute-based repeats. There are a number of errors that may occur, especially when these attributes are used with html:table. Be sure to test your form carefully. Example <xforms:model id="i_model"> <xforms:instance xmlns=""> <data xmlns:html="http://www.w3.org/1999/xhtml" xmlns=""> <val id="1"> <nest>Nest 1.1</nest> <nest>Nest 1.2</nest> </val> <val ...
XForms - Archive of obsolete content
See the HTML Forms Guide for approaches to creating forms in HTML5. XForms Essentials An online book giving you a guided tour of XForms. XForms were envisioned as the future of online forms as envisioned by the W3C. ...
...XForms brings to the table is the separation of data from presentation, strong data typing, the ability to submit XML data to servers instead of name/value pairs, and a descriptive way to author forms so that they can be displayed by a wide variety of devices. XForms is a W3C specification. XForms Tutorial and Cookbook XForms in Wikibook Format - Over 50 examples tested with Firefox. XForms sup
port can be added to Firefox and SeaMonkey by installing the Mozilla XForms extension. This extension, while sup
porting a significant subset of the XForms 1.0 and 1.1 candidate recommendations, is not actively maintained any more since about 2010. The last official release has been done for Firefox 3.6 and is available for download on addons.mozilla.org. For more details about the future of the Mozil...
Introduction to game development for the Web - Game development
Also useful to help make your game playable even when the user isn't connected to the Web (such as when they're stuck on an airplane for hours on end). JavaScript JavaScript, the programming language used on the Web, is blazing fast in modern browsers and getting faster all the time. Use its power to write the code for your game, or look at using technologies like Emscripten or Asm.js to easily
port your existing games. Pointer Lock API The Pointer Lock API lets you lock the mouse or other pointing device within your game's interface so that instead of absolute cursor positioning you receive coordinate deltas that give you more precise measurements of what the user is doing, and prevent the user from accidentally sending their input somewhere else, thereby missing im
portant action. SVG (S...
..., game data, or anything else, even if it's not in a native JavaScript format. Web Audio API This API for controlling the playback, synthesis, and manipulation of audio from JavaScript code lets you create awesome sound effects as well as play and manipulate music in real time. WebGL Lets you create high-performance, hardware-accelerated 3D (and 2D) graphics from Web content. This is a Web-sup
ported implementation of OpenGL ES 2.0. WebRTC The WebRTC (Real-Time Communications) API gives you the power to control audio and video data, including teleconferencing and transmitting other application data back and forth between two users. Want your players to be able to talk to each other while blowing up monsters? This is the API for you. WebSockets The WebSocket API lets you connect your app...
2D collision detection - Game development
ts of the two circles and ensuring the distance between the centre points are less than the two radii added together. Playable code <div id="cr-stage"></div> <p>Move the circle with arrow keys. ...
...ring the distance between the centre points are less than the two radii added together. Playable code <div id="cr-stage"></div> <p>Move the circle with arrow keys. ...
Building up a basic demo with A-Frame - Game development
ment world, but it targets web developers with a familiar markup structure, manipulable with JavaScript. The end result is 3D web experiences, which are VR-enabled by default. Environment setup Let's start by setting up an environment to create something with A-Frame. We'll then build up a demo and run it. You should start off by: Making sure you are using a modern browser with good WebGL sup
port (and WebXR sup
port if you have available VR or AR hardware) such as the latest Firefox or Chrome -- download Firefox Nightly or Chrome (v54 or higher). (Optional) set up a VR device such as Oculus Rift or Google Cardboard. Create a new directory to store your project in. Save a copy of the latest A-Frame JavaScript library file inside your directory (check the GitHub repository for latest stab...
...heck it out on GitHub. That was easier than you thought, right? A-Frame targets web developers by offering easy to use web markup and all the advantages that brings, such as JavaScript manipulation. It is easy to start with, but also provides a powerful API for advanced concepts, as well as dealing with cross browser differences and suchlike. The community is growing, just like the number of sup
ported VR devices -- it's a great time to start experimenting with such frameworks. ...
Building up a basic demo with Babylon.js - Game development
have already worked through our Building up a basic demo series with Three.js, PlayCanvas or A-Frame (or you are familiar with other 3D libraries) you'll notice that Babylon.js works on similar concepts: camera, light and objects. Environment setup To start developing with Babylon.js, you don't need much. You should start off by: Making sure you are using a modern browser with good WebGL sup
port, such as the latest Firefox or Chrome. Creating a directory to store your experiments in. Saving a copy of the latest Babylon.js engine inside your directory. Opening the Babylon.js documentation in a separate tab -- it is useful to refer to. HTML structure Here's the HTML structure we will use: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>MDN Games: Babylon.js demo...
...The first <script> element includes the Babylon.js library in the page; we will write our example code in the second one. There is one helper variable already included, which will store a reference to the <canvas> element. Before reading on, copy this code to a new text file and save it in your working directory as index.html. Initialising the Babylon.js engine We have to create a Babyl...
Building up a basic demo with the PlayCanvas engine - Game development
on the screen. If you have already worked through our Building up a basic demo with Three.js article (or you are familiar with other 3D libraries) you'll notice that PlayCanvas works on similar concepts: camera, light and objects. Environment setup To start developing with PlayCanvas, you don't need much. You should start off by: Making sure you are using a modern browser with good WebGL sup
port, such as the latest Firefox or Chrome. Creating a directory to store your experiments in. Saving a copy of the latest PlayCanvas engine inside your directory. Opening the PlayCanvas documentation in a separate tab -- it is useful to refer to. HTML structure Here's the HTML structure we will use. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>MDN Games: PlayCanvas demo<...
...The first <script> element includes the PlayCanvas library in the page; we will write our example code in the second one. There is one helper variable already included, which will store a reference to the <canvas> element. Before reading on, copy this code to a new text file and save it in your working directory as index.html. PlayCanvas application To begin developing our game we have ...
GLSL Shaders - Game development
earer to understand, so you can just focus on the shader code. Three.js and other 3D libraries abstract a lot of things for you -- if you wanted to create such an example in raw WebGL, you'd have to write a lot of extra code to actually make it work. Environment setup To start with the WebGL shaders you don't need much. You should: Make sure you are using a modern browser with good WebGL sup
port, such as the latest Firefox or Chrome. Create a directory to store your experiments in. Save a copy of the latest minimized Three.js library inside your directory. HTML structure Here's the HTML structure we will use. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>MDN Games: Shaders demo</title> <style> body { margin: 0; padding: 0; font-size: 0; } canvas { width: 100%; ...
...'s code goes here </script> <script id="fragmentShader" type="x-shader/x-fragment"> // fragment shader's code goes here </script> <script> // scene setup goes here </script> </body> </html> It contains some basic information like the document <title>, and some CSS to set the width and height of the <canvas> element that Three.js will insert on the page to be the full size of the view
port. The <script> element in the <head> includes the Three.js library in the page; we will write our code into three script tags in the <body> tag: The first one will contain the vertex shader. The second one will contain the fragment shader. The third one will contain the actual JavaScript code generating the scene. Before reading on, copy this code to a new text file and save it in your work...
3D games on the Web - Game development
For rich gaming experiences on the web, the weapon of choice is WebGL, which is rendered on HTML <canvas>. WebGL is basically an OpenGL ES 2.0 for the Web -- it's a JavaScript API providing tools to build rich interactive animations and of course, also games. You can generate and render dynamic 3D graphics with JavaScript that is hardware accelerated. Documentation and browser sup
port The WebGL project documentation and specification is maintained by the Khronos Group, not the W3C as with most of the web APIs. Sup
port on modern browsers is very good, even on mobile, so you don't have to worry about that too much. The main browsers are all sup
porting WebGL and all you need to focus on is optimizing the performance on the devices you use. There's an ongoing effort on releasing WebGL 2.0 (bas...
...lding up a basic demo with Three.js Three.js, like any other library, gives you a huge advantage: instead of writing hundreds of lines of WebGL code to build anything interesting you can use built-in helper functions to do it a lot easier and faster. See the Building up a basic demo with Three.js subpage for the step-by-step process of creating the demo. Other tools Both Unity and Unreal can ex
port your game to WebGL with asm.js, so you're free to use their tools and techniques to build games that will be ex
ported to the web. Where to go next With this article we just scratched the surface of what's possible with currently available technologies. You can build immersive, beautiful and fast 3D games on the Web using WebGL, and the libraries and frameworks build on top of it. Source code...
Desktop gamepad controls - Game development
Previous Overview: Control mechanisms Next Now we'll look at adding something extra -- sup
port for gamepad controls, via the Gamepad API. It brings a console-like experience to your web games. The Gamepad API gives you the ability to connect a gamepad to your computer and detect pressed buttons directly from the JavaScript code thanks to the browsers implementing such feature. An API exposes all the information you need to hook up your game's logic and successfully control the user interface and gameplay. ...
... console-like experience to your web games. The Gamepad API gives you the ability to connect a gamepad to your computer and detect pressed buttons directly from the JavaScript code thanks to the browsers implementing such feature. An API exposes all the information you need to hook up your game's logic and successfully control the user interface and gameplay. API status, browser and hardware sup
port The Gamepad API is still in Working Draft status, although browser sup
port is already quite good -- around 63% global coverage, according to caniuse.com. The list of sup
ported devices is also quite extensive -- most popular gamepads (e.g. XBox 360 or PS3) should be suitable for web implementations. Pure JavaScript approach Let's think about implementing pure JavaScript gamepad controls in our ...
Mobile touch controls - Game development
screen. touchmove is fired when they move the finger on the screen while touching it touchend is fired when the user stops touching the screen touchcancel is fired when a touch is cancelled, for example when the user moves their finger outside of the screen. Note: The touch events reference article provides more examples and information. Pure JavaScript demo Let's implement the mobile sup
port in a little demo available on GitHub, so we can move the player's ship by touching the screen on a mobile device. We will use two events: touchstart and,touchmove both handled by one function. Why? The function touchHandler will assign proper variables to the ship's position so that we can use it for both cases: when the player touches the screen but doesn't move it (touchstart), and when the fi...
...the screen and is 80 pixels wide. The stick being pressed can be handled during the gameplay in the update function like so: if(this.stick.isDown) { // move the player } We can adjust the player's velocity based on the current angle of the stick and move him appropriately. Summary That covers adding touch controls for mobile; in the next article we'll see how to add keyboard and mouse sup
port. Overview: Control mechanisms Next ...
Implementing game control mechanisms - Game development
in JavaScript right now, but it should be fairly easy to reuse the knowledge contained within these articles when building games in pure JavaScript or any other framework. If you're looking for a good introduction to Phaser, then check the 2D breakout game using Phaser tutorial. In the following articles we will show how to implement various different control mechanisms for Captain Rogers to sup
port different platforms -- from touch on mobile, through keyboard/mouse/gamepad on desktop, to more unconventional ones like TV remote, shouting to or waving your hand in front of the laptop, or squeezing bananas. Setting up the environment Let's start with a quick overview of the game's folder structure, JavaScript files and in-game states, so we know what's happening where. The game's folders loo...
...boolean variable on every frame of the game. That should give you some understanding of the project structure. We'll be playing mostly with the MainMenu.js and Game.js files, and we'll explain the code inside the create() and update() methods in much more detail in later articles. Pure JavaScript demo There's also a small online demo with full source code available on GitHub where the basic sup
port for the control mechanisms described in the articles is implemented in pure JavaScript. It will be explained in the given articles themselves below, but you can play with it already, and use the code however you want for learning purposes. The articles JavaScript is the perfect choice for mobile gaming because of HTML5 being truly multiplatform; all of the following articles focus on the APIs p...
Efficient animation for web games - Game development
We touch on CSS transitions and CSS animations, and JavaScript loops involving window.requestAnimationFrame. There are several techniques worth knowing that will improve the performance of your game or application whilst also using less battery life, especially on low-end devices. It is worth documenting some of these things, as there is evidence to suggest (in popular and widely-used UI libraries, for example) that they aren't necessarily common knowledge. First off, let us discuss some basic ideas. ...
...hardware (for the record, it's almost there on Galaxy Nexus-class hardware) while still being playable on low-end devices (such as a Firefox OS Geeksphone Keon). It would have been good to use as much third party software as possible, but most of what we tried was either too complicated for simple use-cases, or had performance issues on mobile. How this conclusion was reached, however, is more im
portant than the conclusion itself. To begin with, the priority was to write the code quickly to iterate on gameplay (and we'd certainly recommend doing this). We assumed that our own, naive code was making the game slower than we would like. To an extent, this was true: we found plenty to optimise in our own code, but it got to the point where we knew what we were doing ought to perform quite well, a...
Techniques for game development - Game development
vaScript can be compiled off the main thread and be cached for future game running, resulting in a significant performance improvement for your users. This article explains how. Optimizing startup performance How to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device. Using WebRTC peer-to-peer data channels In addition to providing sup
port for audio and video communication, WebRTC lets you set up peer-to-peer data channels to exchange text or binary data actively between your players. This article explains what this can do for you, and shows how to use libraries that make this easy. Efficient animation for web games This article covers techniques and advice for creating efficient animation for web games, with a slant towards supp...
...Web-based audio is maturing fast, but there are still many browser differences to negotiate. ...
Visual-js game engine - Game development
m/frenchtoast747/webgl-obj-loader Textures download from http://textures.com More texture downloads http://www.textures4photoshop.com/ Female Body v3.blend this file has been released by AndresCuccaro under the following license: Creative Commons Attribution 3.0 About GUI for windows (canvas2d part only) : windows GUI application version 1.0 (using visual-js 0.9 lib) Im
portant : you will need NET 4.5.2 minimum also redistribution pack for c++ How to start project ? 1) Click CREATE APPLICATION 2) Enter new application name in input prompt 3) Select folder for server part of application (im
portant : www is not secure place) 4) Select folder for client part of application ( any path in www) 5) New app name will appear in project list , select and click OPEN APPL...
... Inserting new code will be always at current line selected intro editor . Save on drop menu or better with ctrl+s before testing in browsers. Adding new script explanation : After adding new script and save script if you have extra changes , open starter/run.js and you will found line : SYS.SCRIPT.LOAD("scripts/new_script.js") ctrl+S Use from menu Run->Choose browser for testing . - im
portant safari not working at the moment chrome , firefox , opera Tutorial - Pencil (Animation path) : How to use Pencil tool to create PATH object . Path object can be saved intro localhost , you can collect object and put it direct source code . File location : starter/templates/paths.js Templetes are made from visual-js core also . See source code : paths.js See the Pen Visual js -...
Visual JS GE - Game development
mkdirp npm install socket.io npm install nodemailer@0.7.0 Setting up config.js You will find config.js in the server_instance folder: All Node.js applications use the same folder -- server_instance. Some apps might need to have local storage, for instance, editor.js. ...
...ome apps might need to have local storage, for instance, editor.js. You need to edit the config file to include the correct paths to the node app and project instance, as indicated below: module.ex
ports = { VERSION : "0.5", PATH_OF_NODE_APP : "D:/PATH_TO_SERVER_INSTANCE_FOLDER/server/" , // EDIT HERE PATH_OF_WWW : "D:/xamp/htdocs/project_instance/", // PATH_TO_WWW EDIT HERE EDITOR_
PORT : "1013", REG_PATH : "users/", ACCOUNT_
PORT : 3666 , DESTROY_SESSION_AFTER_X_mSECONDS : 20000, }; local node.js application tools (uses in developer mode only) The following section provides information about the tools involved in Visual-JS game engine. In page editor Found at server_instance/editor.js. build_from_editor_to_visual_js Found at server_instance/build_from_editor...
Domain sharding - MDN Web Docs Glossary: Definitions of Web-related terms
ber of active connections per domain, serving all the required resources from a single domain could be slow as assets need to be downloaded sequentially. ...
... be downloaded sequentially. With domain sharding, the required downloads are served from more than one domain, enabling the browser to simultaneously download needed resources. ...
Polyfill - MDN Web Docs Glossary: Definitions of Web-related terms
The reason why polyfills are not used exclusively is for better functionality and better performance. Native implementations of APIs can do more and are faster than polyfills. ...
... The reason why polyfills are not used exclusively is for better functionality and better performance. Native implementations of APIs can do more and are faster than polyfills. ...
QUIC - MDN Web Docs Glossary: Definitions of Web-related terms
It provides multiplexing, flow control, security and congestion control. Key features of QUIC include: Reduction in connection establishment time. Improved congestion control. ...
...ented on UDP. It was developed by Google as a way to experiment with ways to improve TCP and web application delivery. As TCP is built into the kernel of many operating systems being able to experiment with changes, test them and implement modifications is an extremely slow process. The creation of QUIC allows developers to conduct experiments and try new things faster. QUIC was designed to sup
port the semantics of HTTP/2. It provides multiplexing, flow control, security and congestion control. Key features of QUIC include: Reduction in connection establishment time. Improved congestion control. Multiplexing without head-of-line blocking. Forward error correction. Connection migration. There is limited browser and server sup
port for QUIC today. Resources Chromium Projects Docu...
SVG - MDN Web Docs Glossary: Definitions of Web-related terms
Based on an XML syntax, SVG can be styled with CSS and made interactive using JavaScript. HTML5 now allows direct embedding of SVG tags in an HTML document. ...
... Based on an XML syntax, SVG can be styled with CSS and made interactive using JavaScript. HTML5 now allows direct embedding of SVG tags in an HTML document. ...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
XML Inclusions (XInclude) is a W3C Recommendation to allow inclusion of XML more different sources in a more convenient fashion than XML external entities. When used in conjunction with XPointer (Firefox sup
ports a subset of it, and is used in the code sample below), XInclude can also target just specific
portions of a document for inclusion. Firefox does not sup
port it natively, but the following function aims to allow its use with documents passed into it. Code sample The following code aims to let <xi:include> and <xi:fallback> tags (the two elements in the language) with all of the attributes of <xi:include> be included in an XML document so as to be resolvable into a single XML document. (Note that this has not been thoroughly tested for all circumstances and may not necessaril...
... break; } request.send(null); if((request.status === 200 || request.status === 0) && request[responseType] !== null) { response = request[responseType]; if (responseType === 'responseXML') { // apply xpointer (only xpath1() subset is sup
ported) var responseNodes; if (xpointer) { var xpathResult = response.evaluate( xpointer, response, null, ...
XLink - MDN Web Docs Glossary: Definitions of Web-related terms
XLink is a W3C standard which is used to describe links between XML and XML or other documents. Some its behaviors are left to the implementation to determine how to handle. Simple XLinks are "sup
ported" in Firefox (at least in SVG and MathML), though they do not work as links if one loads a plain XML document with XLinks and attempts to click on the relevant points in the XML tree. For those who may have found XLink 1.0 cumbersome for regular links, XLink 1.1 drops the need to specify xlink:type="simple" for simple links. XLink is used in SVG, MathML, and other im
portant standards. ...
... in the XML tree. For those who may have found XLink 1.0 cumbersome for regular links, XLink 1.1 drops the need to specify xlink:type="simple" for simple links. XLink is used in SVG, MathML, and other im
portant standards. Specification XLink 1.0 XLink 1.1 (currently a Working Draft) See also XML in Mozilla Code snippets:getAttributeNS - a wrapper for dealing with some browsers not sup
porting this DOM method Code snippets:xml:base function - a rough attempt to find a full XLink-based on an xlink:href attribute (or <xi:include href=>) and its or an ancestor's xml:base. ...
Assessment: Accessibility troubleshooting - Learn web development
ed with a fictional nature site displaying a "factual" article about bears. As it stands, it has a number of accessibility issues -- your task is to explore the existing site and fix them to the best of your abilities, answering the questions given below. Color The text is difficult to read because of the current color scheme. Can you do a test of the current color contrast (text/background), re
port the results of the test, and then fix it by changing the assigned colors? Semantic HTML The content is still not very accessible -- re
port on what happens when you try to navigate it using a screenreader. Can you update the article text to make it easier for screenreader users to navigate? The navigation menu part of the site (wrapped in <div class="nav"></div>) could be made more accessibl...
...add paragraph elements, you'll notice the styling looking better. The images The images are currently inaccessible to screenreader users. Can you fix this? The audio player The <audio> player isn't accessible to hearing impaired (deaf) people -- can you add some kind of accessible alternative for these users? The <audio> player isn't accessible to those using older browsers that don't sup
port HTML5 audio. How can you allow them to still access the audio? The forms The <input> element in the search form at the top could do with a label, but we don't want to add a visible text label that would potentially spoil the design and isn't really needed by sighted users. How can you add a label that is only accessible to screenreaders? The two <input> elements in the comment form have vis...
Accessibility - Learn web development
To help you achieve this, this module will cover general best practices (which are demonstrated throughout the HTML, CSS, and JavaScript topics), cross browser testing, and some tips on enforcing accessibility from the start. We'll cover accessibility in special detail. ...
...t that can create accessibility problems is multimedia -- video, audio, and image content need to be given proper textual alternatives, so they can be understood by assistive technologies and their users. This article shows how. Mobile accessibility With web access on mobile devices being so popular, and popular platforms such as iOS and Android having fully-fledged accessibility tools, it is im
portant to consider the accessibility of your web content on these platforms. This article looks at mobile-specific accessibility considerations. Assessments Accessibility troubleshooting In the assessment for this module, we present to you a simple site with several accessibility issues that you need to diagnose and fix. ...
Advanced styling effects - Learn web development
modes, and filters. Prerequisites: HTML basics (study Introduction to HTML) and an idea of how CSS works (study CSS first steps.) Objective: To get an idea about how to use some of the advanced styling effects available in modern browsers. Box shadows box-shadow allows you to apply one or more drop shadows to an element's box. Like text shadows, box shadows are sup
ported pretty well across browsers, including IE9+ and Edge. Users of older IE versions might just have to cope with no shadows, so just test your designs to make sure your content is legible without them. You can find the examples in this section at box-shadow.html (see the source code too). A simple box shadow Let's look at a simple example to get things started. First, some HTML: <article class...
...ckground images and colors set on a single element. mix-blend-mode, which blends together the element it is set on with elements it is overlapping -- both background and content. You can find a lot more examples than are available here in our blend-modes.html example page (see source code), and on the <blend-mode> reference page. Note: Blend modes are also very new, and slightly less well sup
ported than filters. There is no sup
port as yet in Edge, and Safari only sup
ports some of the blend mode options. background-blend-mode Again, let's look at some examples so we can understand this better. First, background-blend-mode -- here we'll show a couple of simple <div>s, so you can compare the original with the blended version: <div> </div> <div class="multiply"> </div> Now some CSS -- we...
CSS selectors - Learn web development
ted by the selector are referred to as the subject of the selector. In earlier articles you met some different selectors, and learned that there are selectors that target the document in different ways -- for example by selecting an element such as h1, or a class such as .special. In CSS, selectors are defined in the CSS Selectors specification; like any other part of CSS they need to have sup
port in browsers for them to work. The majority of selectors that you will come across are defined in the Level 3 Selectors specification, which is a mature specification, therefore you will find excellent browser sup
port for these selectors. Selector lists If you have more than one thing which uses the same CSS then the individual selectors can be combined into a selector list so that the rule is a...
...nding out about type, class, and ID selectors. Previous Overview: Building blocks Next Reference table of selectors The below table gives you an overview of the selectors you have available to use, along with links to the pages in this guide which will show you how to use each type of selector. I have also included a link to the MDN page for each selector where you can check browser sup
port information. You can use this as a reference to come back to when you need to look up selectors later in the material, or as you experiment with CSS generally. Selector Example Learn CSS tutorial Type selector h1 { } Type selectors Universal selector * { } The universal selector Class selector .box { } Class selectors id...
Test Your Skills: Fundamental layout comprehension - Learn web development
e images using their Assets functionality and replace the value in the src attribute to point to the new image location. Your tasks You now need to implement your layout. The tasks you need to achieve are: To display the navigation items in a row, with an equal amount of space between the items. The navigation bar should scroll with the content and then become stuck at the top of the view
port when it reaches it. The image that is inside the article should have text wrapped around it. The <article> and <aside> elements should display as a two column layout. The columns should be a flexible size so that if the browser window shrinks smaller the columns become narrower. The photographs should display as a two column grid with a 1 pixel gap between the images. You will not need to ed...
...to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. In this module Introduction to CSS layout Normal flow Flexbox Grid Floats Positioning Multiple-column layout Responsive design Beginner's guide to media queries Legacy layout methods Sup
porting older browsers Fundamental layout comprehension assessment ...
Normal Flow - Learn web development
ement in this manner, you need to set it to behave like a block level element with display: block; (or even,display: inline-block; which mixes characteristics from both.) That explains individual elements, but what about how elements interact with one another? The normal layout flow (mentioned in the layout introduction article) is the system by which elements are placed inside the browser's view
port. By default, block-level elements are laid out in the block flow direction, based on the parent's writing mode (initial: horizontal-tb) -- each one will appear on a new line below the last one, and they will be separated by any margin that is set on them. In English therefore, or any other horizontal, top to bottom writing mode, block-level elements are laid out vertically. Inline elements behav...
... flow, and how the browser lays things out by default, move on to understand how to change this default display to create the layout needed by your design. Previous Overview: CSS layout Next In this module Introduction to CSS layout Normal flow Flexbox Grid Floats Positioning Multiple-column layout Responsive design Beginner's guide to media queries Legacy layout methods Sup
porting older browsers Fundamental layout comprehension assessment ...
How do you make sure your website works properly? - Learn web development
r hosting provider forgot to give you access rights to a directory). 404: Not found Self-explanatory. We'll discuss how to solve this below. 500: Internal server error Something went wrong on the server. For instance, maybe the server-side language (PHP, .Net, etc.) stopped working, or the web server itself has a configuration problem. ...
...It turns out that we made a typo in our HTML code: unicorn_pics.png rather than unicorn_pic.png. ...
What do common web layouts contain? - Learn web development
age's main content. Footer Visible at the bottom of every page on the site. Like the header, contains less prominent global information like legal notices or contact info. These elements are quite common in all form factors, but they can be laid out different ways. Here are some examples (1 represents header, 2 footer; A main content; B1, B2 things on the side): 1-column layout. Especially im
portant for mobile browsers so you don't clutter the small screen up. 2-column layout. Often used to target tablets, since they have medium-size screens. 3-column layouts. Only suitable for desktops with big screens. (Even many desktop-users prefer viewing things in small windows rather than full-screen.) The real fun begins when you start mixing them all together: ... These are just...
...ctly related to the main content. It's a trap MICA. This is a bit trickier. It looks like a three-column layout... ...but it's not. B1 and B2 float around the main content. Remember that word "float"--it will ring a bell when you start learning about CSS. Why would you think it's a three-column layout? Because the image on the top-right is L-shaped, because B1 looks like a column sup
porting the shifted main content, and because the "M" and "I" of the MICA logo create a vertical line of force. This is a good example of a classic layout sup
porting some design creativity. Simple layouts are easier to implement, but allow yourself room to express your creativity in this area. A much trickier layout The Opera de Paris. Basically a two-column layout, but you'll notice man...
How much does it cost to do something on the Web? - Learn web development
ors can be free (GIMP, Paint.NET), moderately expensive (PaintShop Pro, less than $100), or several hundred dollars (Adobe Photoshop). You can use any of them, as they will have similar functionality, though some are so comprehensive you'll never use every feature. If at some point you need to exchange projects with other designers, you should find out what tools they're using. Editors can all ex
port finished projects to standard file formats, but each editor saves ongoing projects in its own specialized format. Most of the images on the internet are copyrighted, so it is better to check the license of the file before you use it. Sites like Pixabay provide images under CC0 license, so you can use, edit and publish them even with modification for commercial use. Media editors If you want to ...
...omplicated designs, touch up photos, or produce audio and video files. You need to upload content to a remote server (see Hosting below), so you need a modem. Your ISP can rent Internet connectivity to you for a few dollars per month, though your budget might vary, depending on your location. ISP access Make sure that you have sufficient bandwidth: Low-bandwidth access may be adequate to sup
port a 'simple' website: reasonably-sized images, texts, some CSS and JavaScript. That will likely cost you a few dozen dollars, including the rent for the modem. On the other hand, you'll need a high-bandwidth connection, such as DSL, cable, or fiber access, if you want a more advanced website with hundreds of files, or if you want to deliver heavy video/audio files directly from your web server. It...
How do you upload your files to a web server? - Learn web development
t and received this info from them: Congratulations for opening an account at Example Hosting Provider. Your account is: demozilla Your website will be visible at demozilla.examplehostingprovider.net To publish to this account, please connect through SFTP with the following credentials: SFTP server: sftp://demozilla.examplehostingprovider.net Username: demozilla Password: quickbrownfox
Port: 5548 To publish on the web, put your files into the Public/htdocs directory. Let's first look at http://demozilla.examplehostingprovider.net/ -- as you can see, so far there is nothing there: Note: Depending on your hosting provider, most of the time you'll see a page saying something like "This website is hosted by [Hosting Service]." when you first go to your web address. To connect ...
...er, follow these steps: Choose File > Site Manager... from the main menu. In the Site Manager window, press the New Site button, then fill in the site name as demozilla in the provided space. Fill in the SFTP server your host provided in the Host: field. In the Logon Type: drop down, choose Normal, then fill in your provided username and password in the relevant fields. Fill in the correct
port and other information. Your window should look something like this: Now press Connect to connect to the SFTP server. Note: Make sure your hosting provider offers SFTP (Secure FTP) connection to your hosting space. FTP is inherently insecure, and you shouldn't use it. Here and there: local and remote view Once connected, your screen should look something like this (we've connected to an ex...
What are hyperlinks? - Learn web development
target document by activating the link. Links stand out from the surrounding text by being underlined and in blue text. Tap or click a link to activate it, or if you use a keyboard, press Tab until the link is in focus and hit Enter or Spacebar. Links are the breakthrough that made the Web so useful and successful. In the rest of this article, we discuss the various types of links and their im
portance to modern Web design. Deeper dive As we said, a link is a text string tied to a URL, and we use links to allow easy jumping from one document to another. That said, there are some nuances worth considering: Types of links Internal link A link between two webpages, where both webpages belong to the same website, is called an internal link. Without internal links, there's no such thing a...
... website navigation in another article, but as a rule, whenever you add a new webpage, make sure at least one of your other pages links to that new page. On the other hand, if your site has more than about ten pages, it's counter-productive to link to every page from every other page. When you're starting out, you don't have to worry about external and incoming links as much, but they are very im
portant if you want search engines to find your site (see below for more details). Anchors Most links tie two webpages together. Anchors tie two sections of one document together. When you follow a link pointing to an anchor, your browser jumps to another part of the current document instead of loading a new document. However, you make and use anchors the same way as other links. Links and Search...
Common questions - Learn web development
in name? Domain names are a key component of the Internet infrastructure. They provide a human-readable address for any Web server available on the Internet. What is a Web server? The term "Web server" can refer to the hardware or software that serves websites to clients across the Web -- or both of them working together. In this article we go over how Web servers work, and why they're im
portant. Tools and setup Questions related to the tools/software you can use to build websites. What software do I need to build a website? In this article we explain which software components you need to edit, upload, or view a website. How much does it cost to do something on the Web? When you're launching a website, you may spend nothing or your costs may go through the roof. In ...
...e the Developer Tools in Firefox to debug and improve performance of your website, using the tools to check memory usage, the JavaScript call tree, the number of DOM nodes being rendered, and more. Design and accessibility This section lists questions related to aesthetics, page structure, accessibility techniques, etc. How do I start to design my website? This article covers the all-im
portant first step of every project: define what you want to accomplish with it. What do common Web layouts contain? When designing pages for your website, it's good to have an idea of the most common layouts. This article runs through some typical Web layouts, looking at the parts that make up each one. What is accessibility? This article introduces the basic concepts behind Web accessibi...
Add a hitmap on top of an image - Learn web development
t-side image maps only. Do not use server-side image maps, which require the user to have a mouse. Image maps, and their drawbacks When you nest an image inside <a>, the entire image links to one webpage. An image map, on the other hand, contains several active regions (called "hotspots") that each link to a different resource. Formerly, image maps were a popular navigation device, but it's im
portant to thoroughly consider their performance and accessibility ramifications. Text links (perhaps styled with CSS) are preferable to image maps for several reasons: text links are lightweight, maintainable, often more SEO-friendly, and sup
port accessibility needs (e.g., screen readers, text-only browsers, translation services). How to insert an image map, properly Step 1: The image Not just an...
...ext-only browsers, translation services). How to insert an image map, properly Step 1: The image Not just any image is acceptable. The image must make it clear what happens when people follow image links. alt text is mandatory, of course, but many people never see it. The image must clearly indicate where hotspots begin and end. Hotspots must be large enough to tap comfortably, at any view
port size. How large is large enough? 72 x 72 CSS pixels is a good minimum, with additional generous gaps between touch targets. The map of the world at 50languages.com (as of time of writing) illustrates the problem perfectly. It's much easier to tap Russia or North America than Albania or Estonia. You insert your image much the same way as always (with an <img> element and alt text). If the image ...
Advanced text formatting - Learn web development
ev.</abbr> Green did it in the kitchen with the chainsaw.</p> These will come out looking something like this (the expansion will appear in a tooltip when the term is hovered over): Note: There is another element, <acronym>, which basically does the same thing as <abbr>, and was intended specifically for acronyms rather than abbreviations. This however has fallen into disuse -- it wasn't sup
ported in browsers as well as <abbr>, and <abbr> has such a similar function that it was considered pointless to have both. Just use <abbr> instead. Active learning: marking up an abbreviation For this simple active learning assignment, we'd like you to simply mark up an abbreviation. You can use our sample below, or replace it with one of your own. Playable code <h2>Live output</h2> <div clas...
... Summary That marks the end of our study of HTML text semantics. Bear in mind that what you have seen during this course is not an exhaustive list of HTML text elements -- we wanted to try to cover the essentials, and some of the more com...
Marking up a letter - Learn web development
ng (the "Re:" line) and three second level headings. Use an appropriate list type to mark up the semester start dates, study subjects, and exotic dances. Put the two addresses inside <address> elements. Each line of the address should sit on a new line, but not be in a new paragraph. Inline semantics The names of the sender and receiver (and Tel and Email) should be marked up with strong im
portance. The four dates in the document should be have appropriate elements containing machine-readable dates. The first address and first date in the letter should have a class attribute value of sender-column. The CSS you'll add later will cause these to be right aligned, as it should be in the case in a classic letter layout. Mark up the five acronyms/abbreviations in the main text of the lette...
... a classic letter layout. Mark up the five acronyms/abbreviations in the main text of the letter to provide expansions of each acronym/abbreviation. The six sub/superscripts should be marked up appropriately -- in the chemical formulae, and the numbers 103 and 104 (they should be 10 to the power of 3 and 4, respectively). Try to mark up at least two appropriate words in the text with strong im
portance/emphasis. There are two places where the letter should have a hyperlink. Add appropriate links with titles. For the location that the links point to, you may use http://example.com as the URL. Mark up the university motto quote and citation with appropriate elements. The head of the document The character set of the document should be set as utf-8 using the appropriate meta tag. The a...
What’s in the head? Metadata in HTML - Learn web development
Previous Overview: Introduction to HTML Next The head of an HTML document is the part that is not displayed in the web browser when the page is loaded. It contains information such as the page <title>, links to CSS (if you choose to style your HTML content with CSS), links to custom favicons, and other metadata (data about the HTML, such as the author, and im
portant keywords that describe the document.) In this article we'll cover all of the above and more, in order to give you a good basis for working with markup. Prerequisites: Basic HTML familiarity, as covered in Getting started with HTML. Objective: To learn about the HTML head, its purpose, the most im
portant items it can contain, and what effect it can have on the HTML document. What is the HTML...
...r many years. It is the first icon of this type: a 16-pixel square icon used in multiple places. You may see (depending on the browser) favicons displayed in the browser tab containing each open page, and next to bookmarked pages in the bookmarks panel. ...
Test your skills: Multimedia and embedding - Learn web development
dding 1 In this task we want you to embed a simple audio file onto the page. You need to: Add the path to the audio file to an appropriate attribute to embed it on the page. The audio is called audio.mp3, and it is in a folder inside the current folder called media. Add an attribute to make browsers display some default controls. Add some appropriate fallback text for browsers that don't sup
port <audio>. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Multimedia and embedding 2 In this task we want you to mark up a slightly more complex video player, with multiple sources, subtitles, and other features besides. You need to: Add an attribute to make browsers display ...
...nload the starting point for this task to work in your own editor or in an online editor. Multimedia and embedding 2 In this task we want you to mark up a slightly more complex video player, with multiple sources, subtitles, and other features besides. You need to: Add an attribute to make browsers display some default controls. Add some appropriate fallback text for browsers that don't sup
port <video>. Add multiple sources, containing the paths to the video files. The files are called video.mp4 and video.webm, and are in a folder inside the current folder called media. Let the browser know in advance what video formats the sources point to, so it can make an informed choice of which one to download ahead of time. Give the <video> a width and height equal to its intrinsic size (320 b...
General asynchronous programming concepts - Learn web development
You should understand these concepts before working through the other articles in the module. Prerequisites: Basic computer literacy, a reasonable understanding of JavaScript fundamentals. Objective: To understand the basic concepts behind asynchronous programming, and how they manifest in web browsers and JavaScript. Asynchronous? Normally, a given program's code runs straight along, with only one thing happening at once. ...
...eads. Threads A thread is basically a single process that a program can use to complete tasks. Each thread can only do a single task at once: Task A --> Task B --> Task C Each task will be run sequentially; a task has to complete before the next one can be started. As we said earlier, many computers now have multiple cores, so can do multiple things at once. Programming languages that can sup
port multiple threads can use multiple cores to complete multiple tasks simultaneously: Thread 1: Task A --> Task B Thread 2: Task C --> Task D JavaScript is single-threaded JavaScript is traditionally single-threaded. Even with multiple cores, you could only get it to run tasks on a single thread, called the main thread. Our example from above is run like this: Main thread: Render circles to canv...
Introducing asynchronous JavaScript - Learn web development
said in the previous article, JavaScript is single threaded. Only one thing can happen at a time, on a single main thread, and everything else is blocked until an operation completes. So in the example above, after you've clicked the button the paragraph won't appear until after the OK button is pressed in the alert box. You can try it for yourself: <button>Click me</button> Note: It is im
portant to remember that alert(), while being very useful for demonstrating a synchronous blocking operation, is terrible for use in real world applications. Asynchronous JavaScript For reasons illustrated earlier (e.g. related to blocking), many Web API features now use asynchronous code to run, especially those that access or fetch some kind of resource from an external device, such as fetching a...
...t. Each .then() block returns another promise, meaning that you can chain multiple .then() blocks onto each other, so multiple asynchronous operations can be made to run in order, one after another. The catch() block at the end runs if any of the .then() blocks fail -- in a similar way to synchronous try...catch blocks, an error object is made available inside the catch(), which can be used to re
port the kind of error that has occurred. Note however that synchronous try...catch won't work with promises, although it will work with async/await, as you'll learn later on. Note: You'll learn a lot more about promises later on in the module, so don't worry if you don't understand them fully yet. The event queue Async operations like promises are put into an event queue, which runs after the m...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
elay between each call. requestAnimationFrame() The modern version of setInterval(). Executes a specified block of code before the browser next repaints the display, allowing an animation to be run at a suitable framerate regardless of the environment it is being run in. The asynchronous code set up by these functions runs on the main thread (after their specified timer has elapsed). It's im
portant to know that you can (and often will) run other code before a setTimeout() call executes, or between iterations of setInterval(). Depending on how processor-intensive these operations are, they can delay your async code even further, as any async code will execute only after the main thread is available. (In other words, when the stack is empty.) You will learn more on this matter as you prog...
... at specific times and at a constant pace, regardless of how fast or slow your device might be. The general pattern you'd use looks something like this: let startTime = null; function draw(timestamp) { if (!startTime) { startTime = timestamp; } currentTime = timestamp - startTime; // Do something based on current time requestAnimationFrame(draw); } draw(); Browser sup
port requestAnimationFrame() is sup
ported in more recent browsers than setInterval()/setTimeout(). Interestingly, it is available in Internet Explorer 10 and above. So, unless you need to sup
port older versions of IE, there is little reason to not use requestAnimationFrame(). A simple example Enough with the theory! Let's build your own personal requestAnimationFrame() example. You're going to cr...
Asynchronous JavaScript - Learn web development
Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Asynchronous JavaScript is a fairly advanced topic, and you are advised to work through JavaScript first steps and JavaScript building blocks modules before attempting this. If you are not familiar with the concept of asynchronous programming, you should definitely start with the General asynchronous programming concepts article in this module. ...
...then you can probably skip to the Introducing asynchronous JavaScript module. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you can try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides General asynchronous programming concepts In this article we'll run through a number of im
portant concepts relating to asynchronous programming, and how this looks in web browsers and JavaScript. You should understand these concepts before working through the other articles in the module. Introducing asynchronous JavaScript In this article we briefly recap the problems associated with sychronous JavaScript, and take a first look at some of the different asynchronous JavaScript techniqu...
Functions — reusable blocks of code - Learn web development
unction's parameter is optional: let myArray = ['I', 'love', 'chocolate', 'frogs']; let madeAString = myArray.join(' '); // returns 'I love chocolate frogs' let madeAString = myArray.join(); // returns 'I,love,chocolate,frogs' If no parameter is included to specify a joining/delimiting character, a comma is used by default. Function scope and conflicts Let's talk a bit about scope -- a very im
portant concept when dealing with functions. When you create a function, the variables and other things defined inside the function are inside their own separate scope, meaning that they are locked away in their own separate compartments, unreachable from code outside the functions. The top level outside all your functions is called the global scope. Values defined in the global scope are accessible ...
...These tests require skills that are covered in the next two articles, so you might want to read those first before trying it. Conclusion This article has explored the fundamental concepts behind functions, paving the way for the next one in which...
Function return values - Learn web development
We'll cover all of these below. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript first steps, Functions -- reusable blocks of code. ...
...ary. As you go further into your programming career, you'll start doing the same kinds of things over and over again. It is a good idea to create your own library of utility functions to do these sorts of things. You can copy them over to new code, or even just apply it to HTML pages wherever you need it. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Functions. Conclusion So there we have it -- functions are fun, very useful, and although there's a lot to talk about in regards to their syntax and functionality, they are fairly understandable. If there is anything you didn't understand, feel free to rea...
JavaScript building blocks - Learn web development
y, this article provides a practical experience. Here you'll get some practice with building up your own custom function. Along the way, we'll also explain some further useful details of dealing with functions. Function return values The last essential concept you must know about a function is return values. Some functions don't return a significant value after completion, but others do. It's im
portant to understand what their values are, how to make use of them in your code, and how to make your own custom functions return useful values. Introduction to events Events are actions or occurrences that happen in the system you are programming, which the system tells you about so you can respond to them in some way if desired. For example if the user clicks a button on a webpage, you might wa...
...om functions return useful values. Introduction to events Events are actions or occurrences that happen in the system you are programming, which the system tells you about so you can respond to them in some way if desired. For example if the user clicks a button on a webpage, you might want to respond to that action by displaying an information box. In this final article we will discuss some im
portant concepts surrounding events, and look at how they work in browsers. Assessments The following assessment will test your understanding of the JavaScript basics covered in the guides above. Image gallery Now that we've looked at the fundamental building blocks of JavaScript, we'll test your knowledge of loops, functions, conditionals and events by building a fairly common item you'll see ...
Fetching data from the server - Learn web development
rather than being inside the previous one (which can get unwieldy). The only other difference is that we've had to include a return statement in front of response.text(), to get it to pass its result on to the next link in the chain. Which mechanism should you use? This really depends on what project you are working on. XHR has been around for a long time now and has very good cross-browser sup
port. Fetch and Promises, on the other hand, are a more recent addition to the web platform, although they're sup
ported well across the browser landscape, with the exception of Internet Explorer. If you need to sup
port older browsers, then an XHR solution might be preferable. If however you are working on a more progressive project and aren't as worried about older browsers, then Fetch could be a goo...
...We set this to be the value of the products variable, then run initialize(products), which starts the process of displaying all the products in the user interface. To handle errors, we chain a .catch() block onto the end of the chain. This runs if the promise fails for some reason. Inside it, we include a function that is passed as a parameter, an error object. This error object can be used to re
port the nature of the error that has occurred, in this case we do it with a simple console.log(). However, a complete website would handle this error more gracefully by displaying a message on the user's screen and perhaps offering options to remedy the situation, but we don't need anything more than a simple console.log(). You can test the fail case yourself: Make a local copy of the example fi...
A first splash into JavaScript - Learn web development
program needs to do, working out what code features are needed to achieve those things, and how to make them work together. This requires a mixture of hard work, experience with the programming syntax, and practice -- plus a bit of creativity. The more you code, the better you'll get at it. We can't promise that you'll develop "programmer brain" in five minutes, but we will give you plenty of op
portunity to practice thinking like a programmer throughout the course. With that in mind, let's look at the example we'll be building up in this article, and review the general process of dissecting it into tangible tasks. Example -- Guess the number game In this article we'll show you how to build up the simple game you can see below: Top hidden code <!DOCTYPE html> <html> <head> <meta ch...
... the form elements, and empties and focuses the text field, ready for a new guess to be entered. Removes the background color from the lastResult paragraph. Generates a new random number so that you are not just guessing the same number again! At this point you should have a fully working (simple) game -- congratulations! All we have left to do now in this article is talk about a few other im
portant code features that you've already seen, although you may have not realized it. Loops One part of the above code that we need to take a more detailed look at is the for loop. Loops are a very im
portant concept in programming, which allow you to keep running a piece of code over and over again, until a certain condition is met. To start with, go to your browser developer tools JavaScript cons...
Basic math in JavaScript — numbers and operators - Learn web development
ogether. 6 + 9 - Subtraction Subtracts the right number from the left. 20 - 15 * Multiplication Multiplies two numbers together. 3 * 7 / Division Divides the left number by the right. 10 / 5 % Remainder (sometimes called modulo) Returns the remainder left over after you've divided the left number into a number of integer
portions equal to the right number. 8 % 3 (returns 2, as three goes into 8 twice, leaving 2 left over). ** Exponent Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times. It was first Introduced in EcmaScript 2016. 5 ** 2 (returns 25, which is the same as 5 * 5). Note: You'll sometimes see numbers involved in...
...chine", and update the label as appropriate. If the button is currently saying "Stop machine" when it is pressed, we swap the display back again. Note: Such a control that swaps between two states is generally referred to as a toggle. It toggles between one state and another -- light on, light off, etc. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Math. Summary In this article we have covered the fundamental information you need to know about numbers in JavaScript, for now. You'll see numbers used again and again, all the way through your JavaScript learning, so it's a good idea to get this out of th...
Useful string methods - Learn web development
This article has given you the basics that you n...
...This article has given you the basics that you need to know about manipulating strings for now. This should serve you well as you go into more complex topics in the future. ...
JavaScript object basics - Learn web development
t member another object. For example, try changing the name member from name: ['Bob', 'Smith'], to name : { first: 'Bob', last: 'Smith' }, Here we are effectively creating a sub-namespace. This sounds complex, but really it's not -- to access these items you just need to chain the extra step onto the end with another dot. Try these in the JS console: person.name.first person.name.last Im
portant: At this point you'll also need to go through your method code and change any instances of name[0] name[1] to name.first name.last Otherwise your methods will no longer work. Bracket notation There is another way to access object properties -- using bracket notation. Instead of using these: person.age person.name.first You can use person['age'] person['name']['first'] This looks very...
...ructors in a later article. Note: It is useful to think about the way objects communicate as message passing -- when an object needs another object to perform some kind of action often it sends a message to another object via one of its methods, and waits for a response, which we know as a return value. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Object basics. Summary Congratulations, you've reached the end of our first JS objects article -- you should now have a good idea of how to work with objects in JavaScript -- including creating your own simple objects. You should also appreciate that object...
JavaScript — Dynamic client-side scripting - Learn web development
course, but only in passing -- here we'll discuss it all explicitly. Introducing JavaScript objects In JavaScript, most things are objects, from core JavaScript features like strings and arrays to the browser APIs built on top of JavaScript. You can even create your own objects to encapsulate related functions and variables into efficient packages. The object-oriented nature of JavaScript is im
portant to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've provided this module to help you. Here we teach object theory and syntax in detail, look at how to create your own objects, and explain what JSON data is and how to work with it. Asynchronous JavaScript In this module we take a look at asynchronous JavaScript, why it i...
...to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've provided this module to help you. Here we teach object theory and syntax in detail, look at how to create your own objects, and explain what JSON data is and how to work with it. Asynchronous JavaScript In this module we take a look at asynchronous JavaScript, why it is im
portant, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. Client-side web APIs When writing client-side JavaScript for web sites or applications, you won't go very far before you start to use APIs -- interfaces for manipulating different aspects of the browser and operating system the site is running on, or even data from other we...
What is web performance? - Learn web development
lot of best practices to consider in making apps feel smooth, for example using CSS animations rather than JavaScript for animation, and minimizing the number of repaints the UI requires due to changes in the DOM. Perceived performance: How fast a website seems to the user has a greater impact on user experience than how fast the website actually is. How a user perceives your performance is as im
portant, or perhaps more im
portant, than any objective statistic, but it's subjective, and not as readily measurable. Perceived performance is user perspective, not a metric. Even if an operation is going to take a long time (because of latency or whatever), it is possible to keep the user engaged while they wait by showing a loading spinner, or a series of useful hints and tips (or jokes, or whatever...
...mized stays optimized. This involves a number of metrics (measurable indicators that can indicate success or failure) and tools to meaure those metrics, which we will discuss throughout this module. To summarize, many features impact performance including latency, application size, the number of DOM nodes, the number of resource requests made, JavaScript performance, CPU load, and more. It is im
portant to minimize the loading and response times, and add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience. Note: Web performance includes both objective measurements like time to load, frames per second, and time to interactive, and subjective exper...
Using Vue computed properties - Learn web development
this would only re-run when the ToDoItems array changes. To create a computed property, we need to add a computed property to our component object, much like the methods property we've used previously. Adding a summary counter Add the following code to your App component object, below the methods property. The list summary method will get the number of finished ToDoItems, and return a string re
porting this. computed: { listSummary() { const numberFinishedItems = this.ToDoItems.filter(item =>item.done).length return `${numberFinishedItems} out of ${this.ToDoItems.length} items completed` } } Now we can add {{listSummary}} directly to our template; we'll add this inside an <h2> element, just above our <ul>. We'll also add an id and an aria-labelledby attribute to assign the <h2>...
...properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript sup
port in Svelte Deployment and next steps ...
Focus management with Vue refs - Learn web development
ocus), you can use Vue refs. For custom Vue components, you can also use refs to directly access the internal structure of a child component, however this should be done with caution as it can make code harder to reason about and understand. To use a ref in a component, you add a ref attribute to the element that you want to access, with a string identifier for the value of the attribute. It's im
portant to note that a ref needs to be unique within a component. No two elements rendered at the same time should have the same ref. Adding a ref to our app So, let's attach a ref to our "Edit" Button in ToDoItem.vue. Update it like this: <button type="button" class="btn" ref="editButton" @click="toggleToItemEditForm"> Edit <span class="visually-hidden">{{label}}</span> </button> To access th...
...properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript sup
port in Svelte Deployment and next steps ...
Vue resources - Learn web development
where to go to find further information on Vue, to continue your learning. Further resources Here's where you should go to learn more about Vue: Vue Docs -- The main Vue site. Contains comprehensive documentation, including examples, cookbooks, and reference material. This is the best place to start learning Vue in depth. Vue Github Repo -- The Vue code itself. This is where you can re
port issues and/or contribute directly to the Vue codebase. Studying the Vue source code can help you better understand how the framework works, and write better code. Vue Forum -- The official forum for getting help with Vue. Vue CLI Docs -- Documentation for the Vue CLI. This contains information on customizing and extending the output you are generating via the CLI. NuxtJS -- NuxtJS is a Server-...
...properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript sup
port in Svelte Deployment and next steps ...
Cross browser testing - Learn web development
ith user groups. Handling common HTML and CSS problems With the scene set, we'll now look specifically at the common cross-browser problems you will come across in HTML and CSS code, and what tools can be used to prevent problems from happening, or fix problems that occur. This includes linting code, handing CSS prefixes, using browser dev tools to track down problems, using polyfills to add sup
port into browsers, tackling responsive design problems, and more. Handling common JavaScript problems Now we'll look at common cross-browser JavaScript problems and how to fix them. This includes information on using browser dev tools to track down and fix problems, using polyfills and libraries to work around problems, getting modern JavaScript features working in older browsers, and more. Handli...
...tting modern JavaScript features working in older browsers, and more. Handling common accessibility problems Next we turn our attention to accessibility, providing information on common problems, how to do simple testing, and how to make use of auditing/automation tools for finding accessibility issues. Implementing feature detection Feature detection involves working out whether a browser sup
ports a certain block of code, and running different code dependent on whether it does (or doesn't), so that the browser can always provide a working experience rather than crashing/erroring in some browsers. This article details how to write your own simple feature detection, how to use a library to speed up implementation, and native features for feature detection such as @sup
ports. Introduction to...
Git and GitHub - Learn web development
in that version, and then get it merged in a controlled manner (in GitHub we use pull requests) with the master version when they are done with it. VCSes provide tools to meet the above needs. Git is an example of a VCS, and GitHub is a web site + infrastructure that provides a Git server plus a number of really useful tools for working with git repositories individually or in teams, such as re
porting issues with the code, reviewing tools, project management features such as assigning tasks and task statuses, and more. Note: Git is actually a distributed version control system, meaning that a complete copy of the repository containing the codebase is made on your computer (and everyone else's). You make changes to your own copy, and then push those changes back up to the server, where an ...
...king projects is essential when you want to contribute to someone else's code. This guide explains how. About Pull Requests (from GitHub) A useful guide to managing pull requests, the way that your suggested code changes are delivered to people's repositories for consideration. Mastering issues (from GitHub) Issues are like a forum for your GitHub project, where people can ask questions and re
port problems, and you can manage updates (for example assigning people to fix issues, clarifying the issue, letting people know things are fixed). This articles gives you what you need to know about issues. Note: There is a lot more that you can do with Git and GitHub, but we feel that the above represents the minimum you need to know to start using Git effectively. As you get deeper into Git, you...
Tools and testing - Learn web development
n more tips and tricks, you'll start to come across all kind of tools, from JavaScript frameworks, to testing and automation tools, and more besides. As your web projects become larger and more complex, you'll want to start taking advantage of some of these tools, working out a reliable toolchain to give your development process superpowers. On top of that, we still need to keep cross-browser sup
port in the forefront of our minds, and make sure that our code follows best practices that allow our projects to work across different browsers and devices that our users are using to browse the Web, and be usable by people with disabilities. Working out what tools you should be using can be a difficult process, so we have written this set of articles to inform you of what types of tool are availabl...
... tools you should be using can be a difficult process, so we have written this set of articles to inform you of what types of tool are available, what they can do for you, and how to make use of the current industry favourites. Note: We have referenced a number of tools in this topic, not because we endorse them or think they are the best, but because we know they work and have good industry sup
port. In most cases there are other tools available, old ones will go out of fashion, and new ones will no doubt appear. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites You should really learn the basics of the core HTML, CSS, and JavaScript languages first befo...
Mozilla Plugin Accessibility
2. Focus gets stuck in plugin. User cannot keyboard navigate out of a plugin We will apply the same solution as in problem 4 above. The plugin will be responsible for bubbling up shift+tab and tab when the user has reached the end of the tab cycle within the plugin. The bug tracking this work is bug 93149. ? No target 3. Many plugins lack accessibility API sup
port Most plugins that work with Mozilla do not yet sup
port accessibility APIs. A notable acception is the Adobe PDF plugin on Windows, which sup
ports MSAA. In other cases, vendors need to find or be convinced of the business justification so that resources are applied to the problem. Plugin vendors. Unknown 4. Seamonkey has no message bar for plugin installation ...
...ork with Mozilla do not yet sup
port accessibility APIs. A notable acception is the Adobe PDF plugin on Windows, which sup
ports MSAA. In other cases, vendors need to find or be convinced of the business justification so that resources are applied to the problem. Plugin vendors. Unknown 4. Seamonkey has no message bar for plugin installation The message bar will be
ported to Seamonkey as part of the toolkit merging work that will occur for xulrunner. Mozilla community No target ...
ZoomText
Instructions for testers We've made a lot of progress with Mozilla/ZoomText compatibility. Here's how you can test: Download a copy of Mozilla 1.8a6 (this is not Firefox). Read the release notes if you're interested. These builds are pretty stable considering they're only alpha, I'm having very good luck with them. It doesn't do us any good to get bug re
ports on older stuff right now. Our main focus is on the browser itself, so you you only need to install mailnews or address book if curious about the other apps. You will also need to install ZoomText 8.11.3. Happy testing! You may wish to read through the current issues on this page before re
porting bugs. Send me email so that I'm aware that you're testing and let me know what bugs you're finding. My email address is aaronleven...
...o install ZoomText 8.11.3. Happy testing! You may wish to read through the current issues on this page before re
porting bugs. Send me email so that I'm aware that you're testing and let me know what bugs you're finding. My email address is aaronleventhal@moonset.net. Issues for AI Squared, from high to low priority DocReader and AppReader don't respect the structure of the document -- no sup
port for columns. ZoomText text to speech doesn't always echo what it should -- need more details from testers. Mozilla issues Cannot tab into frames and iframes. Cannot customize the sidebar with the keyboard only. Comboboxes re
port incorrect bounds, causing ZoomText tracking to move to the wrong area of the screen. ...
Lightweight themes
be anchored to the top-right corner of the browser window. View a sample Theme Header here. Image requirements Dimensions should be 3000px wide x 200px high PNG or JPG file format Image must be no larger than 300 KB in file size Tips Subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser UI. Firefox may reveal more of the lower
portion of the image if another toolbar or other UI element is added to the top of the window. The upper right-hand side of the image should have the most im
portant information - as a user increases the width of the browser window, the browser reveals more of the left-hand side of the image. Ultrawide monitors can run to 3440px wide, to look good on these monitors, ensure the left of the image fades...
...is obvious that your category and/or tags are unrelated to your theme. Describe your theme -- write a short description of your theme. Keep in mind that a reviewer may reject your theme if your description is not an accurate representation of your theme. Select a license for your theme -- decide on a copyright license for your work. Read more about the types of Creative Common licenses. Im
portant: Please be sure you have the rights to use the image in your theme! Upload your image -- make sure it is under 300 KB in size and JPG or PNG format! Select text and tab colors -- you can choose the tab ("background") color and foreground text color that work best with your header image. Submit your theme -- if everything looks right, click the Submit Theme button and you're done! You c...
Adding a new event
. Otherwise, you need to specify the path to the header file in dom/bindings/Bindings.conf. When you create a DOM event class, its name should be same as the name defined in its standard specification. And it should be in mozilla::dom namespace. For example, KeyboardEvent which is defined in DOM Level 3 Events should be implemented as mozilla::dom::KeyboardEvent. And the header file should be ex
ported as "mozilla/dom/FooEvent.h". Add the header file to EX
PORTS.mozilla.dom in dom/events/moz.build. You probably need to implement a lot of methods to the event class, but this document doesn't explain all of them. Please refer existing DOM event implementation for example. However, there are some hints: Set mEventIsInternal in the constructor of the most descendant class because each constru...
...t() If your DOM event implementation is generatable or you're in case 3, you can skip this section. The first half of EventDispatcher::CreateEvent() is a factory to create a DOM event instance from internal event instance. You need to modify this. The last half of it is the implementation of legacy event creator of Javascript such as: var event = document.createEvent("FooEvent"); If you sup
port this feature, you need to modify here. However, this feature shouldn't be implemented for compabitility with other browsers since web applications should use event constructor. Register each event into EventNameList.h If you're in case 3, you can skip this section. EventNameList.h defines mapping between DOM event name, internal event message, event handler attribute owner and internal event...
Adding a new CSS property
akes to watch out for when writing custom parsing code (which might go away if we redesign the parser along the lines described in css3-syntax): make sure to call SkipUntil() to look for the matching close parentheses, braces, or brackets whenever you hit an error inside of them. make sure to call UngetToken() if you have called GetToken() but the result is unexpected. This is particularly im
portant in case the unexpected token is a parenthesis or something else that requires matching the other half of a pair. if you're adding a preference-controlled property to a non-preference-controlled shorthand, you need to call AppendValue for that property if and only if its preference is enabled (and see next point) if you need to check a preference in custom parsing code (e.g., because you're a...
...se where the computation you do might vary between elements that match the same list of style rules, you need to set the canStoreInRuleTree variable to false. A common example of this is 'em' units, which depend on the font size. Note that use of SetCoord (if the resulting value needs to be a tagged union) or SetDiscrete is preferred when it's possible to use those functions. Also, it's very im
portant not to touch the computed style data at all when there's no specified data provided (eCSSUnit_Null); touching the computed style data in this case would break partial computation based on a start struct, which is when we computed style data on the basis of computed data we've already computed from a subset of the style rules that we're currently computing from. Then you need to change nsStyle...
Creating reftest-based unit tests
d produce a certain Sanskrit glyph. How does one test that? One should be able to "snap a picture" of the glyph as it should be displayed and then the reference page would include that graphic in an <img> element. More investigation into whether this will work is definitely warranted. Experiments with this have shown it to be not as easy as one would hope. We'll see. Here is a list of reftest op
portunities files in the source. These are files that have been checked in to be tested. Presumably, one was supposed to open the pages with a browser and look at them and see if they look right. It is hard to tell how many of these will be usable as reftests. If the file is associated with a bug, the bug should be examined. I have seen a case where the html file in the bug had a problem, but the chec...
...g, that the browser correctly "invalidates" the parts of the screen that should change so that the screen displays the correct output the next time it is repainted. Invalidation tests check both that the internal state of the document has been updated correctly, and that the browser then correctly invalidates and repaints the appropriate parts of the screen. In order to test invalidation it is im
portant that invalidation tests let the document completely finish loading and displaying before making the changes for which invalidation and repainting is to be tested. Making the changes before the document has completely finished loading and painting would mean that the test may not actually test the browser's invalidation logic, since the changed parts of the document may end up displaying correc...
Debugging on Windows
sing an undocumented feature of VC. See the blog post How to Not Step Into Functions using the Visual C++ Debugger for details. ...
... VS hang and seeing the "Downloading symbols for <library>" status at the bottom left of the main window. Problems post-mortem debugging on Windows 7 SP1 x64? If you attempt to use NS_DebugBreak etc to perform post-mortem debugging on a 64bit Windows 7, but as soon as you try and continue debugging the program crashes with an Access Violation, you may be hitting a Windows bug relating to AVX sup
port. For more details, including a work-around see this blog post or this social.msdn thread. (And just in-case those links die, the work-around is to execute bcdedit /set xsavedisable 1 from an elevated command-prompt to disable AVX sup
port.) Got a tip? If you think you know a cool Mozilla debugging trick, feel free to discuss it with #developers and then post it here. Originally by Heikki To...
Debugging
on Windows FAQ Questions (and answers) about debugging Mozilla on Windows. Debugging Mozilla on OS X Questions (and answers) about debugging Mozilla on OS X. Debugging Mozilla with gdb gdb is our primary debugger on Mac and Linux. Debugging Mozilla with lldb lldb is the new debugger on Mac. Advanced debugging techniques Understanding crash re
ports How to read crash re
ports, which are full of information yet often not easy to interpret and act on. Debugging a minidump Windows crash re
ports include a minidump, which contains a lot of information about the application when it crashed. Debugging Mozilla with valgrind Valgrind is a memory debugger for Mac and Linux. It is slow, but good for tracking down difficult memo...
... Notes on debugging issues in Gecko's layout engine. Miscellaneous Debugging Safari Some tips for debugging Safari Debugging Chrome Some tips for debugging Chrome Debugging Internet Explorer Some tips for debugging Internet Explorer Providing useful information to the Mozilla developers How to get a stacktrace for a bug re
port Useful information you can provide about a crash. Re
porting a Performance Problem ...using the Gecko Profiler extension. Debugging a hang on OS X Collecting "samples" to attach to a bug. Remote debugging Core dumps and examples of remote debugging. Useful if a developer can't reproduce your crash. HTTP logging How to log HTTP network traffic for debugg...
Simple SeaMonkey build
'Development tools' is defunct in Fedora 19 and above use the following sudo yum groupinstall 'C Development Tools and Libraries' sudo yum group mark install "X Software Development" Mac: Install Xcode Tools. Insert "Mac OS X Install Disc 2", then open XcodeTools.mpkg. (For some Mac OS X versions, you will find it in a directory called "Optional Installs".) Install Mac
Ports. Run these commands to install the other build tools: sudo
port sync sudo
port install mercurial libidl autoconf213 yasm Problems? See Mac OS X build prerequisites. Windows: Install Visual C++ 2013. Both the professional edition and the express edition will work. You may need to install one or more Windows SDKs. See Windows SDK versions for a qu...
...uires more disk space, about 3 GB, and twice as much available RAM. mk_add_options MOZ_OBJDIR=/path/to/comm-central/obj-sm-debug ac_add_options --enable-application=suite ac_add_options --enable-debug ac_add_options --disable-optimize Normally a shared build suffices for debugging purposes but current nightly releases are actually static builds which require even more memory to link. The sup
port for libxul builds is still experimental but it should work if you --disable-mailnews. On Windows, the above commands will create the comm-central directory in %USERPROFILE% which may be some subfolder of c:\Documents and Settings\ on systems upgraded from XP or below. The space in this directory name, or in your user name if it contains one, will cause the configure script to break. To (possibl...
Simple Sunbird build
You can give it a try, but its likely that the build system will present you an error. Instead it is suggested to build Thunderbird with Lightning. Please refer to the Simple Thunderbird build guide. You can build a bleeding-edge, development version of Sunbird using the commands below. For complete information, see the build documentation. Installing build tools If your system is not listed below, see the build prerequisites page. ...
...sudo yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development' sudo yum install mercurial autoconf213 glibc-static libstdc++-static yasm wireless-tools-devel mesa-libGL-devel Mac: Install Xcode Tools. Insert "Mac OS X Install Disc 2", then open XcodeTools.mpkg. (For some Mac OS X versions, you will find it in a directory called "Optional Installs".) Install Mac
Ports. Run these commands to install the other build tools: sudo
port sync sudo
port install mercurial libidl autoconf213 Problems? See Mac OS X build prerequisites. Windows: If you're using Windows XP, you must have Windows XP Service Pack 2 and .NET Framework 2.0. Install Visual C++ 2005 or 2008. Both the professional edition and the express edition will work. You may need to install one or...
Simple Thunderbird build
irectory. Use an absolute path to be sure! To also build Lightning when building Thunderbird (DEPRECATED) NOTE: The Lightning calendar add-on was integrated into Thunderbird starting with version 74. The `--enable-calendar` option is now deprecated and no longer has any effect. If it is in your `mozconfig` file, you should go ahead and remove it when building Thunderbird 74 or later, since sup
port for it will eventually be removed completely. Add the following line to your mozconfig file: ac_add_options --enable-calendar To add that line you can do this in the source/ directory: echo 'ac_add_options --enable-calendar' >> mozconfig Building Before you start, make sure that the version you checked out is not busted. For hg tip, you should see green Bs on https://treeherder.mozilla.or...
...e instruction). Check to make sure that the path in which you placed the source code has no spaces, and is not too long. Searched the bug database for issues relating to your problem (e.g., platform-specific issues). Try asking in mozilla.dev.builds - include details of what is in your mozconfig, and what the actual error is. Check if your mozilla/ is a symlink. A symlink there is not sup
ported. Check for @TOPSRCDIR@ or relative paths in your mozconfig. Those have caused several problems historically and tend to be poorly tested when the build system changes. If on Windows you get link errors like "LNK1102: out of memory" or "LNK1318: Unexpected PDB error; OK (0)", try deleting the largest .PDB files before rushing out the door to buy more RAM. Clobbering (see below) will also remov...
Interface Compatibility
r other similar techniques. Binary Interfaces Traditionally, Mozilla has maintained a set of XPCOM interfaces and functions with the @status FROZEN marking. Using these interfaces, and using dynamic calls to QueryInterface, it has been possible to write binary XPCOM components which were compatible with multiple versions of Firefox. Beginning with Mozilla 2 (Firefox 4), this will no longer be sup
ported: all @status markings have been removed, and extensions that use binary components will need to recompile for each major version they wish to sup
port. JS-ctypes is the recommended way for extensions to call into OS or third-party native code. You should strongly consider migrating existing code to use js-ctypes instead of binary components. If necessary, it is possible for an extension to su...
...d: all @status markings have been removed, and extensions that use binary components will need to recompile for each major version they wish to sup
port. JS-ctypes is the recommended way for extensions to call into OS or third-party native code. You should strongly consider migrating existing code to use js-ctypes instead of binary components. If necessary, it is possible for an extension to sup
port multiple versions by shipping multiple shared libraries (DLLs) in the same extension package, and selecting the correct version using versioning flags in its chrome.manifest file. JSAPI, NSPR, NSS, and other libraries which are currently shipped as separate shared libraries may be integrated into libxul, and extension authors should avoid linking against them. ...
Commenting IDL for better documentation
lunteers. We will take your comments and notes and turn them into beautiful, easy to search and read documentation. But by following the guidelines here, you can help make sure that our tools can generate a "good start" version of the documentation for your interfaces, and that the writers will be able to easily figure out what the tools are not able to do automatically. Comment format Doxygen sup
ports several comment formats; for style and consistency reasons, we use the following: /** * */ Note the two asterisks ("**") on the first line of the comment. That lets Doxygen (and by extension, our automated documentation im
port tools) know that the comment should be absorbed into documentation. If you use any other format for your comments, our tools will ignore them. Following the rules below...
...ve out things like [in]/[out]. @returns description If the method returns something then this should be included. @throws ERROR description The error should be the actual name of the error constant, in all caps. @note description Used to include a note styled paragraph. @remarks remark A remark paragraph to be included in the Remarks section of the documentation. Note: This is not yet sup
ported by our documentation tool. Using it will make it easier for documenters. @see description Either an interface or a HTML link. Note: This is not yet sup
ported by our documentation tool. Using it will make it easier for documenters. - or . Used at the beginning of a comment line to indicate an unordered list item. There must be a space between the list marker and the item. Nested lists shoul...
Listening to events on all tabs
Adding a listener To listen to progress events on all tabs, call the browser's addTabsProgressListener() method: gBrowser.addTabsProgressListener(myProgressListener); myProgressListener is an object that implements the callbacks used to provide notifications of progress events. Removing a listener To remove a previously installed progress listener, call removeTabsProgressListener(): gBrowser.removeTabsProgressListener(myProgressListener); Implementing a listener The listener object itself has five methods it can implement to handle various events: onLocationChange Called when the URI of the document displayed in the tab changes. ...
...d the notification. aWebProgress The nsIWebProgress instance that fired the notification. aRequest The nsIRequest that has new status. aStatus This value is not an error code. Instead, it is a numeric value that indicates the current status of the request. This interface does not define the set of possible status codes. Note: Some status values are defined by nsITrans
port and nsISocketTrans
port. aMessage Localized text corresponding to aStatus. onRefreshAttempted Notification that a refresh or redirect has been requested in aWebProgress for example, via a <meta http-equiv="refresh"> or an HTTP Refresh: header. If any registered progress listener returns false from this method then the attempt to refresh will be blocked. boolean onRefreshAttempted( nsI...
Runtime Directories
~/.mozilla/firefox/xxxxxxxx.default/ n/d Thunderbird OS Application Directory User Profile Directory Temporary Directory Windows Vista/7 C:\Program Files\Mozilla Thunderbird\ C:\Users\<username>\AppData\Roaming\Thunderbird\ (or %APPDATA%...
...:\Documents and Settings\<username>\Local Settings\Application Data\Thunderbird\ OS X /Applications/Thunderbird.app ~/Library/Thunderbird/Profiles/xxxxxxxx.default/ ~/Library/Caches/Thunderbird/Profiles/xxxxxxxx.default/ Linux ???? ~/.thunderbird/xxxxxxxx.default/ (or ~/.mozilla-thunderbird/xxxxxxxx.default/ on Debian/Ubuntu) n/d See also https://sup
port.mozilla.org/kb/profiles-where-firefox-stores-user-data#w_how-do-i-find-my-profile https://sup
port.mozilla.org/kb/profiles-tb#w_where-is-my-profile-stored http://kb.mozillazine.org/Profile_folder ...
Developer guide
generation of searching Mozilla's source code. In active development. SearchFox Another option for Mozilla code searching. Indexes JS as well as C++, includes blame capabilities. In active development. Mozilla build VM A VirtualBox compatible virtual machine configured with all the software needed to build and work on Firefox. TaskCluster TaskCluster is the task execution framework that sup
ports Mozilla's continuous integration and release processes. Treeherder Treeherder shows the status of the tree (whether or not it currently builds successfully). Check this before checking in and out, to be sure you're working with a working tree. Perfherder Perfherder is used to aggregate the results of automated performance tests against the tree. Crash tracking Information about the Socorr...
...s continuous integration and release processes. Treeherder Treeherder shows the status of the tree (whether or not it currently builds successfully). Check this before checking in and out, to be sure you're working with a working tree. Perfherder Perfherder is used to aggregate the results of automated performance tests against the tree. Crash tracking Information about the Socorro crash re
porting system. Callgraph A tool to help perform static analysis of the Mozilla code by generating callgraphs automatically. Developer forums A topic-specific list of discussion forums and mailing lists where you can talk about Mozilla development issues. Mozilla Platform Development Cheat Sheet (archive.org) Brian Bondy's list of frequently referenced information for platform developers. Brian ...
Displaying Places information using views
s, which are generic and will save you a lot of time writing basic functionality so that you can focus on building your extension or application. Places provides the following built-in views: Tree Menu Toolbar Instantiating The three built-in views are simply standard XUL elements with a special type attribute whose value is "places". Every XUL document containing a built-in view must im
port the stylesheet browser/components/places/content/places.css and overlay the file browser/components/places/content/placesOverlay.xul: <?xml-stylesheet href="chrome://browser/content/places/places.css" ?> <?xul-overlay href="chrome://browser/content/places/placesOverlay.xul" ?> It's this stylesheet that binds elements with the special type attribute to one of the views. The overlay contains Java...
... PlacesTreeView, is especially useful since it implements all three of nsINavHistoryResultTreeViewer, nsINavHistoryResultObserver, and nsITreeView. You can therefore implement your own custom functionality on top of PlacesTreeView while relying on it for non-custom functionality and much of the tedious work. One strategy is to create your custom object(s) implementing each of these interfaces, sup
port your custom behavior with them, but pass off everything else to a PlacesTreeView instance that you would own. Perhaps an easier strategy is to modify an existing PlacesTreeView instance, which is what the following example does. The following JavaScript creates a new PlacesTreeView instance but overrides two of its nsITreeView methods to display columns not present in the built-in tree view: va...
Multiple Firefox profiles
Reasons to have multiple profiles The casual user may want to have different profiles for work and personal use, or different family members. Having different profiles would help separate work and personal life, or allow each family member to have his or her own set of bookmarks, settings, and add-ons. ...
...profile folder you wish to launch into. This will launch Firefox immediately. Otherwise, enter a space character followed by --profilemanager. This will present the Profile Manager window in which you can make your selection. Hit return. Here is a complete example Terminal command from steps 2-3: /Applications/Firefox.app/Contents/macOS/firefox -profile /Users/Suzie/Library/Application\ Sup
port/Firefox/Profiles/r99d1z7c.default If the Profile Manager window does not open, Firefox may have been running in the background, even though it was not visible. Close all instances of Firefox, or restart the computer, and then try again. If you want to do this frequently and more easily, you may wish to create an Automator application, as explained in this tutorial. Creating a profile Crea...
Message manager overview
Since javascript modules are singletons they will only be executed once per process even when they are loaded in multiple frame scripts. The JSM can then use the child process message manager to exchange messages with the parent process message manager. This c...
...e manager The parent process message manager lives in the implements nsIMessageListenerManager nsIMessageBroadcaster Child process message manager implements nsIMessageListenerManager nsIMessageSender Loading scripts per child process Since the process message managers do not sup
port script loading the only way to implement per-child process code is to use a frame script which im
ports a custom javascript module (JSM). Since javascript modules are singletons they will only be executed once per process even when they are loaded in multiple frame scripts. The JSM can then use the child process message manager to exchange messages with the parent process message manager. This can be useful for addons to register categories, observers and components in child processes. ...
Tracking Protection
when content from a tracking site is loaded, then the callback will not execute. ...
... Note: Depending on a third party in this way is not a good practice anyway, because then your site can be broken if the third party is slow or ...
Firefox UI considerations for web developers
els. The icon closest in size to 96 pixels is selected. Firefox does its best to avoid having to scale the images, which can result in fuzzy or distorted images, especially at smaller sizes. Providing a Top Sites ready icon The simple rule is to provide an icon which is at least 96x96 pixels in size, using a <link> element whose rel attribute is a reference to a file containing an icon of a sup
ported type. <link rel="apple-touch-icon" sizes="128x128" href="touch-icon-128x128.png"> <link rel="apple-touch-icon" sizes="46x46" href="touch-icon-46x46.png"> <link rel="apple-touch-icon" sizes="256x256" href="touch-icon-256x256.png"> <link rel="icon" href="favicon.ico"> In this code, the 128x128 pixel icon will be used by Firefox, as it's the smallest icon which is larger than the 96-pixel size ...
...128.png"> <link rel="apple-touch-icon" sizes="46x46" href="touch-icon-46x46.png"> <link rel="apple-touch-icon" sizes="256x256" href="touch-icon-256x256.png"> <link rel="icon" href="favicon.ico"> In this code, the 128x128 pixel icon will be used by Firefox, as it's the smallest icon which is larger than the 96-pixel size it requires. Note: Only "rich" icons (apple-touch-icon and fluid-icon) sup
port the sizes attribute. You can't specify the size for rel="icon" using the sizes attribute. Examples Consider again the example Top Sites box shown at the top of the page, repeated below: Let's look at some examples among the icons shown here (note that this discussion is based on the site designs as of early January, 2019). USA Today The only icon provided by USA Today is its classic favic...
Using the Browser API
ck and forward buttons after each page reload. In addition, the background of the controls UI bar is changed to the background color of the site that has just loaded, to provide a more integrated experience -- this can be read out of the event object's e.detail.backgroundColor value. When the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backgroundColor value re
ported is rgb(0, 83, 159). Back to the stop/reload button -- updating the icon is nice, but we also need to update the functionality that is invoked when each icon is displayed. We do this with the following function, which runs the HTMLIFrameElement.stop() method to stop the page loading if the button is displaying a cross, and the HTMLIFrameElement.reload() method to reload the page otherwise. sto...
...Note that this doesn't include simple errors due to incorrect URLs being entered. See the mozbrowsererror...
mozbrowserloadend
The mozbrowserloadend event is fired when the browser <iframe> has finished loading all its assets, or has failed to load. This can be used when the embedder wants to stop spinning a loading indicator, or update the UI in some other way to indicate loading is complete. ...
...rloadend events are used to change the icon shown on the stop/reload button between stop (x) and reload (R), as appropriate. In addition, the background of the controls UI bar is changed to the background color of the site that has just loaded, to provide a more integrated experience. When the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backgroundColor value re
ported is rgb(0, 83, 159). var browser = document.querySelector("iframe"); browser.addEventListener('mozbrowserloadend',function(e) { stopReload.textContent = 'R'; console.log(e.detail.backgroundColor); controls.style.background = e.detail.backgroundColor; }); browser.addEventListener('mozbrowserloadend',function() { stopReload.textContent = 'R'; }); Related Events mozbrowserasyncscroll...
mozbrowserresize
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowserresize event is fired when a browser <iframe> view
port is resized in some way. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. ...
... bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: width A number representing the new width of the <iframe> view
port, in device pixels. height A number representing the new height of the <iframe> view
port, in device pixels. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserresize", function( event ) { console.log("The new window size is " + event.details.width + " x " + event.details.height + "."); }); Related Events mozbrowserasyncscroll mozbrowserclose m...
Browser API
e can make it appear like a top-level browser window to the embedded content. This means that window.top, window.parent, window.frameElement, etc. should not reflect the frame hierarchy. API extensions: The API includes several new methods and events to manipulate and listen for changes to the embedded content's state, interited by the HTMLIFrameElement interface. Browser API interfaces To sup
port the requirement of a browser <iframe>, the HTMLIFrameElement DOM interface has been extended with new methods that give the <iframe> some super powers. Navigation methods The following navigation methods allow navigation through the browsing history of the <iframe>. They are necessary to be able to implement back, forward, stop, and reload buttons. HTMLIFrameElement.reload() Allows reloadin...
...aying in the browser <iframe>. HTMLIFrameElement.unmute() Unmutes any audio playing in the browser <iframe>. HTMLIFrameElement.getMuted() Indicates whether the browser <iframe> is currently muted. Event-related methods In order to manage the browser <iframe>'s content, many new events were added (see below). The following methods are used to deal with those events: The <iframe> gains sup
port for the methods of the EventTarget interface addEventListener(), removeEventListener(), and dispatchEvent(). HTMLIFrameElement.sendMouseEvent() Sends a MouseEvent to the <iframe>'s content. Utility methods Last, there are some utility methods, useful for apps that host a browser <iframe>. HTMLIFrameElement.getStructuredData() Retrieves any structured microdata (and hCard and hCalendar m...
Gecko
der web content, such as HTML, CSS, XUL, JavaScript, and render it on the user's screen or print it. In XUL-based applications Gecko also renders the application's user interface. Gecko is used in many applications, including a few browsers such as Firefox and SeaMonkey (for a complete list, please refer to Wikipedia's article on Gecko). Products using the same version of Gecko have identical sup
port for Web standards. Documentation Chrome This page contains information specific to browser chrome (not Google Chrome) code running in Gecko. Gecko FAQ Frequently asked questions about Gecko. Gecko DOM reference Reference to the DOM. Gecko event reference Reference to events used within Gecko and Mozilla applications; for web...
... Frequently asked questions about Gecko. Gecko DOM reference Reference to the DOM. Gecko event reference Reference to events used within Gecko and Mozilla applications; for web-standard DOM events, see the DOM event reference. Introduction to Layout in Mozilla Tech Talk on layout. Embedding Mozilla Using Gecko in your own application. Character sets sup
ported by Gecko A list of the character sets sup
ported by Gecko. HTML parser threading Description of multithreading in the HTML parser. Gecko Home Page on MozillaWiki Home for the active developers. Roadmaps and more up-to-date resources. View All... Community View Mozilla forums: Mailing list Newsgroup RSS feed Related Top...
Geckoview-Junit Tests
<class> Please note that unlike Robocop tests, <class> needs to be specified using the fully qualified class name including the package, e.g. org.mozilla.geckoview.test.ContentDelegateTest. To run just one test: mozilla-central$ mach geckoview-junit <class>#<test> To run more than one test: mozilla-central$ mach geckoview-junit <class1>#<test1> <class2>#<test2> mach geckoview-junit also sup
ports running a list of tests that are specified in a text file. Each test must be listed on its own line. For example: <class1>#<test1> <class2> <class3>#<test2> <class3>#<test3> To run the tests specified in the file: mozilla-central$ mach geckoview-junit --test-filters-file <path-to-filter-file> Disabling one failing test There is no manifest listing the geckoview junit tests. To disable a...
...test1> <class2> <class3>#<test2> <class3>#<test3> To run the tests specified in the file: mozilla-central$ mach geckoview-junit --test-filters-file <path-to-filter-file> Disabling one failing test There is no manifest listing the geckoview junit tests. To disable a single test, edit the source code and insert JUnit's @Ignore annotation before the existing @Test annotation. For example: im
port org.junit.Ignore ... @RunWith(TestRunner.class) public class TestSomeThings { @Ignore @Test public void testSomething() { ... Tests can also be conditionally skipped using JUnit's assume or assumeThat methods. For example: im
port org.junit.Assume.assumeThat ... @Test fun contentCrashIgnored() { // Cannot test x86 debug builds due to Gecko's "ah_crap_handler" // th...
Getting Started with Chat
espond. Posting a message like "Help!" is not particularly helpful. Asking a good question will result in a better experience for both you and the person trying to help. Relax and have fun! Software There are several different applications which allow you to connect to IRC networks. You will need to use the following information to configure the server connection: Server: irc.mozilla.org
Port: 6667 (default) or 6697 (SSL) Desktop clients Desktop clients tens to allow the most detailed configuration. For example, you can connect using SSL or a non-secure connection, and you can configure the client to automatically connect to a server and join a particular set of channels when you start the client. The following are some other options available to you: Windows Mac ...
...cting to IRC by clicking on irc:// links. One of the simplest web-based clients is Mibbit, another is IRCCloud. These operate very much in the same way as the previously mentioned desktop clients and ChatZilla. Mibbit does NOT require flash or any other plugins. Channels Here is a list of channels you should be aware of as a member of the Mozilla community: (Remember to use irc.mozilla.org and
port 6697 or 6667 for your server settings) #qa A channel for QA discussion #developers A channel for Mozilla development discussion #sumo A channel for sup
port with Firefox For more information about the Mozilla IRC network and more channels, go here. Commands The following is a list of commands you should be familiar with. Simply type them into the mess...
How test harnesses work
The python harness communicates with the browser by inserting an extension in the testing profile or uses marionette's wire protocol to drive the browser. ...
...extension in the profile (for non-marionette tests) gathers the tests (manifestdestiny) potentially sets up an HTTP server for test data (mozhttpd) invokes the binary (mozrunner) it is the job of the shim extension to shut down the browser logging (mozlog, in theory) (run tests, accrue results) cleanup: shutdown the browser check for crashes (mozcrash) re
porting (moztest) Marionette Tests List of Testing Extensions pageloader (talos) mochitest: //github.com/RealityRipple/UXP/blob/master/testing/mochitest/install.rdf (mochitest) ...
JavaScript-DOM Prototypes in Mozilla
difying host objects is an unsafe practice. It is not guaranteed to work or be error-free in any implementation. It is not standard and cannot be expected to have any result. Here is an attempt to modify a host object: (function(){ try { Image.prototype.src = 1; } catch(ex){ alert(ex); } })(); This demonstrates that the Image constructor, a host object sup
ported in nearly all browsers for Mac and Windows, has a prototype property, and that an attempt to modify the prototype's src - property results in an error. Another example would be modifying the pageX property of a MouseEvent instance. The pageX property actually needs a patch because it doesn't get set correctly in initMouseEvent bug 411031. Here is a diagram that shows the prototype layout of a...
...totype of the class is by looking at the parent of the primary interface in the class info (if the name is a class constructor, such as HTMLImageElement) or by looking at the parent of the interface that the IID stored in the nsScriptNameSpaceManager for this name represents (if the name is a class prototype, such as Node). Once the name of the parent interface is known (and the name is not nsISup
ports) the code will look up a property by that name on the global object. This will cause the code to recurse down along the parent chain of the interface of interest for the name we started out resolving (i.e. nsWindowSH::GlobalResolve() will be called for every name on the parent chain). The result of this recursion is that by resolving the name HTMLImageElement, we'll create the constructor HTMLIm...
JavaScript Tips
ect an object that implements several interfaces thus requiring you to write a QueryInterface method. However, in JavaScript this is quite simple even in the case of a weak reference which in C++ requires a helper class: var weakObserver = { QueryInterface: function QueryInterface(aIID) { if (aIID.equals(Components.interfaces.nsIObserver) || aIID.equals(Components.interfaces.nsISup
portsWeakReference) || aIID.equals(Components.interfaces.nsISup
ports)) return this; throw Components.results.NS_NOINTERFACE; }, observe: function observe(aSubject, aTopic, aState) { } } When declaring XPCOM methods, try to use the same names for method parameters as are used in the interface definition. DOM elements DOM elements are just XPCOM objects with some of the...
...lassName. (The property could have been implemented as ["class"'] but that just looks silly.) XUL also maps the hidden and collapsed attributes to properties, but note that these are boolean properties whereas the above list are all string properties. XUL also maps other useful properties and methods using XBL bindings; these vary from element to element. For best performance give ids to all im
portant elements. However in addition to locating elements by tag name XUL also allows you to locate an element by attribute, starting at any element in the document. References This was started as a reprint of Neil's guide Some more current info on this blog post How to remove duplicate objects from an array JavaScript ...
AddonUpdateChecker
The AddonUpdateChecker is used to download and parse update information for an add-on's update manifest. If all you care about is finding the newest version for an Addon then you probably want to use findUpdates() instead. ...
... The AddonUpdateChecker is used to download and parse update information for an add-on's update manifest. If all you care about is finding the newest version for an Addon then you probably want to use findUpdates() instead. ...
Add-on Repository
ed SearchCallback object when the search is completed. Results passed to the SearchCallback object only include add-ons that are compatible with the current application and are not already installed or in the process of being installed. AddonRepository can only process one search at a time. A new search will immediately fail if the AddonRepository is already handling another search request. ...
...ssed to the SearchCallback object only include add-ons that are compatible with the current application and are not already installed or in the process of being installed. AddonRepository can only process one search at a time. A new search will immediately fail if the AddonRepository is already handling another search request. ...
AsyncShutdown.jsm
nt during phase profileBeforeChange, function condition will be called. Phase profileBeforeChange is guaranteed to not terminate until promise is either resolved or rejected. If, for some reason, promise is never resolved/rejected, Firefox will crash during shutdown to avoid blocking system shutdown, preventing the user from restarting Firefox or burning through a battery. In this case, a crash re
port is produced, with information on all the shutdown blockers that have not been resolved, and all the additional debug information returned by calls to info(). Instances of Phase Note that you cannot create an instance of Phase yourself. See Attributes for the instances of Phase. If you need a new Phase added to AsyncShutdown, please file a bug. Methods overview void addBlocker(stri...
...cker(string name, function|promise condition, optional function info) boolean removeBlocker(function|promise condition) Methods addBlocker () Register a blocker for the completion of a phase. void addBlocker( in string name, in function|promise|* condition, optional in function info ) Arguments name The human-readable name of the blocker. Used for debugging/error re
porting. Please make sure that the name respects the following model: "Some Service: some action in progress" - for instance "OS.File: flushing all pending I/O". condition A condition blocking the completion of the phase. Generally, this is a function returning a promise. This function is evaluated during the phase and the phase is guaranteed to not terminate until the resulting promise is either re...
Download
s, and also if it failed or has been canceled. If the download has been completed successfully, this property is not relevant anymore. Whether partial data can actually be retained depends on the saver and the download source, and may not be known before the download is started. hasProgress Read only boolean Indicates whether this download's progress property is able to re
port partial progress while the download proceeds, and whether the value in totalBytes is relevant. This depends on the saver and the download source. launchWhenSucceeded boolean If this property is true when the download finishes successfully, the target file will be opened or executed automatically. launcherPath string Local file path of the application to be used to la...
...n associated with the contentType property or the extension of the target file. onchange Function This can be set to a function that is called after other properties change. Warning: This property cannot be used if the download is part of a DownloadList. progress Read only number Progress percent, from 0 to 100. Intermediate values are re
ported only if hasProgress is true. Note: You shouldn't rely on this property being equal to 100 to determine whether the download is completed. You should use the individual state properties (for example, the succeeded property) instead. saver Read only DownloadSaver Saver object associated with this download. source Read only DownloadSource Source of this dow...
FileUtils.jsm
The FileUtils.jsm JavaScript code module offers utility routines dealing with files. ...
... The FileUtils.jsm JavaScript code module offers utility routines dealing with files. ...
Log.jsm
ilized, expect frequent updates, including different interfaces and behavior in different versions of the platform. Progress is tracked in Bugzilla using dependencies of bug 451283. The Log.jsm JavaScript code module (formerly named log4moz.js) provides a log4j style API for logging log messages to various endpoints, such as the Browser Console or a file on disk. To use it, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/Log.jsm"); Basic usage Components.utils.im
port("resource://gre/modules/Log.jsm"); // Get a logger, give it a name unique to this chunk of code. // Use dots to create a hierarchy, this way you can later change // the log level of sets of loggers under some common root let log = Log.repository.getLogge...
...recated APIs, poor use of API, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". Expect these to be immediately visible on a status console. INFO Interesting runtime events (startup/shutdown). Expect these to be immediately visible on a console, so be conservative and keep to a minimum. CONFIG Information regarding im
portant configuration options the system is using that affect how it runs. DEBUG Detailed information on the flow through the system. Expect these to be written to logs only. TRACE Most detailed information. Expect these to be written to logs only. Class overview Appender(); length: 1 Keys of prototype: append(); ...
OSFile.jsm
-based manipulation of files (nsIFile, subsets of nsIIOService, etc.) by JavaScript code. What are the relationships with the HTML5 File API? None, really. The File API is designed for high-level, highly-restricted manipulation of files by web applications. OS.File is designed for efficient, unrestricted, manipulation of files by Firefox itself and by add-ons. Why is Off Main Thread File I/O im
portant? One thing that all developers need to remember is that the duration of a File I/O operation is unbounded. Depending on the current load of the kernel, the current disk activity, the current load of the bus, the current rotation speed of the disk, the amount of battery power, etc. operations can take an arbitrary amount of time. We are talking about several seconds to execute operations that ...
... the disk, the amount of battery power, etc. operations can take an arbitrary amount of time. We are talking about several seconds to execute operations that look trivial, such as closing a file, or checking when it was last modified. If the operation is called on the main thread, this means that the whole user experience is stuck for several seconds, which is quite bad. Why is I/O Efficiency im
portant? I/O efficiency is all about minimizing the number of actual I/O calls. This is critical because some platforms have extremely slow storage (e.g. smartphones, tablets) and because, regardless of the platforms, doing too much I/O penalizes not just your application but potentially all the applications running on the system, which is quite bad for the user experience. Finally, I/O is often expe...
Timer.jsm
The Timer.jsm JavaScript code module contains pure-JavaScript implementations of setTimeout, clearTimeout, setInterval, and clearInterval that are compatible with the DOM window functions, but that can be used by code that does not have access to a DOM window (for example, JavaScript code modules or content frame scripts). ...
... The Timer.jsm JavaScript code module contains pure-JavaScript implementations of setTimeout, clearTimeout, setInterval, and clearInterval that are compatible with the DOM window functions, but that can be used by code that does not have access to a DOM window (for example, JavaScript code modules or content frame scripts). ...
L10n Checks
n Checks shows the missing and obsolete strings in a pseudo-diff format. ab-CD browser chrome/browser browser.dtd +backForwardMenu.tooltip +fullZoomEnlargeCmd.commandkey3 +fullZoomReduceCmd.commandkey2 +fullZoomResetCmd.commandkey2 +organizeBookmarks.label -showAllBookmarksCmd2.label migration/migration.dtd -im
portFromFile.accesskey -im
portFromFile.label +im
portFromHTMLFile.accesskey +im
portFromHTMLFile.label You can assume changed strings when you see entities removed and added with a similar name. The file names will be shown in a hierarchical form, so in the example above, your files are browser.dtd in ab-CD/browser/chrome/browser and migration.dtd in another directory leve...
...JSON output In all modes you can tell L10n Checks to present the output as JSON by setting the...
Localization notes
There are a number of automated tools that parse these comments for easier access and use by localizers. ...
...There are a number of automated tools that parse these comments for easier access and use by localizers. ...
Localizing XLIFF files for iOS
irefox for iOS uses the XLIFF XML-based file format to hold and transfer localization data. XLIFF (eXtensible Localisation Interchange File Format) is a localization standard governed by the OASIS standards body. The goal of the standard is to have an XML-based format to use when exchanging localization data between tools without the potential of data loss or corruption. Most translation tools sup
port the XLIFF standard, making localizing the XLIFF files for Firefox for iOS easy to do using translation tools. Editing the raw XLIFF file is also rather easy, especially if you're already familiar with XML. This tutorial will walk you through the steps you need to take to translation strings within an XLIFF file. String repository for Firefox on iOS The firefox-ios.xliff file is located in SVN. ...
... format, %1$@ is another variable format. <note> tags contain localizer notes from developers and should not be translated. <trans-unit id="Add to Bookmarks"> <source>Add to Bookmarks</source> <target>Agregar a marcadores</target> <note>No comment provided by engineer.</note> </trans-unit> Save your translations along the way. Once you've completed translation, it's im
portant to make sure the XML in your XLIFF file is valid (e.g., no broken tag sets). Open the file in Firefox to have it run a validity check and correct any errors it might yell about. Commiting your XLIFF file Using this command, commit your translated XLIFF file into your locale's directory: git commit -m "Commit message here" . Push your commit into the github repo: git push Kick up your fe...
Initial setup
t to them and ask how you can help. If a community doesn't exist, send an email to the new-locales newsgroup for additional guidance. Accounts There are a handful of accounts that you need to be aware of as you begin. They're not required for you to begin contributing, but will be required when you are preparing to produce an official release. For now, simply be aware that these will become im
portant as your efforts progress. These accounts will store your code, contributions, and help you produce an official localization. hg (Mercurial) Mercurial is the revision control environment that houses the main Mozilla source code as well as localized code for each official Mozilla localization. You will need this for localizing Mozilla applications. Hg commit access is not necessary to begin ...
...hen filing your hg account registration bug. Add a request about creating your locale's repository to the new locales newsgroup. SVN SVN is a revision control environment that Mozilla uses to house Mozilla source websites and their localizations for each official Mozilla localization. See this wiki page about how to gain access to SVN. The SVN for Localizers guide will help you learn the most im
portant SVN commands for l10n. Add a request about creating your locale's repository to the new locales newsgroup. Web-based L10n tools We'll talk about these in a little bit. For now, just be aware that should you choose to use them, you may need to create a personal account. Mozilla LDAP You will need a Mozilla LDAP account once you're ready to have your localization registered on the main Mo...
QA phase
ng your L10n & seeing your work Now that you have your langpack or L10n repack, let's discuss seeing your work and testing it in the application. Testing the langpack will put you one step closer to having your localization added to the L10n releases. Follow the steps below to test your localization: Install Aurora in your preferred language. ...
...After you test your localization, you should send it to a remote repository, which will serve as a backup for your work and will let others follow your progress. We're going to go through the process below. The official localization teams use repositories at hg.mozilla.org. ...
Translation phase
applications So you're interested in localizing Mozilla applications. Each l10n tool follows a different workflow for localizing Mozilla application projects. We've linked a brief tutorial to each l10n tool name below. Follow the tutorials to help you decide which l10n tool fits your specific needs. These are the l10n tools we use to localize Mozilla applications: Pootle A user-friendly web
portal built on the Translate Toolkit API. This tool includes workspaces for translating strings, reviewing string submissions, and project dashboards. See the instance of Pootle used to localize Mozilla applications. Koala A l10n add-on for the offline, stand-alone Komodo Edit text editor. Mozilla Translator Am offline, stand-alone, Java-based l10n tool that helps you translate and integrates ...
...: Pontoon A web-based, What-You-See-Is-What-You-Get (WYSIWYG) l10n tool that allows you to localize Mozilla websites within the site itself. Visit Pontoon here. Please note the Pontoon is not available for all web projects yet. These are the Mozilla web projects that are localized using the l10n tools above: mozilla.org Every user's first Mozilla experience. addons.mozilla.org (AMO) A
portal for all users interested in finding add-ons for their local Mozilla applications. Read the guidelines on localizing AMO, straight from the AMO team. developer.mozilla.org (MDN) Where you are now! Help localize the MDN user interface for everyone in your region. sup
port.mozilla.com (SUMO) A
portal for anyone who needs technical sup
port for their Mozilla applications. Help localize the SUMO u...
SVN for Localizers
y SVN we are referring to either the SVN server and the SVN client. This may seem confusing, but don't fret because we'll make sure to differentiate between the two here: SVN server: This is installed on one of Mozilla's servers that we use to manage our localizable web system. SVN client: This is what a localizer installs on their own computer. The SVN client is the localizer's communication
portal for accessing the Mozilla SVN server. You use it to copy files from the server to your computer and to push changed or localized files back onto the server. Installing SVN client: Linux users can download the SVN client from http://subversion.apache.org/packages.html or install packages provided within their distribution (for example, in Debian, sudo apt-get install subversion). Mac OS X ...
...inutes and check the staging website for your locale. Your recent changes should now be visible online. You will have the chance to see how the localized website will look when it's pushed to prod (i.e., a website that regular visitors will see). When localizing websites, l10n-drivers will always add needed files to your repository or update your files with new strings in English. It's very im
portant for you to update your working copy with the newest files from Mozilla SVN repository before you start making changes. Enter the following command from the command-line: svn update Your local SVN repository (i.e., working directory) will be updated with the newest files from the URL you initially cloned your repository from. It's very im
portant that you do this often. As a general rule, yo...
Localization technical reviews
tailed and comprehensive form of review. That being the case, there are some criteria in a technical review that will only ever be considered once, as all reviews after this only evaluate the changes you're adding on top of this revision from release to release. Here is some of the criteria we use to perform technical reviews: Revision attachment contains only relevant files We run into ex
ports that contain .xpi langpacks and other random files. Make sure the top-level directory doesn't contain garbage. compare-locale We run the compare-locales tool on the new locale to get the statistics on translation of strings and re
port basic errors. defines.inc The file for each app (like browser/defines.inc) contains the names of all contributors that a localization team would like to cred...
...ight be too long. This is something to look for, but can be difficult to diagnose immediately. For more info, see bug 435874. Check for bad migration of access keys In the past, it was common to find broken access keys for Safari and Camino in browser/chrome/browser/migration/migration.dtd. For this review, we look at this file to make sure that the access keys look normal. If they don't, we re
port any strange access keys or translations that localizers might have changed during their initial translation process. For more info about access keys in the technical review process, see bug 421893. No UTF-7 in the intl.properties file Firefox no longer has a UTF-7 parser. There should not be any UTF-7 encodings in the file toolkit/chrome/global/intl.properties. For more info about UTF-7 in Fir...
MathML3Testsuite
if there is no fatal error (crash, etc). This exception also holds for obsolete features (such as macro, mode etc) or for other undefined behaviors (attribute href for example). Note that in general, comparing with the "Sample Rendering" is not enough to conclude on the success/failure of the test. So please do not edit these pages if you are not able to explain Gecko's rendering. However, any re
port is welcome on the Tracking bug for the MathML testsuite. Characters Blocks Symbols Variants EntityNames NumericRefs UTF8 General Clipboard GenAttribs Math Presentation CSS DynamicExpressions GeneralLayout ScriptsAndLimits TablesAndMatrices TokenElements Topics Accents BiDI ElementaryMathExamples EmbellishedOp LargeOp LineBreak Nesting StretchyChars WhiteSpace TortureTests E...
... ...
MathML In Action
mathml/tests. Now, what next? As you try out MathML in Mozilla, what to do with those few things that appear to you not to work as per the MathML spec? Or what about those things that just seem itchy, and that you wish could be done just a little better? Or what about those things that were working before and are not working anymore (a.k.a. ...
...er the MathML spec? Or what about those things that just seem itchy, and that you wish could be done just a little better? Or what about those things that were working before and are not working anymore (a.k.a. regressions)? In either case, head over to Bugzilla to re
port the discrepancies. Bugzilla has a big memory for these things, and besides, how would your problems be fixed if they are not re
ported?! Getting involved is part of your contribution towards enriching Gecko with an elegant standards-compliant MathML renderer. Your feedback can be manifested by putting MathML content on the web, re
porting bugs in Bugzilla, and, if you can help with code, inspecting/improving the current code, and/or picking up an item in the ToDo list. ...
Mozilla MathML Project
For a quick overview, see the slides for the innovation fairs at Mozilla Summit 2013. Updates Status of each tag Result of the MathML 3 Testsuite Unofficial nightly builds with MathML patches applied (maintained by Bill Gianopoulos) More updates and archived content Community View Mozilla forums... Mailing list Newsgroup RSS feed IRC channel Wiki used by contributors - check out the latest developments and help us improving MathML in Mozilla. ...
...the Symbol font that is pre-installed by default on most OS configurations. MathML Torture Test - Comparative testing of MathML rendering against TeX. Demo of some MathML tags: mfrac, mo, mtable, mspace, mmultiscripts, msqrt-mroot. MathML Extras - Technology demonstration of some interesting upshots from building natively upon the browser environment. Various MathML Tests - These pages were im
ported from layout/mathml/tests/. Blog with comments that include MathML. Create MathML Documents Authoring MathML Editors Converters Stylesheets Original Document Information Author(s): Roger B. Sidje Other Contributors: Frederic Wang Last Updated Date: April 4, 2010 Copyright Information:
Portions of this content are (C) 1999-2010 by individual mozilla.org contributors; content ava...
Mozilla Development Tools
ing diffs, etc.) Tinderbox Tinderbox is for knowing when the tree is in flames. It is our home-grown web-based tool for watching the progress of the continuous builds that we run on multiple platforms. It is how we are able to tell when a checkin has broken the build on some platform, and how we know which person needs to be viciously flogged. Bugzilla Bugzilla is where developers can re
port bugs in the Mozilla source releases, and browse an online database of already-re
ported bugs. Doctor Doctor is a web interface to CVS. It lets developers and others edit pages on the mozilla.org web site without having to use CVS. Doctor lets you edit pages in WYSIWYG mode if the pages contain the <?doctor enable_wysiwyg_mode ?> processing instruction. Access Doctor by clicking the "Edit this...
...t pages on the mozilla.org web site without having to use CVS. Doctor lets you edit pages in WYSIWYG mode if the pages contain the <?doctor enable_wysiwyg_mode ?> processing instruction. Access Doctor by clicking the "Edit this Page" link at the bottom of any mozilla.org web page. Original Document Information Author(s): Myk Melez Last Updated Date: November 8, 2005 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Mozilla projects on GitHub
r to fork it and start your own project based on Mozilla-related code--you need a GitHub account. To learn more about setting up a GitHub account, visit the GitHub website. Most Mozilla project code is located in repositories within the Mozilla GitHub organization. This is a great place to start looking for any projects not listed below. Projects This listing covers the larger-scale and more im
portant Mozilla projects on GitHub. It does not include everything since it's hard to keep track of all the smaller projects. Look to GitHub for the most complete list of Mozilla projects on GitHub. Project name Description PDF.js A
Portable Document Format (PDF) reader written entirely in JavaScript. Shumway Shumway is a Flash VM and runtime written in JavaScr...
...ls Adapter that lets you debug various remote targets from the Firefox Developer Tools. firefox-dev.tools A Web page to help new Mozilla contributors find bugs to work on that relate to the Firefox Developer Tools. gecko-dev A read-only mirror of the Mercurial repositories used for Mozilla private code. kitsune Kitsune is the platform that drives the Mozilla sup
port web site, SUMO. kuma The Django project that powers this site (MDN). mdn Code samples for the MDN Web site. mozbrick The Mozilla Brick project. mozilla-B2G The Firefox OS project. mozilla-appmaker The Appmaker project -- a Web tool to let non-programmers create apps. mozilla-l10n Scripts and tools used by the localization dri...
Gecko Profiler FAQ
e profiler platform doesn't capture any information about lines. It only knows what function was executed and what line this function starts at. For native code, the profiler captures the necessary information but doesn't have a way to display it. Similarly it also can't show you instruction level information about where each sample was captured (this is why there is no sup
port for line-level sampling for native code either.) At this point the granularity of each sample it displays is a native function. Therefore the Gecko Profiler is not a suitable tool for finding hotspots within a single function. For this purpose you should try to use a native profiler on your platform of choice (for example xperf/vtune on Windows, Instruments on OSX, and perf/Zoom on ...
...e that those profiles only show you that we spend a lot of time in GC / CC. In that case, the Gecko Profiler is the wrong tool to debug this. Even about:memory would be more useful. Overview of the changes in the last (year?) to Cleopatra/etc Faster, hopefully more reliable Has a Timeline tab Lets you hide threads with a context menu Sup
ports symbolication for local builds on Windows if you run "mach buildsymbols" first Profiling non-nsThreads? The current setup requires each thread that you want to profile to notify the profiler about its existence. We have this hooked up for nsThreads, and as of very recently also for rayon threads (used in stylo). We have not attempted to register other threads with the pr...
JS::PerfMeasurement
The JS::PerfMeasurement class, found in jsperf.h, lets you take detailed performance measurements of your code. It is a stopwatch profiler -- that is, it counts events that occur while code of interest is running; it does not do call traces or sampling. ...
...grations Migrations of the profiled thread from one CPU core to another These events map directly to "generic events" in the Linux 2.6.31+ <linux/perf_event.h> interface, and so unfortunately are a little vague in their specification; for instance, we can't tell you exactly which level of cache you get misses for if you measure CACHE_MISSES. We also can't guarantee that all platforms will sup
port all event types, once we have more than one back end for this interface. Here is the complete C++-level API: PerfMeasurement::EventMask This is an enumeration defining all of the bit mask values in the above table. You bitwise-OR the ones you want together and pass them to the constructor. PerfMeasurement::ALL In a constructor call, this special value means "measure everything that can possibly...
Measuring performance using the PerfMeasurement.jsm code module
The PerfMeasurement.jsm JavaScript code module lets you take detailed performance measurements of your code. Note: The PerfMeasurement.jsm JavaScript code module can only be used from chrome -- that is, from within the application itself or an add-on. The first thing you need to do is to im
port the module into your scope: Components.utils.im
port("resource://gre/modules/PerfMeasurement.jsm") You can then create a PerfMeasurement object. You give the constructor a bit-mask of events you're interested in; see Note: At present, PerfMeasurement.jsm is only functional on Linux, but it is planned to add sup
port for Windows (bug 583322) and OSX (bug 583323) as well, and we welcome patches for other operating systems. For instance, let's measure instructions executed, cache references, and cache misse...
..._to_be_benchmarked(), and disable it as soon as it returns, the code in set_up_some_state() and clean_up_afterward() is not measured. The monitor object automatically accumulates counts over start/stop cycles (that is, it doesn't automatically zero the counters each time you start recording). When you're done benchmarking, you can read out each of the counters you asked for as properties: let re
port = "CPU cycles: " + monitor.cpu_cycles + "\n" + "Cache refs: " + monitor.cache_references + "\n" + "Cache misses: " + monitor.cache_misses + "\n"; monitor.reset(); alert(re
port); The reset() method clears all of the enabled counters, as you might expect. When you're done with your measurements, just let the monitor object go out of scope. ...
Profiling with the Gecko Profiler and Local Symbols on Windows
of a local build of Firefox for Windows, you will need to point talos to a zipfile containing breakpad-style symbols for your build. Follow the steps below: NOTE: You only need to do this if you're on Windows and you've built Firefox yourself. For any official release of Firefox (Nightly, Beta, etc), you do not need to use these steps. Make sure you don't have ac_add_options --disable-crashre
porter in your Firefox .mozconfig file. If you're building a Beta or Release channel version, and you want proper C++ callstacks in your profiles, add ac_add_options --enable-profiling to your Firefox .mozconfig file. You don't need to do this if you're building Nightly, because --enable-profiling is the default on Nightly. Build Firefox as usual, e.g. using ./mach build. Generate the Breakpad symb...
...g is the default on Nightly. Build Firefox as usual, e.g. using ./mach build. Generate the Breakpad symbol files by running ./mach buildsymbols: https://developer.mozilla.org/en/Building_Firefox_with_Debug_Symbols#Breakpad_symbol_files This will have created symbols under $OBJDIR/dist/ , named after the binary name, architecture and version, so something like "firefox-40.0a1.en-US-win32.crashre
porter-symbols.zip" Point talos to this zipfile by passing its path to the --symbolsPath flag. ...
tools/power/rapl
without root privileges by setting the contents of /proc/sys/kernel/perf_event_paranoid to 0. Note that if you do change this file, its contents may reset when the machine is next rebooted. You must be running Linux kernel version 3.14 or later for rapl to work. Otherwise, it will fail with an error message explaining this requirement. Windows Unfortunately, rapl does not work on Windows, and
porting it would be difficult because Windows does not have APIs that allow easy access to the relevant model-specific registers. Output The following is 10 seconds of output from a default invocation of rapl. total W = _pkg_ (cores + _gpu_ + other) + _ram_ W #01 5.17 W = 1.78 ( 0.12 + 0.10 + 1.56) + 3.39 W #02 9.43 W = 5.44 ( 1.44 + 1.20 + 2.80) + 3.98 W #03 14.26 W = 10.21 ( 5.47 + ...
...t line indicates the meaning of each column. The underscores in _pkg_, _gpu_ and _ram_ are present so that each column's name has five characters. The total power is the sum of the package power and the RAM power. The package estimate is divided into three parts: cores, GPU, and "other". "Other" is computed as the package power minus the cores power and GPU power. If the processor does not sup
port GPU or RAM estimates then " n/a " will be printed in the relevant column instead of a number, and it will contribute zero to the total. Once sampling is finished -- either because the user interrupted it, or because the requested number of samples has been taken -- the following summary data is shown: 10 samples taken over a period of 10.000 seconds Distribution of 'total' values: ...
Midas
Introduction Midas is the code name for Gecko's built-in rich text editor. Midas can be enabled via JavaScript on an HTML document. When Midas is enabled, the document becomes editable by the user. Scripting for Midas is based on the DHTML commands sup
ported by Internet Explorer. Internet Explorer sup
ports the ability to make an entire document editable by setting the designMode property of the document object; this is how Midas is invoked in Gecko. Internet Explorer also sup
ports the ability to edit specific elements using the contentEditable attribute; Starting with Firefox 3, Gecko also sup
ports contentEditable. Once Midas is invoked, a few more methods of the document object become available. You can try demo of this here. Properties document.designMode By setting this prope...
...nd can be executed on the document in its current state. Document.queryCommandIndeterm Determines whether the current selection is in an indetermined state. Document.queryCommandState Determines whether the given command has been executed on the current selection. Document.queryCommandValue Determines the current value of the document, range, or current selection for the given command. Sup
ported Commands Command Value Description backcolor A color code. This command will set the background color of the document. bold If there is no selection, the insertion point will set bold for subsequently typed characters. If there is a selection and all of the characters are already bold, the bold will be removed. Otherwise, all selected character...
Dynamic Library Linking
ading functions on some platforms, certain environment variables must be set at run time, and you may need to link your executable programs using special linker options. This section summarizes these platform idiosyncrasies. For more information, consult the man pages for ld and dlopen (or shl_load on HP-UX) for Unix, and the LoadLibrary documentation for Win32. Dynamic Library Search Path Ex
porting Symbols from the Main Executable Program Dynamic Library Search Path The dynamic library search path is the list of directories in which to look for a dynamic library. Each platform has its own standard directories in which to look for dynamic libraries, plus a customizable list of directories specified by an environment variable. On most Unix systems, this environment variable is LD_LIB...
...Alternatively, you can enable the +s option as a postprocessing step using the chatr tool. For example, link your executable program a.out without the +s option, then execute the following: chatr +s enable a.out On Rhapsody, the environment variable is DYLD_LIBRARY_PATH. On Win32, the environment variable is PATH. The same search path is used to search for executable programs and DLLs. Ex
porting Symbols from the Main Executable Program On some systems, symbols defined in the main executable program are not ex
ported by default. On HP-UX, you must link the executable program with the -E linker option in order to ex
port all symbols in the main program to shared libraries. If you use the GNU compilers (on any platform), you must also link the executable program with the -E option. ...
Long Long (64-bit) Integers
<< PreviousNext >> This chapter describes the global functions you use to perform 64-bit integer operations. The functions define a
portable API that can be used reliably in any environment. Where 64-bit integers are desired, use of NSPR's implementation is recommended to ensure cross-platform compatibility. Most of the 64-bit integer operations are implemented as macros. The specific implementation of each macro depends on whether the compiler for the target platform sup
ports 64-bit integers. For a specific target platform, if 64-bit integers are sup
ported for that platform, define HAVE_LONG_LONG at compile time. 64-Bit Integer Types NSPR provides two types to represent 64-bit integers: PRInt64 PRUint64 64-Bit Integer Functions The API defined for the 64-bit integer f...
...on whether the compiler for the target platform sup
ports 64-bit integers. For a specific target platform, if 64-bit integers are sup
ported for that platform, define HAVE_LONG_LONG at compile time. 64-Bit Integer Types NSPR provides two types to represent 64-bit integers: PRInt64 PRUint64 64-Bit Integer Functions The API defined for the 64-bit integer functions is consistent across all sup
ported platforms. Limits and Initialization Relational Operators Logical Operators Arithmetic Operators Shift Operators Conversion Operators ...
NSPR Error Handling
nction. PR_IO_PENDING_ERROR An I/O operation has been attempted on a file descriptor that is currently busy with another operation. PR_DIRECTORY_OPEN_ERROR The directory could not be opened. PR_INVALID_ARGUMENT_ERROR One or more of the arguments to the function is invalid. PR_ADDRESS_NOT_AVAILABLE_ERROR The network address (PRNetAddr) is not available (probably in use). PR_ADDRESS_NOT_SUP
PORTED_ERROR The type of network address specified is not sup
ported. PR_IS_CONNECTED_ERROR An attempt to connect on an already connected network file descriptor. PR_BAD_ADDRESS_ERROR The network address specified is invalid (as re
ported by the network). PR_ADDRESS_IN_USE_ERROR Network address specified (PRNetAddr) is in use. PR_CONNECT_REFUSED_ERROR The peer has refused to allow the connectio...
...t to use a non-network file descriptor on a network-only operation. PR_NOT_TCP_SOCKET_ERROR Attempt to perform a TCP specific function on a non-TCP file descriptor. PR_SOCKET_ADDRESS_IS_BOUND_ERRO Attempt to bind an address to a TCP file descriptor that is already bound. PR_NO_ACCESS_RIGHTS_ERROR Calling thread does not have privilege to perform the operation requested. PR_OPERATION_NOT_SUP
PORTED_ERRO The requested operation is not sup
ported by the platform. PR_PROTOCOL_NOT_SUP
PORTED_ERROR The host operating system does not sup
port the protocol requested. PR_REMOTE_FILE_ERROR Access to the remote file has been severed. PR_BUFFER_OVERFLOW_ERROR The value retrieved is too large to be stored in the buffer provided. PR_CONNECT_RESET_ERROR The (TCP) connection has been reset by the ...
NSPR Types
on Types are used for externally visible functions and globals. Algebraic Types of various lengths are used for integer algebra. Miscellaneous Types are used for representing size, pointer difference, Boolean values, and return values. For information on naming conventions for NSPR types, functions, and macros, see NSPR Naming Conventions. Calling Convention Types These types are used to sup
port cross-platform declarations of prototypes and implementations: PR_EXTERN is used for declarations of external functions or variables. PR_IMPLEMENT is used for definitions of external functions or variables. PR_CALLBACK is used for definitions and declarations of functions that are called via function pointers. A typical example is a function implemented in an application but called from a sh...
...Integer Types Different platforms treat 64-bit numeric fields in different ways. Some systems require emulation of 64-bit fields by using two 32-bit numeric fields bound in a structure. Since the types (long long versus struct LONGLONG) are not type compatible, NSPR defines macros to manipulate 64-bit numeric fields. These macros are defined in prlong.h. Conscientious use of these macros ensures
portability of code to all the platforms sup
ported by NSPR and still provides optimal behavior on those systems that treat long long values directly. PRInt64 PRUint64 Floating-Point Number Type The NSPR floating-point type is always 64 bits. PRFloat64 Native OS Integer Types These types are most appropriate for automatic variables. They are guaranteed to be at least 16 bits, though variou...
Network Addresses
6 (IPv6). To facilitate the transition to IPv6, it is recommended that clients treat all structures containing network addresses as transparent objects and use the functions documented here to manipulate the information. If used consistently, this API also eliminates the need to deal with the byte ordering of network addresses. ...
... All NSPR functions that require PRNetAddr as an argument accept either an IPv4 or IPv6 version of the address. ...
PRSockOption
Syntax #include <prio.h> typedef enum PRSockOption { PR_SockOpt_Nonblocking, PR_SockOpt_Linger, PR_SockOpt_Reuseaddr, PR_SockOpt_Keepalive, PR_SockOpt_RecvBufferSize, PR_SockOpt_SendBufferSize, PR_SockOpt_IpTimeToLive, PR_SockOpt_IpTypeOfService, PR_SockOpt_AddMember, PR_SockOpt_DropMember, PR_SockOpt_McastInterface, PR_SockOpt_McastTimeToLive, PR_SockOpt_McastLoopback, PR_SockOpt_NoDelay, PR_SockOpt_MaxSegment, PR_SockOpt_Last } PRSockOption; Enumerators The enumeration has the following enumerators: PR_SockOpt_Nonblocking Nonblocking I/O. ...
..._SockOpt_McastTimeToLive IP multicast time-to-live. PR_SockOpt_McastLoopback IP multicast loopback. PR_SockOpt_NoDelay Disable Nagle algorithm. Don't delay send to coalesce packets. PR_SockOpt_MaxSegment Maximum segment size. PR_SockOpt_Last Always one greater than the maximum valid socket option numerator. Description The PRSockOption enumeration consists of all the socket options sup
ported by NSPR. The option field of PRSocketOptionData should be set to an enumerator of type PRSockOption. ...
PR_EnumerateHostEnt
Evaluates each of the possible addresses of a PRHostEnt structure, acquired from PR_GetHostByName or PR_GetHostByAddr. Syntax #include <prnetdb.h> PRIntn PR_EnumerateHostEnt( PRIntn enumIndex, const PRHostEnt *hostEnt, PRUint16
port, PRNetAddr *address); Parameters The function has the following parameters: enumIndex The index of the enumeration. To begin an enumeration, this argument is set to zero. ...
...ndex of the enumeration. To begin an enumeration, this argument is set to zero. To continue an enumeration (thereby getting successive addresses from the host entry structure), the value should be set to the function's last returned value. The enumeration is complete when a value of zero is returned. hostEnt A pointer to a PRHostEnt structure obtained from PR_GetHostByName or PR_GetHostByAddr.
port The
port number to be assigned as part of the PRNetAddr structure. This parameter is not checked for validity. address On input, a pointer to a PRNetAddr structure. On output, this structure is filled in by the runtime if the result of the call is greater than 0. Returns The function returns one of the following values: If successful, the function returns the value you should specify in ...
PR_GetInheritedFileMap
Note: This function is not implemented. ...
... Note: This function is not implemented. ...
PR_OpenTCPSocket
Creates a new TCP socket of the specified address family. Syntax #include <prio.h> PRFileDesc* PR_OpenTCPSocket(PRIntn af); Parameters The function has the following parameters: af The address family of the new TCP socket. Can be PR_AF_INET (IPv4), PR_AF_INET6 (IPv6), or PR_AF_LOCAL (Unix domain, sup
ported on POSIX systems only). Returns The function returns one of the following values: Upon successful completion, a pointer to the PRFileDesc object created for the newly opened TCP socket. If the creation of a new TCP socket failed, NULL. Description TCP (Transmission Control Protocol) is a connection-oriented, reliable byte-stream protocol of the TCP/IP protocol suite. PR_OpenTCPSocket creates a new TCP socket of the address family af. A TCP connection is established by a ...
.... Description TCP (Transmission Control Protocol) is a connection-oriented, reliable byte-stream protocol of the TCP/IP protocol suite. PR_OpenTCPSocket creates a new TCP socket of the address family af. A TCP connection is established by a passive socket (the server) accepting a connection setup request from an active socket (the client). Typically, the server binds its socket to a well-known
port with PR_Bind, calls PR_Listen to start listening for connection setup requests, and calls PR_Accept to accept a connection. The client makes a connection request using PR_Connect. After a connection is established, the client and server may send and receive data between each other. To receive data, one can call PR_Read or PR_Recv. To send data, one can call PR_Write, PR_Writev, PR_Send, or PR_Tr...
PR OpenUDPSocket
Creates a new UDP socket of the specified address family. Syntax #include <prio.h> PRFileDesc* PR_OpenUDPSocket(PRIntn af); Parameters The function has the following parameters: af The address family of the new UDP socket. Can be PR_AF_INET (IPv4), PR_AF_INET6 (IPv6), or PR_AF_LOCAL (Unix domain, sup
ported on POSIX systems only). Returns The function returns one of the following values: Upon successful completion, a pointer to the PRFileDesc object created for the newly opened UDP socket. If the creation of a new UDP socket failed, NULL. Description UDP (User Datagram Protocol) is a connectionless, unreliable datagram protocol of the TCP/IP protocol suite. UDP datagrams may be lost or delivered in duplicates or out of sequence. PR_OpenUDPSocket creates a new UDP socket of...
...t created for the newly opened UDP socket. If the creation of a new UDP socket failed, NULL. Description UDP (User Datagram Protocol) is a connectionless, unreliable datagram protocol of the TCP/IP protocol suite. UDP datagrams may be lost or delivered in duplicates or out of sequence. PR_OpenUDPSocket creates a new UDP socket of the address family af. The socket may be bound to a well-known
port number with PR_Bind. Datagrams can be sent with PR_SendTo and received with PR_RecvFrom. When the socket is no longer needed, it should be closed with a call to PR_Close. ...
PR_SetConcurrency
mCPUs The number of extra virtual processor threads to be created. Description Setting concurrency controls the number of virtual processors that NSPR uses to implement its M x N threading model. The M x N model is not available on all host systems. On those where it is not available, PR_SetConcurrency is ignored. Virtual processors are actuallyglobal threads, each of which is designed to sup
port an arbitrary number oflocal threads. Since global threads are scheduled by the host operating system, this model is particularly applicable to multiprocessor architectures, where true parallelism is possible. However, it may also prove advantageous on uniprocessor systems to reduce the impact of having a locally scheduled thread calling incidental blocking functions. In such cases, all the thread...
...ry number oflocal threads. Since global threads are scheduled by the host operating system, this model is particularly applicable to multiprocessor architectures, where true parallelism is possible. However, it may also prove advantageous on uniprocessor systems to reduce the impact of having a locally scheduled thread calling incidental blocking functions. In such cases, all the threads being sup
ported by the virtual processor will block, but those assigned to another virtual processor will be unaffected. ...
NSPR
The API is used in the Mozilla clients, many of Red Hat's and Oracle's server applications, and other software offerings. Documentation About NSPR This topic describes, in general terms, the goals of NSPR and a bit about how it does it. NSPR API Reference The reference describes each API public macro, structure and function in the NSPR API. NSPR build instructions How to checkout and build from source. NSPR release process How to prepare an NSPR release. ...
...tions How to checkout and build from source. NSPR release process How to prepare an NSPR release. Legacy NSPR Content Older NSPR content is available in SVN for browsing and/or migration to this site Getting NSPR NSPR is available in various source and binary packages, depending on your platform: Windows: Build the source package, using the NSPR build instructions. Mac: Install the Mac
Ports nspr package, or the Homebrew nspr package. Ubuntu: Install the libnspr4-dev package via apt-get. Debian: Install the libnspr4-dev package via apt-get. openSUSE Linux: Install one or more of the following via yast or zypper : mozilla-nspr : Binary libraries for your platform mozilla-nspr-32bit : Binary libraries needed to run 32-bit programs on a 64-bit OS mozilla-nspr-devel : Fil...
NSS CERTVerify Log
CERTVerifyLog All the NSS verify functions except, the *VerifyNow() functions, take a parameter called 'CERTVerifyLog'. If you supply the log parameter, NSS will continue chain validation after each error . The log tells you what the problem was with the chain and what certificate in the chain failed. To create a log: #include "sec
port.h" #include "certt.h" CERTVerifyLog *log; arena =
PORT_NewArena(512); log =
PORT_ArenaZNew(arena,log); log->arena = arena; You can then pass this log into your favorite cert verify function. On return: log->count is the number of entries. log->head is the first entry; log->tail is the last entry. Each entry is a CERTVerifyLogNode. Defined in certt.h: /* * This structure is used to keep a log of errors when verifying * a cert chain. This allows m...
...RT_ArenaZNew(arena,log); log->arena = arena; You can then pass this log into your favorite cert verify function. On return: log->count is the number of entries. log->head is the first entry; log->tail is the last entry. Each entry is a CERTVerifyLogNode. Defined in certt.h: /* * This structure is used to keep a log of errors when verifying * a cert chain. This allows multiple errors to be re
ported all at * once. */ struct CERTVerifyLogNodeStr { CERTCertificate *cert; /* what cert had the error */ long error; /* what error was it? */ unsigned int depth; /* how far up the chain are we */ void *arg; /* error specific argument */ struct CERTVerifyLogNodeStr *next; /* next in the list */ struct CERTVerifyLogNodeStr *prev; /* next in ...
Certificate functions
interact with certificate databases. If documentation is available for a function listed below, the function name is linked to either its MDC wiki page or its entry in the old SSL Reference. The Mozilla Cross Reference (MXR) link for each function provides access to the function definition, prototype definition, and source code references. The NSS version column indicates which versions of NSS sup
port the function. Function name/documentation Source code NSS versions CERT_AddCertToListTail MXR 3.2 and later CERT_AddExtension MXR 3.5 and later CERT_AddOCSPAcceptableResponses MXR 3.6 and later CERT_AddOKDomainName MXR 3.4 and later CERT_AddRDN MXR 3.2.1 and later CERT_AsciiToName MXR 3.2 and ...
... CERT_GetSlopTime MXR 3.2 and later CERT_GetSSLCACerts MXR 3.2 and later CERT_GetStateName MXR 3.2 and later CERT_GetUsePKIXForValidation MXR 3.12 and later CERT_GetValidDNSPatternsFromCert MXR 3.12 and later CERT_GenTime2FormattedAscii MXR 3.2 and later CERT_Hexify MXR 3.2 and later CERT_Im
portCAChain MXR 3.2 and later CERT_Im
portCerts MXR 3.2 and later CERT_IsRootDERCert MXR 3.8 and later CERT_IsUserCert MXR 3.6 and later CERT_KeyFromDERCrl MXR 3.4 and later CERT_MakeCANickname MXR 3.4 and later CERT_MergeExtensions MXR 3.10 and later CERT_NameToAscii MXR 3.2 and later ...
FIPS Mode - an explanation
opy of NSS. (Note, the current version of FIPS 140 is revision 2, a.k.a. FIPS 140-2. FIPS 140-3 is being devised by NIST now for adoption in the future.) Users who are subject to the FIPS regulations must ensure that they have Mozilla's FIPS Mode enabled when they use Mozilla software, in order to be fully conformant. Instructions for how to configure Firefox into FIPS mode may be found on sup
port.mozilla.com. Is NSS FIPS-140 compliant? Mozilla's NSS cryptographic software has been tested by government-approved independent testing labs and certified by NIST as being FIPS 140 compliant when operated in FIPS mode on 4 previous occasions. As of this writing, NSS is now being retested to be recertified for the fifth time. NSS was the first open source cryptographic library to be FIPS certi...
...ers. NSS divides its operations up into two "devices" rather than just one. One device does all the operations that may be done without needing to authenticate, and the other device stores the user's certificates and private keys and performs operations that use those private keys. How do I put Firefox into FIPS Mode? Instructions for how to configure Firefox into FIPS mode may be found on sup
port.mozilla.com. Some third-parties distribute Firefox ready for FIPS mode, a partial list can be found at the NSS wiki. ...
Getting Started With NSS
f Mozilla Firefox and other applications that make use of NSS? We are looking forward to your contributions! We have a large list of tasks waiting for attention, and we are happy to assist you in identifying areas that match your interest or skills. You can find us on Mozilla IRC in channel #nss or you could ask your questions on the mozilla.dev.tech.crypto newsgroup. The NSS library and its sup
porting command line tools are written in the C programming language. Its build system and the automated tests are based on makefiles and bash scripts. Over time, many documents have been produced that describe various aspects of NSS. You can start with: the current primary NSS documentation page from which we link to other documentation. a General Overview of the applications that use NSS and th...
...irectory mozilla/security/nss/cmd Or have a look at some basic NSS sample code. A new set of samples is currently under development and review, see Create new NSS samples. You are welcome to download the samples via: hg clone https://hg.mozilla.org/projects/nss; cd nss; hg update SAMPLES_BRANCH How to Contribute ... (this section is still under construction, but there are many contribution op
portunities) Start by opening a bugzilla account at bugzilla.mozilla.org if you don't have one. NSS :: Libraries component for issues you'd like to work on. We maintain a list of NSS bugs marked with a keyword "good-first-bug" that you can view. Creating your Patch Seee our section on NSS sources, building, and testing to get started making your patch. When you're satisfied with it, you'll need c...
NSS_3.12.2_release_notes.html
stanpcertdb.c should set the PR_NOT_IMPLEMENTED_ERROR error. Bug 456854: CERT_DecodeCertPackage does not set NSPR error code upon error Bug 457980: hundreds of kilobytes of useless strings in libPKIX Bug 457984: Enable PKCS11 module logging in optimized builds Bug 458905: Memory leaks in PKIX bridge certificates. Bug 459231: Memory leak in cert fetching - AIA extension. Bug 459248: Sup
port Intel AES extensions. Bug 459359: ForwardBuilderState object is leaked when AIA path incorrect Bug 459481: NSS build problem with GCC 3.4.6 on OS/2 Documentation For a list of the primary NSS documentation pages on mozilla.org, see NSS Documentation. New and revised documents available since the release of NSS 3.11 include the following: Build Instructions for NSS 3.11.4 and above NS...
...tible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.12.2 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with mozilla.org Bugzilla (product NSS). ...
NSS 3.15.4 release notes
rade immediately. Bug 919877 - (CVE-2013-1740) When false start is enabled, libssl will sometimes return unencrypted, unauthenticated data from PR_Recv New in NSS 3.15.4 New Functionality Implemented OCSP querying using the HTTP GET method, which is the new default, and will fall back to the HTTP POST method. Implemented OCSP server functionality for testing purposes (httpserv utility). Sup
port SHA-1 signatures with TLS 1.2 client authentication. Added the --empty-password command-line option to certutil, to be used with -N: use an empty password when creating a new database. Added the -w command-line option to pp: don't wrap long output lines. New Functions CERT_ForcePostMethodForOCSP CERT_GetSubjectNameDigest CERT_GetSubjectPublicKeyDigest SSL_PeerCertificateChain SSL_Recomme...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.15.4 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.15.5 release notes
.15.5 are described in the "Bugs Fixed" section below. Distribution Information The HG tag is NSS_3_15_5_RTM. NSS 3.15.5 requires NSPR 4.10.2 or newer. NSS 3.15.5 source distributions are also available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_15_5_RTM/src/ New in NSS 3.15.5 New Functionality Added sup
port for the TLS application layer protocol negotiation (ALPN) extension. Two SSL socket options, SSL_ENABLE_NPN and SSL_ENABLE_ALPN, can be used to control whether NPN or ALPN (or both) should be used for application layer protocol negotiation. Added the TLS padding extension. The extension type value is 35655, which may change when an official extension type value is assigned by IANA. NSS automatic...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.15.5 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.16.2.2 release notes
: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_16_2_2_RTM/src/ New in NSS 3.16.2.2 New Functionality No new functionality is introduced in this release. This is a patch release to fix a regression. Notable Changes in NSS 3.16.2.2 Bug 1049435: Change RSA_PrivateKeyCheck to not require p > q. This fixes a regression introduced in NSS 3.16.2 that prevented NSS from im
porting some RSA private keys (such as in PKCS #12 files) generated by other crypto libraries. Bugs fixed in NSS 3.16.2.2 Bug 1049435 - Im
porting an RSA private key fails if p < q Compatibility NSS 3.16.2.2 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.2.2 shared libraries without r...
...ible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.2.2 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.16.6 release notes
rballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_16_6_RTM/src/ New in NSS 3.16.6 New Functionality No new functionality is introduced in this release. This is a patch release to fix a regression. Notable Changes in NSS 3.16.6 Bug 1049435: Change RSA_PrivateKeyCheck to not require p > q. This fixes a regression introduced in NSS 3.16.2 that prevented NSS from im
porting some RSA private keys (such as in PKCS #12 files) generated by other crypto libraries. Bugs fixed in NSS 3.16.6 Bug 1049435 - Im
porting an RSA private key fails if p < q Compatibility NSS 3.16.6 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.6 shared libraries without recompi...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.16.6 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.16 release notes
as released Network Security Services (NSS) 3.16, which is a minor release. Distribution Information The HG tag is NSS_3_16_RTM. NSS 3.16 requires NSPR 4.10.3 or newer. NSS 3.16 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_16_RTM/src/ New in NSS 3.16 New Functionality Sup
ports the Linux x32 ABI. (This requires NSPR 4.10.4.) To build for the Linux x32 target, set the environment variable USE_X32=1 when building NSS. New Functions in cms.h NSS_CMSSignerInfo_Verify - verify the signature of a single SignerInfo. It just verifies the signature, assuming that the certificate has been verified already. New Macros in sslproto.h TLS_RSA_WITH_RC4_128_SHA,...
...n sec_pkcs12_new_asafe. Bug 956082: If the NSS_SDB_USE_CACHE environment variable is set, skip the runtime test sdb_measureAccess. The built-in roots module has been updated to version 1.97, which adds, removes, and distrusts several certificates. The atob utility has been improved to automatically ignore lines of text that aren't in base64 format. The certutil utility has been improved to sup
port creation of version 1 and version 2 certificates, in addition to the existing version 3 sup
port. Bugs fixed in NSS 3.16 This Bugzilla query returns all the bugs fixed in NSS 3.16: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.16 ...
NSS 3.17.2 release notes
https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_17_2_RTM/src/ New in NSS 3.17.2 New Functionality No new functionality is introduced in this release. This is a patch release to fix a regression and other bugs. Notable Changes in NSS 3.17.2 Bug 1049435: Change RSA_PrivateKeyCheck to not require p > q. This fixes a regression introduced in NSS 3.16.2 that prevented NSS from im
porting some RSA private keys (such as in PKCS #12 files) generated by other crypto libraries. Bug 1057161: Check that an im
ported elliptic curve public key is valid. Previously NSS would only validate the peer's public key before performing ECDH key agreement. Now EC public keys are validated at im
port time. Bug 1078669: certutil crashes when an argument is passed to the --certVersion option. Bugs...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.17.2 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.17.3 release notes
SS 3.17.3 are described in the "Bugs Fixed" section below. Distribution Information The HG tag is NSS_3_17_3_RTM. NSS 3.17.3 requires NSPR 4.10.7 or newer. NSS 3.17.3 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_17_3_RTM/src/ New in NSS 3.17.3 New Functionality Sup
port for TLS_FALLBACK_SCSV has been added to the ssltap and tstclnt utilities. Notable Changes in NSS 3.17.3 The QuickDER decoder now decodes lengths robustly (CVE-2014-1569). The following CA certificates were Removed CN = GTE CyberTrust Global Root SHA1 Fingerprint: 97:81:79:50:D8:1C:96:70:CC:34:D8:09:CF:79:44:31:36:7E:F4:74 CN = Thawte Server CA SHA1 Fing...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.17.3 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.17.4 release notes
https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_17_4_RTM/src/ New in NSS 3.17.4 New Functionality No new functionality is introduced in this release. This is a patch release to fix multiple bugs. Notable Changes in NSS 3.17.4 Bug 1084986: If an SSL/TLS connection fails, because client and server don't have any common protocol version enabled, NSS has been changed to re
port error code SSL_ERROR_UNSUP
PORTED_VERSION (instead of re
porting SSL_ERROR_NO_CYPHER_OVERLAP). Bug 1112461: libpkix was fixed to prefer the newest certificate, if multiple certificates match. Bug 1094492: fixed a memory corruption issue during failure of keypair generation. Bug 1113632: fixed a failure to reload a PKCS#11 module in FIPS mode. Bug 1119983: fixed interoperability of NSS server co...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.17.4 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.19.2.1 release notes
ling streaming BER data. While the majority of NSS uses a separate, unaffected DER decoder, several public routines also accept BER data, and thus are affected. An attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code execution. The following security-relevant bugs have been resolved in NSPR 4.10.10, which affect NSS. Because NSS includes
portions of the affected NSPR code at build time, it is necessary to use NSPR 4.10.10 when building NSS. Bug 1205157 (NSPR, CVE-2015-7183): A logic bug in the handling of large allocations would allow exceptionally large allocations to be re
ported as successful, without actually allocating the requested memory. This may allow attackers to bypass security checks and obtain control of arbitrary mem...
...ible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.19.2.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.19.2.4 release notes
r newer. NSS 3.19.2.4 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_19_2_4_RTM/src/ New in NSS 3.19.2.4 New Functionality No new functionality has been introduced in this release. ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.19.2.4 shared libraries without recompiling or relinking. Furthermore, applications that restrict the use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.19.4 release notes
ling streaming BER data. While the majority of NSS uses a separate, unaffected DER decoder, several public routines also accept BER data, and thus are affected. An attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code execution. The following security-relevant bugs have been resolved in NSPR 4.10.10, which affect NSS. Because NSS includes
portions of the affected NSPR code at build time, it is necessary to use NSPR 4.10.10 when building NSS. Bug 1205157 (NSPR, CVE-2015-7183): A logic bug in the handling of large allocations would allow exceptionally large allocations to be re
ported as successful, without actually allocating the requested memory. This may allow attackers to bypass security checks and obtain control of arbitrary mem...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.19.4 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.19 release notes
traints - Check if any imposed constraints exist for the given certificate, and if found, return the constraints as encoded certificate extensions. Notable Changes in NSS 3.19 The SSL 3 protocol has been disabled by default. NSS now more strictly validates TLS extensions and will fail a handshake that contains malformed extensions (bug 753136). In TLS 1.2 handshakes, NSS advertises sup
port for the SHA512 hash algorithm in order to be compatible with TLS servers that use certificates with a SHA512 signature (bug 1155922). Bugs fixed in NSS 3.19 This Bugzilla query returns all the bugs fixed in NSS 3.19: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.19 Acknowledgements The NSS development...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.19 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.20.1 release notes
ling streaming BER data. While the majority of NSS uses a separate, unaffected DER decoder, several public routines also accept BER data, and thus are affected. An attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code execution. The following security-relevant bugs have been resolved in NSPR 4.10.10, which affect NSS. Because NSS includes
portions of the affected NSPR code at build time, it is necessary to use NSPR 4.10.10 when building NSS. Bug 1205157 (NSPR, CVE-2015-7183): A logic bug in the handling of large allocations would allow exceptionally large allocations to be re
ported as successful, without actually allocating the requested memory. This may allow attackers to bypass security checks and obtain control of arbitrary mem...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.20.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.22.2 release notes
in NSS 3.22.2 Bug 1245528 / CVE-2016-1950 - Fixed a heap-based buffer overflow related to the parsing of certain ASN.1 structures. An attacker could create a specially-crafted certificate which, when parsed by NSS, would cause a crash or execution of arbitrary code with the permissions of the user. Notable Changes in NSS 3.22.2 Bug 1247990 - The root CA changes from NSS 3.23 have been back
ported. Acknowledgements The NSS development team would like to thank security researcher Francis Gabriel for responsibly disclosing the issue in Bug 1245528. Compatibility NSS 3.22.2 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.22.2 shared libraries without recompiling or relinking. Fur...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.22.2 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.26 release notes
Introduction The Network Security Services (NSS) team has released NSS 3.26, which is a minor release. Distribution information The hg tag is NSS_3_26_RTM. NSS 3.26 requires Netscape
Portable Runtime (NSPR) 4.12 or newer. NSS 3.26 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_26_RTM/src/ New in NSS 3.26 New Functionality the selfserv test utility has been enhanced to sup
port ALPN (HTTP/1.1) and 0-RTT added sup
port for the System-wide crypto policy available on Fedora Linux, see http://fedoraproject.org/wiki/Changes/CryptoPolicy introduced build flag NSS_DISABLE_LIBPKIX which allows compilation of NSS without the libpkix library Notable Changes in NS...
...ackwards compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.26 shared libraries without recompiling or relinking. Applications that restrict their use of NSS APIs, to the functions listed in NSS Public Functions, will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.27.1 release notes
ementation has been re-disabled in the default build. Previous versions of NSS made TLS 1.3 (draft) available only when compiled with NSS_ENABLE_TLS_1_3. NSS 3.27 set this value on by default, allowing TLS 1.3 (draft) to be disabled using NSS_DISABLE_TLS_1_3, although the maximum version used by default remained TLS 1.2. However, some applications query the list of protocol versions that are sup
ported by the NSS library, enabling all sup
ported TLS protocol versions. Because NSS 3.27 enabled compilation of TLS 1.3 (draft) by default, it caused those applications to enable TLS 1.3 (draft). This resulted in connectivity failures, as some TLS servers are version 1.3 intolerant, and failed to negotiate an earlier TLS version with NSS 3.27 clients. NSS 3.27.1 once again requires NSS_ENABLE_TLS_1_...
...ackwards compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.27.1 shared libraries without recompiling or relinking. Applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.28.2 release notes
3.28. Distribution Information The HG tag is NSS_3_28_2_RTM. NSS 3.28.2 requires NSPR 4.13.1 or newer. NSS 3.28.2 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_28_2_RTM/src/ Incorrect version number Note the version numbers embedded in the NSS 3.28.2 are wrong (it re
ports itself as version 3.28.1). New in NSS 3.28.2 No new functionality is introduced in this release. This is a patch release includes bug fixes and addresses some compatibility issues with TLS. Bugs fixed in NSS 3.28.2 Bug 1334114 - NSS 3.28 regression in signature scheme flexibility, causes connectivity issue between iOS 8 clients and NSS servers with ECDSA certificates Bug 1330612 - X25...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.28.2 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.28.5 release notes
_3_28_5_RTM. NSS 3.28.5 requires NSPR 4.13.1 or newer. NSS 3.28.5 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_28_5_RTM/src/ New in NSS 3.28.5 No new functionality is introduced in this release. This is a patch release to update the list of root CA certificates. It back
ports the changes that were initially released in NSS version 3.30.2. Notable Changes in NSS 3.28.5 The following CA certificates were Removed: O = Japanese Government, OU = ApplicationCA SHA-256 Fingerprint: 2D:47:43:7D:E1:79:51:21:5A:12:F3:C5:8E:51:C7:29:A5:80:26:EF:1F:CC:0A:5F:B3:D9:DC:01:2F:60:0D:19 CN = WellsSecure Public Root Certificate Authority SHA-2...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.28.5 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.29.2 release notes
Introduction Network Security Services (NSS) 3.29.2 is a patch release for NSS 3.29. The bug fixes in NSS 3.29.2 are described in the "Bugs Fixed" section below. Distribution Information The HG tag is NSS_3_29_2_RTM. NSS 3.29.2 requires Netscape
Portable Runtime (NSPR) 4.13.1 or newer. NSS 3.29.2 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_29_2_RTM/src/ New in NSS 3.29.2 New Functionality No new functionality is introduced in this release. Bugs fixed in NSS 3.29.2 NSS 3.29 and 3.29.1 included a change that reduced the time that NSS considered a TLS session ticket to be valid. This release restores the session ticket lifetime to the intended value. See Bug 1340841...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.29.2 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.29 release notes
Introduction The Network Security Services (NSS) team has released NSS 3.29, which is a minor release. Distribution information The hg tag is NSS_3_29_RTM. NSS 3.29 requires Netscape
Portable Runtime (NSPR) 4.13.1 or newer. NSS 3.29 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_29_RTM/src/ Notable Changes in NSS 3.29 Fixed a NSS 3.28 regression in the signature scheme flexibility that causes connectivity issues between iOS 8 clients and NSS servers with ECDSA certificates (bug1334114). TLS 1.3 is now enabled by default in (bug1311296). Bugs fixed in NSS 3.29 This Bugzilla query returns all the bugs fixed in NSS 3.29: https://bugzilla.mozilla.org/bug...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.29 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.31.1 release notes
This is a DRAFT document. This notice will be removed when completed. Introduction The Network Security Services (NSS) team has released NSS 3.31.1, which is a patch release for NSS 3.31. Distribution information The hg tag is NSS_3_31_1_RTM. NSS 3.31.1 requires Netscape
Portable Runtime (NSPR) 4.15, or newer. NSS 3.31.1 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_31_1_RTM/src/ New in NSS 3.31.1 No new functionality is introduced in this release. Bugs fixed in NSS 3.31.1 Bug 1381784 - Potential deadlock when using an external PKCS#11 token. Compatibility NSS 3.31.1 shared libraries are backward compatible with all older NSS 3.x shared libraries...
...ible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.31.1 shared libraries, without recompiling, or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.32 release notes
NSS 3.32 source distributions are available on ftp.mozilla.org, for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_32_RTM/src/ Notable Changes in NSS 3.32 Various minor improvements and correctness fixes. The Code Signing trust bit was turned off for all, included root certificates. ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.32 shared libraries, without recompiling, or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (select the product 'NSS'). ...
NSS 3.34.1 release notes
NSS 3.34.1 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_34_1_RTM/src/ Notable Changes in NSS 3.34.1 The following CA certificate was Re-Added. It was previously removed in NSS 3.34, but now re-added with only the Email trust bit set. ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.34 shared libraries, without recompiling, or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (select product 'NSS'). ...
NSS 3.36.8 release notes
er releases are available in NSS Releases. New in NSS 3.36.8 New Functionality No new functionality is introduced in this release. This is a patch release to fix bugs. Bugs fixed in NSS 3.36.8 1554336 - Optimize away unneeded loop in mpi.c 1515342 - More thorough input checking (CVE-2019-11729) 1540541 - Don't unnecessarily strip leading 0's from key material during PKCS11 im
port (CVE-2019-11719) Compatibility NSS 3.36.8 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.36.8 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with fu...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.36.8 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.40 release notes
3.40, which is a minor release. Distribution Information The HG tag is NSS_3_40_RTM. NSS 3.40 requires NSPR 4.20 or newer. NSS 3.40 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_40_RTM/src/ New in NSS 3.40 New Functionality The draft-00 version of encrypted SNI sup
port is implemented tstclnt now takes -N option to specify encrypted SNI key New Functions none Notable Changes in NSS 3.40 The mozilla::pkix library has been
ported from Mozilla PSM to NSS. This is a C++ library for building certification paths. mozilla::pkix APIs are not exposed in the libraries NSS builds. It is easier to build NSS on Windows in mozilla-build environments. The ...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.40 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.41 release notes
Fingerprint: 56C77128D98C18D91B4CFDFFBC25EE9103D4758EA2ABAD826A90F3457D460EB4 CN = OpenTrust Root CA G2 SHA-256 Fingerprint: 27995829FE6A7515C1BFE848F9C4761DB16C225929257BF40D0894F29EA8BAF2 CN = OpenTrust Root CA G3 SHA-256 Fingerprint: B7C36231706E81078C367CB896198F1E3208DD926949DD8F5709A410F75B6292 Bugs fixed in NSS 3.41 Bug 1412829, Reject empty sup
ported_signature_algorithms in Certificate Request in TLS 1.2 Bug 1485864 - Cache side-channel variant of the Bleichenbacher attack (CVE-2018-12404) Bug 1481271 - Resend the same ticket in ClientHello after HelloRetryRequest Bug 1493769 - Set session_id for external resumption tokens Bug 1507179 - Reject CCS after handshake is complete in TLS 1.3 This Bugzilla query returns all...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.41 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.44.4 release notes
Distribution Information The HG tag is NSS_3_44_4_RTM. NSS 3.44.4 requires NSPR 4.21 or newer. ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.44.4 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.48.1 release notes
lable on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_48_1_RTM/src/ Other releases are available in NSS Releases. New in NSS 3.48.1 No new functionality is introduced in this release. Bugs fixed in NSS 3.48.1 Bug 1606992 - Cache the most recent PBKDF2 password hash, to speed up repeated SDR operations, im
portant with the increased KDF iteration counts. This Bugzilla query returns all the bugs fixed in NSS 3.48: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.48 Compatibility NSS 3.48.1 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.48.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.48 release notes
42 - Ensure DES IV length is valid before usage from PKCS#11 Bug 1588567 - Enable mozilla::pkix gtests in NSS CI Bug 1591315 - Update NSC_Decrypt length in constant time Bug 1562671 - Increase NSS MP KDF default iteration count, by default for modern key4 storage, optionally for legacy key3.db storage Bug 1590972 - Use -std=c99 rather than -std=gnu99 Bug 1590676 - Fix build if ARM doesn't sup
port NEON Bug 1575411 - Enable TLS extended master secret by default Bug 1590970 - SSL_SetTimeFunc has incomplete coverage Bug 1590678 - Remove -Wmaybe-uninitialized warning in tls13esni.c Bug 1588244 - NSS changes for Delegated Credential key strength checks Bug 1459141 - Add more CBC padding tests that missed NSS 3.47 Bug 1590339 - Fix a memory leak in btoa.c Bug 1589810 - fix uninitialized v...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.48 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.49.1 release notes
lable on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_49_1_RTM/src/ Other releases are available in NSS Releases. New in NSS 3.49.1 No new functionality is introduced in this release. Bugs fixed in NSS 3.49.1 Bug 1606992 - Cache the most recent PBKDF2 password hash, to speed up repeated SDR operations, im
portant with the increased KDF iteration counts. This Bugzilla query returns all the bugs fixed in NSS 3.49: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.49 Compatibility NSS 3.49.1 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.49.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.49.2 release notes
lable on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_49_2_RTM/src/ Other releases are available in NSS Releases. New in NSS 3.49.2 No new functionality is introduced in this release. Bugs fixed in NSS 3.49.2 Bug 1606992 - Cache the most recent PBKDF1 password hash, to speed up repeated SDR operations, im
portant with the increased KDF iteration counts. NSS 3.49.1 sped up PBKDF2 operations, though PBKDF1 operations are also relevant for older NSS databases. Bug 1608327 - Fix compilation problems with NEON-specific code in freebl Bug 1608895 - Fix a taskcluster issue with Python 2 / Python 3 This Bugzilla query returns all the bugs fixed in NSS 3.49: https://bugzilla.mozilla.org/buglist.cgi?resolut...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.49.2 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.51.1 release notes
for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_51_1_RTM/src/ Other releases are available in NSS Releases. Notable Changes in NSS 3.51.1 Bug 1617968 - Update Delegated Credentials implementation to draft-07. Bugs fixed in NSS 3.51.1 Bug 1619102 - Add workaround option to include both DTLS and TLS versions in DTLS sup
ported_versions. Bug 1619056 - Update README: TLS 1.3 is not experimental anymore. Bug 1618739 - Don't assert fuzzer behavior in SSL_ParseSessionTicket. Bug 1618915 - Fix UBSAN issue in ssl_ParseSessionTicket. Bug 1608245 - Consistently handle NULL slot/session. Bug 1608250 - broken fipstest handling of KI_len. Bug 1617968 - Update Delegated Credentials implementation to draft-07. Compatibilit...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.51.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.51 release notes
ug 1608892 - Update DTLS 1.3 implementation to draft-34. Bug 1611209 - Correct swapped PKCS11 values of CKM_AES_CMAC and CKM_AES_CMAC_GENERAL Bug 1612259 - Complete integration of Wycheproof ECDH test cases Bug 1614183 - Check if PPC __has_include(<sys/auxv.h>) Bug 1614786 - Fix a compilation error for 'getFIPSEnv' "defined but not used" Bug 1615208 - Send DTLS version numbers in DTLS 1.3 sup
ported_versions extension to avoid an incompatibility. Bug 1538980 - SECU_ReadDERFromFile calls strstr on a string that isn't guaranteed to be null-terminated Bug 1561337 - Correct a warning for comparison of integers of different signs: 'int' and 'unsigned long' in security/nss/lib/freebl/ecl/ecp_25519.c:88 Bug 1609751 - Add test for mp_int clamping Bug 1582169 - Don't attempt to read the fips_en...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.51 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.52.1 release notes
Distribution Information The HG tag is NSS_3_52_1_RTM. NSS 3.52.1 requires NSPR 4.25 or newer. ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.52.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.53.1 release notes
Distribution Information The HG tag is NSS_3_53_1_RTM. NSS 3.53.1 requires NSPR 4.25 or newer. ...
...atible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.53.1 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS 3.56 release notes
on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_56_RTM/src/ Other releases are available in NSS Releases. Notable Changes in NSS 3.56 NSPR dependency updated to 4.28. The known issue where Makefile builds failed to locate seccomon.h was fixed in Bug 1653975. Bugs fixed in NSS 3.56 Bug 1650702 - Sup
port SHA-1 HW acceleration on ARMv8 Bug 1656981 - Use MPI comba and mulq optimizations on x86-64 MacOS. Bug 1654142 - Add CPU feature detection for Intel SHA extension. Bug 1648822 - Add stricter validation of DH keys in FIPS mode. Bug 1656986 - Properly detect arm64 during GYP build architecture detection. Bug 1652729 - Add build flag to disable RC2 and relocate to lib/freebl/deprecated. Bug 16...
...mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.56 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS Sample Code sample2
NSS Sample Code 2: Symmetric Encryption /* Example code to illustrate DES enccryption/decryption using NSS. * The example skips the details of obtaining the Key & IV to use, and * just uses a hardcoded Key & IV. * Note: IV is only needed if Cipher Blocking Chaining (CBC) mode of encryption * is used * * The recommended approach is to store and trans
port WRAPPED (encrypted) * DES Keys (IVs can be in the clear). However, it is a common (and dangerous) * practice to use raw DES Keys. This example shows the use of a RAW key. */ #include "nss.h" #include "pk11pub.h" /* example Key & IV */ unsigned char gKey[] = {0xe8, 0xa7, 0x7c, 0xe2, 0x05, 0x63, 0x6a, 0x31}; unsigned char gIV[] = {0xe4, 0xbb, 0x3b, 0xd3, 0xc3, 0x71, 0x2e, 0x58}; int main(int argc, char **argv) { CK_M...
...round as SECItems. These contain a pointer to * data and a length. Turn the raw key into a SECItem. */ keyItem.type = siBuffer; keyItem.data = gKey; keyItem.len = sizeof(gKey); /* Turn the raw key into a key object. We use PK11_OriginUnwrap * to indicate the key was unwrapped - which is what should be done * normally anyway - using raw keys isn't a good idea */ SymKey = PK11_Im
portSymKey(slot, cipherMech, PK11_OriginUnwrap, CKA_ENCRYPT, &keyItem, NULL); if (SymKey == NULL) { fprintf(stderr, "Failure to im
port key into NSS (err %d)\n", PR_GetError()); goto out; } /* set up the PKCS11 encryption paramters. * when not using CBC mode, ivItem.data and ivItem.len can be 0, or you * can simply pass NULL for the iv par...
FC_GetMechanismList
A user may call FC_GetMechanismList without logging into the token (to assume the NSS User role). ...
...A user may call FC_GetMechanismList without logging into the token (to assume the NSS User role). ...
FIPS mode of operation
ion FC_CloseAllSessions FC_GetSessionInfo FC_GetOperationState FC_SetOperationState FC_Login FC_Logout Object management functions These functions manage certificates and keys. FC_CreateObject FC_CopyObject FC_DestroyObject FC_GetObjectSize FC_GetAttributeValue FC_SetAttributeValue FC_FindObjectsInit FC_FindObjects FC_FindObjectsFinal Encryption functions These functions sup
port Triple DES and AES in ECB and CBC modes. FC_EncryptInit FC_Encrypt FC_EncryptUpdate FC_EncryptFinal Decryption functions These functions sup
port Triple DES and AES in ECB and CBC modes. FC_DecryptInit FC_Decrypt FC_DecryptUpdate FC_DecryptFinal Message digesting functions These functions sup
port SHA-1, SHA-256, SHA-384, and SHA-512. FC_DigestInit FC_Digest FC_DigestUpdate ...
... FC_EncryptFinal Decryption functions These functions sup
port Triple DES and AES in ECB and CBC modes. FC_DecryptInit FC_Decrypt FC_DecryptUpdate FC_DecryptFinal Message digesting functions These functions sup
port SHA-1, SHA-256, SHA-384, and SHA-512. FC_DigestInit FC_Digest FC_DigestUpdate FC_DigestKey FC_DigestFinal Signature and MAC generation functions These functions sup
port DSA, RSA, ECDSA, and HMAC. FC_SignInit FC_Sign FC_SignUpdate FC_SignFinal FC_SignRecoverInit FC_SignRecover Signature and MAC verification functions These functions sup
port DSA, RSA, ECDSA, and HMAC. FC_VerifyInit FC_Verify FC_VerifyUpdate FC_VerifyFinal FC_VerifyRecoverInit FC_VerifyRecover Dual-function cryptographic functions FC_DigestEncryptUpdate FC_DecryptDigestUpda...
NSS cryptographic module
The NSS cryptographic module has two modes of operation: the non-FIPS (default) mode and FIPS mode. ...
...by different functions. The standard PKCS #11 function C_GetFunctionList or the equivalent NSC_GetFunctionList function returns pointers to the functions that implement the default mode of operation. To enable the FIPS mode of operation, use the function FC_GetFunctionList instead to get pointers to the functions that implement the FIPS mode of operation. The NSS cryptographic module also ex
ports the function NSC_ModuleDBFunc for managing the NSS module database secmod.db. The following sections document the data types and functions. PKCS #11 data types PKCS #11 functions in the non-FIPS (default) mode of operation PKCS #11 functions in the FIPS mode of operation NSC_ModuleDBFunc ...
troubleshoot.html
rmation on troubleshooting the NSS and JSS build and test systems, including known problems and configuration suggestions. If you have suggestions for this page, please post them to mozilla.dev.tech.crypto. Building NSS Having /usr/ucb/bin in the path before /usr/ccs/bin breaks the build on 64-bit Solaris. The Solaris compiler needs to be workshop-5.0 or greater. The 64-bit builds don't sup
port gcc. If the build fails early on the gmakein coreconf try updating your cvs tree with -P: cd mozilla cvs update -P Building a 32-bit version on a 64-bit may fail with: /usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory In this case remember to set USE_64=1 Testing NSS The SSL stress test opens 2,048 TCP connections in quick succession. Ke...
...directory In this case remember to set USE_64=1 Testing NSS The SSL stress test opens 2,048 TCP connections in quick succession. Kernel data structures may remain allocated for these connections for up to two minutes. Some systems may not be configured to allow this many simultaneous connections by default; if the stress tests fail, try increasing the number of simultaneous sockets sup
ported. Building JSS Windows Only: The shell invoked by gmake, shmsdos.exe, is likely to crash when invoking some Java tools on Windows. The current workaround is to use some other shell in place of shmsdos, such as sh.exe, which should be distributed with the Cygnus toolkit you installed to build NSS. The change is unfortunately rather drastic: to trick gmake, you rename the shell program. ...
OLD SSL Reference
Additional types are described with the functions that use them or in the header files. Types and Structures CERTCertDBHandle CERTCertificate PK11SlotInfo SECItem ...
...tionGetDefault SSL_CipherPrefSetDefault SSL_CipherPrefGetDefault SSL_ClearSessionCache SSL_ConfigServerSessionIDCache Initializing Multi-Processing with a Shared SSL Server Cache SSL_ConfigMPServerSIDCache SSL_InheritMPServerSIDCache SSL Ex
port Policy Functions NSS_SetDomesticPolicy NSS_SetEx
portPolicy NSS_SetFrancePolicy SSL_CipherPolicySet SSL_CipherPolicyGet SSL Configuration Functions SSL Configuration SSL_Im
portFD SSL_OptionSet ...
ssltyp.html
rt of the SSL Reference that we are migrating into the format described in the MDN Style Guide. If you are inclined to help with this migration, your help would be very much appreciated. Upgraded documentation may be found in the Current NSS Reference Selected SSL Types and Structures Chapter 3 Selected SSL Types and Structures This chapter describes some of the most im
portant types and structures used with the functions described in the rest of this document, and how to manage the memory used for them. Additional types are described with the functions that use them or in the header files. Types and Structures Managing SECItem Memory Types and Structures These types and structures are described here: CERTCertDBHandle CERTCertificate PK11SlotInfo SECIt...
... attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. PK11SlotInfo An opaque structure representing a physical or logical PKCS #11 slot. Syntax #include <pk11expt.h> typedef struct PK11SlotInfoStr PK11SlotInfo; SECItem A structure that points to other structures. ...
S/MIME functions
The public functions listed here perform S/MIME operations using the S/MIME Toolkit. The Mozilla Cross Reference (MXR) link for each function provides access to the function definition, prototype definition, and source code references. The NSS version column indicates which versions of NSS sup
port the function. Function name/documentation Source code NSS versions NSS_CMSContentInfo_GetBulkKey MXR 3.2 and later NSS_CMSContentInfo_GetBulkKeySize MXR 3.2 and later NSS_CMSContentInfo_GetContent MXR 3.2 and later NSS_CMSContentInfo_GetContentEncAlgTag MXR 3.2 and later NSS_CMSContentInfo_GetContentTypeTag MXR 3.2 and later ...
...S_CMSSignedData_Destroy MXR 3.2 and later NSS_CMSSignedData_GetContentInfo MXR 3.2 and later NSS_CMSSignedData_GetDigestAlgs MXR 3.2 and later NSS_CMSSignedData_GetSignerInfo MXR 3.2 and later NSS_CMSSignedData_HasDigests MXR 3.2 and later NSS_CMSSignedData_Im
portCerts MXR 3.2 and later NSS_CMSSignedData_SetDigests MXR 3.2 and later NSS_CMSSignedData_SetDigestValue MXR 3.4 and later NSS_CMSSignedData_SignerInfoCount MXR 3.2 and later NSS_CMSSignedData_VerifyCertsOnly MXR 3.2 and later NSS_CMSSignedData_VerifySignerInfo...
NSS tools : signver
standard cryptographic techniques. The Signature Verification Tool can also display the contents of the signed object. Options -A Displays all of the information in the PKCS#7 signature. -V Verifies the digital signature. -d [sql:]directory Specify the database directory which contains the certificates and keys. signver sup
ports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new SQLite databases (cert9.db, key4.db, and pkcs11.txt). If the prefix sql: is not used, then the tool assumes that the given databases are in the old format. -a Sets that the given signature file is in ASCII format. -i input_file ...
...me that the given security databases follow the more common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: # signver -A -s signature -d sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: ex
port NSS_DEFAULT_DB_TYPE="sql" This line can be set added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: o https://wiki.mozilla.org/NSS_Shared_DB_Howto F...
Necko FAQ
word rhyming with Gecko and starting with the same letters as networking. That's all! Any resemblance in flavor to the Necco candy is purely coincidental. What do I need to build this library? See the code section on the main page. Currently you'd need to get the mozilla tree and at least build NSPR, and XPCOM. TODO put links! How does PSM fit into this picture? Todo How does the proxy sup
port work? Todo What about Proxy Auto Config? Todo What about SOCKS sup
port? Todo When is the next stable release of this library going to be available? Todo I'd like to use this library for my project. What licences apply? Todo - MPL What do the page load options mean in the preferences? Todo Original Document Information Author(s): Gagan Saksena Last Updated Date: December 21, ...
... ...
Necko Interfaces Overview
equest attribute of a nsIRequest channel impl adds itself to its load group during invocation of AsyncOpen channel impl removes itself from its load group when download completes load groups in gecko own all channels used to load a particular page (until the channels complete) all channels owned by a load group can be canceled at once via the load group's nsIRequest::Cancel method nsITrans
port represents a physical connection, such as a file descriptor or a socket used directly by protocol handler implementations (as well as by mailnews and chatzilla) synchronous I/O methods: OpenInputStream, OpenOutputStream asynchronous I/O methods: AsyncRead, AsyncWrite nsITrans
port::AsyncRead takes a nsIStreamListener parameter Original Document Information Author(s): Darin Fisher Las...
... ...
Necko walkthrough
StreamListener, i.e. has OnStartRequest, OnStopRequest, OnDataAvailable, the three functions in which channel responses are received asynchronously. nsHttpChannel::AsyncOpen called from OpenURI; OpenChannel isn't named the best, since the opening happens in the context of OpenURI, its calling function. This is where it hits Necko code. But the interface for clients of Necko is im
portant to consider: SEND REQUEST URI helps creates channel setup channel (headers, request data, response callback...) channel->AsyncOpen. RECEIVE RESPONSE get a callback to each of these: nsIStreamListener::OnStartRequest (header info) nsIStreamListener::OnDataAvailable (data in single or multiple chunks) nsIStreamListener::OnStopRequest (no more data fr...
... socket thread... The event queue works around to nsHttpConnectionMgr::OnMsgNewTransaction (with the nsHttpTransaction passed as a param - Remember the event was posted earlier by InitiateTransaction from the main thread). nsHttpConnectionMgr::OnMsgNewTransaction nsHttpConnectionMgr::ProcessNewTransaction (Notice the check that we're on gSocketThread) Gets conn info (i.e. hostname and
port) from the transaction, and then gets or creates a connection entry from the connection table, an nsClassHashtable<nsCStringHashKey, nsConnectionEntry> called mCT in nsHttpConnectionMgr. If a connection entry already exists matching the required conn info, then that one will be used; otherwise a new one is created (MakeNewConnection - creates socket etc.). Note: nsConnectionEntry has a singl...
Installing Pork
See the MCPP manual. In particular, -K tells MCPP to add the macro annotations we use to get exact source positions. C++ files from other projects can be preprocessed with gcc -E -Wp,-W0,-K. Building a 32-bit MCPP on a 64-bit system This is dark magic, a...
... /dev/null | sort | grep -E ' *#define *[A-Za-z]+' \ + ${CXX} ${CPPFLAGS} -E -xc++ -dM /dev/null | sort | grep -E ' *#define *[A-Za-z]+' \ > gxx${gcc_maj_ver}${gcc_min_ver}_predef_old.h fi if test ${host_system} = SYS_CYGWIN; then If you don't do this, MCPP will get the wrong set of automatic definitions and you'll end up with an unpleasant hybrid x86-64/i686 build system. $ ex
port PATH=/builds/gcc-3.4.6-installed/bin:$PATH $ ex
port CPPFLAGS=-m32 $ CC=gcc34 CXX=g++34 CPPFLAGS=-m32 LDFLAGS=-m32 ../src/configure --enable-replace-cpp --prefix=/builds/gcc-3.4.6-installed --target=i686-pc-linux $ make $ make install program_transform_name= ...
Small Footprint
kage org.mozilla.javascript.regexp can be removed. Rhino will continue to run, although it will not be able to execute any regular expression matches. This change saves 47,984 bytes of class files. Debug information Debug information in Rhino classes consumes about 25% of code size and if you can live without that, you can recompile Rhino to remove it. smalljs.jar Ant build script in Rhino sup
ports smalljar target that will generate smalljs.jar that does not include Tools, Optimizer, JavaAdapter and Class generation library, Regular Expressions, E4X implementataion and deprecated files. To build such minimalist jar without debug information, run the following command from the top directory of Rhino distribution: ant clean ant -Ddebug=off -Dno-regexp=true -Dno-e4x=true smalljar If you om...
..., JavaAdapter and Class generation library, Regular Expressions, E4X implementataion and deprecated files. To build such minimalist jar without debug information, run the following command from the top directory of Rhino distribution: ant clean ant -Ddebug=off -Dno-regexp=true -Dno-e4x=true smalljar If you omit -Dno-regexp=true, then the resulting smalljs.jar will include Regular Expression sup
port. Similarly omitting -Dno-e4x=true results in smalljs.jar that includes runtime sup
port for E4X. ...
Rhino optimization
The compilation time is minimized at the expense of runtime performance. No class files are generated, which may improve memory usage depending on your system. Another benefit of the interpreted mode is that the interpreter performs tail-call elimination of recursive functions. Also, you must use this optimization level if your code uses Continuation objects. If the optimization package is not available, then optimization acts as if it is always -1. 0 No optimizations are performed. The bytecode compiler runs fastest in this mode, but the generated byte code is less efficient. 1-9 All optimizations are performed. ...
...ava VM registers. Function call targets are speculatively pre-cached (based on the name used in the source) so that dispatching can be direct, pending runtime confirmation of the actual target. Arguments are passed as Object/Number pairs to reduce conversion overhead. Note Some language features (indirect calls to eval, use of the arguments property of function objects) were previously not sup
ported in higher optimization levels. These features have been removed from the language in ECMA, so higher optimization levels are now conformant. Future versions may allocate more aggressive optimizations to higher optimization levels. For compatibility with future versions, use level 1. For maximal optimization, use level 9, but retest your application when upgrading to new versions. Scripts are ...
Rhino requirements and limitations
To use the JavaAdapter feature or an optimization level of 0 or greater, Rhino must be running under a security manager that allows the definition of class loaders. ...
... ...
FOSS
d native platforms. Getting started here. Flusspferd - (newer) C++ bindings libjspp - C++ template based library for extending & embedding SpiderMonkey; works with SpiderMonkey 1.8.5 and above, has lots of goodies Spiderape - the oldest C++ bindings for SpiderMonkey TriXUL - (TriXUL CVS) - Trixul XML-based GUI toolkit embeds SpiderMonkey, using JavaScript to implement logic behind its GUI, sup
porting calls from JavaScript to C++ objects Rust mozjs - Rust bindings used by Servo GNOME gjs - JavaScript bindings to GNOME (broadly, to any library using the GObject introspection mechanism) Objective Caml http://alain.frisch.fr/soft.html#spider - bindings to embed SpiderMonkey in OCaml applications Perl http://jspl.msg.mx/ - bindings to cross-embed SpiderMonkey and Perl. Inclu...
... with native objects for files, networks, databases, compression, email, etc. http://code.google.com/p/gpsee/ - commonJS platform, native-language module interoperability methods, modules, etc. for SpiderMonkey. Designed to supplement existing embeddings, GPSEE ships with a sample trivial embedding, a scripting host, and an augmented version of Mozilla's JS Shell. Bundled modules include sup
port for ByteArray, ByteString, CGI, POSIX Signals, FFI, and more. http://javalikescript.free.fr/ - a general-purpose JavaScript platform that aims to provide an extensible tooling framework http://www.synchro.net/ - a telnet/SSH bulletin board system (BBS) and internet server (HTTP/SMTP/FTP) with extra Internet services written in JavaScript (IRC, IMAP, Gopher, and many more) https:...
64-bit Compatibility
FFFFC, then zero-extended to 0x00000000FFFFFFFC - a subtle and nasty bug, assuming it is unintended. The best way to fix this is to make types explicit, such as: const uintptr_t POINTER_TAGBITS = 3 Or by using a cast inside the macro. This sort of bug happens surprisingly often - see bug 501324, bug 512866 for example. AMD64 Pointers If mucking with pointers on AMD64 (or EM64-T/Intel64), it is im
portant to keep in mind an invariant that bits 63-48 must be sign-extended from bit 47. If you use these bits to squirrel away a payload, they must be adjusted before attempting to dereference the pointer. For more information and platform specific details on virtual address widths, see this article on Wikipedia. Builtins and Calls When passing arguments to LirWriter::insCall(), there are four types: ...
...it platforms, does nothing. On 64-bit platforms, performs a LIR_i2q. ins_u2p() - On 32-bit platforms, does nothing. On 64-bit platforms, performs a LIR_u2q. ins_p2i() - On 32-bit platforms, does nothing. On 64-bit platforms, performs a LIR_qlo. A common use for extending values is to perform advanced addressing. For example, this code tries to load an index from an integer array, but it is not
portable: lir->insLoad(LIR_ldp, lir->ins2(LIR_piadd, arrayIns, lir->ins2i(LIR_mul, indexIns, sizeof(int)) ), 0); The SanityFilter will assert on a 64-bit platform because LIR_piadd (which will be LIR_qiadd) needs both operands to be 64-bit. The correct code is, assuming the index is unsigned: lir->insLoad(L...
Exact Stack Rooting
The method you should use to keep the GC up-to-date with this information will vary depending on where the GCPointer is being stored. ...
...Object obj(cx, JS_NewObject(cx, clasp, NullPtr(), NullPtr()); Common Pitfalls The C++ type system allows us to eliminate the possibility of most common errors; however, there are still a few things that you can get wrong that the compiler cannot help you with. There is basically never a good reason to do any of these. If you think you do need to do one of these, ask on one of SpiderMonkey's sup
port forums: maybe we've already solved your problem using a different mechanism. Storing a js::RootedT on the heap. It would be very easy to violate the LIFO constraint if you did this. Use a different rooting mechanism if you store a GCPointer on the heap. There are MOZ_STACK_CLASS annotations that will cause a separate static analysis to fail if these are detected. Storing a js::HandleT on the ...
JIT Optimization Outcomes
get of the property access doesn't guarantee that it is an SIMD object. AccessNotTypedObject The observed type of the target of the property access doesn't guarantee that it is a TypedObject. AccessNotTypedArray AccessNotString StaticTypedArrayUint32 StaticTypedArrayCantComputeMask OutOfBounds GetElemStringNotCached NonNativeReceiver IndexType SetElemNonDenseNonTANotCached NoSimdJitSup
port Optimization failed because SIMD JIT sup
port was not enabled. SimdTypeNotOptimized The type observed as being retrieved from this property access did not match an optimizable type. UnknownSimdProperty The property being accessed on the object is not one of the optimizable property names. HasCommonInliningPath Inlined DOM Monomorphic Polymorphic Inline Cache Outcomes Outcomes describin...
...on call. The interpreted callee is a bound function generated from Function.prototype.bind that failed some sub-checks. (expand) CantInlineNativeNoSpecialization Unable to inline function call. Ion does not have built-in specialization for the native (implemented in C++) callee function. CantInlineNativeBadForm Unable to inline function call. The native callee function was called with an unsup
ported number of arguments, or calling non-constructing functions with new. CantInlineBadType Unable to inline function call. The native callee function was called with arguments with types that the built-in specialization does not sup
port. For example, calling Math functions on objects. CantInlineNativeNoTemplateObj Unable to inline function call. Cannot inline a native constructor (e.g., new Arr...
JIT Optimization Strategies
This page has two intended uses: 1. Provide a repository of JIT Optimization Strategy information which the JIT Coach tool can parse to display in its UI. 2. ...
...ence engine has failed to collect enough information to guide the optimization process. Call Call_Inline A function call f(x) usually pushes a frame onto the call stack. Inlining a call site conceptually copies the body of the callee function and pastes it in place of the call site and avoids pushing a new execution frame. Usually, hot functions do well to be inlined. This is one of the most im
portant optimizations the JIT performs. Ion inlines both interpreted (i.e., written in JavaScript) functions and native (i.e., built-ins such as Math.sin implemented in C++). A successfully inlined call site has the outcome Inlined. Failure to inline comes in two flavors: unable (e.g., unable to determine exact callee) and unwilling (e.g., heuristics concluded that the time-space tradeoff will not ...
JS::CallArgs
rgs unsigned Number of argument. (2nd argument of JSNative) vp JS::Value * A pointer to the argument value array. (3nd argument of JSNative) Methods Methods of JS::CallArgs Method Description bool requireAtLeast(JSContext *cx, const char *fnname, unsigned required) Returns true if there are at least required arguments passed in. If false, it re
ports an error message on the context. Methods inherited from JS::CallArgsBase Method Description unsigned length() const Returns the number of arguments.. JS::MutableHandleValue operator[](unsigned i) const Returns the i-th zero-indexed argument. JS::HandleValue get(unsigned i) const Returns the i-th zero-indexed argument, or undefined if there'...
... code should use CallArgs instead of JS_CALLEE etc. whenever possible. The eventual plan is to change JSNative to take const CallArgs& directly, for automatic assertion of correct use and to make calling functions more efficient. Embedders should start internally switching away from using argc and vp directly, except to create a CallArgs. Then, when an eventual release making that change occurs,
porting efforts will require changing methods' signatures but won't require invasive changes to the methods' implementations, potentially under time pressure. JS::CallArgs encapsulates access to the callee, this, the function call's arguments, and eventual return value for a function call. The principal way to create a CallArgs is like so, using JS::CallArgsFromVp: static bool FunctionReturningArgcT...
JS::CompileOptions
generated syntax errors (via a window.onerror handler) for juicy morsels of its contents. To counter this attack, HTML5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded. Callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in JSErrorRe
ports. const char *filename() const Returns filename of the source code. const char *introducerFilename() const Returns filename of the file which introduces the file. const char16_t *sourceMapURL() const Returns the URL of the source map. Methods of JS::OwningCompileOptions Method Description JSObject *element() const Return...
... allocated C string: one of following in general: "eval" - code passed to eval "Function" - code passed to the Function constructor. "GeneratorFunction" - code passed to the GeneratorFunction constructor. In addition to above, the following are used in browser: "Worker" - code loaded by calling the Web worker constructor--the worker's main script. "im
portScript" - code by calling im
portScripts in a web worker. "eventHandler" - code assigned to DOM elements' event handler IDL attributes as a string. "scriptElement" - code belonging to <script> elements. "javascriptURL" - code presented in javascript: URLs. "setTimeout" - code passed to setTimeout as a string. "setInterval" - code passed to setInterval as a string. ...
JSErrorFormatString
} JSErrorFormatString; Name Type Description format const char * The error format string in ASCII. ...
... The error format string in ASCII. argCount uint16_t The number of arguments to expand in the formatted error message. ...
JSNewEnumerateOp
Syntax typedef bool (* JSNewEnumerateOp)(JSContext *cx, JS::HandleObject obj, JS::AutoIdVector &properties); // Added in SpiderMonkeySidebar 38 typedef bool (* JSNewEnumerateOp)(JSContext *cx, JS::HandleObject obj, JSIterateOp enum_op, JS::MutableHandleValue statep, JS::MutableHandleId idp); // Obsolete since JSAPI 37 Name Type Description cx JSContext * The context in which the enumeration is taking place. obj JS::HandleObject The object to be enumerated. ...
... statep JS::MutableHandleId Obsolete since JSAPI 37 In/out parameter. The meaning depends on enum_op. See the Description below. idp JS::MutableHandleId Obsolete since JSAPI 37 In/out parameter. The meaning depends on enum_op. See the Description below. Description From SpiderMonkey 38, JSNewEnumerateOp is the type of ObjectOps::enumerate. This callback overrides a
portion of SpiderMonkey's default [[Enumerate]] internal method. When an ordinary object is enumerated, that object and each object on its prototype chain is tested for an enumerate op, and those ops are called in order. The properties each op adds to the properties vector are added to the set of values the for-in loop will iterate over. All of this is nonstandard. An object is "enumerated" when it's...
JS_ClearPendingException
exception if the most recently thrown exception in cx has not yet been caught or cleared.) When any JSAPI call fails with an exception, the caller must either use JS_ClearPendingException to catch the exception; or return false to allow the exception to propagate to the caller. Note that a JSAPI failure does not necessarily indicate that an exception is pending. ...
...not necessarily indicate that an exception is pending. Many JSAPI functions can simply re
port an error and return false without building and throwing an exception object. Use JS_IsExceptionPending or JS_GetPendingException to check for a pending exception. See examples in the JSAPI Phrasebook. ...
JS_CompileFunction
ber of arguments to pass to the function. argnames const char ** Names to assign to the arguments passed to the function. body const char * or const jschar * String containing the body of the function to compile. length size_t The length, in characters, of body. filename const char * Name of file or URL containing the function. Used to re
port filename or URL in error messages. lineno unsigned int Line number. Used to re
port the offending line in the file or URL if an error occurs. Description JS_CompileFunction compiles a function from a text string, bytes, and optionally associates it with a JS object, obj. JS_CompileUCFunction is the Unicode version of the function. name is the name to assign to the newly cre...
... each argument. The number of argument names should match the number of arguments specified in nargs. body is a string containing the source code of the function. length is the length of the source code in characters. filename is the name of the file (or URL) containing the function. This information is used in error messages if an error occurs during compilation. Similarly, lineno is used to re
port the line number where an error occurred during compilation. If both obj and name are non-null, the new function becomes a method of obj. (A new property is defined on obj with the given name and the new Function object as its value.) On success, JS_CompileFunction and JS_CompileUCFunction return a pointer to the newly compiled function. On error or exception, they return NULL. See Also MXR ...
JS_CompileFunctionForPrincipals
arguments to pass to the function. argnames const char ** Names to assign to the arguments passed to the function. body const char * or const jschar * String containing the source code of the function to compile. length size_t The length, in characters, of body. filename const char * Name of file or URL containing the function. Used to re
port filename or URL in error messages. lineno unsigned int Line number. Used to re
port the offending line in the file or URL if an error occurs. Description JS_CompileFunctionForPrincipals compiles a security-enabled function from a text string, bytes, and associates it with a JS object, obj. JS_CompileUCFunctionForPrincipals is the Unicode version of the function. principals ...
... assign each argument. The number of argument names should match the number of arguments specified in nargs. body is the string containing the source code of the function. length is the length of the string in characters. filename is the name of the file (or URL) containing the function. This information is passed in messages if an error occurs during compilation. Similarly, lineno is used to re
port the line number of the function or file where an error occurred during compilation. On success, JS_CompileFunctionForPrincipals and JS_CompileUCFunctionForPrincipals return a pointer to the newly compiled function. On error or exception, they return NULL. See Also MXR ID Search for JS_CompileFunctionForPrincipals MXR ID Search for JS_CompileUCFunctionForPrincipals JSFUN_BOUND_METHOD JSFUN...
JS_CompileScriptForPrincipals
with which the script is associated. principals JSPrincipals * Pointer to the structure holding the security information for this script. src const char * or const jschar * String containing the script to compile. length size_t The length of src, in characters. filename const char * Name of file or URL containing the function. Used to re
port filename or URL in error messages. lineno unsigned int Line number. Used to re
port the offending line in the file or URL if an error occurs. version JSVersion JavaScript Version for the script. Description JS_CompileScriptForPrincipals compiles a security-enabled script, src, for execution. JS_CompileUCScriptForPrincipals is the Unicode version of the functio...
...nter to the JSPrincipals structure that contains the security information to associate with this script. src is the string containing the text of the script. length indicates the length of the script, in characters. filename is the name of the file (or URL) containing the script. This information is included in error messages if an error occurs during compilation. Similarly, lineno is used to re
port the line number of the script or file where an error occurred during compilation. On success, JS_CompileScriptForPrincipals and JS_CompileUCScriptForPrincipals return a pointer to the compiled script. On error or exception, they return NULL. The application is responsible for ensuring that the new compiled script is cleaned up later--either by calling JS_DestroyScript() directly or by calling J...
JS_ConvertArguments
PE_FUNCTION safely. v jsval Argument value (no conversion) * N/A None. If an asterisk (*) is present in format, it tells the conversion routine to skip converting the current argument. / N/A None. Arguments after the slash are optional. If an optional argument is missing from argv, JS_ConvertArguments neither assigns anything to any variable nor re
ports an error. This function also takes in consideration any additional custom types defined on cx using JS_AddArgumentFormatter. For example, if format is "bIob", then JS_ConvertArguments converts the first JS value in argv into a bool, the second value into a double, the third value into a JSObject *, and the last value into a bool. To skip a given argument, pass an asterisk in the corresp...
...dArgumentFormatter. For example, if format is "bIob", then JS_ConvertArguments converts the first JS value in argv into a bool, the second value into a double, the third value into a JSObject *, and the last value into a bool. To skip a given argument, pass an asterisk in the corresponding position in format. If argc is less than the number of arguments required by format, JS_ConvertArgument re
ports an error and returns false. If argc is greater than the number of arguments described in format, the extraneous arguments are ignored. On success, JS_ConvertArgument returns true. If any argument conversion fails or there are not enough arguments, it returns false. To perform the opposite conversion, converting values of various C types to an array of jsvals, use JS_PushArguments. See Also ...
JS_ErrorFromException
Get or create JSErrorRe
port from an exception object. Syntax JSErrorRe
port * JS_ErrorFromException(JSContext *cx, JS::HandleObject obj); Name Type Description cx JSContext * Pointer to a JS context whose errors should be re
ported via your function. Other contexts in the same runtime can have their own error re
porting functions. obj JS::HandleObject An exception object. Description If obj is an exception object, the exception will have (or be able to lazily create) an error re
port struct, and JS_ErrorFromException will return the address of that struct. Otherwise, it returns nullptr. The lifetime of the error re
port struct that might be returned is the same as the lifetime of the exception object. See Also MXR ID Search for JS_Erro...
... Description If obj is an exception object, the exception will have (or be able to lazily create) an error re
port struct, and JS_ErrorFromException will return the address of that struct. Otherwise, it returns nullptr. ...
JS_EvaluateScript
text. obj JSObject * The scope in which to execute the script. This parameter is documented in detail at JS_ExecuteScript. src const char * or const jschar * String containing the script to compile and execute. length unsigned int The length of src, in characters. filename const char * Name of file or URL containing the script. Used to re
port filename or URL in error messages. lineno unsigned int Line number. Used to re
port the offending line in the file or URL if an error occurs. rval jsval * Out parameter. On success, if rval is not NULL, *rval receives the result value. Description JS_EvaluateScript compiles and executes a script in the specified scope, obj. JS_EvaluateUCScript is the Unicode v...
...a script in the specified scope, obj. JS_EvaluateUCScript is the Unicode version of the function. src is the string containing the text of the script. length indicates the size of the text version of the script in characters. filename is the name of the file (or URL) containing the script. This information is used in messages if an error occurs during compilation. Similarly, lineno is used to re
port the line number of the script or file where an error occurred during compilation. rval is an optional out parameter. If it is non-null, then on success, the result value is stored in *rval. This value is determined the same way as for the standard eval function. In the common case where the script is just an expression, the result value is simply the value of that expression. More generally, the...
JS_EvaluateScriptForPrincipals
Script. principals JSPrincipals * Pointer to the structure holding the security information for this script. src / bytes / chars const char * or const jschar String containing the script to compile and execute. length unsigned int The length of src, in characters. filename const char * Name of file or URL containing the script. Used to re
port filename or URL in error messages. lineno unsigned int Line number. Used to re
port the offending line in the file or URL if an error occurs. rval jsval * Out parameter. On success, *rval receives the value from the last-executed expression statement in the script. version JSVersion JavaScript Version for the script. Description JS_EvaluateScrip...
...incipals is a pointer to the JSPrincipals structure that contains the security information to associate with this script. src is the string containing the text of the script. length is the length of the script, in characters. filename is the name of the file (or URL) containing the script. This information is used in messages if an error occurs during compilation. Similarly, lineno is used to re
port the line number of the script or file where an error occurred during compilation. If the script compiles and executes successfully, *rval receives the value from the last-executed expression statement processed in the script, and JS_EvaluateScriptForPrincipals or JS_EvaluateUCScriptForPrincipals returns JS_TRUE. Otherwise it returns JS_FALSE, and the value left in *rval is undefined. See Also ...
JS_InstanceOf
cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::Handle<JSObject*> Object to test. clasp JSClass * Class against which to test the object. args JS::CallArgs * Optional pointer to arguments. If non-null, re
port an error if obj is not of type clasp. Added in SpiderMonkey 38 argv jsval * Optional argument vector. If non-null, re
port an error if obj is not of type clasp. argv must be the argv argument passed from the engine to a JSNative callback, JS_ARGV(cx, rv) in a JSFastNative callback, or NULL. Obsolete since JSAPI 32 Description JS_InstanceOf can be used to check whether an obj...
... JS_GetClass(obj) == clasp. JS_InstanceOf can also be used in native functions to check the class of an argument when a particular class is required. To use it this way, pass the arguments provided by the engine for args with JS::CallArgsFromVp(argc, vp). When args is non-null, JS_InstanceOf behaves as follows. If obj is of the given class, it returns true. Otherwise, it returns false; it also re
ports a TypeError containing the function's name. Note that JS_InstanceOf is not the equivalent of the JavaScript instanceof keyword, which examines constructor properties along the prototype chain. JS_HasInstance is similar to instanceof. See Also MXR ID Search for JS_InstanceOf JS_HasInstance JS_GetClass bug 959787 ...
JS_ValueToInt32
convert. ip int32 * Out parameter. On success, *ip receives the converted integer value. Description JS_ValueToInt32 converts a specified JS value, v, to a 32-bit signed integer (-2147483648 to 2147483647). First it converts v to a floating-point number as if by calling JS::ToNumber. If the result is NaN, an infinity, or a number outside the 32-bit range, JS_ValueToInt32 re
ports an error and conversion fails. Otherwise, the floating-point number is rounded to the nearest integer value. On success, JS_ValueToInt32 stores the converted value in *ip and returns JS_TRUE. On error or exception, it returns JS_FALSE, and the value left in *ip is undefined. JS_ValueToInt32 is pre-ECMA-262 Edition 1, and rounds differently than JS_ValueToECMAInt32 and JS::ToInt32. This routine...
...you know you need its rounding behavior, it is best to avoid it in favour of JS::ToInt32. JS::ToInt32 rounds as specified in ECMA 262-3 ?9.5, while this routine rounds by adding 0.5 to the converted float-point number and truncating the result at the decimal point. JS::ToInt32 will also convert NaN (and anything that converts to NaN, such as an array of strings) to 0, whereas this routine would re
port an error. See Also JS_ConvertArguments JS::ToInt32 bug 933946 ...
JS_malloc
ory that is not managed by the garbage collector. Syntax void * JS_malloc(JSContext *cx, size_t nbytes); void * JS_realloc(JSContext *cx, void *p, size_t oldBytes, size_t newBytes); char * JS_strdup(JSContext *cx, const char *s); void JS_free(JSContext *cx, void *p); Name Type Description cx JSContext * Pointer to a JS context. If allocation fails, an error is re
ported in this context. p void * (JS_realloc and JS_free only) Pointer to a previously allocated region of memory to resize or deallocate. nbytes size_t (JS_malloc and JS_realloc only) Amount of space, in bytes, to allocate. s const char * (JS_strdup only) Pointer to a null-terminated string. s must not be NULL. Description JS_malloc allocates a regio...
...ed, any newly allocated space is uninitialized. JS_realloc(cx, NULL, nbytes) behaves exactly like JS_malloc(cx, nbytes). When p is not null, JS_realloc(cx, p, 0) behaves like JS_free(cx, p) and returns NULL. JS_strdup allocates a copy of the null-terminated string s. On success, it returns a pointer to the copy. If any of these three functions fails to allocate the required amount of memory, it re
ports an error as though by calling JS_Re
portOutOfMemory(cx) and returns NULL. JS_free deallocates a region of memory allocated a previous call to JS_malloc, JS_realloc, or JS_strdup. If p is null, JS_free does nothing. Once the region of memory is freed, the application must not use it again. For JS_realloc and JS_free, if p is non-null, cx must be associated with the same runtime as the context used...
TPS Tests
all the changes performed in profile2 have successfully been synced to profile1. Lastly, Firefox closes and the tests ends. (Implementation detail) Two final cleanup phases are run to wipe the server state and unregister devices. Troubleshooting and debugging tips for writing and running TPS tests TPS evaluates the whole file in every phase, so any syntax error(s) in the file will get re
ported in phase 1, even though the error may not be in phase 1 itself. Inspect tps.log. When a tps test fails, the log is dumped to tps.log in the virtualenv. Inspect about:sync-log. Every sync should have a log and every item synced should have a record. Run runtps with --debug. This will enable much more verbose logging in all engines. Check the tps.log file written out after TPS runs. It will i...
.... A TPS failure may not point directly to the problem. For example, Most errors involving bookmarks look like "Places Item not found in expected index", which could mean a number of issues. The other engines are similarly unhelpful, and will likely fail if there's any problem, without really indicating what the problem is. It's common for the phase after the problem to be the one re
porting errors (e.g. if one phase doesn't upload what it should, we won't notice until the next phase). TPS runs one "cleanup" phase for each profile (even for failed tests), which means most tests have two cleanup phases. This has a couple side effects You usually need to scroll up a bit in the log past the end of the test to find the actual failure. When one of the cleanup phases fail...
Mozinfo
lethora of OS and architecture combinations conform to a subset of values of relevance to Mozilla software. The current implementation exposes relevant key, values: os, version, bits, and processor. Additionally, the service pack in use is available on the windows platform. API Usage MozInfo is a python package. ...
...ading the software and running python setup.py develop will allow you to do im
port mozinfo from python. mozinfo.py is the only file contained is this package, so if you need a single-file solution, you can just download or call this file through the web. The top level attributes (os, version, bits, processor) are available as module globals: if mozinfo.os == 'win': ... In addition, mozinfo ex
ports a dictionary, mozinfo.info, that contain these values. mozinfo also ex
ports: choices: a dictionary of possible values for os, bits, and processor main: the console_script entry point for mozinfo unknown: a singleton denoting a value that cannot be determined unknown has the string representation "UNKNOWN". unknown will evaluate as False in python: if not mozinfo.os: ... # unknown! Comm...
Exploitable crashes
You want to look primarily for three things, in order: Look at the top frame of the stack trace. ...
...ou see a bogus address at the top of the stack in step 1. Finding exploitable crashes Exploitable crashes are most often discovered through normal testing and usage, when developers recognize a crash stack in gdb or submitted to a bug as exploitable. Additionally, Mozilla developers make heavy use of two tools in particular to find exploitable situations before they show up as exploitable crash re
ports. The first tool is AddressSanitizer (ASAN). There is an MDN article documenting its use with Mozilla projects. The other tool is Valgrind. There is an MDN article documenting its use with Mozilla projects. Next steps Once you've determined that a crash is potentially exploitable, take the following steps. If you need help with any of the steps (e.g. perhaps you lack necessary bugzilla privileges...
Browser security
An im
portant aspect of developing code for any browser, including Firefox, as well as any Web-oriented project, is its security. These articles provide im
portant guides and references to ensuring the code you write is secure, including both design recommendations and testing guidelines. A Web PKI x509 certificate primerX.509 (in this document referred as x509) is an ITU standard to describe certificates. ...
...ard to describe certificates. This article provides an overview of what these are and how they work.Exploitable crashesThis article will help you determine if a crash is exploitable, find crashes which are exploitable, and to fix exploitable crashes.Handling Mozilla Security BugsThis document describes how the new security organizational structure will work, and how security-related Mozilla bug re
ports will be handled.Pinning violation re
portsIf a site makes use of key pinning, and your browser sees a certificate chain for that site which does not match the pin, Firefox will reject the connection and display an error page. Secure Development GuidelinesThe following content will likely see significant revision, though can be used as a reference for security best practices to follow when dev...
Setting up an update server
the line that begins "Size", not the one that begins "Size on disk". Be sure to remove the commas when you paste this number into the XML file. On macOS, you can get the exact size of your MAR by running the command: stat -f%z <filename> Or on Linux, the same command would be: stat --format "%s" <filename> Starting your update server Now, start an update server to serve the update files on
port 8000. An easy way to do this is with Python. Remember to navigate to the correct directory before starting the server. This is the Python2 command: python -m SimpleHTTPServer 8000 or, this is the Python3 command: python3 -m http.server 8000 If you aren't sure that you started the server correctly, try using a web browser to navigate to http://127.0.0.1:8000/update.xml and make sure that you ...
...navigate to http://127.0.0.1:8000/update.xml and make sure that you get the XML file you created earlier. Installing the update You may want to start by deleting any pending updates to ensure that no previously found updates interfere with installing the desired update. You can use this command with Firefox's browser console to determine the update directory: const {FileUtils} = ChromeUtils.im
port("resource://gre/modules/FileUtils.jsm"); FileUtils.getDir("UpdRootD", [], false).path Once you have determined the update directory, close Firefox, browse to the directory and remove the subdirectory called updates. Next, you need to change the update URL to point to the local XML file. This can be done most reliably with an enterprise policy. The policy file location depends on the operating s...
Gecko states
State constants are defined in nsIAccessibleStates. States List STATE_UNAVAILABLE The object is unavailable, i.e. disabled. Applied to: all roles. STATE_SELECTED The object is selected, i.e. indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected. Applied to: ROLE_MENUITEM, ROLE_CELL, ROLE_OUTLINEITEM, XXX: continue Events: EVENT_STATE_CHANGE ?oncomitant state: STATE_SELECTABLE STATE_FOCUSED The object is focused Applied to: Events: Concomitant state: STATE_FOCUSABLE STATE_PRESSED The object is pressed. ...
...ed to: Events: Concomitant state: STATE_FOCUSED STATE_SELECTABLE The object can be selected. Applied to: Events: Concomitant state: STATE_SELECTED STATE_LINKED Indicates that the object is formatted as a hyperlink. The object role will usually be ROLE_TEXT_LEAF. STATE_TRAVERSED The object is a hyperlink that has been visited (previously clicked) by a user. STATE_MULTISELECTABLE Sup
ports multiple selection STATE_EXTSELECTABLE Sup
ports extended selection STATE_REQUIRED Indicates that user interaction is required. STATE_IM
PORTANT Isn;t used. STATE_INVALID Indicates a validation failure. EXT_STATE_SUP
PORTS_AUTOCOMPLETION For editable areas that have any kind of autocompletion EXT_STATE_DEFUNCT Object no longer exists EXT_STATE_SELECTABLE_TEXT For text which is sele...
XForms Accessibility
Implementation of accessible objects for XForms elements is based on top of the existing object hierarchy introduced in the Mozilla accessibility module. XForms elements behavior is implemented in accordance with accessible toolkit checklist. In general, when elements are similar to HTML elements, they are exposed to MSAA/ATK in a similar way. Get Build Subsections below explain how you can obtain accessible XForms-enabled build. ...
...me clarification about navindex. He wrote: Navindex was in XForms - it was stripped out as it was believed the focus model was dependent on the content which used it. So, yes we don't care about navindex in XForms. If you use xhtml1.x use tabindex. If you use Xhtml2 use nextfocus. Therefore since Mozilla XForms works in XHTML (1.x) or XUL documents only then we use tabindex instead. Note, we sup
port -moz-user-focus style neither for XHTML or XUL. AT API Accessible properties This section describes common rules how accessibility properties are formed for forms control elements. name It is formed from value of child XForms label element if the element doesn't have labelledby attribute. description It is formed from value of child XForms hint element if the element doesn't have described...
History Service Design
ill the database I/O to save data is complete. For this reason visits and favicons are added lazily on a timer. In future this will probably change in favour of Storage asynchronous statements, so that the INSERTs will be queued-up by mozStorage itself in a separate thread. SQL queries are built with performance in mind, and constantly tested against large databases. Database indexes are quite im
portant, and a good query can make the difference between minutes or seconds. Many queries are especially optimized, for example limited history queries, often used to build menus, allowing for good performances even in presence of a really large history. Storing pages and visits Pages (intended as URIs) are stored into a table shared by both History and Bookmarks, every url is unique in this table ...
...rvices, so it is possible to query history, bookmarks or both, also with values coming from other services like tags, annotations. Result nodes can be simple uri nodes with page attributes or complete visit attributes, or can be containers (folders, other queries, dynamic containers and so on). See Querying Places for deeper knowledge on the actual implementation. Expiration Expiration is an im
portant part of data management for two reasons: Privacy: expiring data based on user interaction is im
portant, nothing must be left behind on a page removal Database maintenance: having cleaner and smaller tables helps queries performances Expiration is done at certain moments, but in future will most likely be moved to async queries, to be executed on a separate thread. Actually pages and visi...
Using the Places history service
shell as you browse. The redirect flag is deprecated. See addDocumentRedirect below. nsIGlobalHistory3.addDocumentRedirect: This is called by the docshell when a redirect occurs. It replaces the old redirect flag on addURI. It gives the old and new channels to the history service so that the source page of the redirect can be determined. nsIBrowserHistory.addPageWithDetails: Called by history im
porting code. New code should use nsINavHistoryService.setPageDetails. nsINavHistoryService.addVisit: This is an advanced function that allows the caller to set the exact referring visit, the time, the session, etc. It is designed for people writing synchronizing or backup services that need access to all the flags. Under normal browsing, addURI and addDocumentRedirect will infer this information for...
...l infer this information for you. Modifying pages in history nsIGlobalHistory2.setPageTitle: Called by Gecko when the <title> element is encountered. nsIGlobalHistory3.setGeckoFlags: Called by Gecko to store rendering information about a page. Currently, this is used to store whether there was a scrollbar, which allows more efficient layout if the page is revisited. However, this is not yet sup
ported by the NavHistory implementation. nsIBrowserHistory.removePage: Removes a given URI and all of its visits from the history database. This is called by the UI when the user deletes a history entry. nsIBrowserHistory.removePagesFromHost: Called from the UI when the user deletes a group associated with a host or domain. This function allows you to delete pages from a specific host, or pages from...
The Publicity Stream API
ion usage. The publicity stream is provided as a central place for applications to publicize application usage for the purpose of notifying a user's friends of the applications which their friends are using. It is not meant as a general application messaging system. Accessing the API The publicity API can be enabled by including a javascript library. This library will detect whether native API sup
port is enabled by the user's browser, if not it will shim in a pure HTML implementation. [is this still doable?] The javascript library should be included from: https://myapps.mozillalabs.com/jsapi/publicity.js All APIs related to open web applications are accessed under the navigator.apps object. Publicity Stream API (navigator.apps.publicity.*) The publicity API is exposed as properties on the navi...
... is not allowed to post to the publicity stream networkError - if the publicity server is unreachable activityParseError - if the activity contains syntax errors (not proper JSON) invalidActivity - if the activity contains semantic errors (i.e. missing required properties) Finally, the publicizeActivity() function will throw an exception if required arguments are missing, or if unsup
ported arguments are present. getPublicityStream( onsuccess: <function>, { [ onerror: <function> ], [ for_apps: <list> ], [ since: <Date> ], [ before: <Date> ], [ count: <int> ]): Provides a means for a web store to receive a list of the current user's socially relevant app activity by being called from an origin which hosts a web store. It is not recommended that applications consume the publ...
extIPreferenceBranch
tring aName, in nsIVariant aValue) void reset() Attributes Attribute Type Description root readonly attribute AString The name of the branch root. all readonly attribute nsIVariant Array of extIPreference listing all preferences in this branch. events readonly attribute extIEvents The events object for the preferences sup
ports: "change" Methods has() Check to see if a preference exists. boolean has(in AString aName) Parameters aName The name of preference Return value true if the preference exists, false if not get() Gets an object representing a preference extIPreference get(in AString aName) Parameters aName The name of preference Return value a preference object, or null if the prefer...
...means that to JavaScript code the value will appear as a value of the same type as is used in the preferences file and no coercion will occur. A quoted string in the preference file will always appear as a string, even if the value of the string is "true" or "false". An integer preference appears as a JavaScript Number, and a boolean appears as a JavaScript Boolean. There are no other types sup
ported by the preference subsystem. setValue() Sets the value of a preference with the given name. void setValue(in AString aName, in nsIVariant aValue) Parameters aName The name of a preference aValue The value of a preference Return value reset() Resets all preferences in a branch back to their default values. Note: This function has not been implemented and will raise an exception...
Preface
web browser, where it's easiest and most practical to illustrate XPCOM's functionality. A full description of the component in this tutorial can be found in the What We'll Be Working On section of the tutorial. Despite what old documentation says, XPCOM should not be used to make NPAPI plugins scriptable. Starting with Gecko 1.7.5 (Firefox 1.0) a special NPAPI extension for scriptability is sup
ported, see Scripting plugins. Organization of the Tutorial The following list provides an overview of the steps that we will take to build an XPCOM component called WebLock, which provides site blocking functionality to Gecko-based browsers. Each one of these steps has its own chapter, in which a number of topics associated with the step are discussed. Create the generic module code for the com...
...rmation clearly. Format Description bold component names appear in bold in the text monospace code listings, interface names and members of interfaces (e.g., createInstance()) appear in monospaced font. Lines of code are placed in separate boxes. Additionally, filenames and directories appear in monospaced font. italic variables appear in italic. Im
portant terms and new concepts are also italicized the first time they appear in the text. Those terms are either explained immediately after they are cited, or else the reader is referred to a section in the book where they are described in detail. link References to other sections and to figures and tables are links to those sections. Acknowledgements Thanks to Peter Lubczynski, ...
Creating XPCOM components
; however, there may be cases when it's unavoidable. Note:This article describes a method that uses xpidl but you should use webidl instead. ...
...ng Classes in XPCOM Using Strings nsEmbedString and nsEmbedCString Smart Pointers Starting WebLock Getting Called at Startup Registering for Notifications Getting Access to the Category Manager Providing Access to WebLock Creating the WebLock Programming Interface Defining the WebLock Interface in XPIDL The XPIDL Syntax Scriptable Interfaces Subclassing nsISup
ports The Web Locking Interface Implementing WebLock Declaration Macros Representing Return Values in XPCOM XPIDL Code Generation Getting the WebLock Service from a Client Implementing the iWebLock Interface The Directory Service Modifying Paths with nsIFile Manipulating Files with nsIFile Using nsILocalFile for Reading Data Processing the White List Data iWebLock Met...
Receiving startup notifications
s to receive notifications as to the progress of the application's startup process, so they can start new services at appropriate times, for example. Receiving startup notifications in Gecko 2.0 (Firefox 4) and later In order to improve startup times, changes were made to the XPCOM startup process. See The startup process for details on how this now works, if you're interested in specifics. ...
...This is no longer the case, so be sure to remove that when migrating existing code. ...
How to build a binary XPCOM component using Visual Studio
ts: Component interface described using IDL. The interface defines the methods, including arguments and return types, of the component. Component implementation using C++. The implementation is where the methods actually do the work. Component factory module, also in C++. The factory is in charge of creating instances of the implementations. Let's specify a simple interface: #include "nsISup
ports.idl" [scriptable, uuid(263ed1ba-5cc1-11db-9673-00e08161165f)] interface ISpecialThing : nsISup
ports { attribute AString name; long add(in long a, in long b); }; Remember to generate your own GUID. The next step is to compile the IDL into a type-library (*.XPT) and a C++ header file (*.H), which we can use to define our implementation object. The blank VC++ project has a BAT file that will...
... #ifndef __SPECIALTHING_IMPL_H__ #define __SPECIALTHING_IMPL_H__ #include "comp.h" #include "nsStringAPI.h" #define SPECIALTHING_CONTRACTID "@starkravingfinkle.org/specialthing;1" #define SPECIALTHING_CLASSNAME "SpecialThing" #define SPECIALTHING_CID { 0x245626, 0x5cc1, 0x11db, { 0x96, 0x73, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f } } class CSpecialThing : public ISpecialThing { public: NS_DECL_ISUP
PORTS NS_DECL_ISPECIALTHING CSpecialThing(); private: ~CSpecialThing(); protected: /* additional members */ nsString mName; }; #endif CPP file: #include "comp-impl.h" NS_IMPL_ISUP
PORTS1(CSpecialThing, ISpecialThing) CSpecialThing::CSpecialThing() { /* member initializers and constructor code */ mName.Assign(L"Default Name"); } CSpecialThing::~CSpecialThing() { /* destructor code */ } ...
Components.utils.cloneInto
; Parameters obj : object The object to clone. targetScope : object The object to attach the object to. options : object This optional parameter is an object with the following optional properties: cloneFunctions: a Boolean value that determines if functions should be cloned. If omitted the default value is false. Cloned functions have the same semantics as functions ex
ported using Components.utils.ex
portFunction. See Cloning objects that have functions below. wrapReflectors: a Boolean value that determines if objects reflected from C++, such as DOM objects, should be cloned. If omitted the default value is false. See Cloning objects that contain DOM elements below. Returns A reference to the cloned object. Example This add-on script creates an object, clones it i...
... "hello from add-on"}; contentWindow.foo(cloneInto(addonScriptObject, contentWindow)); // "they said: hello from add-on" Cloning objects that have functions If the object to be cloned contains functions, you must pass the {cloneFunctions:true} flag or you'll get an error. ...
Components.utils.forceGC
rform garbage collection automatically when the JavaScript heap grows beyond a certain size. This mechanism doesn't account for any native (C++) XPCOM objects hanging off JavaScript objects though. In many cases a JavaScript application will have internal knowledge of JavaScript objects referencing large (trees of) XPCOM objects and know when they are no longer reachable. In this case it can be im
portant to be able to force a garbage collection cycle from JavaScript. Another instance where it can be useful to force garbage collection is before cleaning out dead reference from a hash of weak JavaScript references. Users should note that garbage collection is a very expensive operation and should only be forced when it is known to be absolutely necessary. Note: nsIDOMWindowUtils.garbageCollect...
...ection is a very expensive operation and should only be forced when it is known to be absolutely necessary. Note: nsIDOMWindowUtils.garbageCollect() offers similar functionality but will trigger the cycle collector in addition to the garbage collector in the JavaScript engine. This will make sure that XPCOM components that build cycles with JavaScript objects also get collected which might be im
portant, for example for testcases that depend on the garbage collector. Requires UniversalXPConnect privileges. If you want to schedule garbage collection to occur in the future, at a time when no JavaScript code is running, you can use Components.utils.schedulePreciseGC() instead. ...
Components object
e in a sandbox, usually used to run code with restricted privileges. utils.forceGC Forces a garbage collection cycle. utils.getGlobalForObject Returns the global object with which a given object is associated (through its prototype chain at birth, for example). utils.getWeakReference Gets a weak reference for the object passed in. utils.im
port Loads a JavaScript module into the current script, without sharing a scope. utils.lookupMethod Looks up a native (i.e. declared in the interface) method or property of an XPCOM object. Serves the same purpose as XPCNativeWrapper. utils.makeObjectPropsNormal Ensures that all functions come from the specified object's scope, and aren't cross-compartment wra...
... Provides access to the value of the methodjit property in the JavaScript environment. utils.methodjit_always Obsolete since Gecko 24.0 Provides access to the value of the methodjit_always property in the JavaScript environment. utils.relimit Provides access to the value of the relimit property in the JavaScript environment. utils.re
portError Re
ports a JavaScript Error object to the Error Console. utils.schedulePreciseGC Requests that garbage collection occur sometime in the future when no JavaScript code is running; accepts a callback function to receive notification once collection is complete. utils.setGCZeal() Sets the GC zeal level for the context. utils.strict ...
XPConnect wrappers
high-level overview of XPConnect wrapper objects (for the more technical description see XPConnect security membranes). For practical advice on dealing with wrappers, see Safely accessing content DOM from chrome. Developers in the know understand that wrappers play a large role in XPConnect, and that we have a lot of them. Less informed developers understand that wrappers exist and are somehow im
portant, but they don't know when they should use what wrappers, or if they should be seeing a wrapper. Note: Wrappers can appear in the console log; for example "[object XrayWrapper [object blah]]". Because these are wrapped, you won't be able to peek down inside them from the console. Basic XPConnect objects XPCWrappedNative These objects are created when any natively implemented XPCOM object (t...
...rder to preserve API compatibility, an XPCWrappedNative is created around the XPCWrappedJS. Security wrappers exposed to chrome To learn about security wrappers, see the article on script security in Gecko. Note that a previous version of the current page recommended using __exposedProps__ to expose objects from chrome to content. This is now deprecated and we are in the process of removing sup
port for it. If you need to make objects or functions defined in chrome code accessible to content, use Components.utils.cloneInto or Components.utils.ex
portFunction. ...
nsScriptableInputStream
<< XPCOM API Reference Summary A component implementing nsIScriptableInputStream. Class ID 7225c040-a9bf-11d3-a197-0050041caf44 ContractID @mozilla.org/scriptableinputstream;1 Sup
ported Interfaces nsIScriptableInputStream, nsIInputStream Remarks This component should be accessed via the XPCOM Component Manager. ...
... // Do something with it! } } catch (e) { dump("Error: failed reading from stream:\n" + e + "\n"); } } See Also nsIScriptableInputStream ...
IAccessibleEditableText
ptable This interface provides clipboard capability to text objects. 1.0 66 Introduced Gecko 1.9 Inherits from: IUnknown Last changed in Gecko 1.9 (Firefox 3) This interface is typically used in conjunction with the IAccessibleText interface and complements that interface with the additional capability of clipboard operations. Note that even a read only text object can sup
port the copy capability so this interface is not limited to editable objects. The substrings used with this interface are specified as follows: If startOffset is less than endOffset, the substring starts with the character at startOffset and ends with the character just before endOffset. If endOffset is lower than startOffset, the result is the same as a call with the two arguments exchanged. The who...
...utes. HRESULT setAttributes( [in] long startOffset, [in] long endOffset, [in] BSTR attributes ); Parameters startOffset Start index of the text whose attributes are modified. The valid range is 0..length. endOffset Start index of the text whose attributes are modified. The valid range is 0..length. attributes Set of attributes that replaces the old list of attributes of the specified text
portion. Return value E_INVALIDARG if bad [in] passed. S_OK. See also IAccessibleText ...
IAccessibleTable
Parameters modelChange A struct of (type(insert, delete, update), firstRow, lastRow, firstColumn, lastColumn). Return value S_FALSE if there is nothing to return, [out] value is null. S_OK. nColumns() Returns the total number of columns in table. [propget] HRESULT nColumns( [out] long columnCount ); Parameters columnCount Number of columns in table (including columns outside the current view
port) Return value S_OK. nRows() Returns the total number of rows in table. [propget] HRESULT nRows( [out] long rowCount ); Parameters rowCount Number of rows in table (including rows outside the current view
port) Return value S_OK. nSelectedChildren() Returns the total number of selected cells. [propget] HRESULT nSelectedChildren( [out] long cellCount ); Parameters cellCount Number of cells...
... Return value E_INVALIDARG if bad [in] passed. S_OK. summary() Returns the summary description of the table. The returned object could be an IAccessible or an IAccessible2. [propget] HRESULT summary( [out] IUnknown accessible ); Parameters accessible Returns a reference to an implementation dependent accessible object representing the table's summary or a null pointer if the table does not sup
port a summary. Return value S_FALSE if there is nothing to return, [out] value is null. S_OK. unselectColumn() Unselects one column, leaving other selected columns selected (if any). HRESULT unselectColumn( [in] long column ); Parameters column 0 based index of the column to be unselected. Return value E_INVALIDARG if bad [in] passed. S_OK. unselectRow() Unselects one row, leaving other selecte...
imgICache
That means that using getService in order to obtain it will yield incorrect results. ...
...sIURI uri); void removeEntry(in nsIURI uri); Methods clearCache() Evict images from the cache. void clearCache( in boolean chrome ); Parameters chrome If true, evict only chrome images. If false, evict everything except chrome images. findEntryProperties() Find Properties Used to get properties such as 'type' and 'content-disposition' 'type' is a nsISup
portsCString containing the images' mime type such as 'image/png' 'content-disposition' will be a nsISup
portsCString containing the header If you call this before any data has been loaded from a URI, it will succeed, but come back empty. nsIProperties findEntryProperties( in nsIURI uri ); Parameters uri The URI to look up. Return value null if the URL was not found in the cache. rem...
imgIContainerObserver
image/public/imgIContainerObserver.idlScriptable An interface to implement to listen to activities on an imgIContainer object. 1.0 66 Introduced Gecko 1.7 Inherits from: nsISup
ports Last changed in Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9) If you wish to listen for activities on an imgIContainer, you should implement the frameChanged() method. Method overview void frameChanged(in imgIRequest aRequest, in imgIContainer aContainer, [const] in nsIntRect aDirtyRect); Native code only! Methods Native code only!frameChanged Called when the frame for an image container has changed. void frameChanged( in imgIRequest aRequest, in imgIContainer aContainer, [const] in nsIntRect aDirtyRect ); Parameters aRequest The...
...nly! Methods Native code only!frameChanged Called when the frame for an image container has changed. void frameChanged( in imgIRequest aRequest, in imgIContainer aContainer, [const] in nsIntRect aDirtyRect ); Parameters aRequest The image request for which the change occurred. aContainer The image container that changed. aDirtyRect A rectangle indicating the
portion of the image container that changed. Notes The aRequest parameter was added to this method in Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9). See also imgIDecoderObserver imgIContainer ...
mozIAsyncFavicons
Simply QueryInterface() the nsIFaviconService to this interface. As an alternative, you can just use PlacesUtils.favicons from JavaScript. ...
..., [const,array,size_is(aDataLen)] in octet aData, in unsigned long aDataLen, in AUTF8String aMimeType, [optional] in PRTime aExpiration); Parameters aFaviconURI URI of the favicon whose data is being set. aData Binary contents of the favicon to save. aDataLen Length of binary data aMimeType MIME type of the data to store. This is im
portant so that we know what to re
port when the favicon is used. You should always set this param unless you are clearing an icon. aExpiration Optional Time in microseconds since the epoch when this favicon expires. Until this time, we won't try to load it again. replaceFaviconDataFromDataURL() Same as replaceFaviconData() but the data is provided by a string containing a data URL. Favi...
mozIStorageError
The mozIStorageError interface represents errors returned by the Storage API, offering attributes to obtain the error code as well as a human-readable error message corresponding to the error that occurred. storage/public/mozIStorageError.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Inherits from: nsISup
ports Attributes Attribute Type Description message AUTF8String A human readable error string with details; this may be null if no details are available. Read only. result long One of the error code values listed under Constants on this page. Constants Constant Value Description ...
...tring or blob exceeds the size limit. CONSTRAINT 19 Aborted due to a constraint violation. INTERNAL 2 An internal logic error occurred. MISMATCH 20 A data type mismatch occurred. MISUSE 21 Library used incorrectly. NOLFS 22 Attempted to use OS features not sup
ported on the host system. AUTH 23 Authorization denied. FORMAT 24 Auxiliary database format error. NOTADB 26 The opened file is not a database. PERM 3 Access permission denied. ABORT 4 A callback routine requested an abort. BUSY 5 The ...
mozIStorageService
storage/public/mozIStorageService.idlScriptable This interface lets you open a mozIStorageConnection to a database file, as well as create backups of an unopened database file. This is the only way to open a database connection. ...
...u call mozIStorageService.backupDatabaseFile() to back up the database so that user data is not lost (although we have no way of recovering this data yet). Each connection uses its own sqlite cache, which is inefficient, so you should use openDatabase() instead of this method unless you need a feature of SQLite that is incompatible with a shared cache, like virtual table and full text indexing sup
port. If cache contention is expected, for instance when operating on a database from multiple threads, using unshared connections may be a performance win. Warning: If you have more than one connection to a file, you must use the exact same name for the file each time, including case. The sqlite code uses a simple string comparison to see if there is already a connection. Opening a connection to...
mozIStorageStatementWrapper
ll the mozIStorageConnection interface's createStatement() method, you get a mozIStorageStatement which has just direct bindings to SQLITE. You can then wrap that statement with a wrapper, which implements nsIXPCScriptable and provides scriptable helpers letting you execute the statement as a function, access bind variables by name as properties, etc. ...
...iables by name as properties, etc. Firefox 3.5 note Firefox 3.5 adds sup
port for these features directly into the mozIStorageStatement interface, so this interface is essentially deprecated. storage/public/mozIStorageStatementWrapper.idlScriptable Please add a summary to this article. Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Inherits from: nsISup
ports Method overview void initialize(in mozIStorageStatement aStatement); void reset(); boolean step(); void execute(); Attributes Attribute Type Description statement mozIStorageStatement The statement that is wrapped. row mozIStorageStatementRow The current row. Throws an exception if no row is currently availabl...
nsIAccessible
<< Gecko AT Interfaces Page Summary The nsIAccessible interface is a cross-platform interface that sup
ports platform-specific accessibility APIs like MSAA and ATK. Contains the sum of what's needed to sup
port IAccessible as well as ATK's generic accessibility objects. Can also be used by in-process accessibility clients to get information about objects in the accessible tree. The accessible tree is a subset of nodes in the DOM tree -- such as documents, focusable elements and text. Mozilla creates the implementations of nsIAccessible on demand. [scriptable, uuid=(c7520419-87ec-42bc-98cc-04c0bf173530)] interface nsIAccessible : nsISup
ports { ... }; accessible/public/nsIAccessible.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.2 (Firefox 3.6 / Th...
... getState Provides a bit fields of accessible states which describe boolean properties of accessible. groupPosition This method returns grouping information. Used for tree items, list items, tab panel labels, radio buttons, etc. Also used for collectons of non-text objects. getChildAtPoint This method returns an accessible child whi...
nsIAccessibleRetrieval
accessible/public/nsIAccessibleRetrieval.idlScriptable An interface for in-process accessibility clients wishing to get an nsIAccessible or nsIAccessNode for a given DOM node. ...
...ins layout info for the DOM node. Return value The nsIAccessNode for the given DOM node or null if an access node does not already exist for this DOM node. getRelevantContentNodeFor() Return an DOM node that is relevant to attached accesible check. This node is either from bindings chain if given node is anonymous and owner binding denies accessible in anonymous content or given node (it's not im
portant whether it is accessible or not). This method doesn't create accessible object for returned node. nsIDOMNode getRelevantContentNodeFor( in nsIDOMNode aNode ); Parameters aNode The DOM node to get relevant content node. Return value The DOM node for parent attached accessible. getStringEventType() Get the type of accessible event as a string. AString getStringEventType( in unsign...
nsIApplicationCache
Each entry in the cache can be marked with a set of types, specified in the Constants section. ...
...st. ITEM_IMPLICIT 4 This item was navigated to in a top level browsing context, and named this cache's group as its manifest. ITEM_DYNAMIC 8 This item was added to the cache using the dynamic scripting API. ITEM_FOREIGN 16 This item was listed in the application manifest, but named a different cache group as its manifest. ITEM_FALLBACK 32 This item was listed as a fallback entry. ITEM_OP
PORTUNISTIC 64 This item matched an op
portunistic cache namespace and was cached for that reason. Methods activate() Makes this cache the active application cache for this group. Future loads associated with this group will come from this cache. Other caches from this cache group will be deactivated. void activate(); Parameters None. addNamespaces() Add a set of namespace entries to the applicatio...
nsIApplicationCacheNamespace
If a load from the cache fails to match on an exact cache entry, the namespace entries are searched for a substring match. ...
...AMESPACE_BYPASS 1 Items matching this namespace can be fetched from the network when loading from this cache. The data attribute is not used. NAMESPACE_FALLBACK 2 Items matching this namespace can be fetched from the network when loading from this cache; however, if the load fails, the cache entry specified by the data attribute should be loaded intstead. NAMESPACE_OP
PORTUNISTIC 4 Items matching this namespace should be cached op
portunistically. Successful top-level loads of resources in this namespace should be placed into the application cache. This can be combined with NAMESPACE_FALLBACK to provide a fallback entry in the data attribute. Methods init() Initializes the namespace. void init( in unsigned long itemType, in ACString namespaceSpec...
nsIAsyncInputStream
t target. closeWithStatus() This method closes the stream and sets its internal status. If the stream is already closed, then this method is ignored. Once the stream is closed, the stream's status cannot be changed. Any successful status code passed to this method is treated as NS_BASE_STREAM_CLOSED, which has an effect equivalent to nsIInputStream.close(). Note: This method exists in part to sup
port pipes, which have both an input end and an output end. If the input end of a pipe is closed, then writes to the output end of the pipe will fail. The error code returned when an attempt is made to write to a "broken" pipe corresponds to the status code passed in when the input end of the pipe was closed, which greatly simplifies working with pipes in some cases. void closeWithStatus( in nsresul...
...the input end of a pipe is closed, then writes to the output end of the pipe will fail. The error code returned when an attempt is made to write to a "broken" pipe corresponds to the status code passed in when the input end of the pipe was closed, which greatly simplifies working with pipes in some cases. void closeWithStatus( in nsresult aStatus ); Parameters aStatus The error that will be re
ported if this stream is accessed after it has been closed. ...
nsIAsyncOutputStream
t target. closeWithStatus() This method closes the stream and sets its internal status. If the stream is already closed, then this method is ignored. Once the stream is closed, the stream's status cannot be changed. Any successful status code passed to this method is treated as NS_BASE_STREAM_CLOSED, which has an effect equivalent to nsIInputStream.close(). Note: This method exists in part to sup
port pipes, which have both an input end and an output end. If the output end of a pipe is closed, then reads from the input end of the pipe will fail. The error code returned when an attempt is made to read to a "closed" pipe corresponds to the status code passed in when the output end of the pipe was closed, which greatly simplifies working with pipes in some cases. void closeWithStatus( in nsresu...
... the output end of a pipe is closed, then reads from the input end of the pipe will fail. The error code returned when an attempt is made to read to a "closed" pipe corresponds to the status code passed in when the output end of the pipe was closed, which greatly simplifies working with pipes in some cases. void closeWithStatus( in nsresult reason ); Parameters reason The error that will be re
ported if this stream is accessed after it has been closed. ...
nsIAsyncStreamCopier
netwerk/base/public/nsIAsyncStreamCopier.idlScriptable This interface is used to copy the contents of one stream to another. ...
...t); void init(in nsIInputStream aSource, in nsIOutputStream aSink, in nsIEventTarget aTarget, in boolean aSourceBuffered, in boolean aSinkBuffered, in unsigned long aChunkSize, in boolean aCloseSource, in boolean aCloseSink); Methods asyncCopy() Starts the copy operation. The specified observer is notified when the copy completes. void asyncCopy( in nsIRequestObserver aObserver, in nsISup
ports aObserverContext ); Parameters aObserver Receives notifications. aObserverContext The object to receive notifications with information about the progress of the copy operation. init() Initializes the stream copier. Note: At least one of the streams must be buffered. void init( in nsIInputStream aSource, in nsIOutputStream aSink, in nsIEventTarget aTarget, in boolean aSourceBuffered, ...
nsIBrowserSearchService
netwerk/base/public/nsIBrowserSearchService.idlScriptable Please add a summary to this article. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Implemented by: @mozilla.org/browser/search-service;1. To access this service, use: var browserSearchService = Components.classes["@mozilla.org/browser/search-service;1"] .getService(Components.interfaces.nsIBrowserSearchService); Attempting to use any method or attribute of this interface before init() has completed will force the service to fall back to a slower, synchronous, initialization. This is not an issue if your code is executed in reaction to a user interaction, as initialization is complete by...
...is shown, the new engine will be used right away automatically. void addEngine( in AString engineURL, in long dataType, in AString iconURL, in boolean confirm, [optional] in nsISearchInstallCallback callback ); Parameters engineURL The URL to the search engine's description file. dataType An integer representing the plugin file format. Must be one of the sup
ported search engine data types defined above. iconURL A URL string to an icon file to be used as the search engine's icon. This value may be overridden by an icon specified in the engine description file. confirm A boolean value indicating whether the user should be asked for confirmation before this engine is added to the list. If this value is false, the engine will be a...
nsIChannelEventSink
These methods are called before onStartRequest. ...
... one. Methods asyncOnChannelRedirect() Called when a redirect occurs. This may happen due to an HTTP 3xx status code. This method notifies the sink that a redirect is about to happen, but also to gives the sink the right to veto the redirect by throwing an exception or passing a failure code in the callback. Note: Vetoing the redirect simply means that newChannel will not be opened. It is im
portant to understand that oldChannel will continue loading as if it received a response of HTTP 200, which includes notifying observers and possibly display or process content attached to the HTTP response. If the sink wants to prevent this loading it must explicitly deal with it, e.g. by calling oldChannel->Cancel() There is a certain freedom in implementing this method: If the return-value indicate...
nsICharsetResolver
intl/chardet/public/nsICharsetResolver.idlScriptable Please add a summary to this article. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview void notifyResolvedCharset(in ACString charset, in nsISup
ports closure); ACString requestCharset(in nsIWebNavigation aWebNavigation, in nsIChannel aChannel, out boolean aWantCharset, out nsISup
ports aClosure); Methods notifyResolvedCharset() Some implementations may request that they be notified when the charset is actually detected. void notifyResolvedCharset( in ACString charset, in nsISup
ports closure ); Parameters charset The detected charset. closure The closure returned by requestCharset(). requestCharset() Called to resolve the charset that should be used for parsing the document being loaded from...
...fied of the final resolved charset when one is available, it can set aWantCharset to true. If this is done, the caller of requestCharset is responsible for calling notifyResolvedCharset() and passing it the final resolved charset and the closure that requestCharset set. ACString requestCharset( in nsIWebNavigation aWebNavigation, in nsIChannel aChannel, out boolean aWantCharset, out nsISup
ports aClosure ); Parameters aWebNavigation The nsIWebNavigation the document is being loaded in. May be null. aChannel The channel the document is coming in from. aWantCharset Gets set to true if notifyResolvedCharset() should be called with the given aClosure object. aClosure A resulting object which should be passed to notifyResolvedCharset() if aWantCharset is set to true. Return value The reso...
nsIChromeFrameMessageManager
meScript(in AString aURL, in boolean aAllowDelayedLoad); void removeDelayedFrameScript(in AString aURL); Methods loadFrameScript() Loads a script into the remote frame. void loadFrameScript( in AString aURL, in boolean aAllowDelayedLoad ); Parameters aURL The URL of the script to load into the frame; this must be an absolute URL, but data: URLs are sup
ported. aAllowDelayedLoad If true, the script will be loaded when the remote frame becomes available; otherwise, the script will only be loaded if the frame is already available. removeDelayedFrameScript() Removes a script from the list of scripts sup
porting delayed load. void removeDelayedFrameScript( in AString aURL ); Parameters aURL The URL of the script to remove ...
... If true, the script will be loaded when the remote frame becomes available; otherwise, the script will only be loaded if the frame is already available. removeDelayedFrameScript() Removes a script from the list of scripts sup
porting delayed load. void removeDelayedFrameScript( in AString aURL ); Parameters aURL The URL of the script to remove from the list of scripts sup
porting delayed load. See also Content process event handling nsIContentFrameMessageManager nsIFrameLoader nsIFrameMessageListener ...
nsICommandLine
toolkit/components/commandlines/public/nsICommandLine.idlScriptable Represents the command line used to invoke a XUL application. This may be the original command line of this instance or a command line provided remotely by another instance of the application. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Components may implement the nsICommandLineHandler interface to add custom command line handling behavior. Definitions arguments Any values found on the command line. switches Flags. In normalized form, these are preceded by a single dash. Some flags may take parameters; for example: "-url <param>" or "-install-xpi <param>". Method overview long findFlag(in AString aFlag, ...
... retrieve. This index is 0-based, and does not include the application name. Return value The value of the specified argument. This is the full text of that argument, so if the argument is a flag, the returned value is "-flag [<flagvalue>]". Exceptions thrown NS_ERROR_INVALID_ARG The specified index is out of bounds. handleFlag() Finds the specified flag, removing it from the array of flags. Re
ports whether or not the specified flag was found. This is useful for Boolean flags; that is, flags that don't accept a parameter. You can determine if the flag was provided and remove it from the list of flags waiting to be processed in one operation. boolean handleFlag( in AString aFlag, in boolean aCaseSensitive ); Parameters aFlag The flag name to find and remove. aCaseSensitive Whether to d...
nsICompositionStringSynthesizer
dom/interfaces/base/nsICompositionStringSynthesizer.idlScriptable This interface is a composition string synthesizer interface that synthesizes composition string with arbitrary clauses and a caret 1.0 66 Introduced Gecko 26 Obsolete Gecko 38 Inherits from: nsISup
ports Last changed in Gecko 38.0 (Firefox 38.0 / Thunderbird 38.0 / SeaMonkey 2.35) This interface is obsoleted in Gecko 38. You need to use nsITextInputProcessor instead of this. Every instance is associated with a DOM window at created by nsIDOMWindowUtils.createCompositionStringSynthesizer(). To create an instance for this: var domWindowUtils = window.windowUtils; var compositionStringSynthesizer = domWindowUtils.createCompositionStringSynthesizer(); For example, when you cre...
...ion string set by setString(). This is optional. I.e., you may not call this before dispatchEvent(). void setCaret(in unsigned long aOffset, in unsigned long aLength); Parameters aOffset Caret offset in the composition string. This value must be between 0 and the length of aString of setString(). aLength If you want wide caret, you can set over 0. However, Gecko doesn't sup
port wide caret yet. (bug 979112) setString() Sets new composition string. This must be called before every call of dispatchEvent(). void setString(in AString aString); Parameters aString New composition string. ...
nsIConsoleMessage
See nsIScriptError for an example. ...
...See nsIScriptError for an example. ...
nsIConsoleService
xpcom/base/nsIConsoleService.idlScriptable The console service is the back-end for the Error Console, bundled with every Mozilla application, and for Firefox's Web Console and Browser Console. It is used to log various messages, warnings, and errors and to obtain the logged messages. ...
... Logging a message with additional information To include other information an nsIConsoleMessage object must be used. In this example nsIScriptError, which implements nsIConsoleMessage, is used to include information about the source file and line number of the error. function myLogToConsole(aMessage, aSourceName, aSourceLine, aLineNumber, aColumnNumber,...
nsIContentView
content/base/public/nsIFrameLoader.idlScriptable Represents a scrollable content view whose contents are actually drawn by a separate process; this is part of the Electrolysis multi-process sup
port framework. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) See Working with content views for details on how to use this API. Note: Currently, only <frame> and <iframe> elements are handled as content views. Sup
port for using this API for all scrollable elements is coming; see bug 618975 for details. Method overview void scrollBy(in float dxPx, in float dyPx); void scrollTo(in float xPx, in float yPx); void setScale(in float xScale, in float yScale); ...
...ctive (that is it is being painted because it's in the visible region of the screen), this value is at first lined up with the content's scroll offset. Note: When this view becomes inactive, the new content view will have scroll values that are reset to the default. Read only. scrollY float Horizontal scroll offset in chrome-document CSS pixels. Read only. view
portHeight float Height of the view
port in chrome-document CSS pixels. Read only. view
portWidth float Width of the view
port in chrome-document CSS pixels. Read only. Methods scrollBy() Scrolls the content view by the specified number of chrome-document CSS pixels along each axis. Fails if the view isn't valid. void scrollBy( in float dxPx, in float dyPx ); Paramete...
nsIControllers
Windows and text inputs have default controllers that allow commands such as cmd_copy to act on the focused element or window. XUL elements can also have controllers, although they do not have any default controllers. Implemented by: @mozilla.org/xul/xul-controllers;1. You should not normally need to create an instance, as you normally need to alter the window or element's existing list of controllers. ...
...ns thrown NS_ERROR_FAILURE The ID is greater than the number of controllers that have been inserted, or the controller has since been removed. getControllerCount() Returns the current number of controllers. unsigned long getControllerCount(); Parameters None. Return value The number of controllers currently in the list of controllers. getControllerForCommand() Searches for a controller that sup
ports the given command. nsIController getControllerForCommand( in string command ); Parameters command The name of a command, e.g. cmd_copy Return value The first controller in the list that sup
ports the given command. getControllerId() Returns the order of insertion of a controller. unsigned long getControllerId( in nsIController controller ); Parameters controller The controller for which ...
nsICryptoHMAC
netwerk/base/public/nsICryptoHMAC.idlScriptable This interface provides HMAC signature algorithms. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Method overview ACString finish(in PRBool aASCII); void init(in unsigned long aAlgorithm, in nsIKeyObject aKeyObject); void reset(); void update([const, array, size_is(aLen)] in octet aData, in unsigned long aLen); void updateFromStream(in nsIInputStream aStream, in unsigned long aLen); Constants Hashing Algorithms. These values are to be used by the init() method to indicate which hashing function to use. These values map onto the values defined in mozilla/security/nss/lib/softoken/pkcs11t.h and are switched to CKM_*_HMA...
...lgorithm types. aKeyObject Object holding a key. To create the key object use for instance: var keyObject = Components.classes["@mozilla.org/security/keyobjectfactory;1"] .getService(Components.interfaces.nsIKeyObjectFactory) .keyFromString(Components.interfaces.nsIKeyObject.HMAC, rawKeyData); Exceptions thrown NS_ERROR_INVALID_ARG If an unsup
ported algorithm type is passed. reset() Reinitialize HMAC context to be reused with the same settings (the key and hash algorithm) but on different set of data. void reset(); Parameters None. update() void update( [const, array, size_is(aLen)] in octet aData, in unsigned long aLen ); Parameters aData A buffer to calculate the hash over. aLen The length of the buffer aData. Ex...
nsIDNSRecord
netwerk/dns/nsIDNSRecord.idlScriptable This interface represents the result of a DNS lookup. Since a DNS query may return more than one resolved IP address, the record acts like an enumerator, allowing the caller to easily step through the list of IP addresses. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview PRNetAddr getNextAddr(in PRUint16 a
Port); Native code only! ACString getNextAddrAsString(); boolean hasMore(); void rewind(); Attributes Attribute Type Description canonicalName ACString for example, www.mozilla.org --> rheet.mozilla.org. Read only. Methods Native code only!getNextAddr This function copies the value of the next IP address into the given PRNetAddr struct and increments the internal address iterator. PRNetAddr getNextA...
...NextAddrAsString(); boolean hasMore(); void rewind(); Attributes Attribute Type Description canonicalName ACString for example, www.mozilla.org --> rheet.mozilla.org. Read only. Methods Native code only!getNextAddr This function copies the value of the next IP address into the given PRNetAddr struct and increments the internal address iterator. PRNetAddr getNextAddr( in PRUint16 a
Port ); Parameters a
Port A
port number to initialize the PRNetAddr with. Return value The value of the next IP address. getNextAddrAsString() This function returns the value of the next IP address as a string and increments the internal address iterator. ACString getNextAddrAsString(); Parameters None. Return value The value of the next IP address as a string. hasMore() This method checks if there...
nsIDOMChromeWindow
dom/interfaces/base/nsIDOMChromeWindow.idlScriptable This interface is implemented on the window object in chrome. Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview void beginWindowMove(in nsIDOMEvent mouseDownEvent); void getAttention(); void getAttentionWithCycleCount(in long aCycleCount); void maximize(); void minimize(); void notifyDefaultButtonLoaded(in nsIDOMElement defaultButton); void restore(); void setCursor(in DOMString cursor); Attributes Attribute Type Description browserDOMWindow nsIBrowserDOMWindow The related nsIBrowserDOMWindow instance which provides access to yet another layer of utility functions by chrome script. It will be null for DOMWindows not corresponding to bro...
...s, we must allow the window manager to handle window dragging. This method tells the window manager to start dragging the window. This method will fail unless called while the left mouse button is held down, callers must check this. void beginWindowMove( in nsIDOMEvent mouseDownEvent ); Parameters mouseDownEvent Exceptions thrown NS_ERROR_NOT_IMPLEMENTED If the operating system does not sup
port this method. getAttention() void getAttention(); Parameters None. getAttentionWithCycleCount() Same as getAttention method excepting that this can specify the maximum number of times to animate the window per system conventions. void getAttentionWithCycleCount( in long aCycleCount ); Parameters aCycleCount The maximum number of times to animate the window per system conventions. If set to -...
nsIDOMFile
"file". This allows the file reference to be saved when the form is submitted while the user is using a web application offline, so that the data can be retrieved and uploaded once the Internet connection is restored. This is also used by the DataTransfer object to describe files dragged into a web application using drag and drop. ...
...Sup
ports, but in the File API specification, it should be a Blob. This will likely change in the future, so avoid using any non-standard methods offered by this interface in order to ensure future compatibility. content/base/public/nsIDOMFile.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Inherits from: nsISup
ports This interface implements the DOM File object; for complete documentation, read up on that. See also nsIDOMFileList nsIDOMFileException DataTransfer Drag and drop ...
nsIDOMGeoPositionCoords
The nsIDOMGeoPositionCoords interface describes a geographical location. dom/interfaces/geolocation/nsIDOMGeoPositionCoords.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Inherits from: nsISup
ports Attributes Attribute Type Description latitude double The user's current latitude, in degrees. Read only. longitude double The user's current longitude, in degrees. Read only. altitude double The user's current altitude, in meters. Zero if the device doesn't sup
port altitude detection. Read only. accuracy double The accuracy of position information, in meters. Read only. altitudeAccuracy double The accuracy of altitude in...
...Read only. heading double The current heading at which the user is moving, in degrees. ...
nsIDOMNode
dom/interfaces/core/nsIDOMNode.idlScriptable This interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. Inherits from: nsISup
ports Last changed in Gecko 0.9.6 Method overview nsIDOMNode appendChild(in nsIDOMNode newChild) nsIDOMNode cloneNode(in boolean deep); boolean hasAttributes(); boolean hasChildNodes(); nsIDOMNode insertBefore(in nsIDOMNode newChild, in nsIDOMNode refChild) boolean isSup
ported(in DOMString feature, in DOMString version); void normalize(); nsIDOMNode removeChild(in nsIDOMNode oldChild) nsIDOMNode replaceChild(in nsIDOMNode newChild, in nsIDOMNode oldChild) Attributes Attribute Type Description attributes nsIDOMNamedNodeMap Read only. childNodes nsIDOMNodeList R...
...d Return value cloneNode() nsIDOMNode cloneNode( in boolean deep ); Parameters deep Return value hasAttributes() boolean hasAttributes(); Parameters None. Return value hasChildNodes() boolean hasChildNodes(); Parameters None. Return value insertBefore() nsIDOMNode insertBefore( in nsIDOMNode newChild, in nsIDOMNode refChild ); Parameters newChild refChild Return value isSup
ported() boolean isSup
ported( in DOMString feature, in DOMString version ); Parameters feature version Return value normalize() void normalize(); Parameters None. removeChild() nsIDOMNode removeChild( in nsIDOMNode oldChild ); Parameters oldChild Return value replaceChild() nsIDOMNode replaceChild( in nsIDOMNode newChild, in nsIDOMNode oldChild ); Parameters newChild oldChild ...
nsIDOMUserDataHandler
dom/interfaces/core/nsIDOMUserDataHandler.idlScriptable The callback function for the setUserData method. 1.0 66 Introduced Gecko 1.5 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Method overview void handle(in unsigned short operation, in DOMString key, in nsIVariant data, in nsIDOMNode src, in nsIDOMNode dst); Constants Constant Value Description NODE_CLONED 1 The node was cloned. NODE_IM
PORTED 2 The node was cloned into a new document. NODE_DELETED 3 Unimplemented NODE_RENAMED 4 Unimplemented NODE_ADOPTED 5 The node was adopted into a new document. Methods handle() This method is a callback which will be called if a node with user data is being cloned, im
ported or adopted. void handle( in unsigned short oper...
...loned, im
ported or adopted. void handle( in unsigned short operation, in DOMString key, in nsIVariant data, in nsIDOMNode src, in nsIDOMNode dst ); Parameters operation One of the NODE_* operation type constants from the above table. key The key that was used to set the user data. data The data that was set on the original node. src The original node. dst The new node, for clone and im
port operations. ...
nsIDOMWindow
dom/interfaces/base/nsIDOMWindow.idlScriptable This interface is the primary interface for a window object. It represents a single window object that may contain child windows if the document in the window contains an HTML frameset document, or if the document contains iframe elements. 66 Introduced Gecko 1.0 Deprecated Gecko 44 Inherits from: nsISup
ports Last changed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) Starting with Firefox 44, this file is empty as its features were either no longer used or are only available from C++ code; see dom/base/nsPIDOMWindow.h for those. While this interface is not officially defined by any standard bodies, it originates from the de-facto DOM Level 0 standard. Starting in Firefox 3, DOM window...
...rrent browsing context. Data stored in session storage may be accessed by any site in the browsing context. Read only.Note: Prior to Gecko 8.0 this attribute was part of nsIDOMStorageWindow. textZoom float Get or set the document scale factor as a multiplier of the default size. When setting this attribute, an NS_ERROR_NOT_IMPLEMENTED error may be returned by implementations not sup
porting zoom. This attribute should always return 1.0 for implementations not sup
porting text zoom. 1.0 represents normal (unzoomed) size. Native code only! top nsIDOMWindow The root window for the hierarchy of windows that contain this nsIDOMWindow. This is the window itself if there is no parent, or if the parent is of a different type. The window hierarchy does not cross chrome-conte...
nsIDOMWindowInternal
xScroll, in long yScroll) nsIDOMWindow Window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. ...
...rop Readonly: Returns the window directories toolbar object. closed boolean Readonly: This property indicates whether the referenced window is closed or not. crypto nsIDOMCrypto Readonly: Returns the browser crypto object, which can then be used to manipulate various browser security features. pkcs11 nsIDOMPkcs11 Obsolete: this property is not sup
ported in newer versions of Firefox. controllers nsIControllers Readonly: Returns the XUL controllers of the chrome window. opener nsIDOMWindowInternal Returns a reference to the window that opened this current window. status DOMString Sets the text in the status bar at the bottom of the browser or returns the previously set text. defaultStatus ...
nsIDeviceMotion
xpcom/system/nsIDeviceMotion.idlScriptable This interface is used to implement accelerometer sup
port. 1.0 66 Introduced Gecko 1.9.2 Inherits from: nsISup
ports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Note: This interface was named nsIDeviceMotion prior to Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3). ...
...r to Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3). Method overview void addListener(in nsIDeviceMotionListener aListener); void addWindowListener(in nsIDOMWindow aWindow); Native code only! void removeListener(in nsIDeviceMotionListener aListener); void removeWindowListener(in nsIDOMWindow aWindow); Native code only! Methods addListener() When called, the accelerometer sup
port implementation must begin to notify the specified nsIDeviceMotionListener by calling its nsIDeviceMotionListener.onAccelerationChange() method as appropriate to share updated acceleration data. void addListener( in nsIDeviceMotionListener aListener ); Parameters aListener The nsIDeviceMotionListener object whose nsIDeviceMotionListener.onAccelerationChange() method should be called with updat...
nsIDeviceMotionData
Read only. x double The amount of tilt along the X axis. ...
...Read only. x double The amount of tilt along the X axis. Read only. y double The amount of tilt along the Y axis. Read only. z double The amount of tilt along the Z axis. Read only. ...
nsIDirIndexListener
netwerk/streamconv/public/nsIDirIndexListener.idlScriptable This interface is used to receive contents of directory index listings from a protocol. They can then be transformed into an output format (such as rdf, html and so on) Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void onIndexAvailable(in nsIRequest aRequest, in nsISup
ports aCtxt, in nsIDirIndex aIndex); void onInformationAvailable(in nsIRequest aRequest, in nsISup
ports aCtxt, in AString aInfo); Methods onIndexAvailable() Called for each directory entry. void onIndexAvailable( in nsIRequest aRequest, in nsISup
ports aCtxt, in nsIDirIndex aIndex ); Parameters aRequest The request. aCtxt Opaque parameter aIndex New index to add. onInf...
... aCtxt, in AString aInfo); Methods onIndexAvailable() Called for each directory entry. void onIndexAvailable( in nsIRequest aRequest, in nsISup
ports aCtxt, in nsIDirIndex aIndex ); Parameters aRequest The request. aCtxt Opaque parameter aIndex New index to add. onInformationAvailable() Called for each information line. void onInformationAvailable( in nsIRequest aRequest, in nsISup
ports aCtxt, in AString aInfo ); Parameters aRequest The request. aCtxt Opaque parameter aInfo New info to add. ...
getFiles
See Also nsIFile, nsILocalFile, nsISimpleEnumerator ...
... See Also nsIFile, nsILocalFile, nsISimpleEnumerator ...
nsIDownloadObserver
netwerk/base/public/nsIDownloader.idlScriptable Please add a summary to this article. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview void onDownloadComplete(in nsIDownloader downloader, in nsIRequest request, in nsISup
ports ctxt, in nsresult status, in nsIFile result); Methods onDownloadComplete() Called to signal a download that has completed. ...
...this article. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview void onDownloadComplete(in nsIDownloader downloader, in nsIRequest request, in nsISup
ports ctxt, in nsresult status, in nsIFile result); Methods onDownloadComplete() Called to signal a download that has completed. ...
nsIDownloadProgressListener
/toolkit/components/downloads/nsIDownloadProgressListener.idlScriptable This interface gives applications and extensions a way to monitor the status of downloads being processed by the Download Manager. Inherits from: nsISup
ports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) To use simply implement this interface in your code, then call nsIDownloadManager.addListener() to start listening. When you no longer need to listen to the Download Manager's state, call nsIDownloadManager.removeListener() to stop listening. ...
...loadManager.addListener() to start listening. When you no longer need to listen to the Download Manager's state, call nsIDownloadManager.removeListener() to stop listening. As the states of downloads change, the methods described here are called by the Download Manager so your code can take whatever steps it needs to. This interface works very similarly to the nsIWebProgress interface. It is im
portant to note that there is no service for this listener. Rather, the developer must create an object with the methods provided below to implement it. Method overview void onDownloadStateChange(in short aState, in nsIDownload aDownload); void onLocationChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI aLocation, in nsIDownload aDownload); Obsolete since Ge...
nsIEditor
<< XPCOM API Reference editor/nsIEditor.idlScriptable Provides methods and attributes used when editing page content. ...
...turns true if the document is modifed and needs saving. flags unsigned long Edit flags for this editor. May be set at any time. isDocumentEditable PRBool Read only. Returns true if we have a document that is not marked read-only. isSelectionEditable boolean Read only. true if the current selection anchor is editable; otherwise false. This helps to sup
port cases where only parts of the document are editable, by letting you see if the current selection is in an editable section. rootElement nsIDOMElement Read only. The root editable element, which for a document is its body. selection nsISelection Read only. The selection/caret for this editor. In the case of a design mode document, this is the same as the window's sel...
nsIEnvironment
getService(Components.interfaces.nsIEnvironment); Method overview void set(in AString aName, in AString aValue); AString get(in AString aName); boolean exists(in AString aName); Methods set() Set the value of an environment variable. ...
...() Check the existence of an environment variable. This method checks whether an environment variable is present in the environment or not. Note: * For Unix/Linux platforms we follow the Unix definition: An environment variable exists when getenv() returns a non-NULL value. An environment variable does not exist when getenv() returns NULL. For non-Unix/Linux platforms we have to fall back to a "
portable" definition (which is incorrect for Unix/Linux!!!!) which simply checks whether the string returned by Get() is empty or not. boolean exists( in AString aName ); Parameters aName The variable name to probe. Return value If the variable has been set, the value returned is PR_TRUE. If the variable was not defined in the environment PR_FALSE will be returned. Examples Windows Th...
nsIEventListenerInfo
content/events/public/nsIEventListenerService.idlScriptable An instance of this interface describes how an event listener was added to an event target; these are returned by nsIEventListenerService.getListenerInfoFor, which provides a list of all the listeners to a given event target. 1.0 66 Introduced Gecko 1.9.2 Inherits from: nsISup
ports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Method overview nsISup
ports getDebugObject(); AString toSource(); Attributes Attribute Type Description allowsUntrusted boolean Indicates whether or not the event listener allows untrusted events. Read only. capturing boolean Indicates whether or not the event listener is in capture m...
...an Indicates whether or not the event listener is in capture mode. Read only. inSystemEventGroup boolean Indicates whether or not the event listener is in the system event group. Read only. type AString The type of the event for which the listener was added. Read only. Methods getDebugObject() Returns the debugger object if the debug service is active. nsISup
ports getDebugObject(); Parameters None. Return value If jsdIDebuggerService is active and the listener is implemented in JS, this returns the listener as a jsdIValue. Otherwise null. This is the method you should use if you want to get access to the actual listener, but the debugger service must be already active, which significantly slows down script execution. Accordingly, this should probably onl...
nsIEventTarget
xpcom/threads/nsIEventTarget.idlScriptable A target for events. Events may be sent to this target from any thread by calling the dispatch method. Implement this interface in order to sup
port receiving events from other threads. ...
... xpcom/threads/nsIEventTarget.idlScriptable A target for events. Events may be sent to this target from any thread by calling the dispatch method. Implement this interface in order to sup
port receiving events from other threads. ...
nsIException
Read only. filename string Filename location. This is the location that caused the error, which may or may not be a source file location. ...
...Read only. filename string Filename location. This is the location that caused the error, which may or may not be a source file location. ...
nsIFTPEventSink
void OnFTPControlLog ( in boolean server, in string msg); Parameters server A boolean value specifying whether you are a server or a client. ...
...void OnFTPControlLog ( in boolean server, in string msg); Parameters server A boolean value specifying whether you are a server or a client. ...
nsIFaviconService
toolkit/components/places/public/nsIFaviconService.idlScriptable Stores favicons for pages in bookmarks and history. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 22.0 (Firefox 22.0 / Thunderbird 22.0 / SeaMonkey 2.19) Implemented by: @mozilla.org/browser/favicon-service;1. To use this service, use: var faviconService = Components.classes["@mozilla.org/browser/favicon-service;1"] .getService(Components.interfaces.nsIFaviconService); Method overview void addFailedFavicon(in nsIURI aFaviconURI); void expireAllFavicons(); void getFaviconData(in nsIURI aFaviconURI, out AUTF8String aMimeType, [optional] out unsigned long aDataLen, [array,retval,size_is(aDataLen)] out octet aData)...
...y,size_is(aDataLen)] in octet aData, in unsigned long aDataLen, Optional from Gecko 2.0 in AUTF8String aMimeType, in PRTime aExpiration ); Parameters aFaviconURI URI of the favicon whose data is being set. aData Binary contents of the favicon to save. aDataLen Optional from Gecko 2.0 Length of binary data. aMimeType MIME type of the data to store. This is im
portant so that we know what to re
port when the favicon is used. You should always set this param unless you are clearing an icon. aExpiration Time in microseconds since the epoch when this favicon expires. Until this time, we won't try to load it again. Exceptions thrown NS_ERROR_FAILURE Thrown if the favicon is overbloated and won't be saved to the db. setFaviconDataFromD...
nsIFeedProgressListener
process. 1.0 66 Introduced Gecko 1.8 Inherits from: nsIFeedResultListener Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void handleEntry(in nsIFeedEntry entry, in nsIFeedResult result); void handleFeedAtFirstEntry(in nsIFeedResult result); void handleStartFeed(in nsIFeedResult result); void re
portError(in AString errorText, in long lineNumber, in boolean bozo); Methods handleEntry() Called after each entry or item is processed. If the document is a standalone item or entry, the HandleFeedAtFirstEntry() method will not already have been called, and the received nsIFeedEntry will have a null parent value. void handleEntry( in nsIFeedEntry entry, in nsIFeedResult result ); Par...
...y is found, but before processing it. handleStartFeed() Called as soon as a reasonable start to a feed is detected; this lets your code know that the feed does appear to be an actual feed rather than some other sort of document. void handleStartFeed( in nsIFeedResult result ); Parameters result An nsIFeedResult describing the current state of the feed at the moment parsing begins. re
portError() Called by the feed processor when a fatal XML parsing error occurs, or if the document isn't a feed. void re
portError( in AString errorText, in long lineNumber, in boolean bozo ); Parameters errorText A short description of the error. lineNumber The line on which the error occurred. bozo The bozo bit will be set if the error was due to a fatal error. See also nsIFeed...
nsIFeedResult
toolkit/components/feeds/nsIFeedResult.idlScriptable This interface provides access to HTTP and parsing metadata for a feed or entry. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void registerExtensionPrefix(in AString aNamespace, in AString aPrefix); Attributes Attribute Type Description bozo boolean The feed processor sets the bozo bit when a feed triggers a fatal error during XML parsing. There may still be feed metadata and entries that were parsed before the error occurred. doc nsIFeedContainer The parsed feed or entry. null if a non-feed was processed. headers nsIProperties The ...
... Methods registerExtensionPrefix() Registers a prefix for a namespace used to access an extension in the feed or entry. Warning: This method is not implemented at this time. void registerExtensionPrefix( in AString aNamespace, in AString aPrefix ); Parameters aNamespace The namespace for the extension. aPrefix The prefix used to access the extension. See also nsISup
ports nsIFeedContainer nsIURI nsIProperties Interwiki link ...
nsIFeedResultListener
toolkit/components/feeds/public/nsIFeedListener.idlScriptable This interface should be implemented by programs to receive events from the feed parser as parsing progresses. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void handleResult(in nsIFeedResult result); Methods handleResult() Called when feed processing is complete. Even if an error occurred during processing, there may be valid data available for feed-level data or entries processed before the error occurred. If you don't care about doing progress display or the like, this is all you need to implement in order to receive the parsed feed. void handleResult( in nsIFeedResult result ...
...ng, there may be valid data available for feed-level data or entries processed before the error occurred. If you don't care about doing progress display or the like, this is all you need to implement in order to receive the parsed feed. void handleResult( in nsIFeedResult result ); Parameters result An nsIFeedResult describing the parsed feed. See also nsIFeedProgressListener nsISup
ports Interwiki link ...
nsIIDNService
netwerk/dns/nsIIDNService.idlScriptable This interface provides sup
port for Internationalized Domain Names, including methods for manipulating IDN hostnames according to IETF specification. ...
... netwerk/dns/nsIIDNService.idlScriptable This interface provides sup
port for Internationalized Domain Names, including methods for manipulating IDN hostnames according to IETF specification. ...
nsIINIParserWriter
nsIINIParserWriter xpcom/ds/nsIINIParser.idlScriptable Allows writing to an INI-format configuration file. 1.0 66 Introduced Gecko 1.9.2 Inherits from: nsISup
ports Last changed in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10) This interface provides methods that allow writing to INI-format configuration files. INI files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property. ...
...ace provides methods that allow writing to INI-format configuration files. INI files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property. To create an nsIINIParserWriter object, you use the nsIINIParserFactory interface to create a parser, then nsISup
ports.QueryInterface() that to get an nsIINIParserWriter, like this: let writer = Components.classes["@mozilla.org/xpcom/ini-processor-factory;1"]. .getService(Components.interfaces.nsIINIParserFactory) .createINIParser(someLocalFile) .QueryInterface(Components.interfaces.nsIINIParserWriter); Here, someLocalFile is an nsIFile base...
nsIIdleService
widget/nsIIdleService.idlScriptable The idle service lets you monitor how long the user has been 'idle', that is they have not used their mouse or keyboard. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsISup
ports Last changed in Gecko 16 (Firefox 16 / Thunderbird 16 / SeaMonkey 2.13) You can get the idle time directly, but in most cases you will want to register an observer for a predefined interval. The observer will get an 'idle' notification when the user is idle for that interval (or longer), and receive a 'back' (Gecko 3 to 15) or 'active' (Gecko 16+) notification when the user starts using their computer again. Note: The idle service is for computer-wide idle detection, not just application idle detection. In other words, even if the user is wo...
...hod overview void addIdleObserver(in nsIObserver observer, in unsigned long time); void removeIdleObserver(in nsIObserver observer, in unsigned long time); Attributes Attribute Type Description idleTime unsigned long The amount of time in milliseconds that has passed since the last user activity. Can be 0 if there is no valid idle time to re
port (this can happen if the user never interacted with the browser at all, and if we are unable to poll for idle time manually). Read only. Methods addIdleObserver() Add an observer to be notified when the user idles for some period of time, and when they get back from that. The subject of the notification the observer will get is always the nsIIdleService itself. When the user goes idle,...
nsIJetpack
js/jetpack/nsIJetpack.idlScriptable This interface enables communication between the chrome process and a remote Jetpack process. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview void sendMessage(in AString aMessageName /* [optional] in jsval v1, [optional] in jsval v2, ... */); void registerReceiver(in AString aMessageName, in jsval aReceiver); void unregisterReceiver(in AString aMessageName, in jsval aReceiver); void unregisterReceivers(in AString aMessageName); void evalScript(in AString aScript); nsIVariant createHandle(); void destroy(); Methods sendMessage() This method asynchronously sends a message to the Jetpack process. void sendMessage( ...
... contents of the script to evaluate in the Jetpack process. createHandle() This creates an opaque handle that can transparently be exchanged between processes. nsIVariant createHandle(); Parameters None. Return value The new handle. destroy() This terminates the Jetpack process. void destroy(); Parameters None. Special Messages If an exception goes uncaught in the Jetpack process, it will be re
ported to the chrome process via a message with the name core:exception. The message comes with one argument, which represents the exception object that was thrown. Warning: bug 589308 prevents this message from being sent in some situations. History See bug 556846 for details. See also nsIJetpackService Jetpack Processes ...
nsIJumpListBuilder
Modifying an applied jump list is not permitted. Callers should begin the creation of a new jump list using initListBuild(), add sub lists using addListToBuild(), then commit the jump list using commitListBuild(). Lists are built in real-time during the sequence of build calls, make sure to check for errors on each individual step. ...
...itional jump list types. Method overview void abortListBuild(); boolean addListToBuild(in short aCatType, in nsIArray items Optional, in AString catName Optional); boolean commitListBuild(); boolean deleteActiveList(); boolean initListBuild(in nsIMutableArray removedItems); Attributes Attribute Type Description available short Indicates whether jump list taskbar features are sup
ported by the current host. Read only. isListCommitted boolean JumpList management. Indicates if a commit has already occurred in this session. Read only. Exceptions thrown NS_ERROR_NOT_AVAILABLE On all calls if taskbar functionality is not sup
ported by the operating system. maxListItems short The maximum number of jump list items the current desktop can sup
port. Read only. Constants Con...
nsILivemarkService
Implemented by: @mozilla.org/browser/livemark-service;2. ...
...the site URI, or null to clear the site URI for this livemark container. Exceptions thrown NS_ERROR_INVALID_ARG If the folder ID isn't known or identifies a folder that isn't a livemark container; also if the siteURI argument isn't a valid nsIURI object (or null) start() This method starts the livemark refresh timer. Being able to manually control this allows activity such as bookmarks im
port to occur without kicking off HTTP traffic. void start(); Parameters None. stopUpdateLivemarks() Stop the livemark refresh timer. void stopUpdateLivemarks(); Parameters None. See also Places Livemark Service nsINavBookmarksService ...
nsILocalFile
L With PR_CREATE_FILE, if the file does not exist, the file is created. If the file already exists, no action and null is returned. DELETE_ON_CLOSE File will be deleted when closed. mode A UNIX-style file permissions value. For example, the octal value 0600 may be used to limit read and write access to the current user of the system. This parameter may be ignored on systems that do not sup
port file permissions. Return value If the file is successfully opened, returns a pointer to the PRFileDesc created for the newly opened file. Returns a null pointer if the open failed. Example #include "prio.h" #include "nsError.h" #include "nsILocalFile.h" // Read the contents of a nsILocalFile... nsresult ReadLocalFile(nsILocalFile *aLocalFile) { PRFileDesc *fd; nsresult rv = aLocalFile-...
... if (NS_FAILED(rv)) return rv; char buf[512]; PRInt32 n; while ((n = PR_Read(fd, buf, sizeof(buf))) > 0) { // Do something with n-byte block of data from file... } if (n < 0) rv = NS_ERROR_UNEXPECTED; PR_Close(fd); return rv; } reveal() Ask the operating system to open the folder which contains this file or folder. This routine only works on platforms which sup
port the ability to open a folder. See the note in the remarks below. void reveal(); Parameters None. setRelativeDescriptor() Initializes the file to the location relative to fromFile using a string returned by getRelativeDescriptor(). void setRelativeDescriptor( in nsILocalFile fromFile, in ACString relativeDesc ); Parameters fromFile The file to which the descriptor is relative. re...
nsILoginInfo
nsILoginInfo is an object containing information for a login stored by the Login Manager. To create and manage logins use nsILoginManager. toolkit/components/passwordmgr/public/nsILoginInfo.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Inherits from: nsISup
ports Implemented by: @mozilla.org/login-manager/loginInfo;1. To create an instance, use: var loginInfo = Components.classes["@mozilla.org/login-manager/loginInfo;1"] .createInstance(Components.interfaces.nsILoginInfo); Method overview nsILoginInfo clone(); boolean equals(in nsILoginInfo aLoginInfo); void init(in AString aHostname, in AString aFormSubmitURL, in AString aHttpRealm, in AString aUsernam...
...th the path removed (for example, "https://www.site.com"). Forms with no action attribute default to submitting to their origin URL, so that is stored here. This field is null for logins attained from protocol authentications and "" means to match against any form action. hostname AString The origin, not hostname, to which the login applies (for example, "https://www.site.com"). A
port number (":123") may be appended. httpRealm AString The HTTP Realm for which the login was requested. When an HTTP server sends a 401 result, the WWW-Authenticate header includes a realm to identify the "protection space." See RFC 2617. If the result did not include a realm, or it was blank, the hostname is used instead. For logins obtained from HTML forms, this field is null. ...
nsILoginManagerIEMigrationHelper
Note: In some cases, multiple logins may be created from a single input when the format is ambiguous. ...
...Note: In some cases, multiple logins may be created from a single input when the format is ambiguous. ...
nsIMarkupDocumentViewer
default = true. ...
... - visual 3 - like the containing document. Obsolete since Gecko 2.0 bidiNumeral octet The type of numerals to display. 1 - depending on context, default is Arabic numerals 2 - depending on context, default is Hindi numerals 3 - Arabic numerals 4 - Hindi numerals. bidiOptions PRUint32 Use this attribute to access all the Bidi options in one operation. bidiSup
port octet Whether to use platform bidi sup
port or Mozilla's bidi sup
port 1 - Use Mozilla's bidi sup
port 2 - Use the platform bidi sup
port 3 - Disable bidi sup
port. bidiTextDirection octet Options for Bidi presentation. Use these attributes to access the individual Bidi options. The default direction for the layout of bidirectional text. 1 - left to right 2 - right to...
nsIMessageWakeupService
content/base/public/nsIMessageWakeupService.idlScriptable Implements the Message Manager wakeup service; this lets other components be woken up when specific Message Manager messages arrive. By using this service, you can avoid starting those components until they're needed. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Note: This service was introduced in Gecko 5.0 on Firefox for Android, but was not provided on desktop until Gecko 13.0 (Firefox 13). There is no IDL for this interface. The parentprocessmessagemanager is used for this, so messages send from childprocessmessagemanagers will be heard. Requesting wakeups To request a wakeup, a wakeup condition must be registered ...
... the component as (e.g. "nsIMyInterface"). The method to call to instantiate the component (either "getService" or "createInstance"). A comma-separated list of messages for which your component should be instantiated. Alternatively, it is possible to register a wakeup entry programmatically via the nsICategoryManager interface. Currently, services must expose a wrappedJSObject in order to sup
port this; however, once bug 593407 is fixed, the service to be woken up must implement nsIFrameMessageListener. ...
nsIMicrosummary
toolkit/components/places/public/nsIMicrosummaryService.idlScriptable This interface defines attributes and methods for dealing with microsummaries generated by an nsIMicrosummaryGenerator. ...
... toolkit/components/places/public/nsIMicrosummaryService.idlScriptable This interface defines attributes and methods for dealing with microsummaries generated by an nsIMicrosummaryGenerator. ...
nsIMicrosummaryGenerator
toolkit/components/places/public/nsIMicrosummaryService.idlScriptable This interface provides access to a microsummary that has been installed in Firefox. 1.0 66 Introduced Gecko 1.8 Obsolete Gecko 6.0 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Warning: Microsummary sup
port was removed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Method overview long calculateUpdateInterval(in nsIDOMNode aPageContent); boolean equals(in nsIMicrosummaryGenerator aOther); AString generateMicrosummary(in nsIDOMNode aPageContent); Attributes Attribute Type Description loaded boolean Has the generator itself (which may be a remote resource) been loaded. Read only. localURI nsIURI For generators installed by t...
... in nsIMicrosummaryGenerator aOther ); Parameters aOther The generator to compare against. Return value A boolean indicating if the two generators are equal. generateMicrosummary() Generate a microsummary by processing the generator template against the page content. If a generator doesn't need content, pass null as the parameter to this method. Note: In the future, this may be expanded to sup
port rich text content. AString generateMicrosummary( in nsIDOMNode aPageContent ); Parameters aPageContent The content of the page being summarized. Return value The text result of processing the template. See also Microsummary topics Creating a Microsummary ...
nsIMsgCompFields
<< XPCOM API Reference Summary The nsIMsgCompFields interface provides properties for an composition of an outgoing message. ...
... newspostUrl char * organization AString otherRandomHeaders AString No longer exists - see https://groups.google.com/forum/#!topic/mozilla.dev.apps.thunderbird/s4oFmM8_B28 priority char * receiptHeaderType PRInt32 references char * replyTo AString securityInfo nsISup
ports subject AString templateName AString temporaryFiles char * obsolete TemporaryFiles OBSOLETE, DO NOT USE ANYMORE to AString useMultipartAlternative PRBool uuEncodeAttachments PRBool Methods Utility Methods PRBool checkCharsetConversion ( out char * fallbackCharset )...
nsIMsgDBView
To create an instance, use: var dbView = Components.classes[@mozilla.org/messenger/msgdbview;1?type=] .createInstance(Components.interfaces.nsIMsgDBView); where type designates different types of view's available. ...
...urrently displayed message. nsMsgViewIndex is defined as a unsigned long in MailNewsTypes2.idl. suppressMsgDisplay boolean Suppress displaying messages. Used when the message pane is collapsed. suppressCommandUpdating boolean Suppress command updating. Used during folder loading. db nsIMsgDatabase Readonly: The current database of messages. sup
portsThreading boolean Readonly: Does the current database sup
port threading? searchSession nsIMsgSearchSession The current search session. removeRowOnMoveOrDelete boolean Readonly: usingLines boolean Readonly: Use lines for size. If false kB are used. Methods open() Opens a folder in the database. void open(in nsIMsgFolder folder, ...
nsIMsgProtocolInfo
Method overview long getDefaultServer
Port(in boolean isSecure); Attributes Attribute Type Description canDelete boolean True if an account of this type may be deleted. Read only. canDuplicate boolean Unused. Read only. canGetIncomingMessages boolean True if Junk UI actions should be enabled for the account type. Read only. ...
... only. serverIID nsIIDPtr The IID of the server-specific interface, used during account creation. Read only. showComposeMsgLink boolean True if Compose UI actions should be enabled for the account type. Read only. specialFoldersDeletionAllowed boolean True if the user can delete folders like Inbox, Trash, etc. Read only. Methods getDefaultServer
Port() Returns the default
port for a connection to a server of this account type. long getDefaultServer
Port( in boolean isSecure ); Parameters isSecure Whether or not the connection will be secure. Return value The default
port number for connections of this account type. Remarks This is one of the interfaces that is required to create a new account type. See also nsIMsgIncomingSer...
nsIMsgSearchValue
Defined in comm-central/ mailnews/ base/ search/ public/ nsIMsgSearchValue.idl #include "nsMsgSearchCore.idl" interface nsIMsgFolder; [scriptable, uuid(783758a0-cdb5-11dc-95ff-0800200c9a66)] interface nsIMsgSearchValue : nsISup
ports { // type of object attribute nsMsgSearchAttribValue attrib; // accessing these will throw an exception if the above // attribute does not match the type! attribute AString str; attribute nsMsgPriorityValue priority; attribute PRTime date; // see nsMsgMessageFlags.idl and nsMsgFolderFlags.idl attribute unsigned long status; attribute unsigned long size; attribute nsMsgKey msgKey; attribute long age; // in days attribute nsIMsgFolder folder; attribute nsMsgLabelValue label; attribute nsMsgJunk...
... * (range 0-100, 100 is junk) */ attribute unsigned long junkPercent; AString toString(); }; ...
nsINavHistoryResult
Result objects represent the model in which the data is stored. External components provide the view and controller pieces of the puzzle; they define how the data looks and how the data is interacted with. ...
...rameters aObserver An object that implements the nsINavHistoryResultObserver interface, which will receive notifications of changes on the result. aOwnsWeak If false, the result will keep an owning reference to the observer, which must be removed by calling removeObserver(). If true, the result will keep a weak reference to the observer, which must implement the nsISup
portsWeakReference interface. removeObserver() Removes an observer that was added by a previous call to addObserver(). void removeObserver( in nsINavHistoryResultObserver aObserver ); Parameters aObserver The observer to remove. See also nsINavHistoryResultObserver nsINavHistoryContainerResultNode ...
nsINavHistoryResultViewObserver
toolkit/components/places/public/nsINavHistoryService.idlScriptable This interface is used by clients of the history results to define domain-specific handling of specific nsITreeView methods that the history result doesn't implement. ...
... Constant Value Description DROP_BEFORE -1 The drag operation wishes to insert the dragged item before the indicated row. DROP_ON 0 The drag operation wishes to drop the dragged item onto the indicated row. DROP_AFTER 1 The drag operation wishes to insert the dragged item after the indicated row. Methods canDrop() Implement this method to re
port whether or not a drop is permitted onto the specified location. To provide behavior similar to the folder pane in Thunderbird, where drops are only permitted on items themselves instead of on the pane as a whole, always return false when the orientation isn't DROP_ON. Warning: Do not change the content of the observer list. boolean canDrop( in long index, in long orientation ); Paramet...
nsIOutputStream
A blocking output stream may suspend the calling thread in order to satisfy a call to Close(), Flush(), write(), writeFrom(), or writeSegments(). A non-blocking output stream, on the other hand, must not block the calling thread of execution. Note: Blocking output streams are often written to on a background thread to avoid locking up the main application thread. ...
...ould block the calling thread for an indeterminate amount of time. This exception may only be thrown if isNonBlocking() returns true. NS_ERROR_NOT_IMPLEMENTED Indicates that the stream does not implement this method. Typically, output streams that do not have an internal buffer will not implement this method since such an implementation would require an intermediate buffer unless aFromStream sup
ported nsIInputStream.readSegments(), but that is not guaranteed. Native code only!writeSegments Low-level write method that has access to the stream's underlying buffer. The reader function may be called multiple times for segmented buffers. This method is expected to keep calling the reader until either there is nothing left to write or the reader returns an error. This method should not call the...
nsIParserUtils
parser/html/nsIParserUtils.idlScriptable Provides non-Web HTML parsing functionality to Firefox extensions and XULRunner applications. 1.0 66 Introduced Gecko 13.0 Inherits from: nsISup
ports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) Warning: Do not use this from within Gecko--use nsContentUtils, nsTreeSanitizer, and so on directly instead. Implemented by: @mozilla.org/parserutils;1 as a service: var parserUtils = Components.classes["@mozilla.org/parserutils;1"] .getService(Components.interfaces.nsIParserUtils); Method overview AString convertToPlainText(in AString src, in unsigned long flags, in unsigned long wrapCol); nsIDOMDocumentFragment parseFragment(in AString fragment, i...
... sanitizer: Allow <style> elements and style attributes (with contents sanitized in case of -moz-binding). Note: If -moz-binding is absent, properties that might be XSS risks in other Web engines are preserved! SanitizerCidEmbedsOnly (1 << 2) Flag for sanitizer: Only allow cid: URLs for embedded content. At present, sanitizing CSS backgrounds, and so on., is not sup
ported, so setting this together with SanitizerAllowStyle doesn't make sense. At present, sanitizing CSS syntax in SVG presentational attributes is not sup
ported, so this option flattens out SVG. SanitizerDropNonCSSPresentation (1 << 3) Flag for sanitizer: Drops non-CSS presentational HTML elements and attributes, such as <font>, <center>, and the bgcolor attribute. Saniti...
nsIPasswordManager
Implemented by: @mozilla.org/passwordmanager;1. ...
...removeReject(in AUTF8String aHost); Attributes Attribute Type Description enumerator nsISimpleEnumerator Readonly: An enumeration of the stored usernames and passwords as nsIPassword objects. enumerator nsISimpleEnumerator Readonly: An enumeration of the rejected sites as nsIPassword objects. Only the host
portion of these objects is relevant. Methods addUser() Stores a password. AString addUser(in AUTF8String aHost, in AString aUser, in AString aPassword); Parameters aHost The hostname of the password to store. aUser The username of the password to store. aPassword The password to store. removeUser() Removes a stor...
nsIPipe
xpcom/io/nsIPipe.idlScriptable This interface represents an in-process buffer that can be read using nsIInputStream and written using nsIOutputStream. Inherits from: nsISup
ports Last changed in Gecko 1.6 Method overview void init(in boolean nonBlockingInput, in boolean nonBlockingOutput, in unsigned long segmentSize, in unsigned long segmentCount, in nsIMemory segmentAllocator); Attributes Attribute Type Description inputStream nsIAsyncInputStream The pipe's input end, which also implements nsISearchableInputStream. Read only. outputStream nsIAsyncOutputStream The pipe's output end. Read only. Methods init() initialize this pipe. void init( in boolean nonBlockingIn...
...t been closed, then if that pipe's input end is non-blocking, then the read call will fail immediately with NS_BASE_STREAM_WOULD_BLOCK as the error condition. However, if that pipe's input end is blocking, then the read call will not return until the pipe has data or until the pipe is closed. This example presumes that the pipe is being filled asynchronously on some background thread. The pipe sup
ports nsIAsyncInputStream and nsIAsyncOutputStream, which give the user of a non-blocking pipe the ability to wait for the pipe to become ready again. For example, in the case of an empty non-blocking pipe, the user can call nsIAsyncInputStream.AsyncWait() on the input end of the pipe to be notified when the pipe has data to read (or when the pipe becomes closed). NS_NewPipe2() and NS_NewPipe() provid...
nsIPluginHost
dom/plugins/base/nsIPluginHost.idlScriptable Please add a summary to this article. ...
...ginTag aResults ); Parameters aPluginCount Optional aResults Native code only!handleBadPlugin void handleBadPlugin( in PRLibraryPtr aLibrary, in nsIPluginInstance instance ); Parameters aLibrary instance Native code only!init void init(); Parameters None. Native code only!instantiateDummyJavaPlugin Instantiate a "dummy" java plugin if a java plugin that sup
ports NPRuntime is installed. This plugin is used for exposing window.java and window.Packages. If the java plugin sup
ports NPRuntime and instantiation was successful, aOwners instance will be non-null, if not, it will be null. void instantiateDummyJavaPlugin( in nsIPluginInstanceOwner aOwner ); Parameters aOwner Native code only!instantiateEmbeddedPlugin void instantiateEmbeddedPlugin...
nsIPrefBranch2
Domain The preference on which to listen for changes. This can be the name of an entire branch to observe. For example holding the "root" prefbranch and calling addObserver("foo.bar.", ...) will observe changes to foo.bar.baz and foo.bar.bzip. aObserver The object to be notified if the preference changes. aHoldWeak true holds a weak reference to aObserver. The object must implement the nsISup
portsWeakReference interface or this will fail. false holds a strong reference to aObserver. removeObserver() Remove a preference change observer. Note: You must call removeObserver method on the same nsIPrefBranch2 instance on which you called addObserver() method in order to remove aObserver; otherwise, the observer will not be removed. void removeObserver( in string aDomain, in nsI...
...ferences which will cause memory leaks. These cycles generally occur because an object both registers itself as an observer (causing the branch to hold a reference to the observer) and holds a reference to the branch object for the purpose of getting/setting preference values. There are 3 approaches which have been implemented in an attempt to avoid these situations: The nsPrefBranch object sup
ports nsISup
portsWeakReference. Any consumer may hold a weak reference to it instead of a strong one. The nsPrefBranch object listens for xpcom-shutdown and frees all of the objects currently in its observer list. This ensures that long lived objects (services for example) will be freed correctly. The observer can request to be held as a weak reference when it is registered. This insures that shorte...
nsIPrivateBrowsingService
The nsIPrivateBrowsingService interface provides access to information about the state of the private browsing feature offered in Firefox 3.5 and later. ...
...es are thrown away when private browsing mode is turned off, and the regular databases are re-activated. The temporary cookie and local storage databases start out empty. Extensions that record potentially private information should use this interface to detect whether private browsing mode is enabled, and if it is, avoid saving that information. For details on how to do this, see the article Sup
porting private browsing mode. Similarly, plug-ins can detect whether or not private browsing mode is in effect by using the NPN_GetValue() function to check the current value of the NPNVprivateModeBool variable. Implemented by: @mozilla.org/privatebrowsing;1. To get access to the service from JavaScript, use: var pbs = Components.classes["@mozilla.org/privatebrowsing;1"] .getServ...
nsIPropertyBag
Read only. Methods getProperty() Get a property value for the given name. nsIVariant getProperty( in AString name ); Parameters name The name to return the matching property. Return value The property matching the given name. ...
...Also pay attention to their platform-specific meaning (e.g. on Android there is version and kernel_version). ...
nsIProxyInfo
This interface identifies a proxy server. netwerk/base/public/nsIProxyInfo.idlScriptable Please add a summary to this article. Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Inherits from: nsISup
ports Attributes Attribute Type Description failoverProxy nsIProxyInfo This attribute specifies the proxy to failover to when this proxy fails. failoverTimeout unsigned long This attribute specifies the failover timeout in seconds for this proxy. If a nsIProxyInfo is re
ported as failed via nsIProtocolProxyService.getFailoverForProxy(), then the failed proxy will not be used again for this many seconds. Read only. flags unsigned long This attribute ...
...undefined bits are reserved for future use. Read only. host AUTF8String This attribute specifies the hostname of the proxy server. Read only. Note: Prior to Gecko 1.8 host was available by the host method. next nsIProxyInfo Proxy info objects may be chained if several proxies could be treated equivalently. This is used to sup
port proxy failover. Read only. Obsolete since Gecko 1.8
port long This attribute specifies the
port number of the proxy server. Read only. Note: Prior to Gecko 1.8
port was available by the
port method. type ACString This attribute specifies the type of the proxy server as a case insensitive ASCII string. Some sp...
nsIRequest
netwerk/base/nsIRequest.idlScriptable This interface is used by the request initiator to control the request. Inherits from: nsISup
ports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) For example nsIChannel typically passes itself as the nsIRequest argument to the nsIStreamListener on each onStartRequest, onDataAvaliable, and onStopRequest invocation. Method overview void cancel(in nsresult aStatus); boolean isPending(); void resume(); void suspend(); Attributes Attribute Type Description loadFlags nsLoadFlags The load flags of this request. Bits 0-15 are reserved. When added to a load group, this request's load flags are merged with the load flags of the load group...
... implementations are only pending once asyncOpen returns successfully). Requests can become pending multiple times during their lifetime. Note: Suspended requests are still considered pending. boolean isPending(); Parameters None. Return value true if the request has yet to reach completion. resume() Resumes the current request. This may have the effect of re-opening any underlying trans
port and will resume the delivery of data to any open streams. void resume(); Parameters None. suspend() Suspends the current request. This may have the effect of closing any underlying trans
port (in order to free up resources), although any open streams remain logically opened and will continue delivering data when the trans
port is resumed. Calling cancel() on a suspended request must not send...
nsIRequestObserver
netwerk/base/public/nsIRequestObserver.idlScriptable This interface is used by various streams (such as nsIChannel ) to indicate the start and end of a request. Inherits from: nsISup
ports Last changed in Gecko 1.0 Method overview void onStartRequest(in nsIRequest aRequest, in nsISup
ports aContext); void onStopRequest(in nsIRequest aRequest, in nsISup
ports aContext, in nsresult aStatusCode); Methods onStartRequest() Called to signify the beginning of an asynchronous request. Note: An exception thrown from onStartRequest has the side-effect of causing the request to be canceled. void onStartRequest( in nsIRequest aRequest, in nsISup
ports aContext ); Parameters aRequest Request being observed. aContext User def...
... aContext User defined context. ...
nsIScriptableInputStream
xpcom/io/nsIScriptableInputStream.idlScriptable This interface provides scriptable access to a nsIInputStream instance. Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview unsigned long available(); void close(); void init(in nsIInputStream aInputStream); string read(in unsigned long aCount); ACString readBytes(in unsigned long aCount); Methods available() Return the number of bytes currently available in the stream. Note: This method should not be used to determine the total size of a stream, even if the stream corresponds to a local file. Moreover, since a stream may make available more than 2^32 bytes of data, this method is incapable of expressing the entire size o...
...criptableInputStream. Note: The init method may be called more than once, allowing a nsIScriptableInputStream instance to be reused. void init( in nsIInputStream aInputStream ); Parameters aInputStream The nsIInputStream to be wrapped. read() Read data from the stream. Warning: If the data contains a null byte, then this method will return a truncated string. Note: It is also im
portant to consider how a language bindings may interpret the string data type. In particular, some bindings may convert the byte values into Unicode code points, by assuming the byte values are encoded as ISO-Latin-1. This is the case for the JavaScript bindings. string read( in unsigned long aCount ); Parameters aCount The maximum number of bytes to read from the stream. Return value Th...
nsIScriptableUnicodeConverter
This legacy API represents binary data using the lower haft of each 16-bit code unit in a JavaScript string. If the other APIs you are reading data from or writing data to don't require you to use this legacy representation, you should use TextDecoder and TextEncoder (available to chrome JavaScript via Components.utils.im
portGlobalProperties) instead of this API. intl/uconv/idl/nsIScriptableUConv.idlScriptable This interface is a Unicode encoder for use by scripts. Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Implemented by: @mozilla.org/intl/scriptableunicodeconverter. To create an instance, use: var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"] .createInstance(Components...
...nsigned long aCount); void convertToByteArray(in AString aString,[optional] out unsigned long aLen,[array, size_is(aLen),retval] out octet aData); nsIInputStream convertToInputStream(in AString aString); Attributes Attribute Type Description charset string Current character set. Throws NS_ERROR_UCONV_NOCONV if the requested charset is not sup
ported. Methods ConvertFromUnicode() Converts the data from Unicode to one Charset. Returns the converted string. After converting, Finish should be called and its return value appended to this return value. ACString ConvertFromUnicode( in AString aSrc ); Finish() Returns the terminator string. Should be called after ConvertFromUnicode() and appended to that function's return value. AC...
nsISearchEngine
netwerk/base/public/nsIBrowserSearchService.idlScriptable Please add a summary to this article. Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Inherits from: nsISup
ports Method overview void addParam(in AString name, in AString value, in AString responseType); nsISearchSubmission getSubmission(in AString data, [optional] in AString responseType, [optional] in AString purpose); boolean sup
portsResponseType(in AString responseType); Attributes Attribute Type Description alias AString An optional shortcut alias for the engine. When non-null, this is a unique identifier. description AString A text description describing the ...
...nse to this submission. If null, will default to "text/html". purpose [optional] A string meant to indicate the context of the search request. This allows the search service to provide a different nsISearchSubmission depending on e.g. where the search is triggered in the UI. Possible values depend on the application's installed search engines. Return value An nsISearchSubmission sup
portsResponseType() Determines whether the engine can return responses in the given MIME type. boolean sup
portsResponseType( in AString responseType ); Parameters responseType The MIME type to check for. Return value Returns true if the engine spec has a URL with the given responseType, false otherwise. See also nsISearchSubmission nsIBrowserSearchService ...
nsISeekableStream
NS_SEEK_CUR 1 Specifies that the offset is relative to the current position in the stream. NS_SEEK_END 2 Specifies that the offset is relative to the end of the stream. Methods seek() This method moves the stream offset of the stream implementing this interface. ...
...arameter to set the stream offset of the implementing stream. A negative value causes seeking in the reverse direction. Exceptions thrown NS_BASE_STREAM_CLOSED If called on a closed stream. setEOF() This method truncates the stream at the current offset. void setEOF(); Parameters None. Exceptions thrown NS_BASE_STREAM_CLOSED If called on a closed stream. tell() This method re
ports the current offset, in bytes, from the start of the stream. long long tell(); Parameters None. Return value The current offset, in bytes, from the start of the stream. Exceptions thrown NS_BASE_STREAM_CLOSED If called on a closed stream. ...
nsISmsService
dom/sms/interfaces/nsISmsService.idlScriptable Used to send SMS text messages for the WebSMS API 1.0 66 Introduced Gecko 13.0 Inherits from: nsISup
ports Last changed in Gecko 15.0 (Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12) Implemented by: @mozilla.org/sms/smsservice;1. To create an instance, use: var smsService = Components.classes["@mozilla.org/sms/smsservice;1"] .createInstance(Components.interfaces.nsISmsService); Method overview [implicit_jscontext] nsIDOMMozSmsMessage createSmsMessage(in long id, in DOMString delivery, in DOMString sender, in DOMString receiver, in DOMString body, in jsval timestamp, in bool read ); unsigned short getNumberOfMessagesForText(in DOMString text); boolean hasSuppo...
... object with the timestamp of the message. read A Boolean indicating whether a message is marked as read or unread. Return value A SmsMessage getNumberOfMessagesForText() unsigned short getNumberOfMessagesForText( in DOMString text ); Parameters text A DOMString text to check. Return value The number of multi-part SMS needed for a given text (160 characters for one SMS). hasSup
port() Checks if the current platform has SMS sup
port. boolean hasSup
port(); Return value Boolean. send() void send( in DOMString number, in DOMString message, in long requestId, in unsigned long long processId Optional ); Parameters number A DOMString with a telephone number to send to. message A DOMString with the text message. requestId Missing Description processId Option...
nsISound
Please use the HTML 5 <audio> tag instead. Note that nsISound instances may play the sounds using another thread; however, this is not controlled by the caller. Implemented by: @mozilla.org/sound;1. ...
...d not be used in modern code. Please use the HTML 5 <audio> tag instead. void playEventSound( in unsigned long aEventId ); Parameters aEventId An event ID which is defined in the constants. playSystemSound() Plays the system sound whose name is specified. If the user's system is configured to not play system sound effects, this will do nothing. Note: This function is not sup
ported on the Macintosh. void playSystemSound( in AString soundAlias ); Parameters soundAlias Two different types of names are sup
ported: You can specify the name of a system sound provided by the host operating system; for example, if you specify "SystemExclamation", you can play the Windows alert sound, but it's played only on Windows. Similarly, if you specify "Blow", you can ...
nsIStreamListener
m: nsIRequestObserver Last changed in Gecko 1.0 Classes which want to consume data from a nsIChannel need to implement this interface. nsIRequestObserver contains two methods. So, in all the three methods - onDataAvailable(), nsIRequestObserver.onStartRequest() and nsIRequestObserver.onStopRequest() have to be implemented. Method overview void onDataAvailable(in nsIRequest aRequest, in nsISup
ports aContext, in nsIInputStream aInputStream, in unsigned long aOffset, in unsigned long aCount); Methods onDataAvailable() This method is called when the next chunk of data for the ongoing request may be read without blocking the calling thread. The data can be read from the nsIInputStream object passed as the argument to this method. Note: Your implementation of this method must read exactly aC...
... Methods onDataAvailable() This method is called when the next chunk of data for the ongoing request may be read without blocking the calling thread. The data can be read from the nsIInputStream object passed as the argument to this method. Note: Your implementation of this method must read exactly aCount bytes of data before returning. void onDataAvailable( in nsIRequest aRequest, in nsISup
ports aContext, in nsIInputStream aInputStream, in unsigned long aOffset, in unsigned long aCount ); Parameters aRequest An nsIRequest indicating the source of the data. aContext A user-defined context value. aInputStream An nsIInputStream from which the data is to be read. aOffset Number of bytes that were sent in previous onDataAvailable() calls for this request. In other words, the sum of a...
nsITaskbarPreviewController
widget/public/nsITaskbarPreviewController.idlScriptable This interface is used on Microsoft Windows to provide the behavior of taskbar previews. Its methods and properties are used by the nsITaskbarPreview interface. 1.0 66 Introduced Gecko 1.9.2 Inherits from: nsISup
ports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Clients should provide their own implementation of this interface. Depending on whether the controller is connected to an nsITaskbarTabPreview or nsITaskbarWindowPreview, only certain methods and attributes need to be implemented. Method overview boolean drawPreview(in nsIDOMCanvasRenderingContext2D ctx); boolean drawThumbnail(in nsIDOMCanvasRenderingContext2D ctx, in unsigned long width, in unsigne...
...ee drawThumbnail() for more information. Read only. width unsigned long The width in pixels of the preview image. This value may change at any time. See drawPreview() for more information. Read only. Note: Although these attributes are read only, that indicates that the previews controlled by an nsITaskbarPreviewController cannot alter these values. The controller and its sup
porting code, however, may change this values at any time. Methods drawPreview() Invoked by nsITaskbarPreview when it needs to render the preview. The specified context is attached to a surface with the controller's width and height, the values of which are obtained immediately prior to calling this method. boolean drawPreview( in nsIDOMCanvasRenderingContext2D ctx ); Parameters ctx An nsI...
nsITaskbarWindowPreview
management. There is existing infrastructure in place to let clients handle those events. Window preview toolbars Window previews may have a toolbar with up to seven buttons. The array of buttons may be accessed by calling getButton(); each button is an nsITaskbarPreviewButton object. You may customize these buttons using the attributes on that interface. User clicks on the toolbar buttons are re
ported to your nsITaskbarPreviewController implementation's nsITaskbarPreviewController.onClick() method. Method overview nsITaskbarPreviewButton getButton(in unsigned long index); Attributes Attribute Type Description enableCustomDrawing boolean If true, the nsITaskbarPreviewController object's nsITaskbarPreviewController.
...If true, the nsITaskbarPreviewController object's nsITaskbarPreviewController.drawPreview() and nsITaskbarPreviewController.drawThumbnail() methods will be called to draw the preview. If false, the operating system draws these for you. Constants Constant Value Description NUM_TOOLBAR_BUTTONS 7 The maximum number of toolbar buttons sup
ported by the Windows Taskbar API. Methods getButton() Returns the specified button from the preview's toolbar. Note: By default, all buttons are hidden. You must fetch and configure each button that you want to make visible. nsITaskbarPreviewButton getButton( in unsigned long index ); Parameters index The index into the button array for the nsITaskbarPreviewButton to retrie...
nsITextInputProcessorNotification
So, nsITextInputProcessorCallback won't be changed for keeping backward compatibility. ...
...So, nsITextInputProcessorCallback won't be changed for keeping backward compatibility. ...
nsIURIFixup
docshell/base/nsIURIFixup.idlScriptable Interface implemented by objects capable of fixing up strings into URIs. ...
...a WYSIWYG URI) into one which we can expose to the user, for example on the URL bar. nsIURI createExposableURI( in nsIURI aURI ); Parameters aURI The URI to be converted. Return value The converted, exposable URI, as an nsIURI. Exceptions thrown NS_ERROR_UNKNOWN_PROTOCOL When we can not get a protocol handler service for the URI scheme. NS_ERROR_MALFORMED_URI When the exposable
portion of aURI is malformed. createFixupURI() Converts the specified string into a URI, first attempting to correct any errors in the syntax or other vagaries. Returns a well formed URI or nsnull if it cannot. nsIURI createFixupURI( in AUTF8String aURIText, in unsigned long aFixupFlags ); Parameters aURIText Candidate URI. aFixupFlags Flags that govern ways the URI may be fixed up. ...
nsIURLFormatter
toolkit/components/urlformatter/public/nsIURLFormatter.idlScriptable This interface exposes methods to substitute variables in URL formats. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Variable names can contain 'A-Z' letters and '_' characters. ...
...lla websites are strongly encouraged to use URLs of the following format: http[s]://%SERVICE%.mozilla.[com|org]/%LOCALE%/ Method overview AString formatURL(in AString aFormat); AString formatURLPref(in AString aPref); Methods formatURL() Formats a string URL. The set of known variables is predefined. If a variable is unknown, it is left unchanged and a non-fatal error is re
ported. AString formatURL( in AString aFormat ); Parameters aFormat Unformatted URL as a string. Return value The formatted URL. formatURLPref() Formats a string URL stored in a preference. If the preference value cannot be retrieved, a fatal error is re
ported and the "about:blank" URL is returned. AString formatURLPref( in AString aPref ); Parameters aPref A string representi...
nsIUTF8StringEnumerator
xpcom/ds/nsIStringEnumerator.idlScriptable An object can implement this interface to allow a client to iterate over a set of strings provided by the object. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview AUTF8String getNext(); boolean hasMore(); Methods getNext() Returns the next string in the enumerator. The "next" element is the first string upon the first call. Must be preceded by a call to hasMore(), which returns PR_TRUE. This method is generally called within a loop to iterate over the strings in the enumerator. AUTF8String getNext(); Parameters None. ...
... next string in the enumerator. The "next" element is the first string upon the first call. Must be preceded by a call to hasMore(), which returns PR_TRUE. This method is generally called within a loop to iterate over the strings in the enumerator. AUTF8String getNext(); Parameters None. Return value The next string in the enumerator. Throws an exception if there are no more strings. hasMore() Re
ports whether or not the enumerator has any strings that can be returned via getNext(). This method is generally used to determine whether or not to initiate or continue iteration over the enumerator, athough it can be called without subsequent getNext() calls. Calling this method doesn't affect the internal state of the enumerator. boolean hasMore(); Parameters None. Return value true if there are r...
nsIUpdateChecker
toolkit/mozapps/update/nsIUpdateService.idlScriptable This interface describes an object that knows how to check for software updates. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void checkForUpdates(in nsIUpdateCheckListener listener, in boolean force); void stopChecking(in unsigned short duration); Constants Constant Value Description CURRENT_CHECK 1 Constant for the stopChecking() method indicating that only the current update check should be stopped. CURRENT_SESSION 2 Constant for the stopChecking() method indicating that all update checks during the current session should be stopped. ANY_CHECKS 3 Constant for the stopChecking() method indi...
...ener of the results. void checkForUpdates( in nsIUpdateCheckListener listener, in boolean force ); Parameters listener An object implementing nsIUpdateCheckListener to be notified of the results of an update check. force If true, the update checker checks for updates, regardless of the current value of the user's update settings. This is used by any user interface that offers the user the op
portunity to check for updates immediately. The force option doesn't work if the system administrator has locked the app.update.enabled preference. stopChecking() Ends any pending update check. void stopChecking( in unsigned short duration ); Parameters duration One of the constants indicating the set of updates to stop. See also nsIUpdatePatch nsIUpdate nsIUpdateCheckListener nsIApplicationUpd...
nsIUserInfo
toolkit/components/startup/public/nsIUserInfo.idlScriptable These are things the system may know about the current user. Inherits from: nsISup
ports Last changed in Gecko 1.7 Implemented by: @mozilla.org/userinfo;1. To get the service, use: var userInfo = Components.classes["@mozilla.org/userinfo;1"] .getService(Components.interfaces.nsIUserInfo); You can then look at the userInfo object's attributes to learn what the system knows about the user. Attributes Attribute Type Description Linux Mac OSX OS/2 Windows domain string Read only. The computer's domain, or the domain of its hostname. The domain
portion of the email address, if available. Not sup
ported. Not sup
ported. emailAddress string Read...
...S/2 Windows domain string Read only. The computer's domain, or the domain of its hostname. The domain
portion of the email address, if available. Not sup
ported. Not sup
ported. emailAddress string Read only. The concatenation of the user's login name and the computer's domain. The user's email address as saved in the system address book. Not sup
ported. Not sup
ported. fullname wstring Read only. The user's full name. The user's full name. Not sup
ported. Not sup
ported. username string Read only. The user's login name. The user's login name. Not sup
ported. The user's login name. ...
nsIVersionComparator
A version-part consists of up to four parts, all of which are optional: <number-a><string-b><number-c><string-d (everything else)> A version-part may also consist of a single asterisk "*" which indicates * "infinity". Numbers are base-10, and are zero if left out. Strings are compared bytewise. ...
...unction compareVersions(a,b) { var x = Services.vc.compare(a,b); if(x == 0) return a + "==" + b; else if(x > 0) return a + ">" + b; return a + "<" + b; } dump(compareVersions("1.0pre", "1.0")); Example - Compare current browser version This example here uses nsIXULAppInfo component to get the version of the browser that the code is running in. ...
nsIWebBrowser
embedding/browser/webBrowser/nsIWebBrowser.idlScriptable This interface is implemented by web browser objects. Embedders use this interface during initialization to associate the new web browser instance with the embedders chrome and to register any listeners. The interface may also be used at runtime to obtain the content DOM window and from that the rest of the DOM. Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Warning: This interface was frozen for a very long time, but was unfrozen for Gecko 2.0. Method overview void addWebBrowserListener(in nsIWeakReference aListener, in nsIIDRef aIID); void removeWebBrowserListener(in nsIWeakReference aListener, in nsIIDRef aIID); Attributes Attribute Type...
...ible tab. Defaults to true. For optimal performance, set it to false when appropriate. parentURIContentListener nsIURIContentListener URI content listener parent. The embedder may set this property to their own implementation if they intend to override or prevent how certain kinds of content are loaded. Note: If this attribute is set to an object that implements nsISup
portsWeakReference, the implementation should get the nsIWeakReference and hold that. Otherwise, the implementation should not refcount this interface; it should assume that a non null value is always valid. In that case, the embedder should explicitly set this value back to null if the parent content listener is destroyed before the browser object. Methods addWebBrowserListener() Registers a li...
nsIWebBrowserChrome2
embedding/browser/webBrowser/nsIWebBrowserChrome2.idlScriptable An extension to nsIWebBrowserChrome. ...
... statusText Status string. null is an acceptable value meaning no status. statusContext An object that provides context pertaining to the status type. If statusType is STATUS_LINK, then this may be a DOM node corresponding to the source of the link. ...
nsIWebProgress
ome implementations. A nsIWebProgressListener instance receives notifications for the nsIWebProgress instance to which it added itself, and it may also receive notifications from any nsIWebProgress instances that are children of that nsIWebProgress instance. uriloader/base/nsIWebProgress.idlScriptable Please add a summary to this article. Last changed in Gecko 1.8.0 Inherits from: nsISup
ports Method overview void addProgressListener(in nsIWebProgressListener aListener, in unsigned long aNotifyMask); void removeProgressListener(in nsIWebProgressListener aListener); Attributes Attribute Type Description DOMWindow nsIDOMWindow The DOM window associated with this nsIWebProgress instance. Read only. Exceptions thrown NS_ERROR_FAILURE Indicates that there is no associated DOM...
...0x000000ff <= Gecko 1.8.1 0x000001ff > Gecko 1.8.1 This flag enables all notifications. Methods addProgressListener() Registers a listener to receive web progress events. void addProgressListener( in nsIWebProgressListener aListener, in unsigned long aNotifyMask ); Parameters aListener The listener interface to be called when a progress event occurs. This object must also implement nsISup
portsWeakReference. aNotifyMask The types of notifications to receive. Exceptions thrown NS_ERROR_INVALID_ARG Indicates that aListener was either null or that it does not sup
port weak references. NS_ERROR_FAILURE Indicates that aListener was already registered. removeProgressListener() Removes a previously registered listener of progress events. void removeProgressListener( in nsIWebProgressListe...
nsIWinAppHelper
toolkit/xre/nsIWinAppHelper.idlScriptable Used on Windows only to do some work from a special process that gets created with elevated privileges. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Implemented by: @mozilla.org/xre/app-info;1. To create an instance, use: var xulAppInfo = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIWinAppHelper); The nsIXULAppInfo and nsIXULRuntime interfaces are also implemented by "xre/app-info". Method overview void fixReg(); Obsolete since Gecko 1.9 void postUpdate(in nsILocalFile logFile); Obsolete since Gecko 1.9.2 Attributes Attribute Type Description userCanElevate bo...
... all true at once: The operating system is at least Windows Vista User Account Control is enabled The user is an Administrator The application is not already running with elevated permissions Otherwise it returns false. Methods fixReg() Obsolete since Gecko 1.9 (Firefox 3) Invokes helper.exe with the /fixreg parameter. Note that this parameter was never actually sup
ported. void fixReg(); Parameters None. postUpdate() Obsolete since Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Invokes helper.exe with the /postupdate parameter. This updates the uninstallation log so that the application can be uninstalled correctly after an update. void postUpdate( in nsILocalFile logFile ); Parameters logFile The file to use for the uni...
nsIWinTaskbar
By default, there is a single taskbar preview per top level window (excluding pop-ups). This preview is represented by an nsITaskbarWindowPreview object. ...
...Read only. defaultGroupId AString The default application user model ID the application registers with the system. This ID is used by the taskbar for grouping windows and when associating pinned shortcuts with running instances and jump lists. Read only. For XULRunner applications, ...
nsIWindowMediator
xpfe/appshell/public/nsIWindowMediator.idlScriptable The window mediator is a Mozilla component that keeps track of open windows. Inherits from: nsISup
ports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5) The two most common uses of nsIWindowMediator are, enumerating all windows of a given type and getting the most recent / any window of a given type. Implemented by: @mozilla.org/appshell/window-mediator;1 as a service: var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); Method overview void addListener(in nsIWindowMediatorListener aListener); boolean calculateZPosition(in nsIXULWindow inWindow, in unsigned long inPosition, i...
... changes. void addListener( in nsIWindowMediatorListener aListener ); Parameters aListener The listener to register. Example: Of window listener object and how to register then unregister. This example below waits for listens to when a window opens, and then after that window opens it adds event listener to listen to when the window completes loading, after that it fires a function. IM
PORTANT: This will attach the functionality to future opened windows, so if you copy paste this code to scratchpad, then after running this script, you need to open a new window by pressing Ctrl + N and then in the new window, selecting tabs will fire the alert. var {Cc: classes, Ci: interfaces} = Components; var windowListener = { onOpenWindow: function (aWindow) { // Wait for the windo...
nsIWindowsRegKey
This interface is highly Win32 specific. ...
... registry value. The numeric values of these constants are taken directly from WinNT.h in the MS Platform SDK. The Microsoft documentation should be consulted for the exact meaning of these value types. This interface is somewhat restricted to using only these value types. There is no method that is directly equivalent to RegQueryValueEx or RegSetValueEx. In particular, this interface does not sup
port the REG_MULTI_SZ and REG_EXPAND_SZ value types. It is still possible to enumerate values that have other types (that is, getValueType() may return a type not defined below). Constant Value Description TYPE_NONE 0 REG_NONE TYPE_STRING 1 REG_SZ TYPE_BINARY 3 REG_BINARY TYPE_INT 4 REG_DWORD TYPE_INT64 11 REG_QW...
nsIWritablePropertyBag2
value Value to set the property to. setPropertyAsAString() void setProperty...
...rop, in PRInt32 value ); Parameters prop Property to set the value of. value Value to set the property to. setPropertyAsInt64() void setPropertyAsInt64( in AString prop, in PRInt64 value ); Parameters prop Property to set the value of. value Value to set the property to. setPropertyAsInterface() void setPropertyAsInterface( in AString prop, in nsISup
ports value ); Parameters prop Property to set the value of. value Value to set the property to. setPropertyAsUint32() void setPropertyAsUint32( in AString prop, in PRUint32 value ); Parameters prop Property to set the value of. value Value to set the property to. setPropertyAsUint64() void setPropertyAsUint64( in AString prop, in PRUint64 value ); Parame...
nsIXMLHttpRequest
NONYMOUS is added, this strips all user data (cookies, tokens, etc). Using event handlers from native code (Not sure if it's up-to-date) From native code, the way to set up onload and onerror handlers is a bit different. Here is a comment from Johnny Stenback <jst@netscape.com>: The mozilla implementation of nsIXMLHttpRequest implements the interface nsIDOMEventTarget and that's how you're sup
ported to add event listeners. Try something like this: nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(myxmlhttpreq)); target->AddEventListener(NS_LITERAL_STRING("load"), mylistener, PR_FALSE) where mylistener is your event listener object that implements the interface nsIDOMEventListener. The 'onload', 'onerror', and 'onreadystatechange' attributes moved to nsIJSXMLHttpRequest, but if you're co...
... example code for opening a simple HTTP request from a xul application (like a Mozilla extension) without using observers: var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); req.open('POST', "http://www.foo.bar:8080/nietzsche.do", true); req.send('your=data&and=more&stuff=here'); Example 2 var {Cu: utils, Cc: classes, Ci: instances} = Components; Cu.im
port('resource://gre/modules/Services.jsm'); function xhr(url, cb) { let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest); let handler = ev => { evf(m => xhr.removeEventListener(m, handler, !1)); switch (ev.type) { case 'load': if (xhr.status == 200) { cb(xhr.response); ...
nsIXPCException
js/src/xpconnect/idl/xpcexception.idlScriptable These exception objects are the preferred types of exceptions when implementing xpcom interfaces in JavaScript. ...
...ing aMessage, in nsresult aResult, in string aName, in nsIStackFrame aLocation, in nsISup
ports aData, in nsIException aInner); xpcexJSVal stealJSVal(); Native code only! void stowJSVal(in xpcexJSContextPtr cx, in xpcexJSVal val); Native code only! Methods initialize() void initialize( in string aMessage, in nsresult aResult, in string aName, in nsIStackFrame aLocation, in nsISup
ports aData, in nsIException aInner ); Parameters aMessage aResult aName aLocation aData aInner Native code only!stealJSVal xpcexJSVal stealJSVal(); Parameters None. Return value Native code only!stowJSVal void stowJSVal( in xpcexJSContextPtr cx, in xpcexJSVal val ); Parameters cx val Remarks Components.Exception is a JavaScript constructor to create nsIXPCException objects. Th...
nsIXULBuilderListener
void didRebuild( in nsIXULTemplateBuilder aBuilder ); Parameters aBuilder The template builder that has rebuilt the content. ...
...mplate builder rebuilds its content. void willRebuild( in nsIXULTemplateBuilder aBuilder ); Parameters aBuilder The template builder that rebuilds the content. ...
nsIZipEntry
Read only. CRC32 unsigned long The CRC-32 hash of the file in the entry. Read only. isDirectory boolean True if the name of the entry ends with '/' and false otherwise. Read only. ...
...Read only. CRC32 unsigned long The CRC-32 hash of the file in the entry. Read only. isDirectory boolean True if the name of the entry ends with '/' and false otherwise. Read only. ...
nsIMsgSearchValue
Defined in comm-central/ mailnews/ base/ search/ public/ nsIMsgSearchValue.idl #include "nsMsgSearchCore.idl" interface nsIMsgFolder; [scriptable, uuid(783758a0-cdb5-11dc-95ff-0800200c9a66)] interface nsIMsgSearchValue : nsISup
ports { // type of object attribute nsMsgSearchAttribValue attrib; // accessing these will throw an exception if the above // attribute does not match the type! attribute AString str; attribute nsMsgPriorityValue priority; attribute PRTime date; // see nsMsgMessageFlags.idl and nsMsgFolderFlags.idl attribute unsigned long status; attribute unsigned long size; attribute nsMsgKey msgKey; attribute long age; // in days attribute nsIMsgFolder folder; attribute nsMsgLabelValue label; attribute nsMsgJunkS...
... * (range 0-100, 100 is junk) */ attribute unsigned long junkPercent; AString toString(); }; ...
nsIAbCard/Thunderbird3
has been overhauled completely for Thunderbird 3. Documentation for the old nsIAbCard interface is currently at nsIAbCard. The nsIAbCard interface is used to represent and manipulate cards in the address book. In a big change from the original nsIAbCard, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be more flexible. Properties currently sup
ported on the card: Names: FirstName, LastName PhoneticFirstName, PhoneticLastName DisplayName, NickName SpouseName, FamilyName PrimaryEmail, SecondEmail Home Contact: HomeAddress, HomeAddress2, HomeCity, HomeState, HomeZipCode, HomeCountry HomePhone, HomePhoneType Work contact. Same as home, but with `Work' instead of `Home' Other Contact: FaxNumber, F...
...s may not be deleted. However, the implementation will not check this constraint at this method. If such a property is deleted, an error may be thrown when the card is modified at the database level. void deleteProperty(in AUTF8String name); Parameters name The case-sensitive name of the property to set. translateTo() Translates a card into a specific format. The following types are sup
ported: base64xml xml vcard AUTF8String translateTo(in AUTF8String aType); Parameters aType The type of item to translate the card into. Return value A string containing the translated card. Exceptions Thrown NS_ERROR_ILLEGAL_VALUE Type not recognized. copy() This function will copy all values from one card to another. void copy(in nsIAbCard srcCard) Parameters srcCard ...
The Thread Manager
The Thread Manager, introduced in Firefox 3, offers an easy to use mechanism for creating threads and dispatching events to them for processing. Only C++ code may use the thread manager and XPCOM thread. Application/Extension JavaScript should consider using a ChromeWorker instead.") Interfaces There are several interfaces that provide threading sup
port: nsIThreadManager The Thread Manager itself lets you create threads. nsIThread The nsIThread interface encapsulates an operating system thread, providing easy cross-platform access to multithreading in your code. nsIThreadPool A thread pool provides a limited set of worker threads. When you dispatch an event to the pool, the pool selects an available worker thread to process the event. nsIThreadInternal A subclass of nsIThread tha...
... interface encapsulates an operating system thread, providing easy cross-platform access to multithreading in your code. nsIThreadPool A thread pool provides a limited set of worker threads. When you dispatch an event to the pool, the pool selects an available worker thread to process the event. nsIThreadInternal A subclass of nsIThread that is implemented by the XPCOM thread object to add sup
port for observing dispatch activity on a thread. nsIThreadObserver Provides the ability to monitor a thread, to receive notifications when events are dispatched to it and when they're finished being processed. nsIThreadEventFilter This interface is used by the nsIThreadInternal.pushEventQueue() method in nsIThreadInternal to allow event filtering. nsIRunnable This interface is the base for all ...
Using the Gecko SDK
Gecko SDK, see here. An XPCOM component will be compatible with future versions of Mozilla if it only makes use of frozen Gecko APIs. A frozen Gecko API is one that is included in the Gecko and marked frozen with the text <tt>@status FROZEN</tt> (with NSPR as the exception to the rule). The frozen Gecko API consists of a set of component interfaces (C++ vtables) and <tt>extern "C"</tt> symbols ex
ported from the XPCOM library and the NSPR libraries. The ABI of the component interfaces depends on the C++ ABI of the host compiler (i.e., the vtable format and calling conventions of the virtual methods may vary from compiler to compiler). The Gecko ABI is therefore compiler sensitive. (<tt>about:buildconfig</tt> can be loaded in Mozilla to reveal details about the compiler that was used.) For the ...
...ces depends on the C++ ABI of the host compiler (i.e., the vtable format and calling conventions of the virtual methods may vary from compiler to compiler). The Gecko ABI is therefore compiler sensitive. (<tt>about:buildconfig</tt> can be loaded in Mozilla to reveal details about the compiler that was used.) For the remainder of this guide, we'll assume you are developing components under Linux. (
Ports of this guide are welcome.) A "frozen" interface or function is guaranteed to be sup
ported by future versions of same major version of the platform. The SDK contains headers for all of the frozen interfaces and functions, and it also contains headers for classes and functions defined in the glue libraries. When those classes or functions are used, the component must link with the corresponding s...
XPCOM ABI
architectures and compiler ABIs. Newest information can always be found by exploring the build system. Note: TARGET_XPCOM_ABI In the Mozilla build system, the variable storing the XPCOM ABI is named TARGET_XPCOM_ABI. (This is an internals detail and should be of no concern to an extension developer.) Extension Installation When the application (e.g. ...
...At extension installation time, the application will choose the most fitting component build for its own ABI. If no such build is found, the extension will be deemed incompatible and the application will refuse to install it. ...
XPIDL Syntax
Purpose of this document This document is not an introduction to XPIDL or IDL in general. It is more focused on XPIDL syntax and grammar. See XPIDL Main Page for more links and introductory content. Simplifications, conventions and notation The syntax is specified according to ABNF as defined by RFC 5234, although a few productions use prose for clarity of understanding. ...
... ident = (%x41-5a / %x61-7a / "_") *(%x41-5a / %x61-7a / %x30-39 / "_") parens = "(" 1*(any char except ")") ")" Functionality not used in xpidl The libIDL parser we use is more powerful than xpidl itself can understand. The following is a list of potential features which are parseable but may not result in expected code: Struct, union, and enumerated types Array declarators (appears to be sup
ported in xpidl_header.c but not xpidl_typelib.c) Exception declarations Module declarations Variable arguments (that makes the ABNF get more wonky) Sequence types Max-length strings Fixed-point numbers "any" and "long double" types. Pyxpidl syntax idlfile = *(CDATA / INCLUDE / interface / typedef / native) typedef = "typedef" IDENTIFER IDENTIFIER ";" native = [attributes] "native" IDENTIF...
XSLT 2.0
Although XSLT 2.0 is not natively sup
ported in Firefox, it is possible via Saxon-B (Java) or, more recently, Saxon-CE (JavaScript) to perform XSLT 2.0. For users Saxon-CE No extensions are required, Saxon-CE runs whenever a HTML page is loaded that links to the Saxon-CE JavaScript library. Saxon-B The XSL Results extension uses the new incarnation of LiveConnect (handled by Java 1.6v12+ instead of Mozilla-specific code) to connect with the Java-based Saxon-B library, and adds sup
port for having XSLT performed automatically when visiting a page with the appropriate XSLT processing instruction (and which isn't processed by Firefox's own XSLT 1.0 processor). For developers Saxon-CE A JavaScript API is provided for initiating an XSLT 2.0 transform from a web page. Error and diagn...
...iagnostics output from Saxon-CE can be reviewed in the Firefox developer console or in Firebug. Saxon-B The extension demonstrates how one can use LiveConnect code to communicate with the Saxon-B library, but one might find the JavaScript code module approach used inside the extension XqUSEme as a more reusable approach. The code does not currently work on the Mac (except for server edition sup
porting Java 1.6) due to its lagging Java sup
port (and thus LiveConnect sup
port). ...
Address book sync client design
by Richard H. Pizzarro <rhp@netscape.com> Contents Overview Client Side Sync Logic Public Interfaces Overview There is an component available in the mozilla tree for performing synchronization operations against a server based address book. ...
...d(91FDFEE1-EFBC-11d3-8F97-000073757374)] interface nsIAbSyncDriver : nsIAbSyncListener { void KickIt(); }; As you can see, this is a very simple interface which allows for the starting of the address book sync operation. The interface of greater interest is the address book sync listener. This provides feedback of the current sync operation. This interface is as follows: #include "nsISup
ports.idl" #include "nsrootidl.idl" #include "nsIFileSpec.idl" [scriptable, uuid(E0ED29E0-098A-11d4-8FD6-00A024A7D144)] interface nsIAbSyncListener : nsISup
ports { /** * Notify the observer that the AB Sync Authorization operation has begun. * */ void OnStartAuthOperation(); /** * Notify the observer that the AB Sync operation has been completed. * ...
Main Windows
information. The base chrome directory of Thunderbird can sometimes appear confusing when you're just beginning to look at it. As such, I've always thought it would be nice to have a list of what xul, js, or other files are that are here, what they do, and where they overlay at different points within the client. Things appear confusing for several reasons: Much of the code is written to be
portable, so instead of duplicating it, its been put in overlays that are loaded over many different types of windows. Some of the code was written based off of early Firefox code, but is not exactly the same. You'll sometimes see reimplementations of things that are already in toolkit, written specially for Thunderbird. messenger.xul The base mail window that you see when you first open Thunderbi...
...rd is the attachment box which can be toggled into a slim or an expanded view baseMenuOverlay.xul Contains the contents of most of the menus (i.e. File, Edit, View, etc). OSX Only: macMenuOverlay.xul A special overlay for OSX that adds a few items to the window menu. customizeToolbar.xul and customizeToolbarSheet.xul These are two old files from when the original customizable toolbars were
ported from Firefox (Phoenix at the time) to Thunderbird (Minotaur at the time). customizeToolbar.xul looks and acts a whole lot like the toolkit's customizeToolbar.xul. Items have the same ID's, and contain the same structure. A few odd pieces are missing though. For instance, the "Add New Toolbar" buttons from toolkit aren't in the Thunderbird version. customizeToolbarSheet.xul is a similar implemen...
Spam filtering
Seth Spitzer The Mozilla implement is based on Paul Graham's A Plan for Spam. Training data is global across all mail accounts within a profile. Training data is stored in a binary format, in a file named "training.dat". Initially, the training.dat file is empty (there was discussion of shipping with a default file). On spam detection, the user can choose to move spam to a special "Junk" folder. The user can configure junk mail can be automatically purged from the "Junk" folder. To analyze a message for spam, we need the entire message, not just the headers. ...
...ens after filters are run. White listing happens after filters, but before spam detection. The purge code is implemented as a search of the "Junk" folder, looking for "old" message that have the proper junk status. When does purging happens? Elaborate on the mime changes that were made for spam. Currently, spam filtering is does not work for news, but it would be possible to add sup
port for this. (there is a bug on it.). initial state user action table changes unknown (user can't see this, looks like "not junk") mark as junk add tokens to bad unknown (user can't see this, looks like "not junk") mark as not junk add tokens to good not junk mark as junk remove tokens from good, add tokens to bad not junk mar...
Add Option to Context Menu
This can be reached by adding these lines to the chrome.manifest file: overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/tbOverlay-tb2.xul appversion<3.0 overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/tbOverlay-tb3.xul appversion=>3.0 Than we need two overlay ...
...For more details see Chrome Registration. ...
customDBHeaders Preference
Because comparisons are case-insensitive, all of the custom headers get set to lowercase when the data gets migrated to the message database. Also, it has been brought to my attention that the delimiter has been changed to a space in the latest code. When using the latest releases, the line should look like: ...
...If the .msf file is rebuilt, all the msgHdrs should have the string property set correctly. The attaching of the column handler through the ObserverService object is some pretty new stuff, so I was using the addEventListener("sele...
libmime content type handlers
by Richard H. Pizzarro <rhp@netscape.com> Contents Overview API's Plugin Location/Installation Sample Content Type Handler Plugin Overview The libmime module implements a general-purpose MIME parser and one of the primary methods provided by the parser is the ability to emit an HTML representation of an input stream. The primary use of libmime is to parse and render RFC822 messages for use by the Messenger component of Seamonkey. A necessary capability of this module is to dynamically add the ability to decode and render various content types. ...
...e prefixed by the * following: mimecth:text/vcard * * libmime will then use nsComponentManager::ContractIDToCLSID() to * locate the appropriate Content Type handler */ #ifndef nsIMimeContentTypeHandler_h_ #define nsIMimeContentTypeHandler_h_ typedef struct { PRBool force_inline_display; } contentTypeHandlerInitStruct; #include "prtypes.h" #include "nsISup
ports.h" #include "mimecth.h" // {20DABD99-F8B5-11d2-8EE0-00A024A7D144} #define NS_IMIME_CONTENT_TYPE_HANDLER_IID \ { 0x20dabd99, 0xf8b5, 0x11d2, \ { 0x8e, 0xe0, 0x0, 0xa0, 0x24, 0xa7, 0xd1, 0x44 } } class nsIMimeContentTypeHandler : public nsISup
ports { public: static const nsIID& GetIID() { static nsIID iid = NS_IMIME_CONTENT_TYPE_HANDLER_IID; return iid; } NS_IMETHOD G...
Thunderbird
l protocols.. Database views Backend information about nsIMsgDBView and related interfaces. Thunderbird API documentation Thunderbird API documentation Extension documentation Tutorials and tips for building Thunderbird extensions View All... ...
...ews Backend information about nsIMsgDBView and related interfaces. Thunderbird API documentation Thunderbird API documentation Extension documentation Tutorials and tips for building Thunderbird extensions View All... ...
Virtualenv
It is written by Mozilla's own Ian Bicking. Creating a virtualenv installs setuptools (or optionally distribute) into the virtual environment. It is recommended that you use virtualenv for installing anything other than system software that you are working on. You will obviate the need to have access to your system packages and you won't mess up your system packages with whatever code you install into the site-packages directory of the virtualenv. site-packages should mostly be for system-installed python and not python that you are installing as a user. This page is mostly a stub for how virtualenv is used at Mozilla. ...
... bin/ subdirectory (or Scripts on windows). > ls tmp/bin/ activate activate.fish easy_install pip python activate.csh activate_this.py easy_install-2.7 pip-2.7 Using this python binary, or these scripts (which point to this python binary), you will correctly install python packages in the lib/python2.x/site-packages directory and they will be appropriately added to your im
port path (sys.path) via lib/python2.x/site.py. In order to get the virtualenv's python binary on your PATH, you should source the bin/activate script on unix or run activate.bat on Windows. Unix example . bin/activate Once the virtualenv is activated, the virtualenv's python (and other executables) will be on your PATH and you will have a new environment variable, VIRTUAL_ENV, that points to the ...
Memory Management
A function or static data declared using the declare() method will hold that library alive. A CType will hold referent CType objects alive. A CData will hold referent CData objects alive, under specific circumstances. For example, a CData object produced by accessing a field of a structure or the internals of an array will hold the referent objects alive. What won't keep objects alive It's im
portant to note that getting direct access to the contents of a CData object using address(), addressOfElement(), or contents, will result in a CData object that does not hold its referent alive. Be sure to hold an explicit reference so that the referent object doesn't get into garbage collection, before you're done using it. Closures You also need to be sure to retain references to any JavaScript c...
...sing address(), addressOfElement(), or contents, will result in a CData object that does not hold its referent alive. Be sure to hold an explicit reference so that the referent object doesn't get into garbage collection, before you're done using it. Closures You also need to be sure to retain references to any JavaScript code that native code may call back into. This should be obvious, but is im
portant enough to be worth stating explicitly. When in doubt, malloc() When you need to keep data around, you can use malloc() to allocate it directly. This bypasses JavaScript's memory management and lets you handle memory management yourself. ...
ctypes.open
nix.o A file named myCFuntionsForUnix.so is successfully created. This native file can be placed in any folder of an addon and then loaded from js-ctypes. They can also be loaded from the system library path. Loading the native file If your addon is restartless, you must set it to be unpacked. See: http://stackoverflow.com/questions/19382201/how-to-load-dll-from-sdk-addon-data-folder It is im
portant to note that custom native files cannot be loaded through chrome:// or resource:// URIs. They must be accessed through a local file path (file://) or a JAR path (jar:). If the addon is an unpacked addon, such as bootstrap or Add-on SDK addons, the JAR path must be used. Therefore, the path has to be converted and then the converted path is used for loading with ctypes.open. If the native fil...
...ile://) or a JAR path (jar:). If the addon is an unpacked addon, such as bootstrap or Add-on SDK addons, the JAR path must be used. Therefore, the path has to be converted and then the converted path is used for loading with ctypes.open. ...
Int64
See 64-bit integers for details. Syntax Creates and returns a new 64-bit signed integer. Int64 Int64( value ); Parameters value The value to assign the new 64-bit integer object. ...
...See 64-bit integers for details. Syntax Creates and returns a new 64-bit signed integer. Int64 Int64( value ); Parameters value The value to assign the new 64-bit integer object. ...
UInt64
See 64-bit integers for details. Syntax Creates and returns a new 64-bit unsigned integer. UInt64 UInt64( value ); Parameters value The value to assign the new 64-bit unsigned integer object. ...
...See 64-bit integers for details. Syntax Creates and returns a new 64-bit unsigned integer. UInt64 UInt64( value ); Parameters value The value to assign the new 64-bit unsigned integer object. ...
URLs - Plugins
HTTP server, uploading files to an FTP server, and sending mail. Uniform resource locator (URL) protocols provide a means for locating and accessing resources that are available on the Internet and on intranets. Plug-ins can request and receive the data associated with URLs of any type that the browser can handle, including HTTP, FTP, news, mailto, and gopher. The table below summarizes URLs sup
ported by Gecko. In addition, Gecko may sup
port URLs not listed on this table. URL Scheme Description about Locates browser information or "fun" pages. file (Host-specific filenames) Locates files on a specific host computer rather than an Internet resource. ftp (File Transfer Protocol) Locates files and directories on Internet hosts for file download. ...
...nk line, then the body. If no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer. NOTE: You cannot use NPN_PostURL to specify headers (even a blank line) in a memory buffer. To do this, use NPN_PostURLNotify for this purpose. ? The NPN_PostURLNotify function has all the same capabilities and works like NPN_PostURL in most ways except that (1) it sup
ports specifying headers when posting a memory buffer, and (2) it calls NPP_URLNotify upon successful or unsuccessful completion of the request. NPN_PostURLNotify is typically asynchronous: it returns immediately and only later handles the request and calls NPP_URLNotify. NPError NPN_PostURLNotify( NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file, v...
Gecko Plugin API Reference - Plugins
the browser. The names of all of these methods begin with NPN_ to indicate that they are implemented by the browser and called by the plug-in. For an overview of how these two sides of the plug-in API interact, see the How Plug-ins Work and Overview of Plug-in Structure sections in the introduction. Warning: You must only call these from the main thread; calling them from other threads is not sup
ported and may have unpredictable results. NPN_DestroyStream Closes and deletes a stream. NPN_ForceRedraw Forces a paint message for a windowless plug-in. NPN_GetAuthenticationInfo This function is called by plug-ins to get HTTP authentication information from the browser. NPN_GetURL Asks the browser to create a stream for the specified URL. NPN_GetURLNotify Requests creation of a new stre...
...er NPObject NPN_CreateObject NPN_RetainObject NPN_ReleaseObject NPN_Invoke NPN_InvokeDefault NPN_Evaluate NPN_GetProperty NPN_SetProperty NPN_RemoveProperty NPN_HasProperty NPN_HasMethod NPN_SetException NPClass Structures NPAnyCallbackStruct NPByteRange NPEmbedPrint NPEvent NPFullPrint NPP NP_
Port NPPrint NPPrintCallbackStruct NPRect NPRegion NPSavedData NPSetWindowCallbackStruct NPStream NPWindow Constants Error Codes Result Codes Plug-in Version Constants Version Feature Constants External resources External projects and articles for plugin creation Original document information Copyright Information: Netscape Communication ...
Introduction to DOM Inspector - Firefox Developer Tools
The DOM Inspector is a Mozilla extension that you can access from the Tools > Web Development menu in SeaMonkey, or by selecting the DOM Inspector menu item from the Tools menu in Firefox and Thunderbird, or by using Ctrl/Cmd+Shift+I in either application. DOM Inspector is standalone; it sup
ports all toolkit applications, and it's possible to embed it in your own XULRunner app. DOM Inspector can serve as a sanity check to verify the state of the DOM, or it can be used to manipulate the DOM by hand, if desired. Note: Starting with Firefox 3, the DOM Inspector is not included in Firefox by default; instead, you must download and install it from the Mozilla add-ons web site. (Note: this is now a dead link.) When you first start the DOM Inspector, you are presented with a two-pane application w...
...aScript to be evaluated by selecting the appropriate menuitem in the context menu. Basic actions of the DOM Nodes viewer Selecting elements by click Another powerful interactive feature of the DOM Inspector is that when you have the DOM Inspector open and have enabled this functionality by choosing Edit > Select Element by Click or by clicking the little magnifying glass icon in the upper left
portion of the DOM Inspector application, you can click anywhere in a loaded web page or the the inspect chrome document, and the element you click will be shown in the document pane in the DOM Nodes viewer and information displayed in the object pane. Searching for Nodes in the DOM Another way to inspect the DOM is to search for particular elements you're interested in by ID, class, or attribute. W...
Set event listener breakpoints - Firefox Developer Tools
ically break when the code hits an event handler. This article explains how to use it. Using a standard event breakpoint To use an event breakpoint, you open up the JavaScript debugger, and find and expand the Event Listener Breakpoints section in the right hand column. To break when event listeners are hit, check the boxes next the events you are interested in. All of the standard events sup
ported in your version of Firefox are listed, arranged by which API or API area they're part of. Now when a keydown, keyup, keypress, or input event occurs, execution will pause as soon as it enters the listener code. When execution pauses, the source pane displays the highlighted line of the JavaScript code that is next to be executed, along with the surrounding code for context. In addition, you...
...re listed, arranged by which API or API area they're part of. Now when a keydown, keyup, keypress, or input event occurs, execution will pause as soon as it enters the listener code. When execution pauses, the source pane displays the highlighted line of the JavaScript code that is next to be executed, along with the surrounding code for context. In addition, you get a box overlaid on the view
port saying "Paused on event breakpoint", with buttons to step over that line of code or resume execution. You could add regular breakpoints at the entry point of the listener to achieve the same effect. If however you have multiple elements, all of which have event listeners attached that you want to break on, this becomes an enormous time saver. This is also useful when debugging code that you're ...
Source map errors - Firefox Developer Tools
re JSON files providing a way to associate transformed sources, as seen by the browser, with their original sources, as written by the developer. You can sometimes encounter problems working with source maps. This page explains the most common problems and how to fix them. Note: If you're new to source maps, you can learn more about them in How to use a source map. General source map error re
porting If you do see a problem, a message will appear in the webconsole. This message will show an error message, the resource URL, and the source map URL: Here, the resource URL tells us that bundle.js mentions a source map, and the source map URL tells us where to find the source map data (in this case, relative to the resource). The error tells us that the source map is not JSON data -- so we...
... ...
Tree map view - Firefox Developer Tools
gs on the heap are divided at the top level into four categories: objects: JavaScript and DOM objects, such as Function, Object, or Array, and DOM types like Window and HTMLDivElement. scripts: JavaScript sources loaded by the page. strings other: this includes internal SpiderMonkey objects. Each category is represented with a rectangle, and the size of the rectangle corresponds to the pro
portion of the heap occupied by items in that category. This means you can quickly get an idea of roughly what sorts of things allocated by your site are using the most memory. Within top-level categories: objects is further divided by the object's type. scripts is further subdivided by the script's origin. It also includes a separate rectangle for code that can't be correlated with a file, such ...
... creates three arrays, each containing 5000 monsters, each monster having a randomly-generated name. You can see that most of the heap is occupied by the strings used for the monsters' names, and the objects used to contain the monsters' other attributes. This treemap is from http://www.bbc.com/, and is probably more representative of real life than the examples. You can see the much larger pro
portion of the heap occupied by scripts, that are loaded from a large number of origins. ...
Network request details - Firefox Developer Tools
alue": "true" }, { "name": "p3p", "value": "CP=\"This is not a P3P policy! ...
...}, { "name": "Accept-Encoding", "value": "gzip, deflate, br" }, { "name": "Accept-Language", "value": "en-US,en;q=0.5" }, { "name": "Connection", "value": "keep-alive" }, { "name": "Cookie", "value": "WMF-Last-Access=11-Jun-2019; WMF-Last-Access-Global=11-Jun-2019; mwPhp7Seed=5c9; GeoIP=US:NY:
Port_Jervis:41.38:-74.67:v4" }, { "name": "DNT", "value": "1" }, { "name": "Host", "value": "en.wikipedia.org" }, { "name": "Referer", "value": "https://www.wikipedia.org/" }, { "name": "TE", "value": "Trailers" }, { "name": "User-Agent", "value": "Mozilla/5.0 (Wi...
Network request list - Firefox Developer Tools
r it, for example). The third-party add-on WebSocket Sniffer may be helpful as well. URL Use the Filter URLs box in the toolbar. You can focus it by clicking in the filter box, or by pressing Ctrl + F (or Cmd + F on a Mac); then start typing. The list of network requests is filtered to include only requests that contain your filter string, in either the Domain or the File
portions. You can filter requests that don't contain your filter string by prefixing your query with the "-" operator. For example, the query "-google.com" will show all requests that don't have "google.com" in the URL. Request properties Use the search box in the toolbar. See next section. Filtering by properties The search box recognizes specific keywords, which can be u...
..." header is present, the cURL command includes --compressed instead of -H "Accept-Encoding: gzip, deflate". This means that the response will be automatically decompressed. --globoff Suppresses cURL's globbing (wildcard matching) feature if the copied URL includes square bracket characters ([ or ]). (Starting in Firefox 76) Managing HAR data The HAR format enables you to ex
port detailed information about network requests. In addition to the Copy and Save menu items for HAR in the context menu, similar menu items are available in the HAR dropdown menu in the toolbar, as well as an Im
port menuitem. Network Monitor features The following articles cover different aspects of using the network monitor: Toolbar Network request details Network traffic recording Perfo...
Examine and edit CSS - Firefox Developer Tools
y of certain CSS and rules view features. You can: toggle pseudo-classes; toggle classes; add a new rule; change the display based on the color scheme preference (as of Firefox 72, you must set devtools.inspector.color-scheme-simulation.enabled to true in the Configuration Editor to enable this feature); change the display based on print media rules. A warning icon appears next to unsup
ported CSS properties or rules that have invalid values. This can help you understand why certain styles are not being applied. In the following example, a spelling error, "background-colour" instead of "background-color" has made the rule invalid: Rule display It displays each rule as in a stylesheet, with a list of selectors followed by a list of property:value; declarations. Highlight matc...
...g classes are suggested as you type. Link to CSS file At the top right of each rule, the source filename and line number is displayed as a link: clicking it opens the file in the Style Editor. You can copy the location of the source file: right-click the link and select "Copy Location". The Inspector understands CSS source maps. That means that if you are using a CSS preprocessor that has sup
port for source maps, and you've enabled source map sup
port in the Style Editor settings, then the link will take you to the original source, not the generated CSS. Read more about CSS source map sup
port in the Style Editor documentation. Overridden declarations If a CSS declaration is overridden by some other CSS rule with a greater weight, then the declaration is shown with a line through it. Ove...
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
rn the line numbers shown for each grid overlay on and off (on by default). Display area names: Turn area names on and off, in the case of grids with named grid areas (on by default, where relevant). Extend lines infinitely: By default, grid lines/tracks are only shown inside the element with display: grid set on it; when toggling this option on, the grid lines extend to the edge of the view
port along each axis. Mini grid view: A smaller view of the currently overlaid grid. Note: Your grid preferences such as overlay color and display settings choices are persisted across page loads for each separate page. Let's examine these features in more detail. Overlay grid Each grid present on a page has an entry in the "Overlay grid" section: Each entry consists of (from left to r...
... off. Display area names In a grid with named areas, the area names are shown on the grid overlay by default. Unchecking the "Display area names" box turns them off. Extend lines infinitely By default, the grid lines/tracks are only shown inside the element with display: grid set on it. When you check the "Extend lines infinitely" option, the grid lines extend to the edge of the view
port along each axis. Mini grid view Shows a small version of the currently overlaid grid, which is in pro
portion to the real thing. Hovering over the different areas of the mini grid causes the equivalent area on the grid overlay to also highlight, along with a tooltip containing useful information such as the dimensions of that area, its row and column numbers, etc. ...
Tips - Firefox Developer Tools
Node: Right-click a node within the Inspector and click "Screenshot Node". Via Web Console command: screenshot <filename.png> --fullpage. Settings: Choose between a light and a dark theme for the developer tools. Change the keyboard bindings to Vim, Emacs or Sublime Text if you're used to different shortcuts. Check or uncheck the different tools to enable or disable them. (There are more than the default tools!) Page Inspector In the markup view: Press H with a node selected to hide/show it. ...
...ebugger Skip JavaScript libraries in debugging sessions via the black box icon (). Press Ctrl+Alt+F to search in all scripts. Press Ctrl+D to search for a function definition. Press Ctrl+L to go to a specific line. Style Editor The black box icon () in the style sheet pane toggles the visibility of a style sheet. Click an @media rule to apply it in Responsive Design Mode. Click the im
port button () to im
port a style sheet or the create button () to create a new one. Click the options button in the style sheet pane and click "Show original sources" to toggle the display of CSS preprocessor files. Network Monitor Click the request summary to compare performance of cache vs. no-cache page loading. When a request is selected click "Edit and Resend" to modify its headers and sen...
Toolbox - Firefox Developer Tools
e is an array of labeled buttons which enables you to switch between the different tools hosted by the Toolbox. The array may include the following tools: Web Console JavaScript Debugger Page Inspector Style Editor Profiler Network Monitor Note that not all the hosted tools are always listed here: only the tools actually available in this context are shown (for example, not all tools sup
port remote debugging yet, so if the debugging target is not the Firefox instance that launched the window, not all the hosted tools will be shown). Extra tools Next there's an array of buttons that can be added or removed in the developer tool settings. By default this array includes: Toggle split console Responsive Design Mode Select a frame as the currently targeted document (this is only in...
... onwards). ...
Validators - Firefox Developer Tools
evelopment references. Checky Checky adds a submenu to your Netscape or Mozilla context menu that allows you to run whatever page you're on through one of (currently) 18 different online validaton and analysis services. Applications and Services DevEdge Web Tune-Up Wizard This interface to W3C services guides beginning-to-intermediate web authors through the process of updating content to sup
port Netscape 7.x, Mozilla and other browsers that sup
port W3C Standards. W3C HTML Validator The W3C HTML Validator will validate any Web page according to the W3C HTML standards. It is very useful for detecting the use of proprietary HTML as well as invalid HTML. W3C CSS Validator The W3C CSS Validator will validate the CSS within any web page or external CSS files according to the W3C CSS standa...
... proprietary HTML as well as invalid HTML. W3C CSS Validator The W3C CSS Validator will validate the CSS within any web page or external CSS files according to the W3C CSS standards. W3C RDF Validator The RDF Validator service will validate the RDF/XML contained on a given URI. Link Checker This tool will check links on a given web page. HTML Tidy HTML Tidy is a tool that can be used to re
port errors in an HTML page and to format web pages for better reading. (Some authoring software, such as HTML-Kit, builds in HTML Tidy which makes validation quick and easy.) HTML Validator Pro This is an automated HTML5 checker using the same validator as the W3C. Provide a starting URL and the tool will find and validate all pages in a website. Accessibility Services Lynx Viewer Checks a web p...
AbstractRange - Web APIs
simply specify the offset to the first and last characters in the HTML. There are a few good reasons for that. First, after your page is loaded, the browser simply isn't thinking in terms of HTML. Once it's been loaded, the page is a tree of DOM Node objects, so you need to specify the beginning and ending locations of a range in terms of nodes and positions within nodes. Second, in order to sup
port the mutability of the DOM tree as much as possible, you need a way to represent positions relative to nodes in the tree, rather than simply global positions within the entire document. By defining points within the document as offsets within a given node, those positions remain consistent with the content even as nodes are added to, removed from, or moved around within the DOM tree--within reason...
... Range object by calling createRange() on the Document itself. We set the starting position of the range to the sixth character of the text node's string, and the end position to the length of the text node's string minus one. This sets the range to encompass the word "paragraph". We then finish up by calling cloneContents() on the Range to create a new DocumentFragment object which contains the
portion of the document encompassed by the range. After that, we use appendChild() to add that fragment at the end of the document's body, as obtained from document.body. The result looks like this: Specifications Specification Status Comment DOMThe definition of 'AbstractRange' in that specification. Living Standard ...
AudioContext() - Web APIs
double-precision floating-point value indicating the preferred maximum latency of the context in seconds. The user agent may or may not choose to meet this request; check the value of AudioContext.baseLatency to determine the true latency after creating the context. sampleRate Optional The sampleRate to be used by the AudioContext, specified in samples per second. The value may be any value sup
ported by AudioBuffer. If not specified, the preferred sample rate for the context's output device is used by default. Return value The newly constructed AudioContext instance. Exceptions NotSup
portedError The specified sampleRate isn't sup
ported by the context. Usage notes The specification doesn't go into a lot of detail about things like how many audio contexts a user agent should suppo...
...details can vary from browser to browser. Be sure to check the values if they matter to you. In particular, the specification doesn't indicate a maximum or minimum number of audio contexts that must be able to be open at the same time, so this is left up to the browser implementations to decide. Google Chrome Per-tab audio context limitation in Chrome Prior to version 66 Google Chrome only sup
ported up to six audio contexts per tab at a time. Non-standard exceptions in Chrome If the value of the latencyHint property isn't valid, Chrome throws a TypeError exception with the message "The provided value '...' is not a valid enum value of type AudioContextLatencyCategory". Example This example creates a new AudioContext for interactive audio (optimizing for latency) and a sample rate of 4...
AudioListener.dopplerFactor - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.forwardX - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.forwardY - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.forwardZ - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.positionX - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.positionY - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.positionZ - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.setOrientation() - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.setPosition() - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.speedOfSound - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.upX - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.upY - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
AudioListener.upZ - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
BaseAudioContext.createBuffer() - Web APIs
r = baseAudioContext.createBuffer(numOfchannels, length, sampleRate); Parameters Note: For an in-depth explanation of how audio buffers work, and what these parameters mean, read Audio buffers: frames, samples and channels from our Basic concepts guide. numOfChannels An integer representing the number of channels this buffer should have. ...
...t sup
port at least 32 channels. length An integer representing the size of the buffer in sample-frames (where each sample-frame is the size of a sample in bytes multiplied by numOfChannels). To determine the length to use for a specific number of seconds of audio, use numSeconds * sampleRate. sampleRate The sample rate of the linear audio data in sample-frames per second. All browsers must sup
port sample rates in at least the range 8,000 Hz to 96,000 Hz. Returns An AudioBuffer configured based on the specified options. Exceptions NotSup
portedError One or more of the options are negative or otherwise has an invalid value (such as numberOfChannels being higher than sup
ported, or a sampleRate outside the nominal range). RangeError There isn't enough memory available to allocate the ...
BaseAudioContext.createPanner() - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
CSSStyleDeclaration.getPropertyPriority() - Web APIs
The CSSStyleDeclaration.getPropertyPriority() method interface returns a DOMString that provides all explicitly set priorities on the CSS property. Syntax var priority = style.getPropertyPriority(property); Parameters property is a DOMString representing the property name to be checked. Return value priority is a DOMString that represents the priority (e.g. "im
portant") if one exists. ...
...orities on the CSS property. Syntax var priority = style.getPropertyPriority(property); Parameters property is a DOMString representing the property name to be checked. Return value priority is a DOMString that represents the priority (e.g. "im
portant") if one exists. If none exists, returns the empty string. Example The following JavaScript code checks whether margin is marked as im
portant in a CSS selector rule: var declaration = document.styleSheets[0].cssRules[0].style; var isIm
portant = declaration.getPropertyPriority('margin') === 'im
portant'; Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSStyleDeclaration.getPropertyPriority()' in that specification. Working Draft Document Object Mo...
CSSStyleDeclaration.setProperty() - Web APIs
hod interface sets a new value for a property on a CSS style declaration object. Syntax style.setProperty(propertyName, value, priority); Parameters propertyName is a DOMString representing the CSS property name (hyphen case) to be modified. value Optional is a DOMString containing the new property value. If not specified, treated as the empty string. ...
...Name, value, priority); Parameters propertyName is a DOMString representing the CSS property name (hyphen case) to be modified. value Optional is a DOMString containing the new property value. If not specified, treated as the empty string. Note: value must not contain "!im
portant" -- that should be set using the priority parameter. priority Optional is a DOMString allowing the "im
portant" CSS priority to be set. If not specified, treated as the empty string. The following values are accepted: String value "im
portant" Keyword undefined String empty value "" Return value undefined Exceptions DOMException (NoModificationAllowedError): if the property or declaration block is read only. If priority can be omitted, JavaScript has a special simpler syntax...
CSSStyleDeclaration - Web APIs
e declaration block. Setting this attribute changes the style. CSSStyleDeclaration.lengthRead only The number of properties. See the item() method below. CSSStyleDeclaration.parentRuleRead only The containing CSSRule. CSS Properties CSSStyleDeclaration.cssFloat Special alias for the float CSS property. CSSStyleDeclaration named properties Dashed and camel-cased attributes for all sup
ported CSS properties. Methods CSSStyleDeclaration.getPropertyPriority() Returns the optional priority, "im
portant". CSSStyleDeclaration.getPropertyValue() Returns the property value given a property name. CSSStyleDeclaration.item() Returns a CSS property name by its index, or the empty string if the index is out-of-bounds. An alternative to accessing nodeList[i] (which instead returns unde...
...eList[i] (which instead returns undefined when i is out-of-bounds). This is mostly useful for non-JavaScript DOM implementations. CSSStyleDeclaration.removeProperty() Removes a property from the CSS declaration block. CSSStyleDeclaration.setProperty() Modifies an existing CSS property or creates a new CSS property in the declaration block. CSSStyleDeclaration.getPropertyCSSValue() Only sup
ported via getComputedStyle in Firefox. Returns the property value as a CSSPrimitiveValue or null for shorthand properties. Example var styleObj = document.styleSheets[0].cssRules[0].style; console.log(styleObj.cssText); for (var i = styleObj.length; i--;) { var nameString = styleObj[i]; styleObj.removeProperty(nameString); } console.log(styleObj.cssText); Specifications Specificat...
Using the CSS Typed Object Model - Web APIs
document.createElement('dd'); cssValue.appendChild(document.createTextNode(val)); stylesList.appendChild(cssValue); } The computedStyleMap() method returns a StylePropertyMapReadOnly object containing the size property, which indicates how many properties are in the map. We iterate through the style map, creating a <dt> and <dd> for each property and value respectively. In browsers that sup
port computedStyleMap(), you'll see a list of all the CSS properties and values. In other browsers, you'll just see a link. Did you realize how many default CSS properties a link had? Update the JavaScript on line 2 to select the <p> rather than the <a>. You'll notice a difference in the margin-top and margin-bottom default computed values. .get() method / custom properties Let's update our exam...
...appendChild(document.createTextNode( propVal )); row.appendChild( cssValue ); // and the type of unit const cssUnit = document.createElement( 'td' ); cssUnit.appendChild( document.createTextNode( allComputedStyles.get( ofInterest[i] ).unit )); row.appendChild( cssUnit ); //add the row to the table stylesTable.appendChild( row ); } For those of you using a non-sup
porting browser, the above output should looks something like this: Property Value Unit padding-top 0 px margin-bottom 16 px font-size 16 px font-stretch 100 percent animation-duration 0 s animation-iteration-count 1 number width auto undefined height auto undefin...
CanvasRenderingContext2D.getImageData() - Web APIs
This method is not affected by the canvas's transformation matrix. If the specified rectangle extends outside the bounds of the canvas, the pixels outside the canvas are transparent black in the returned ImageData object. Note: Image data can be painted onto a canvas using the putImageData() method. You can find more information about getImageData() and general manipulation of canvas contents in Pixel manipulation with canvas. ...
...y contain pixels which were loaded from an origin other than the one from which the document itself was loaded. To avoid SecurityError being thrown in this situation, configure CORS to allow the source image to be used in this way. See Allowing cross-origin use of images and canvas. Example Getting image data from a canvas This example draws a rectangle, and then uses getImageData() to grab a
portion of the canvas. HTML <canvas id="canvas"></canvas> JavaScript The object retrieved by getImageData() has a width of 200 and a height of 100, for a total of 20,000 pixels. Of those pixels, most are either transparent or taken from off the canvas; only 5,000 of them are opaque black (the color of the drawn rectangle). const canvas = document.getElementById('canvas'); const ctx = canvas.getC...
CanvasRenderingContext2D - Web APIs
g around the current path. CanvasRenderingContext2D.scrollPathIntoView() Scrolls the current path or a given path into the view. CanvasRenderingContext2D.clip() Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only. For an example, see Clipping paths in the Canvas tutorial. CanvasRenderingContext2D.isPointInPath() Re
ports whether or not the specified point is contained in the current path. CanvasRenderingContext2D.isPointInStroke() Re
ports whether or not the specified point is inside the area contained by the stroking of a path. Transformations Objects in the CanvasRenderingContext2D rendering context have a current transformation matrix and methods to manipulate it. The transformation matrix is applied when...
...ringContext2D.mozPathText() This method was introduced in Gecko 1.9 and is removed starting with Gecko 7.0. CanvasRenderingContext2D.mozTextAlongPath() This method was introduced in Gecko 1.9 and is removed starting with Gecko 7.0. Internal APIs (chrome-context only) CanvasRenderingContext2D.drawWindow() Renders a region of a window into the canvas. The contents of the window's view
port are rendered, ignoring view
port clipping and scrolling. CanvasRenderingContext2D.demote() This causes a context that is currently using a hardware-accelerated backend to fallback to a software one. All state should be preserved. Internet Explorer CanvasRenderingContext2D.msFillRule The fill rule to use. This must be one of evenodd or nonzero (default). Specifications Speci...
Manipulating video using canvas - Web APIs
ml> The key bits to take away from this are: This document establishes two canvas elements, with the IDs c1 and c2. Canvas c1 is used to display the current frame of the original video, while c2 is used to display the video after performing the chroma-keying effect; c2 is preloaded with the still image that will be used to replace the green background in the video. The JavaScript code is im
ported from a script named processor.js. The JavaScript code The JavaScript code in processor.js consists of three methods. Initializing the chroma-key player The doLoad() method is called when the XHTML document initially loads. This method's job is to prepare the variables needed by the chroma-key processing code, and to set up an event listener so we can detect when the user starts playing th...
...late. Line 4 computes the number of pixels in the image by dividing the total size of the frame's image data by four. The for loop that begins on line 6 scans through the frame's pixels, pulling out the red, green, and blue values for each pixel, and compares the values against predetermined numbers that are used to detect the green screen that will be replaced with the still background image im
ported from foo.png. Every pixel in the frame's image data that is found that is within the parameters that are considered to be part of the green screen has its alpha value replaced with a zero, indicating that the pixel is entirely transparent. As a result, the final image has the entire green screen area 100% transparent, so that when it's drawn into the destination context in line 13, the result...
Basic animations - Web APIs
move x += dx; } Below is the <canvas> in which the image is scrolled. Note that the width and height specified here must match the values of the CanvasXZSize and CanvasYSize variables in the JavaScript code. ...
... z-index: -1; } body { margin: 0; padding: 0; background-color: rgba(0,0,0,0.05); } </style> </head> <body> <canvas id="cw"></canvas> </body> </html> OutPut Snake Game <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="view
port" content="width=device-width,initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Nokia 1100:snake..Member berries</title> </head> <body> <div class="keypress hide"> <div class="up" onclick="emit(38)">↑</div> <div class="right" onclick="emit(39)">→</div> <div class="left" onclick="emit(37)">←</div> <div class...
Drawing shapes with canvas - Web APIs
ll elements are placed relative to this origin. So the position of the top left corner of the blue square becomes x pixels from the left and y pixels from the top, at coordinate (x,y). Later in this tutorial we'll see how we can translate the origin to a different position, rotate the grid and even scale it, but for now we'll stick to the default. Drawing rectangles Unlike SVG, <canvas> only sup
ports two primitive shapes: rectangles and paths (lists of points connected by lines). All other shapes must be created by combining one or more paths. Luckily, we have an assortment of path drawing functions which make it possible to compose very complex shapes. First let's look at the rectangle. There are three functions that draw rectangles on the canvas: fillRect(x, y, width, height) Draws a ...
...arcTo(x + width, y + height, x + width, y + height-radius, radius); ctx.lineTo(x + width, y + radius); ctx.arcTo(x + width, y, x + width - radius, y, radius); ctx.lineTo(x + radius, y); ctx.arcTo(x, y, x, y + radius, radius); ctx.stroke(); } The resulting image looks like this: ScreenshotLive sample We won't go over this in detail, since it's actually surprisingly simple. The most im
portant things to note are the use of the fillStyle property on the drawing context, and the use of a utility function (in this case roundedRect()). Using utility functions for bits of drawing you do often can be very helpful and reduce the amount of code you need, as well as its complexity. We'll take another look at fillStyle, in more detail, later in this tutorial. Here, all we're doing is using i...
Using images - Web APIs
<< PreviousNext >> Until now we have created our own shapes and applied styles to them. One of the more exciting features of <canvas> is the ability to use images. These can be used to do dynamic photo compositing or as backdrops of graphs, for sprites in games, and so forth. External images can be used in any format sup
ported by the browser, such as PNG, GIF, or JPEG. You can even use the image produced by other canvas elements on the same page as the source! Im
porting images into a canvas is basically a two step process: Get a reference to an HTMLImageElement object or to another canvas element as a source. It is also possible to use images by providing a URL. Draw the image on the canvas using the drawImage() function. Let's take a look at how to do this. Getting...
...mg element img.src = 'data:image/gif;base64,R0lGODlhCwALAIAAAAAA3pn/ZiH5BAEAAAEALAAAAAALAAsAAAIUhA+hkcuO4lmNVindo7qyrIXiGBYAOw=='; One advantage of data URLs is that the resulting image is available immediately without another round trip to the server. Another potential advantage is that it is also possible to encapsulate in one file all of your CSS, JavaScript, HTML, and images, making it more
portable to other locations. Some disadvantages of this method are that your image is not cached, and for larger images the encoded url can become quite long. Using frames from a video You can also use frames from a video being presented by a <video> element (even if the video is not visible). For example, if you have a <video> element with the ID "myvideo", you can do this: function getMyVideo() ...
CloseEvent - Web APIs
seEvent. Properties This interface also inherits properties from its parent, Event. CloseEvent.code Read only Returns an unsigned short containing the close code sent by the server. The following values are permitted status codes. The following definitions are sourced from the IANA website [Ref]. Note that the 1xxx codes are only WebSocket-internal and not for the same meaning by the trans
ported data (like when the application-layer protocol is invalid). The only permitted codes to be specified in Firefox are 1000 and 3000 to 4999 [Source, Bug]. Status code Name Description 0-999 Reserved and not used. 1000 Normal Closure Normal closure; the connection successfully completed whatever purpose for which it was created. ...
...; the connection successfully completed whatever purpose for which it was created. 1001 Going Away The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection. 1002 Protocol Error The endpoint is terminating the connection due to a protocol error. 1003 Unsup
ported Data The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data). 1004 Reserved. A meaning might be defined in the future. 1005 No Status Received Reserved. Indicates that no status code was provided even though one was expected. 1006 Abnorm...
DOMError - Web APIs
ange (e.g. thrown in a range object). HierarchyRequestError The node tree hierarchy is not correct. WrongDocumentError The object is in the wrong document. InvalidCharacterError The string contains invalid characters. NoModificationAllowedError The object can not be modified. NotFoundError The object can not be found here. ...
... HierarchyRequestError The node tree hierarchy is not correct. WrongDocumentError The object is in the wrong document. InvalidCharacterError The string contains invalid characters. NoModificationAllowedError The object can not be modified. NotFoundError The object can not be found here. NotSup
portedError The operation is not sup
ported InvalidStateError The object is in an invalid state. SyntaxError The string did not match the expected pattern. InvalidModificationError The object can not be modified in this way. NamespaceError The operation is not allowed by Namespaces in XML InvalidAccessError The object does not sup
port the operation or argument. TypeMism...
DOMException - Web APIs
ENT_ERR) InvalidCharacterError The string contains invalid characters. (Legacy code value: 5 and legacy constant name: INVALID_CHARACTER_ERR) NoModificationAllowedError The object cannot be modified. (Legacy code value: 7 and legacy constant name: NO_MODIFICATION_ALLOWED_ERR) NotFoundError The object cannot be found here. (Legacy code value: 8 and legacy constant name: NOT_FOUND_ERR) NotSup
portedError The operation is not sup
ported. (Legacy code value: 9 and legacy constant name: NOT_SUP
PORTED_ERR) InvalidStateError The object is in an invalid state. (Legacy code value: 11 and legacy constant name: INVALID_STATE_ERR) SyntaxError The string did not match the expected pattern. (Legacy code value: 12 and legacy constant name: SYNTAX_ERR) InvalidModificationError The object cannot be...
...expected pattern. (Legacy code value: 12 and legacy constant name: SYNTAX_ERR) InvalidModificationError The object cannot be modified in this way. (Legacy code value: 13 and legacy constant name: INVALID_MODIFICATION_ERR) NamespaceError The operation is not allowed by Namespaces in XML. (Legacy code value: 14 and legacy constant name: NAMESPACE_ERR) InvalidAccessError The object does not sup
port the operation or argument. (Legacy code value: 15 and legacy constant name: INVALID_ACCESS_ERR) TypeMismatchError The type of the object does not match the expected type. (Legacy code value: 17 and legacy constant name: TYPE_MISMATCH_ERR) This value is deprecated; the JavaScript TypeError exception is now raised instead of a DOMException with this value. SecurityError The operation is insec...
DOMImplementation.createHTMLDocument() - Web APIs
Line 4 uses createHTMLDocument() to construct a new HTML document whose <title> is "New Document". Lines 5 and 6 create a new paragraph element with some simple content, and then lines 8-12 handle inserting th...
...to it. Line 4 uses createHTMLDocument() to construct a new HTML document whose <title> is "New Document". Lines 5 and 6 create a new paragraph element with some simple content, and then lines 8-12 handle inserting the new paragraph into the new document. Line 16 pulls the contentDocument of the frame; this is the document into which we'll be injecting the new content. The next two lines handle im
porting the contents of our new document into the new document's context. Finally, line 20 actually replaces the contents of the frame with the new document's contents. View Live Examples The returned document is pre-constructed with the following HTML: <!doctype html> <html> <head> <title>title</title> </head> <body> </body> </html> Specifications Specification Status Comment ...
DOMMatrixReadOnly.scale() - Web APIs
anything other than 0, the resulting matrix will be 3D. Return value Returns a DOMMatrix containing a new matrix being the result of the matrix x and y dimensions being scaled by the given factor, centered on the origin given. The original matrix is not modified. If a scale is applied about the z-axis, the resulting matrix will be a 4x4 3D matrix. Note: At time of writing, Firefox still sup
ports an older version of the specification that accepts either one or three values. DOMMatrix.scale(scale[, originX][, originY]) We'll show an example of how you can deal with the cross-browser sup
port implications of this in the Examples section, below. Examples This SVG contains three squares, one red, one blue, and one green, each positioned at the document origin: <svg width="250" height="2...
...rigin: <svg width="250" height="250" viewBox="0 0 25 25"> <rect width="25" height="25" fill="red" /> <rect id="transformed" width="25" height="25" fill="blue" /> <rect id="transformedOrigin" width="25" height="25" fill="green" /> </svg> This JavaScript first creates an identity matrix, then uses the scale() method to create a new matrix with a single parameter. We test if the browser sup
ports a six parameter scale() method by creating a new matrix using three parameters and observing it's is2D property -- if this is false then the third parameter has been accepted by the browser as a scaleZ parameter, making this a 3D matrix. We then create a new matrix scaled about a given origin, using either three or six parameters depending on the browser sup
port. These new matrices are then ap...
DisplayMediaStreamConstraints.audio - Web APIs
straints.audio = mediaTrackConstraints; displayMediaStreamConstraints = { audio: allowAudioFlag|mediaTrackConstraints; } Value The value may be either a Boolean or a MediaTrackConstraints object. ...
...The audio track is always considered optional. Example Specifications Specification Status Comment UnknownThe definition of 'DisplayMediaStreamConstraints.audio' in that specification. ...
Document.createCDATASection() - Web APIs
Will throw a NS_ERROR_DOM_INVALID_CHARACTER_ERR exception if one tries to submit the closing CDATA sequence ("]]>") as part of the data, so unescaped user-provided data cannot be safely used without with this method getting this exception (createTextNode() can often be used in its place). Specifications ...
... Will throw a NS_ERROR_DOM_INVALID_CHARACTER_ERR exception if one tries to submit the closing CDATA sequence ("]]>") as part of the data, so unescaped user-provided data cannot be safely used without with this method getting this exception (createTextNode() can often be used in its place). Specifications Specification Status Comment DOMThe definition of 'docu...
Document.createEvent() - Web APIs
unction (e) { // e.target matches elem }, false); // Target can be any Element or other EventTarget. elem.dispatchEvent(event); Notes Event type strings suitable for passing to createEvent() are listed in the DOM standard -- see the table in step 2. Bear in mind that most event objects now have constructors, which are the modern recommended way to create event object instances. ...
... Notes Event type strings suitable for passing to createEvent() are listed in the DOM standard -- see the table in step 2. Bear in mind that most event objects now have constructors, which are the modern recommended way to create event object instances. Gecko sup
ports some non-standard event object aliases, which are listed below. Event Module Standard event object Gecko also sup
ports Text event module TextEvent TextEvents Keyboard event module KeyboardEvent KeyEvents Basic events module Event Events Specifications Specification Status Comment DOMThe definition of 'document.createEvent' in that specification. Living Standard ...
Document: pointercancel event - Web APIs
Bubbles Yes Cancelable No Interface PointerEvent Event handler property onpointercancel Some examples of situations that will trigger a pointercancel event: A hardware event occurs that cancels the pointer activities. ...
... A hardware event occurs that cancels the pointer activities. This may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. The device's screen orientation is changed while the pointer is active. The browser decides that the user started pointer input accidentally. This can happen if, for example, the hardware sup
ports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. The touch-action CSS property prevents the input from continuing. After the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. Examples Using addEventListener(): document.addEventListener('pointercancel', (event) => { console.log('...
DocumentOrShadowRoot.elementFromPoint() - Web APIs
If the element at the specified point belongs to another document (for example, the document of an <iframe>), that document's parent element is returned (the <iframe> itself). If the element at the given point is anonymous or XBL generated content, such as a textbox's scroll bars, then the first non-anonymous ancestor element (for example, the textbox) is returned. ...
...s being called. If the specified point is outside the visible bounds of the document or either coordinate is negative, the result is null. If you need to find the specific position inside the element, use Document.caretPositionFromPoint(). Syntax const element = document.elementFromPoint(x, y) Parameters x The horizontal coordinate of a point, relative to the left edge of the current view
port. y The vertical coordinate of a point, relative to the top edge of the current view
port. Return value The topmost Element object located at the specified coordinates. Example This example creates two buttons which let you set the current color of the paragraph element located under the coordinates (2, 2). JavaScript function changeColor(newColor) { elem = document.elementFromPoint(2, 2...
DocumentOrShadowRoot.elementsFromPoint() - Web APIs
It operates in a similar way to the elementFromPoint() method. Syntax const elements = document.elementsFromPoint(x, y); Parameters x The horizontal coordinate of a point. y The vertical coordinate of a point. Return value An array of element objects. ...
... Obsolete CSS Object Model (CSSOM) View ModuleThe definition of 'elementsFromPoint()' in that specification. Working Draft ...
DocumentOrShadowRoot.nodeFromPoint() - Web APIs
Currently this method is only implemented in Firefox, and only available to chrome code. Syntax var node = document.nodeFromPoint(x, y); Parameters x A double representing the horizontal coordinate of a point. y A double representing the vertical coordinate of a point. Returns A Node object. ...
...e object. Examples HTML Content <div> <p>Some text</p> </div> <p>Top node at point 30, 20:</p> <div id="output"></div> JavaScript Content var output = document.getElementById("output"); if (document.nodeFromPoint) { var node = document.nodeFromPoint(30, 20); output.textContent += node.localName; } else { output.innerHTML = "<span style=\"color: red;\">" + "Browser does not sup
port <code>document.nodeFromPoint()</code>" + "</span>"; } Specifications Not part of any specification at present. ...
DocumentOrShadowRoot.nodesFromPoint() - Web APIs
Currently this method is only implemented in Firefox, and only available to chrome code. Syntax var nodes = document.nodesFromPoint(x, y); Parameters x The horizontal coordinate of a point. y The vertical coordinate of a point. Returns An array of Node objects. ...
... ...
Element.getClientRects() - Web APIs
rectangles for each CSS border box in a client. Syntax let rectCollection = object.getClientRects(); Return value The returned value is a collection of DOMRect objects, one for each CSS border box associated with the element. Each DOMRect object contains read-only left, top, right and bottom properties describing the border box, in pixels, with the top-left relative to the top-left of the view
port. For tables with captions, the caption is included even though it's outside the border box of the table. When called on SVG elements other than an outer-<svg>, the "view
port" that the resulting rectangles are relative to is the view
port that the element's outer-<svg> establishes (and to be clear, the rectangles are also transformed by the outer-<svg>'s viewBox transform, if any). Originally, Mic...
...ct for each line of text. However, the CSSOM working draft specifies that it returns a DOMRect for each border box. For an inline element, the two definitions are the same. But for a block element, Mozilla will return only a single rectangle. Firefox 3.5 note Firefox 3.5 adds width and height properties to the TextRectangle object. The amount of scrolling that has been done of the view
port area (or any other scrollable element) is taken into account when computing the rectangles. The returned rectangles do not include the bounds of any child elements that might happen to overflow. For HTML <area> elements, SVG elements that do not render anything themselves, display:none elements, and generally any elements that are not directly rendered, an empty list is returned. Rectangles ar...
Element.scrollHeight - Web APIs
The height is measured in the same way as clientHeight: it includes the element's padding, but not its border, margin or horizontal scrollbar (if present). ...
... ut libero cursus ultrices. Pellentesque nec dignissim enim. Phasellus ut quam lacus, sed ultricies diam. Vestibulum convallis rutrum dolor, sit amet egestas velit scelerisque id. Proin non dignissim nisl. Sed mi odio, ullamcorper eget mattis id, malesuada vitae libero. Integer dolor lorem, mattis sed dapibus a, faucibus id metus. Duis iaculis dictum pulvinar. In nisi nibh, dapibus ac blandit at,
porta at arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent dictum ipsum aliquet erat eleifend sit amet sollicitudin felis tempus. Aliquam congue cursus venenatis. Maecenas luctus pellentesque placerat. Mauris nisl odio, condimentum sed fringilla a, consectetur id ligula. Praesent sem sem, aliquet non faucibus vitae, iaculis nec elit. Nullam vo...
Element.setCapture() - Web APIs
Syntax element.setCapture(retargetToElement); retargetToElement If true, all events are targeted directly to this element; if false, events can also fire at descendants of this element. ...
...x; } </style> <script type="text/javascript"> function init() { var btn = document.getElementById("myButton"); if (btn.setCapture) { btn.addEventListener("mousedown", mouseDown, false); btn.addEventListener("mouseup", mouseUp, false); } else { document.getElementById("output").innerHTML = "Sorry, there appears to be no setCapture sup
port on this browser"; } } function mouseDown(e) { e.target.setCapture(); e.target.addEventListener("mousemove", mouseMoved, false); } function mouseUp(e) { e.target.removeEventListener("mousemove", mouseMoved, false); } function mouseMoved(e) { var output = document.getElementById("output"); output.innerHTML = "Position: " + e.clientX + "...
ExtendableMessageEvent.data - Web APIs
eEvent interface returns the event's data. It can be any data type. Syntax var myData = extendableMessageEvent.data; Value Any data type. Examples When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. ...
...s When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. var
port; self.addEventListener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') {
port.postMessage(obj); } else if(obj.action === 'init' || obj.action === 'chatMsg') {
port.postMessage(obj); } }); self.onmessage = function(e) { console.log(e.data);
port = e.
ports[0]; } Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableMessageEvent.data' in that specification. Working Draft Initial definition. ...
ExtendableMessageEvent.lastEventId - Web APIs
event ID of the event source. This is an empty string. Syntax var myLastEventId = extendableMessageEvent.lastEventId; Value A DOMString. Examples When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. ...
...s When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. var
port; self.addEventListener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') {
port.postMessage(obj); } else if(obj.action === 'init' || obj.action === 'chatMsg') {
port.postMessage(obj); } }); self.onmessage = function(e) { console.log(e.lastEventId);
port = e.
ports[0]; } Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableMessageEvent.lastEventId' in that specification. Working Draft Initial defi...
ExtendableMessageEvent.origin - Web APIs
interface returns the origin of the Client that sent the message. Syntax var myOrigin = extendableMessageEvent.origin; Value A USVString. Examples When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. ...
...s When the following code is used inside a service worker to respond to a push messages by sending the data received via PushMessageData to the main context via a channel message, the event object of onmessage will be a ExtendableMessageEvent. var
port; self.addEventListener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') {
port.postMessage(obj); } else if(obj.action === 'init' || obj.action === 'chatMsg') {
port.postMessage(obj); } }); self.onmessage = function(e) { console.log(e.origin);
port = e.
ports[0]; } Specifications Specification Status Comment Service WorkersThe definition of 'ExtendableMessageEvent.origin' in that specification. Working Draft Initial definition. ...
FeaturePolicy.features() - Web APIs
The features() method of the FeaturePolicy interface returns a list of names of all features sup
ported by the User Agent. Feature whose name appears on the list might not be allowed by the Feature Policy of the current execution context and/or might not be accessible because of user's permissions. Syntax const sup
portedFeatures = FeaturePolicy.features() Parameters None. Return value A list of strings that represent names of all Feature Policy directives sup
ported by the User Agent. Example The followin example logs all the sup
ported directives in the console. ...
...ermissions. Syntax const sup
portedFeatures = FeaturePolicy.features() Parameters None. Return value A list of strings that represent names of all Feature Policy directives sup
ported by the User Agent. Example The followin example logs all the sup
ported directives in the console. // Get the Feature Policy object const featurePolicy = document.featurePolicy // Retreive the list of all sup
ported Feature Policy directives const sup
portedDirectives = featurePolicy.features() // Print out each directive into the console for (const directive of sup
portedDirectives){ console.log(directive) } Specification Specification Status Comment Feature PolicyThe definition of 'features' in that specification. Editor's Draft Initial definition. ...
FetchEvent.respondWith() - Web APIs
L. If the Response.url value is the empty string, then the FetchEvent.request.url is used as the final URL. In the past the FetchEvent.request.url was used as the final URL in all cases. The provided Response.url was effectively ignored. This means, for example, if a service worker intercepts a stylesheet or worker script, then the provided Response.url will be used to resolve any relative @im
port or im
portScripts() subresource loads (bug 1222008). For most types of network request this change has no impact because you can't observe the final URL. There are a few, though, where it does matter: If a fetch() is intercepted, then you can observe the final URL on the result's Response.url. If a worker script is intercepted, then the final URL is used to set self.location and used as the ...
...RL. There are a few, though, where it does matter: If a fetch() is intercepted, then you can observe the final URL on the result's Response.url. If a worker script is intercepted, then the final URL is used to set self.location and used as the base URL for relative URLs in the worker script. If a stylesheet is intercepted, then the final URL is used as the base URL for resolving relative @im
port loads. Note that navigation requests for Windows and iframes do NOT use the final URL. The way the HTML specification handles redirects for navigations ends up using the request URL for the resulting Window.location. This means sites can still provide an "alternate" view of a web page when offline without changing the user-visible URL. Syntax fetchEvent.respondWith( // Promise that resolv...
Using FormData Objects - Web APIs
med "username", "accountnum", "userfile" and "webmasterfile", then uses the XMLHttpRequest method send() to send the form's data. The field "webmasterfile" is a Blob. A Blob object represents a file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to sup
port files on the user's system. In order to build a Blob you can invoke the Blob() constructor. Retrieving a FormData object from an HTML form To construct a FormData object that contains the data from an existing <form>, specify that form element when creating the FormData object: Note: FormData will only use input fields that use the name attribute. var formData = new FormData(someFormElement...
...ver the method specified in the open() call. You can also append a File or Blob directly to the FormData object, like this: data.append("myfile", myBlob, "filename.txt"); When using the append() method it is possible to use the third optional parameter to pass a filename inside the Content-Disposition header that is sent to the server. When no filename is specified (or the parameter isn't sup
ported), the name "blob" is used. Using a formdata event A more recent addition to the platform than the FormData object is the formdata event -- this is fired on an HTMLFormElement object after the entry list representing the form's data is constructed. This happens when the form is submitted, but can also be triggered by the invocation of a FormData() constructor. This allows a FormData object to...
GlobalEventHandlers.onerror - Web APIs
ails to load, an error event using interface Event is fired at the element that initiated the load, and the onerror() handler on the element is invoked. These error events do not bubble up to window, but (at least in Firefox) can be handled with a window.addEventListener configured with useCapture set to True. Installing a global error event handler is useful for automated collection of error re
ports. Syntax For historical reasons, different arguments are passed to window.onerror and element.onerror handlers (as well as on error-type window.addEventListener handlers). window.onerror window.onerror = function(message, source, lineno, colno, error) { ... }; Function parameters: message: error message (string). Available as event (sic!) in HTML onerror="" handler. source: URL of the s...
...ot available on the server for any reason. <img src="imagenotfound.gif" onerror="this.onerror=null;this.src='imagefound.gif';" /> The reason we have the this.onerror=null in the function is that the browser will be stuck in an endless loop if the onerror image itself generates an error. Notes When an error occurs in a script, loaded from a different origin, the details of the error are not re
ported to prevent leaking information (see bug 363897). Instead the error re
ported is simply "Script error." This behavior can be overriden in some browsers using the crossorigin attribute on <script> and having the server send the appropriate CORS HTTP response headers. A workaround is to isolate "Script error." and handle it knowing that the error detail is only viewable in the browser console and ...
HTMLCanvasElement - Web APIs
assigned to the <canvas>, then this value will also be used as the width of the canvas in the length-unit CSS Pixel. HTMLCanvasElement.mozOpaque Is a Boolean reflecting the moz-opaque HTML attribute of the <canvas> element. It lets the canvas know whether or not translucency will be a factor. If the canvas knows there's no translucency, painting performance can be optimized. This is only sup
ported in Mozilla-based browsers; use the standardized canvas.getContext('2d', { alpha: false }) instead. HTMLCanvasElement.mozPrintCallback Is a function that is Initially null. Web content can set this to a JavaScript function that will be called when the canvas is to be redrawn while the page is being printed. When called, the callback is passed a "printState" object that implements the MozCanva...
...ion rendering of the canvas at the resolution of the printer being used. See this blog post. Methods Inherits methods from its parent, HTMLElement. HTMLCanvasElement.captureStream() Returns a CanvasCaptureMediaStream that is a real-time video capture of the surface of the canvas. HTMLCanvasElement.getContext() Returns a drawing context on the canvas, or null if the context ID is not sup
ported. A drawing context lets you draw on the canvas. Calling getContext with "2d" returns a CanvasRenderingContext2D object, whereas calling it with "webgl" (or "experimental-webgl") returns a WebGLRenderingContext object. This context is only available on browsers that implement WebGL. HTMLCanvasElement.toDataURL() Returns a data-URL containing a representation of the image in the format specifie...
HTMLElement: pointercancel event - Web APIs
Bubbles Yes Cancelable No Interface PointerEvent Event handler property onpointercancel Some examples of situations that will trigger a pointercancel event: A hardware event occurs that cancels the pointer activities. ...
... A hardware event occurs that cancels the pointer activities. This may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. The device's screen orientation is changed while the pointer is active. The browser decides that the user started pointer input accidentally. This can happen if, for example, the hardware sup
ports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. The touch-action CSS property prevents the input from continuing. After the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. Examples Using addEventListener(): const para = document.querySelector('p'); para.addEventListener('point...
HTMLFontElement.face - Web APIs
The obsolete HTMLFontElement.face property is a DOMString that reflects the face HTML attribute, containing a comma-separated list of one or more font names. The document text, in the default style, is rendered as the first font face that the client's browser sup
ports. If no font listed is installed on the local system, the browser typically defaults to the pro
portional or fixed-width font for that system. The format of the string must follow one of the following HTML microsyntax: Microsyntax Description Examples List of one or more valid font family names A list of font names, that have to be present on the local system courier,verdana Syntax faceString = fontObj.face; fontObj.face = faceString; Examples // Assumes there is <font id="f">...
... ...
HTMLFormElement - Web APIs
dity() Returns true if the element's child controls are subject to constraint validation and satisfy those contraints; returns false if some controls do not satisfy their constraints. Fires an event named invalid at any control that does not satisfy its constraints; such controls are considered invalid if the event is not canceled. It is up to the programmer to decide how to respond to false. re
portValidity() Returns true if the element's child controls satisfy their validation constraints. When false is returned, cancelable invalid events are fired for each invalid child and validation problems are re
ported to the user. requestSubmit() Requests that the form be submitted using the specified submit button and its corresponding configuration. reset() Resets the form to its initial state.
... Examples Creating a new form element, modifying its attributes, then submitting it: const f = document.createElement("form"); // Create a form document.body.appendChild(f); // Add it to the document body f.action = "/cgi-bin/some.cgi"; // Add action and method attributes f.method = "POST"; f.submit(); // Call the for...
HTMLHyperlinkElementUtils.host - Web APIs
The HTMLHyperlinkElementUtils.host property is a USVString containing the host, that is the hostname, and then, if the
port of the URL is nonempty, a ':', and the
port of the URL. ...
...RL is nonempty, a ':', and the
port of the URL. Syntax string = object.host; object.host = string; Examples var anchor = document.createElement("a"); anchor.href = "https://developer.mozilla.org/HTMLHyperlinkElementUtils.host" anchor.host == "developer.mozilla.org" anchor.href = "https://developer.mozilla.org:443/HTMLHyperlinkElementUtils.host" anchor.host == "developer.mozilla.org" // The
port number is not included because 443 is the scheme's default
port anchor.href = "https://developer.mozilla.org:4097/HTMLHyperlinkElementUtils.host" anchor.host == "developer.mozilla.org:4097" Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLHyperlinkElementUtils.host' in that specification. Living Standard Initial definition ...
HTMLHyperlinkElementUtils - Web APIs
y property. HTMLHyperlinkElementUtils.href This a stringifier property that returns a USVString containing the whole URL, and allows the href to be updated. HTMLHyperlinkElementUtils.protocol This is a USVString containing the protocol scheme of the URL, including the final ':'. HTMLHyperlinkElementUtils.host This is a USVString containing the host, that is the hostname, and then, if the
port of the URL is not empty (which can happen because it was not specified or because it was specified to be the default
port of the URL's scheme), a ':', and the
port of the URL. HTMLHyperlinkElementUtils.hostname This is a USVString containing the domain of the URL. HTMLHyperlinkElementUtils.
port This is a USVString containing the
port number of the URL. HTMLHyperlinkElementUtils.pathname Thi...
...nt identifier of the URL. HTMLHyperlinkElementUtils.username This is a USVString containing the username specified before the domain name. HTMLHyperlinkElementUtils.password This is a USVString containing the password specified before the domain name. HTMLHyperlinkElementUtils.origin Read only This returns a USVString containing the origin of the URL (that is its scheme, its domain and its
port). Methods Note: This interface doesn't inherit any method. HTMLHyperlinkElementUtils.toString() This returns a USVString containing the whole URL. It is a synonym for HTMLHyperlinkElementUtils.href, though it can't be used to modify the value. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLHyperlinkElementUtils' in th...
HTMLImageElement - Web APIs
DOMString that reflects the referrerpolicy HTML attribute, which tells the user agent how to decide which referrer to use in order to fetch the image. Read this article for details on the possible values of this string. HTMLImageElement.sizes A DOMString reflecting the sizes HTML attribute. This string specifies a list of comma-separated conditional sizes for the image; that is, for a given view
port size, a particular image size is to be used. Read the documentation on the sizes page for details on the format of this string. HTMLImageElement.src A USVString that reflects the src HTML attribute, which contains the full URL of the image including base URI. You can load a different image into the element by changing the URL in the src attribute. HTMLImageElement.srcset A USVString reflectin...
...empty or null. The specified src URL is the same as the URL of the page the user is currently on. The specified image is corrupted in some way that prevents it from being loaded. The specified image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. The specified image is in a format not sup
ported by the user agent. Example var img1 = new Image(); // Image constructor img1.src = 'image1.png'; img1.alt = 'alt'; document.body.appendChild(img1); var img2 = document.createElement('img'); // Use DOM HTMLImageElement img2.src = 'image2.jpg'; img2.alt = 'alt text'; document.body.appendChild(img2); // using first image in the document alert(document.images[0].src); Specifications ...
HTMLInputElement.stepDown() - Web APIs
ements the value of a numeric type of <input> element by the value of the step attribute or up to n multiples of the step attribute if a number is passed as the parameter. The method, when invoked, decrements the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified. Valid on all numeric, date, and time input types that sup
port the step attribute, includingdate, month, week, time, datetime-local, number, and range. Given <input id="myTime" type="time" max="17:00" step="900" value="17:00">, invoking myTime.step(3) will change the value to 16:15, decrementing the time by 3 * 900, or 45 minutes. myTime.step(), with no parameter, would have resulted in 16:45, as n defaults to 1. <!-- decrements by intervals of 900 second...
... n will increment the value, but will not increment beyond the max value. If the value before invoking the stepDown() method is invalid, for example, if it doesn't match the constraints set by the step attribute, invoking the stepDown() method will return a value that does match the form controls constraints. If the form control is non time, date, or numeric in nature, and therefore does not sup
port the step attribute (see the list of sup
ported input types in the the table above), or if the step value is set to any, an InvalidStateError exception is thrown. HTMLInputElement.stepDown() Decrements the value by (step * n), where n defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception: if the method is not applicable to for the current type value, if the element has no ...
HTMLObjectElement.setCustomValidity - Web APIs
a custom validity message for the element. Syntax HTMLObjectElement.setCustomValidity(message); Parameters error The message to use for validity errors. Return value undefined Exceptions None. Examples In this example, we pass the ID of an input element, and set different error messages depending on whether the value is missing, too low or too high. ...
...ages depending on whether the value is missing, too low or too high. Additionally you must call the re
portValidity method on the same element or nothing will happen. function validate(inputID) { var input = document.getElementById(inputID); var validityState_object = input.validity; if (validityState_object.valueMissing) { input.setCustomValidity('You gotta fill this out, yo!'); input.re
portValidity(); } else if (input.rangeUnderflow) { input.setCustomValidity('We need a higher number!'); input.re
portValidity(); } else if (input.rangeOverflow) { input.setCustomValidity('Thats too high!'); input.re
portValidity(); } else { input.setCustomValidity(''); input.re
portValidity(); } } It's vital to set the message to an empty string if there are no errors. As long as t...
HTMLSelectElement - Web APIs
tions collection with the specified name. The name string can match either the id or the name attribute of an option node. You can also access an item by specifying the name in array-style brackets or parentheses, without calling this method explicitly. HTMLSelectElement.remove() Removes the element at the specified index from the options collection for this select element. HTMLSelectElement.re
portValidity() This method re
ports the problems with the constraints on the element, if any, to the user. If there are problems, it fires a cancelable invalid event at the element, and returns false; if there are no problems, it returns true. HTMLSelectElement.setCustomValidity() Sets the custom validity message for the selection element to the specified message. Use the empty string to indicate th...
...the value changes, and you can then update anything you need to. See the example provided in the documentation for the change event for details. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLSelectElement' in that specification. Living Standard Since the latest snapshot, HTML5, it adds the autocomplete property and the re
portValidity() method. HTML5The definition of 'HTMLSelectElement' in that specification. Recommendation Is a snapshot of HTML Living Standard. It adds the autofocus, form, required, labels, selectedOptions, willValidate, validity and validationMessage properties. The tabindex property and the blur() and focus() methods have been moved to HTMLElement. The methods item(), name...
File drag and drop - Web APIs
The main steps to drag and drop are to define a drop zone (i.e. a target element for the file drop) and to define event handlers for the drop and dragover events. These steps are described below, including example code snippets. The full source code is available in MDN's drag-and-drop repository (pull requests and/or issues are welcome). Note: HTML drag and drop defines two different APIs to sup
port dragging and dropping files. One API is the DataTransfer interface and the second API is the DataTransferItem and DataTransferItemList interfaces. This example illustrates the use of both APIs (and does not use any Gecko specific interfaces). Define the drop zone The target element of the drop event needs an ondrop global event handler. The following code snippet shows how this is done with a <...
...ement is a drop zone. In this example, the drop target element uses the following styling: #drop_zone { border: 5px solid blue; width: 200px; height: 100px; } Note that dragstart and dragend events are not fired when dragging a file into the browser from the OS. Process the drop The drop event is fired when the user drops the file(s). In the following drop handler, if the browser sup
ports DataTransferItemList interface, the getAsFile() method is used to access each file; otherwise the DataTransfer interface's files property is used to access each file. This example shows how to write the name of each dragged file to the console. In a real application, an application may want to process a file using the File API. Note that in this example, any drag item that is not a file is ig...
Browser storage limits and eviction criteria - Web APIs
data storage? In Firefox, the following technologies make use of browser data storage to store data when required. We term them "quota clients" in this context: IndexedDB asm.js caching Cache API Cookies Note: In Firefox, Web Storage will soon start to use the same storage management tools too, as described in this document. Note: In private browsing mode, most data storage is not sup
ported. Local storage data and cookies are still stored, but they are ephemeral -- the data is deleted when you close the last private browsing window. The "last access time" of origins is updated when any of these are activated/deactivated -- origin eviction will delete data for all these quota clients. In Chrome/Opera, the Quota Management API handles quota management for AppCache, IndexedDB, Web...
...ge/default -- default data storage repository Note: After introducing Storage API, the "permanent" folder can be considered obsolete; the "permanent" folder only stores IndexedDB persistent-type databases. It doesn't matter if box mode is "best-effort" or "persistent" -- data is stored under <profile>/storage/default. Note: In Firefox, you can find your profile folder by entering about:sup
port in the URL bar, and pressing the Show in... button (e.g., Show in Finder on Mac OS X) next to the Profile Folder title. Note: If you are looking around in your Profile at the data stored, you might see a fourth folder: persistent. Basically, the persistent folder was renamed to permanent a while ago to keep upgrades/migration simpler. Note: Users shouldn't add their own directories or files...
IndexedDB API - Web APIs
ata, including files/blobs. This API uses indexes to enable high-performance searches of this data. While Web Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution. This is the main landing page for MDN's IndexedDB coverage -- here we provide links to the full API reference and usage guides, browser sup
port details, and some explanation of key concepts. Note: This feature is available in Web Workers. Note: IndexedDB API is powerful, but may seem too complicated for simple cases. If you'd prefer a simple API, try libraries such as localForage, dexie.js, ZangoDB, PouchDB, idb, idb-keyval, JsStore and lovefield that make IndexedDB more programmer-friendly. Key concepts and usage IndexedDB is a tr...
...DB, idb, idb-keyval, JsStore and lovefield that make IndexedDB more programmer-friendly. Key concepts and usage IndexedDB is a transactional database system, like an SQL-based RDBMS. However, unlike SQL-based RDBMSes, which use fixed-column tables, IndexedDB is a JavaScript-based object-oriented database. IndexedDB lets you store and retrieve objects that are indexed with a key; any objects sup
ported by the structured clone algorithm can be stored. You need to specify the database schema, open a connection to your database, and then retrieve and update data within a series of transactions. Read more about the Concepts behind IndexedDB. Learn to use IndexedDB asynchronously from first principles with our Using IndexedDB guide. Combine IndexedDB for storing data offline with Service Work...
IntersectionObserver.root - Web APIs
The IntersectionObserver interface's read-only root property identifies the Element or Document whose bounds are treated as the bounding box of the view
port for the element which is the observer's target. If the root is null, then the bounds of the actual document view
port are used. Syntax var root = intersectionObserver.root; Value A Element or Document object whose bounding box is used as the bounds of the view
port for the purposes of determining how much of the target element is visible. The intersection of this bounding rectangle, offset by any margins specified in the options passed to the IntersectionObserver() constructor, the target element's bounds, minus the bounds of every element or other object which overlaps the target element, is considered to be the visible area of the ta...
... intersection of this bounding rectangle, offset by any margins specified in the options passed to the IntersectionObserver() constructor, the target element's bounds, minus the bounds of every element or other object which overlaps the target element, is considered to be the visible area of the target element. If root is null, then the owning document is used as the root, and the bounds its view
port (that is, the visible area of the document) are used as the root bounds. Example This example sets the border of the intersection observer's root element to be a 2-pixel medium green line. observer.root.style.border = "2px solid #44aa44"; Specifications Specification Status Comment Intersection ObserverThe definition of 'IntersectionObserver' in that specification. ...
Location: host - Web APIs
The host property of the Location interface is a USVString containing the host, that is the hostname, and then, if the
port of the URL is nonempty, a ':', and the
port of the URL. ...
...me, and then, if the
port of the URL is nonempty, a ':', and the
port of the URL. Syntax string = object.host; object.host = string; Examples var anchor = document.createElement("a"); anchor.href = "https://developer.mozilla.org/Location.host" anchor.host == "developer.mozilla.org" anchor.href = "https://developer.mozilla.org:443/Location.host" anchor.host == "developer.mozilla.org" // The
port number is not included because 443 is the scheme's default
port anchor.href = "https://developer.mozilla.org:4097/Location.host" anchor.host == "developer.mozilla.org:4097" Specifications Specification Status Comment HTML Living StandardThe definition of 'host' in that specification. Living Standard Initial definition ...
MIDIAccess - Web APIs
The MIDIAccess interface of the Web MIDI API provides methods for listing MIDI input and output devices, and obtaining access to those devices. Properties MIDIAccess.inputs Read only Returns an instance of MIDIInputMap which provides access to any available MIDI input
ports. MIDIAccess.outputs Read only Returns an instance of MIDIOutputMap which provides access to any available MIDI output
ports. MIDIAccess.sysexEnabled Read only A boolean attribute indicating whether system exclusive sup
port is enabled on the current MIDIAccess instance. Event Handlers MIDIAccess.onstatechange Called whenever a new MIDI
port is added or an existing
port changes state. Examples navigator.requestMIDIAccess() .then(function(access) { // Get lists of available MIDI controllers ...
...new MIDI
port is added or an existing
port changes state. Examples navigator.requestMIDIAccess() .then(function(access) { // Get lists of available MIDI controllers const inputs = access.inputs.values(); const outputs = access.outputs.values(); access.onstatechange = function(e) { // Print information about the (dis)connected MIDI controller console.log(e.
port.name, e.
port.manufacturer, e.
port.state); }; }); Specifications Specification Status Comment Web MIDI API Working Draft Initial definition. ...
MediaDecodingConfiguration - Web APIs
Properties A MediaDecodingConfiguration dictionary takes two properties: type -- the type of media being tested. This takes one of two values: file: Represents a configuration that is meant to be used for a plain file playback. ...
...ed const mediaConfig = { type : 'file', // or 'media-source' video : { contentType : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, // number of bits used to encode 1s of video framerate : 30 // number of frames making up that 1s. } }; // check sup
port and performance navigator.mediaCapabilities.decodingInfo(mediaConfig).then(result => { console.log('This configuration is ' + (result.sup
ported ? '' : 'not ') + 'sup
ported.') }); Specifications Specification Status Comment Media CapabilitiesThe definition of 'MediaDecodingConfiguration' in that specification. Draft Initial definition ...
MediaEncodingConfiguration - Web APIs
Properties A MediaEncodingConfiguration dictionary takes two properties: type -- the type of media being tested; takes one of two values: record -- Represents a configuration for recording of media, e.g. using MediaRecorder. ...
... const mediaConfig = { type : 'record', // or 'transmission' video : { contentType : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, // number of bits used to encode 1s of video framerate : 30 // number of frames making up that 1s. } }; // check sup
port and performance navigator.mediaCapabilities.encodingInfo(mediaConfig).then(result => { console.log('This configuration is ' + (result.sup
ported ? '' : 'not ') + 'sup
ported.') }); Specifications Specification Status Comment Media CapabilitiesThe definition of 'MediaEncodingConfiguration' in that specification. Draft Initial definition ...
MediaQueryList.addListener() - Web APIs
-standard MediaQueryListListener object. In the new implementation the standard event mechanism is used, the callback is a standard function, and the event object is a MediaQueryListEvent, which inherits from Event. Return value Void. ...
...nt, which inherits from Event. Return value Void. Examples var para = document.querySelector('p'); var mql = window.matchMedia('(max-width: 600px)'); function screenTest(e) { if (e.matches) { /* the view
port is 600 pixels wide or less */ para.textContent = 'This is a narrow screen -- less than 600px wide.'; document.body.style.backgroundColor = 'red'; } else { /* the view
port is more than than 600 pixels wide */ para.textContent = 'This is a wide screen -- more than 600px wide.'; document.body.style.backgroundColor = 'blue'; } } mql.addListener(screenTest); Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'addListener' in that specification. Working Draft Initial definition ...
MediaQueryList.matches - Web APIs
rue if the document currently matches the media query list, or false if not. You can be notified when the value of matches changes by watching for the change event to be fired at the MediaQueryList. Syntax var matches = <varm>MediaQueryList.matches; Value A Boolean which is true if the document currently matches the media query list; otherwise, it's false. ...
... Working Draft Initial definition ...
MediaQueryList.removeListener() - Web APIs
representing the callback function you want to remove. In the original implementation, the callback was a non-standard MediaQueryListListener object. In the new implementation the standard event mechanism is used, and the callback is a standard function. Return value Void. ...
...dard event mechanism is used, and the callback is a standard function. Return value Void. ...
MediaQueryListEvent.matches - Web APIs
ListEvent interface is a Boolean that returns true if the document currently matches the media query list, or false if not. Syntax var matches = MediaQueryListEvent.matches; Value A Boolean; returns true if the document currently matches the media query list, false if not. ...
... Boolean; returns true if the document currently matches the media query list, false if not. Examples var mql = window.matchMedia('(max-width: 600px)'); function screenTest(e) { if (e.matches) { /* the view
port is 600 pixels wide or less */ para.textContent = 'This is a narrow screen -- less than 600px wide.'; document.body.style.backgroundColor = 'red'; } else { /* the view
port is more than than 600 pixels wide */ para.textContent = 'This is a wide screen -- more than 600px wide.'; document.body.style.backgroundColor = 'blue'; } } mql.addListener(screenTest); Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'matches' in that specification. Working Draft Initial definition ...
MediaQueryListEvent.media - Web APIs
The media read-only property of the MediaQueryListEvent interface is a DOMString representing a serialized media query. Syntax var media = MediaQueryListEvent.media; Value A DOMString representing a serialized media query. ...
...edia = MediaQueryListEvent.media; Value A DOMString representing a serialized media query. Examples var mql = window.matchMedia('(max-width: 600px)'); function screenTest(e) { if (e.matches) { /* the view
port is 600 pixels wide or less */ para.textContent = 'This is a narrow screen -- less than 600px wide.'; document.body.style.backgroundColor = 'red'; } else { /* the view
port is more than than 600 pixels wide */ para.textContent = 'This is a wide screen -- more than 600px wide.'; document.body.style.backgroundColor = 'blue'; } console.log(e.media); } mql.addListener(screenTest); Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'media' in that specification. Working Draft In...
MediaQueryListEvent - Web APIs
at returns true if the document currently matches the media query list, or false if not. MediaQueryListEvent.mediaRead only A DOMString representing a serialized media query. Methods The MediaQueryListEvent interface inherits methods from its parent interface, Event. ...
...ods The MediaQueryListEvent interface inherits methods from its parent interface, Event. Examples var mql = window.matchMedia('(max-width: 600px)'); function screenTest(e) { if (e.matches) { /* the view
port is 600 pixels wide or less */ para.textContent = 'This is a narrow screen -- less than 600px wide.'; document.body.style.backgroundColor = 'red'; } else { /* the view
port is more than than 600 pixels wide */ para.textContent = 'This is a wide screen -- more than 600px wide.'; document.body.style.backgroundColor = 'blue'; } } mql.addListener(screenTest); Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'MediaQueryListEvent' in that specification. Working Draft Initial defini...
MediaRecorder() - Web APIs
ties: mimeType: A MIME type specifying the format for the resulting media; you may simply specify the container format (the browser will select its preferred codecs for audio and/or video), or you may use the codecs parameter and/or the profiles parameter to provide detailed information about which codecs to use and how to configure them. Applications can check in advance if a mimeType is sup
ported by the user agent by calling MediaRecorder.isTypeSup
ported(). audioBitsPerSecond: The chosen bitrate for the audio component of the media. videoBitsPerSecond: The chosen bitrate for the video component of the media. bitsPerSecond: The chosen bitrate for the audio and video components of the media. This can be specified instead of the above two properties. If this is specified along with o...
...nstead of the above two properties. If this is specified along with one or the other of the above properties, this will be used for the one that isn't specified. If bits per second values are not specified for video and/or audio, the default adopted for video is 2.5Mbps, while the audio default is adaptive, depending upon the sample rate and the number of channels. Exceptions NotSup
portedError The specified MIME type is not sup
ported by the user agent. Example This example shows how to create a media recorder for a specified stream, whose audio bit rate is set to 128 Kbit/sec and whose video bit rate is set to 2.5 Mbit/sec. The recorded media data will be stored in an MP4 wrapper (so if you gather the chunks of media data and save them to disk, they will be in an MP4 file). ...
MediaRecorder.mimeType - Web APIs
The mimeType read-only property returns the MIME media type that was specified when creating the MediaRecorder object, or, if none was specified, which was chosen by the browser. This is the file format of the file that would result from writing all of the recorded data to disk. Keep in mind that not all codecs are sup
ported by a given container; if you write media using a codec that is not sup
ported by a given media container, the resulting file may not work reliably if at all when you try to play it back. See our media type and format guide for information about container and codec sup
port across browsers. Note: The term "MIME type" is officially considered to be historical; these strings are now officially known as media types. MDN Web Docs content uses the terms interchangeably. Synt...
...y the media recorder. The media type strings are standardized by the Internet Assigned Numbers Authority (IANA). For their official list of defined media type strings, see the article Media Types on the IANA site. See also media types to learn more about media types and how they're used in web content and by web browers. Example ... ...
MediaRecorder.start() - Web APIs
ds to record into each Blob. If this parameter isn't included, the entire media duration is recorded into a single Blob unless the requestData() method is called to obtain the Blob and trigger the creation of a new Blob into which the media continues to be recorded. Return value undefined. Exceptions Errors that can be detected immediately are thrown as DOM exceptions. All other errors are re
ported through error events sent to the MediaRecorder object. You can implement the onerror event handler to respond to these errors. InvalidModificationError The number of tracks on the stream being recorded has changed. You can't add or remove tracks while recording media. InvalidStateError The MediaRecorder is not in the inactive state; you can't start recording media if it's already being re...
...iaRecorder object. You can implement the onerror event handler to respond to these errors. InvalidModificationError The number of tracks on the stream being recorded has changed. You can't add or remove tracks while recording media. InvalidStateError The MediaRecorder is not in the inactive state; you can't start recording media if it's already being recorded. See the state property. NotSup
portedError The media stream you're attempting to record is inactive, or one or more of the stream's tracks is in a format that can't be recorded using the current configuration. SecurityError The MediaStream is configured to disallow recording. This may be the case, for example, with sources obtained using getUserMedia() when the user denies permission to use an input device. This also happens wh...
MediaSession.setActionHandler() - Web APIs
e MediaSessionActionDetails dictionary, which provides both the action type (so the same function can handle multiple action types), as well as data needed in order to perform the action. Media session actions A media session action's type is specified using a string from the MediaSessionAction enumerated type. Values Each of the actions is a common media session control request. Implement sup
port for each of these in order to allow that type of action to be performed. The following strings identify the currently available types of media session action: nexttrack Advances playback to the next track. pause Pauses playback of the media. play Begins (or resumes) playback of the media. previoustrack Moves back to the previous track. seekbackward Seeks backward through the media fr...
...ession.setActionHandler('seekforward', evt => { // User clicked "Seek Forward" media notification icon. audio.currentTime = Math.min(audio.currentTime + skipTime, audio.duration); }); navigator.mediaSession.setActionHandler('seekbackward', evt => { // User clicked "Seek Backward" media notification icon. ...
MediaSession.setPositionState() - Web APIs
Call this method on the navigator object's mediaSession object. ...
... Example In this example, a player for a non-standard media file format, written in JavaScript, uses setInterval() to establish a callback which fires once per second to refresh the position information by calling setPositionState(). If the media is still playing when the interval is fired, setPositionState() is called with an object that specifies the duration, playback rate, and position as re
ported by a myMedia object that describes the track being played. If the media is not playing, clearInterval() is used to remove the interval handler. let positionInterval = window.setInterval(() => { if (myMedia.isPlaying) { navigator.mediaSession.setPositionState({ duration: myMedia.trackDurationInSeconds, playbackRate: myMedia.playbackRate, position: myMedia.trackPlayPosit...
MediaSessionActionDetails - Web APIs
oint value indicating the absolute time within the media to move the playback position to, where 0 indicates the beginning of the media. This property is not present for other action types. Media action types A media session action's type is specified using a string from the MediaSessionAction enumerated type. Values Each of the actions is a common media session control request. Implement sup
port for each of these in order to allow that type of action to be performed. The following strings identify the currently available types of media session action: nexttrack Advances playback to the next track. pause Pauses playback of the media. play Begins (or resumes) playback of the media. previoustrack Moves back to the previous track. seekbackward Seeks backward through the media fr...
...ession.setActionHandler('seekforward', evt => { // User clicked "Seek Forward" media notification icon. audio.currentTime = Math.min(audio.currentTime + skipTime, audio.duration); }); navigator.mediaSession.setActionHandler('seekbackward', evt => { // User clicked "Seek Backward" media notification icon. ...
MediaSource.readyState - Web APIs
e source is attached to a media element but the stream has been ended via a call to MediaSource.endOfStream(). Syntax var myReadyState = mediaSource.readyState; Value A DOMString. ...
...ten by Nick Desaulniers (view the full demo live, or download the source for further investigation.) if ('MediaSource' in window && MediaSource.isTypeSup
ported(mimeCodec)) { var mediaSource = new MediaSource; //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsup
ported MIME type or codec: ', mimeCodec); } function sourceOpen (_) { //console.log(this.readyState); // open var mediaSource = this; var sourceBuffer = mediaSource.addSourceBuffer(mimeCodec); fetchAB(assetURL, function (buf) { sourceBuffer.addEventListener('updateend', function (_) { mediaSource.endOfStream(); video.play(); //console.log(mediaSource.readyState); // ende...
MediaSource - Web APIs
ekableRange() Clears a seekable range previously set with a call to setLiveSeekableRange(). MediaSource.endOfStream() Signals the end of the stream. MediaSource.removeSourceBuffer() Removes the given SourceBuffer from the MediaSource.sourceBuffers list. MediaSource.setLiveSeekableRange() Sets the range that the user can seek to in the media element. Static methods MediaSource.isTypeSup
ported() Returns a Boolean value indicating if the given MIME type is sup
ported by the current user agent -- this is, if it can successfully create SourceBuffer objects for that MIME type. Examples The following simple example loads a video with XMLHttpRequest, playing it as soon as it can. This example was written by Nick Desaulniers and can be viewed live here (you can also download the source f...
...ten by Nick Desaulniers and can be viewed live here (you can also download the source for further investigation.) var video = document.querySelector('video'); var assetURL = 'frag_bunny.mp4'; // Need to be specific for Blink regarding codecs // ./mp4info frag_bunny.mp4 | grep Codec var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; if ('MediaSource' in window && MediaSource.isTypeSup
ported(mimeCodec)) { var mediaSource = new MediaSource(); //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsup
ported MIME type or codec: ', mimeCodec); } function sourceOpen (_) { //console.log(this.readyState); // open var mediaSource = this; var sourceBuffe...
MediaStreamTrackAudioSourceNode() - Web APIs
options A MediaStreamTrackAudioSourceOptions object defining the properties you want the MediaStreamTrackAudioSourceNode to have: mediaStreamTrack The MediaStreamTrack from which to take audio data for this node's output. Return value A new MediaStreamTrackAudioSourceNode object representing the audio node whose media is obtained from the specified media track. Exceptions NotSup
portedError The specified context is not an AudioContext. InvalidStateError The specified MediaStreamTrack isn't an audio track (that is, its kind property isn't audio. Example This example uses getUserMedia() to obtain access to the user's camera, then creates a new MediaStreamAudioSourceNode from the first audio track provided by the device. let audioCtx = new (window.AudioContext || window.w...
... Working Draft ...
MediaStream Image Capture API - Web APIs
amTrack objects to select the one you need. const track = mediaStream.getVideoTracks()[0]; At this point, you might want to configure the device capabilities before capturing an image. You can do this by calling applyConstraints() on the track object before doing anything else. ...
... let imageCapture = new ImageCapture(track); Interfaces ImageCapture An interface for capturing images from a photographic device referenced through a valid MediaStreamTrack. PhotoCapabilities Provides available configuration options for an attached photographic device. ...
MediaTrackConstraints.cursor - Web APIs
The MediaTrackConstraints dictionary's cursor property is a ConstrainDOMString describing the requested or mandatory constraints placed upon the value of the cursor constrainable property, which is used to specify whether or not the cursor should be included in the captured video. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.cursor as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var constraintsObject = { cursor: constraint }; constraintsObject.cursor = constraint; Value A ConstrainDOMString which specifies whether or not the mouse cursor should be rendered into the vi...
... used. Example: Cursor always visible This example sets up the constraints to request that the cursor always be visible. let displayMediaOptions = { cursor: "always" }; Example: Cursor visible during motion with fallback In this example, the cursor property is configured to request that the cursor be visible when in motion, falling back to always being visible if the user agent doesn't sup
port in-motion only cursor rendering. let displayMediaOptions = { cursor: ["motion", "always"] }; Example: Require that the cursor not be visible This constraints object explicitly requires that the cursor not be rendered into the video track. let displayMediaOptions = { cursor: { exact: "none" } }; Specifications Specification Status Comment Screen Capture...
MessageChannel() - Web APIs
The MessageChannel() constructor of the MessageChannel interface returns a new MessageChannel object with two new Message
Port objects. Note: This feature is available in Web Workers. Syntax var channel = new MessageChannel(); Returns A newly created MessageChannel object. Example In the following code block, you can see a new channel being created using the MessageChannel.MessageChannel constructor. When the IFrame has loaded, we pass
port2 to the IFrame using Message
Port.postMessage along with a message. The handleMessage handler then responds to a message being sent back from the IFrame (using Message
Port.onmessage), putting it into a paragraph. MessageChannel.
port1 is listened to, to check when the message arrives. var channel = new MessageChannel(); var para = document.querySelect...
...it into a paragraph. MessageChannel.
port1 is listened to, to check when the message arrives. var channel = new MessageChannel(); var para = document.querySelector('p'); var ifr = document.querySelector('iframe'); var otherWindow = ifr.contentWindow; ifr.addEventListener("load", iframeLoaded, false); function iframeLoaded() { otherWindow.postMessage('Hello from the main page!', '*', [channel.
port2]); } channel.
port1.onmessage = handleMessage; function handleMessage(e) { para.innerHTML = e.data; } For a full working example, see our channel messaging basic demo on Github (run it live too). Specifications Specification Status Comment HTML Living StandardThe definition of 'MessageChannel()' in that specification. Living Standard ...
MouseEvent.pageX - Web APIs
Being based on the edge of the document as it is, this property takes into account any horizontal scrolling of the page. ...
...r. The CSSOM View Module redefined it as a double float. See the Browser compatibility section for details. See Page in Coordinate systems for some additional information about coordinates specified in this fashion. Syntax var pageX = MouseEvent.pageX; Value A floating-point number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or view
port positioning that may be in effect. This property was originally specified in the Touch Events specification as a long integer, but was redefined in the CSSOM View Module to be a double-precision floating-point number to allow for subpixel precision. Even though numeric types both are represented by Number in JavaScript, they may be handled differently internally in the browser's code, resulting ...
msFirstPaint - Web APIs
ncompatibilities between implementations and the behavior may change in the future. msFirstPaint is a read-only property which gets the time when the document loaded by the window object began to be displayed to the user. Put another way, msFirstPaint utilizes the browser to measure when the first content completes being painted in the window. It is available from javascript and can be re
ported from the field. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax p = object.msFirstPaint; Value An Integer value that represents the time when the document began to be displayed or 0 if the document could not be loaded. The numerical value re
ported represents the number of milliseconds between the recorded time and midnight January 1, 1970 (UTC). ...
...his proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax p = object.msFirstPaint; Value An Integer value that represents the time when the document began to be displayed or 0 if the document could not be loaded. The numerical value re
ported represents the number of milliseconds between the recorded time and midnight January 1, 1970 (UTC). This property is sup
ported only for documents displayed in IE9 Standards mode. Example The following example shows how to calculate the time that is required to request the document before the document begins to display for the user. var oTiming = window.performance.timing; var iTimeMS = oTiming.msFirstPaint - oTiming.navigationStart; ...
MutationObserver.observe() - Web APIs
of its callbacks will be triggered any longer), call MutationObserver.disconnect(). Syntax mutationObserver.observe(target, options) Parameters target A DOM Node (which may be an Element) within the DOM tree to watch for changes, or to be the root of a subtree of nodes to be watched. options A MutationObserverInit object providing options that describe which DOM mutations should be re
ported to mutationObserver's callback. Return value undefined. Exceptions TypeError Thrown in any of the following circumstances: The options are configured such that nothing will actually be monitored. (For example, if MutationObserverInit.childList, MutationObserverInit.attributes, and MutationObserverInit.characterData are all false.) The value of options.attributes is false (indi...
...tivated. If the same MutationObserver is not already in use on the target, then the existing observers are left alone and the new one is added. Observation follows nodes when disconnected Mutation observers are intended to let you be able to watch the desired set of nodes over time, even if the direct connections between those nodes are severed. If you begin watching a subtree of nodes, and a
portion of that subtree is detached and moved elsewhere in the DOM, you continue to watch the detached segment of nodes, receiving the same callbacks as before the nodes were detached from the original subtree. In other words, until you've been notified that nodes are being split off from your monitored subtree, you'll get notifications of changes to that split-off subtree and its nodes. This prevent...
MutationObserverInit.attributeOldValue - Web APIs
optional attributeOldValue property is used to specify whether or not to record the prior value of the altered attribute in MutationRecord objects denoting attribute value changes. Syntax var options = { attributeOldValue: true | false } Value A Boolean value indicating whether or not the prior value of a changed attribute should be included in the MutationObserver.oldValue property when re
porting attribute value changes. If true, oldValue is set accordingly. If false, it is not. When using attributeOldValue, setting the attributes option to true is optional. Example In this example, a Mutation Observer is set up to watch for changes to the status and username attributes in any elements contained within a subtree that displays the names of users in a chat room. This lets the code, fo...
... of MutationRecord.type being "attributes"), a function called notifyUser() is used to tell the user the name of the attribute that changed as well as the attribute's new value (mutation.target[mutation.attributeName]) and its old value (mutation.oldValue). When observe() is called, the specified options are attributes and attributeOldValue, which means that changes to attribute values will be re
ported, and each mutation record will include the oldValue property specifying the attribute's previous value. Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.attributeOldValue' in that specification. Living Standard ...
MutationObserverInit.attributes - Web APIs
The default value is false. ...
... of MutationRecord.type being "attributes"), a function called notifyUser() is used to tell the user the name of the attribute that changed as well as the attribute's new value (mutation.target[mutation.attributeName]) and its old value (mutation.oldValue). When observe() is called, the specified options are attributes and attributeOldValue, which means that changes to attribute values will be re
ported, and each mutation record will include the oldValue property specifying the attribute's previous value. Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.attributes' in that specification. Living Standard ...
Navigator.mediaCapabilities - Web APIs
PI. Syntax mediaCapabilitiesObj = globalObj.navigator.mediaCapabilities Value A MediaCapabilities object. ...
...esObj = globalObj.navigator.mediaCapabilities Value A MediaCapabilities object. ...
Navigator.share() - Web APIs
ared successfully' } catch(err) { resultPara.textContent = 'Error: ' + err } }); Sharing Files To share files, first test for and call navigator.canShare(). Then include an array of files in the call to navigator.share(): Notice: That the sample handles feature detection by testing for navigator.canShare() rather than for navigator.share(). The data object passed to canShare() only sup
ports the files property. Image, video, audio, and text files can be shared. if (navigator.canShare && navigator.canShare({ files: filesArray })) { navigator.share({ files: filesArray, title: 'Pictures', text: 'Our Pictures.', }) .then(() => console.log('Share was successful.')) .catch((error) => console.log('Sharing failed', error)); } else { console.log(`Your system doesn't s...
...the files property. Image, video, audio, and text files can be shared. if (navigator.canShare && navigator.canShare({ files: filesArray })) { navigator.share({ files: filesArray, title: 'Pictures', text: 'Our Pictures.', }) .then(() => console.log('Share was successful.')) .catch((error) => console.log('Sharing failed', error)); } else { console.log(`Your system doesn't sup
port sharing files.`); } Specifications Specification Status Comment Web Share APIThe definition of 'share()' in that specification. Draft ...
navigator.hardwareConcurrency - Web APIs
ypical), but each physical core is also usually able to run more than one thread at a time using advanced scheduling techniques. So a four-core CPU may offer eight logical processor cores, for example. The number of logical processor cores can be used to measure the number of threads which can effectively be run at once without them having to context switch. ...
... can effectively be run at once without them having to context switch. The browser may, however, choose to re
port a lower number of logical cores in order to represent more accurately the number of Workers that can run at once, so don't treat this as an absolute measurement of the number of cores in the user's system. Examples In this example, one Worker is created for each logical processor re
ported by the browser and a record is created which includes a reference to the new worker as well as a Boolean value indicating whether or not we're using that worker yet; these objects are, in turn, stored into an array for later use. This creates a pool of workers we can use to process requests later. let workerList = []; for (let i = 0; i < window.navigator.hardwareConcurrency; i++) { let newW...
Online and offline events - Web APIs
onnecting to the network. According to the specification: The navigator.onLine attribute must return false if the user agent will not contact the network when the user follows links or when a script requests a remote page (or knows that such an attempt would fail)... Firefox 2 updates this property when switching to/from the browser's Offline mode. Firefox 41 updates this property when the OS re
ports a change in network connectivity on Windows, Linux, and OS X. This property existed in older versions of Firefox and Internet Explorer (the specification based itself off of these prior implementations), so you can begin using it immediately. Network status autodetection was implemented in Firefox 2. "online" and "offline" events Firefox 3 introduces two new events: "online" and "offline". Th...
...fox 3 introduces two new events: "online" and "offline". These two events are fired on the <body> of each page when the browser switches between online and offline mode. Additionally, the events bubble up from document.body, to document, ending at window. Both events are non-cancellable (you can't prevent the user from coming online, or going offline). Firefox 41 fires these events when the OS re
ports a change in network connectivity on Windows, Linux, and OS X. You can register listeners for these events in a few familiar ways: using addEventListener on the window, document, or document.body by setting the .ononline or .onoffline properties on document or document.body to a JavaScript Function object. (Note: using window.ononline or window.onoffline will not work for compatibility reaso...
NetworkInformation.downlinkMax - Web APIs
ble in Web Workers. Syntax var max = NetworkInformation.downlinkMax Return value an unrestricted double representing the maximum downlink speed, in megabits per second (Mb/s), for the underlying connection technology. Examples The following example monitors the connection using the change event and logs changes as they occur. ...
...= NetworkInformation.downlinkMax Return value an unrestricted double representing the maximum downlink speed, in megabits per second (Mb/s), for the underlying connection technology. Examples The following example monitors the connection using the change event and logs changes as they occur. ...
Node.textContent - Web APIs
Syntax let text = someNode.textContent someOtherNode.textContent = string Value A string or null Description The value of textContent depends on the situation: If the node is a document or a Doctype, textContent returns null. ...
...ding comments and processing instructions. (This is an empty string if the node has no children.) Setting textContent on a node removes all of the node's children and replaces them with a single text node with the given string value. Differences from innerText Don't get confused by the differences between Node.textContent and HTMLElement.innerText. Although the names seem similar, there are im
portant differences: textContent gets the content of all elements, including <script> and <style> elements. In contrast, innerText only shows "human-readable" elements. textContent returns every element in the node. In contrast, innerText is aware of styling and won't return the text of "hidden" elements. Moreover, since innerText takes CSS styles into account, reading the value of innerText...
NonDocumentTypeChildNode.previousElementSibling - Web APIs
ntSibling; document.write('<p>Siblings of div-03</p><ol>'); while (el) { document.write('<li>' + el.nodeName + '</li>'); el = el.previousElementSibling; } document.write('</ol>'); </script> This example outputs the following into the page when it loads: Siblings of div-03 1. LI 2. LI 3. DIV 4. ...
...e (el) { document.write('<li>' + el.nodeName + '</li>'); el = el.previousElementSibling; } document.write('</ol>'); </script> This example outputs the following into the page when it loads: Siblings of div-03 1. LI 2. LI 3. DIV 4. ...
PaintWorklet - Web APIs
); Load a PaintWorklet The following example demonstrates loading the above worklet from its js file and does so by feature detection. ...
...{ CSS.paintWorklet.addModule('checkerboard.js'); } </script> Use a PaintWorklet This example shows how to use a PaintWorklet in a stylesheet, including the simplest way to provide a fallback if PaintWorklet isn't sup
ported. <style> textarea { background-image: url(checkerboard); background-image: paint(checkerboard); } </style> <textarea></textarea> You can also use the @sup
ports at-rule. @sup
ports (background: paint(id)) { background-image: paint(checkerboard); } Specifications Specification Status Comment CSS Painting API Level 1The definition of 'PaintWorkletGlobalScope' in that specification. Working Draft Initial definition. ...
PannerNode.distanceModel - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
PannerNode.maxDistance - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
PannerNode.panningModel - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
PannerNode.setOrientation() - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
PannerNode.setPosition() - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
PannerNode.setVelocity() - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
PannerNode - Web APIs
to change realistically as your character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. ...
...implementation, check out our panner-node example (view the source code) -- this demo trans
ports you to the 2.5D "Room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! Note how we have used some feature detection to either give the browser the newer property values (like AudioListener.forwardX) for setting position, etc. if it sup
ports those, or older methods (like AudioListener.setOrientation()) if it still sup
ports those but not the new properties. // set up listener and panner position information var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var xPos = Math.floor(WIDTH/2); var yPos = Math.floor(HEIGHT/2); var zPos = 295; // define other variables var AudioContext = window.AudioContext || window.webkit...
PaymentAddress.regionCode - Web APIs
The code is derived from the ISO 3166-2 standard, which defines codes for identifying the subdivisions (e.g., states, provinces, autonomous regions, etc.) of all countries in the world. If the browser can't determine the region code, or the country doesn't use regions for postal addresses, it returns an empty string. ...
... identifying the subdivisions (e.g., states, provinces, autonomous regions, etc.) of all countries in the world. If the browser can't determine the region code, or the country doesn't use regions for postal addresses, it returns an empty string. Syntax var regionCode = paymentAddress.regionCode; Value A DOMString indicating the one to three character alphanumeric code representing the region
portion of the address. This should correspond to region, but should be the ISO 3166--2 standard's region code. The string is empty if the region code couldn't be determined, isn't needed for the address's country, or was not provided. ...
PerformanceEntry - Web APIs
sTimeStamp representing the starting time for the performance metric. PerformanceEntry.duration Read only A DOMHighResTimeStamp representing the time value of the duration of the performance event. Methods PerformanceEntry.toJSON() Returns a JSON representation of the PerformanceEntry object. Example The following example checks all PerformanceEntry properties to see if the browser sup
ports them and if so, write their values to the console. function print_PerformanceEntries() { // Use getEntries() to get a list of all performance entries var p = performance.getEntries(); for (var i=0; i < p.length; i++) { console.log("PerformanceEntry[" + i + "]"); print_PerformanceEntry(p[i]); } } function print_PerformanceEntry(perfEntry) { var properties = ["name", ...
...nce.getEntries(); for (var i=0; i < p.length; i++) { console.log("PerformanceEntry[" + i + "]"); print_PerformanceEntry(p[i]); } } function print_PerformanceEntry(perfEntry) { var properties = ["name", "entryType", "startTime", "duration"]; for (var i=0; i < properties.length; i++) { // Check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " is NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 3 Editor's Draft Resource Timing Level 2 ...
PerformanceResourceTiming - Web APIs
Returns "resource". PerformanceEntry.nameRead only Returns the resources URL. PerformanceEntry.startTimeRead only Returns the timestamp for the time a resource fetch started. This value is equivalent to PerformanceEntry.fetchStart. PerformanceEntry.durationRead only Returns a timestamp that is the difference between the responseEnd and the startTime properties. The interface also sup
ports the following properties which are listed in the order in which they are recorded for the fetching of a single resource. An alphabetical listing is shown in the navigation, at left. PerformanceResourceTiming.initiatorTypeRead only A string representing the type of resource that initiated the performance entry, as specified in PerformanceResourceTiming.initiatorType. PerformanceResourceTimi...
...before the browser starts requesting the resource from the server. PerformanceResourceTiming.responseStartRead only A DOMHighResTimeStamp immediately after the browser receives the first byte of the response from the server. PerformanceResourceTiming.responseEndRead only A DOMHighResTimeStamp immediately after the browser receives the last byte of the resource or immediately before the trans
port connection is closed, whichever comes first. PerformanceResourceTiming.transferSizeRead only A number representing the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body. PerformanceResourceTiming.encodedBodySizeRead only A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body,...
Permissions.query() - Web APIs
tatus) { ... }) Parameters PermissionDescriptor An object that sets options for the query operation consisting of a comma-separated list of name-value pairs. The available options are: name: The name of the API whose permissions you want to query. An up-to-date list of permission names can be found in the spec under the PermissionName enum, but bear in mind that the actual permissions sup
ported by browsers is currently much smaller than this. Firefox for example currently sup
ports geolocation, notifications, push, and persistent-storage (see our Permissions.webidl file). userVisibleOnly: (Push only, not sup
ported in Firefox -- see the Browser Sup
port section below) Indicates whether you want to show a notification for every message or be able to send silent push notifications. The d...
...The persistent-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the Storage API. Returns A Promise that resolves to a PermissionStatus object. Exceptions Exception Explanation TypeError Retrieving the PermissionDescriptor information failed in some way, or the permission doesn't exist or is currently unsup
ported (e.g. midi, or push with userVisibleOnly). Example navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state == 'granted') { showLocalNewsWithGeolocation(); } else if (result.state == 'prompt') { showButtonToEnableLocalNews(); } // Don't do anything if the permission was denied. }); Specification Specification Status Comment ...
PointerEvent.pointerType - Web APIs
The pointerType read-only property of the PointerEvent interface indicates the device type (mouse, pen, or touch) that caused a given pointer event. Syntax var pType = pointerEvent.pointerType; Return value pType The event's pointer type. The sup
ported values are the following strings: "mouse" The event was generated by a mouse device. "pen" The event was generated by a pen or stylus device. "touch" The event was generated by a touch, such as a finger. If the device type cannot be detected by the browser, the value can be an empty string (""). If the browser sup
ports pointer device types other than those listed above, the value should be vendor-prefixed to avoid conflicting names for different types of devices. Example This example illustrates using the value of...
... Obsolete Initial definition. Pointer Events - Level 2The definition of 'pointerType' in that specification. Recommendation Non-stable version. CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent'...
Using Pointer Events - Web APIs
ld a multi-touch enabled drawing application. This example is based on the one in the touch events overview, except it uses the pointer events input event model. Another difference is that because pointer events are pointer device agnostic, the application accepts coordinate-based inputs from a mouse, a pen, or a fingertip using the same code. This application will only work on a browser that sup
ports pointer events. A live version of this application is available on GitHub. The source code is available on Github and pull requests and bug re
ports are welcome. Definitions Surface A touch-sensitive surface. This may be a trackpad, a touch screen, or even a virtual mapping of a user's desk surface (or mousepad) with the physical screen. Touch point A point of contact with the surface.
...escribing the contact with the surface, but it could, of course, also be a stylus, mouse, or other method of pointing at a location. Create a canvas The touch-action property is set to none to prevent the browser from applying its default touch behavior to the application. <canvas id="canvas" width="600" height="600" style="border:solid black 1px; touch-action:none"> Your browser does not sup
port canvas element. </canvas> <br> <button onclick="startup()">Initialize</button> <br> Log: <pre id="log" style="border: 1px solid #ccc;"></pre> Setting up the event handlers When the page loads, the startup() function shown below should be called by our <body> element's onload attribute (but in the example we use a button to trigger it, due to limitations of the MDN live example system). functi...
PublicKeyCredentialRequestOptions - Web APIs
pting a specific text on the authenticator, etc.). Methods None. ...
...ytes sent from the server */]), rpId: "example.com", /* will only work if the current domain is something like foo.example.com */ userVerification: "preferred", timeout: 60000, // Wait for a minute allowCredentials: [ { trans
ports: "usb", type: "public-key", id: new Uint8Array(26) // actually provided by the server }, { trans
ports: "internal", type: "public-key", id: new Uint8Array(26) // actually provided by the server } ], extensions: { uvm: true, // RP wants to know how the user was verified loc: false, txAuthSimple: "Could you please verify yourself?" } }; navigator.credentials.get({ "publicKey": options }) .then(function (credentialInfoAssertion) { // send assertion respons...
PushManager - Web APIs
The PushManager interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications. This interface is accessed via the ServiceWorkerRegistration.pushManager property. Note: This interface replaces functionality previously offered by the obsolete PushRegistrationManager interface. Properties PushManager.sup
portedContentEncodings Returns an array of sup
ported content codings that can be used to encrypt the payload of a push message. Methods PushManager.getSubscription() Retrieves an existing push subscription. It returns a Promise that resolves to a PushSubscription object containing details of an existing subscription. If no existing subscription exists, this resolves to a null value. PushManager.permissio...
... console.log(pushSubscription.endpoint); // The push subscription details needed by the application // server are now available, and can be sent to it using, // for example, an XMLHttpRequest. }, function(error) { // During development it often helps to log errors to the // console. In a production environment it might make sense to // also re
port information about errors back to the // application server. console.log(error); } ); }); Specifications Specification Status Comment Push APIThe definition of 'PushManager' in that specification. Working Draft Initial definition. ...
RTCIceCandidate.foundation - Web APIs
The RTCIceCandidate interface's read-only foundation property is a string which uniquely identifies the candidate across multiple trans
ports. As such, the foundation can be used to correlate candidates that are present on multiple RTCIceTrans
port objects Syntax var foundation = RTCIceCandidate.foundation; Value A DOMString which uniquely identifies the candidate across all RTCIceTrans
ports on which it is available. Note: If
port is null -- and
port is sup
ported by the user agent -- passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. Usage notes Consider this SDP attribute line (a-line) which describes an ICE candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The field "4234997325" is the foundation. Example This...
...) which describes an ICE candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The field "4234997325" is the foundation. Example This code snippet uses the foundation of two candidates to determine if they're actually the same candidate. if (candidate1.foundation == candidate2.foundation) { /* the two candidates are the same, even if they're on different trans
ports */ } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate.foundation' in that specification. Candidate Recommendation Initial definition. ...
RTCIceCandidate.usernameFragment - Web APIs
se a 24-character ufrag in which bit 4 of each character is randomly selected between 0 and 1. Another example: it might take a user-defined string and append three 8-bit random bytes to the end. Or perhaps every character is entirely random. Usage notes ICE uses the usernameFragment and password to ensure message integrity. This avoids crosstalk among multiple ongoing ICE sessions, but, more im
portantly, helps secure ICE transactions (and all of WebRTC by extension) against attacks that might try to inject themselves into an ICE exchange. Note: There is no API to obtain the ICE password, for what should be fairly obvious security reasons. The usernameFragment and password both change every time an ICE restart occurs. Example Although the WebRTC infrastructure will filter out obsolete ...
...Msg, arrives from the signaling server that contains an ICE candidate to be added to the RTCPeerConnection. To avoid including candidates obsoleted by an ICE restart, we can use code like this: const ssNewCandidate = signalMsg => { let candidate = new RTCIceCandidate(signalMsg.candidate); let receivers = pc.getReceivers(); receivers.forEach(receiver => { let parameters = receiver.trans
port.getParameters(); if (parameters.usernameFragment === candidate.usernameFragment) { return; } }); pc.addIceCandidate(candidate) .catch(re
portError); } This walks through the list of the RTCRtpReceiver objects being used to receive ICE data, and looks to see if the usernameFragment indicated in the candidate matches any of them. If it does, ssNewCandidate() aborts. Otherwi...
RTCIceCandidatePair.local - Web APIs
The local property of the RTCIceCandidatePair dictionary specifies the RTCIceCandidate which describes the configuration of the local end of a viable WebRTC connection. Syntax localCandidate = RTCIceCandidatePair.local; Value An RTCIceCandidate which describes the configuration of the local end of a viable pair of ICE candidates. The RTCIceCandidatePair is returned by the RTCIceTrans
port method getSelectedCandidatePair(). Example This one-line example simply obtains the current candidate pair and then from that gets the local candidate. var candidatePair = pc.getSenders()[0].trans
port.trans
port.getSelectedCandidatePair(); var localCandidate = candidatePair.local; The RTCIceTrans
port is found by getting the list of RTCRtpSender objects for the RTCPeerConnection pc. In the first RTCRtp...
...ample This one-line example simply obtains the current candidate pair and then from that gets the local candidate. var candidatePair = pc.getSenders()[0].trans
port.trans
port.getSelectedCandidatePair(); var localCandidate = candidatePair.local; The RTCIceTrans
port is found by getting the list of RTCRtpSender objects for the RTCPeerConnection pc. In the first RTCRtpSender, we get the RTCDtlsTrans
port over which the media data is being transmitted and finally, from that, the RTCIceTrans
port. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidatePair.local' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidatePair.remote - Web APIs
The remote property of the RTCIceCandidatePair dictionary specifies the RTCIceCandidate describing the configuration of the remote end of a viable WebRTC connection. Syntax remoteCandidate = RTCIceCandidatePair.remote; Value An RTCIceCandidate which describes the configuration of the remote end of a viable pair of ICE candidates. The RTCIceCandidatePair is returned by the RTCIceTrans
port method getSelectedCandidatePair(). Example This one-line example simply obtains the current candidate pair and then from that gets the remote candidate. var candidatePair = pc.getSenders()[0].trans
port.trans
port.getSelectedCandidatePair(); var remoteCandidate = candidatePair.remote; The RTCIceTrans
port is found by getting the list of RTCRtpSender objects for the RTCPeerConnection pc. In the first RTC...
...le This one-line example simply obtains the current candidate pair and then from that gets the remote candidate. var candidatePair = pc.getSenders()[0].trans
port.trans
port.getSelectedCandidatePair(); var remoteCandidate = candidatePair.remote; The RTCIceTrans
port is found by getting the list of RTCRtpSender objects for the RTCPeerConnection pc. In the first RTCRtpSender, we get the RTCDtlsTrans
port over which the media data is being transmitted and finally, from that, the RTCIceTrans
port. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidatePair.remote' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidatePairStats.availableIncomingBitrate - Web APIs
bandwidth you can assume is available for incoming data. You can get the incoming outgoing bitrate from availableoutgoingBitrate. Syntax availableIncomingBitrate = rtcIceCandidatePairStats.availableIncomingBitrate; Value A floating-point value which approximates the amount of available bandwidth for incoming data on the network connection described by the RTCIceCandidatePair. The value is re
ported in bits per second and is computed over a 1-second interval. The value returned is calculated by adding up the available bit rate for every RTP stream using the connection described by this candidate pair. The returned value doesn't take into account overhead introduced by underlying protocols, including IP, UDP, or TCP. Note: The returned value is computed using a method similar--but not id...
... and is computed over a 1-second interval. The value returned is calculated by adding up the available bit rate for every RTP stream using the connection described by this candidate pair. The returned value doesn't take into account overhead introduced by underlying protocols, including IP, UDP, or TCP. Note: The returned value is computed using a method similar--but not identical--to the Trans
port Independent Application Specific Maximum (TIAS) described in RFC 3890: 6.2. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCIceCandidatePairStats.availableIncomingBitrate' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidatePairStats.availableOutgoingBitrate - Web APIs
bandwidth you can assume is available for outgoing data. You can get the incoming available bitrate from availableIncomingBitrate. Syntax availableOutgoingBitrate = rtcIceCandidatePairStats.availableOutgoingBitrate; Value A floating-point value which approximates the amount of available bandwidth for outgoing data on the network connection described by the RTCIceCandidatePair. The value is re
ported in bits per second and is computed over a 1-second interval. The returned value is undefined in each of the following situations: The underlying implementation doesn't sup
port computing a sender-side estimate of the outgoing bit rate. The RTCIceCandidatePair described by this object has never been used. The candidate pair was once in use, but no longer is. The value returned is calculat...
...e pair was once in use, but no longer is. The value returned is calculated by adding up the available bit rate for every RTP stream using the connection described by this candidate pair. The returned value doesn't take into account overhead introduced by underlying protocols, including IP, UDP, or TCP. Note: The returned value is computed using a method similar--but not identical--to the Trans
port Independent Application Specific Maximum (TIAS) described in RFC 3890: 6.2. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCIceCandidatePairStats.availableoutgoingbitrate' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidateStats.address - Web APIs
s separators, the value is interpreted as an IPv4 address. If the value is entirely comprised of hexadecimal digits and colon (":") characters, it is interpreted as an IPv6 address. ...
...ord (assuming IPv6 is available), then using an A record (if no result is found or the device onlu sup
ports IPv4). If multiple IP addresses are returned in response to the query, the user agent selects one, which is then used for the duration of ICE processing. Usage notes The address property was previously known as ip, and only permitted IPv4 and IPv6 addresses to be used. The addition of sup
port for fully-qualified domain names to be used for the address brought about the renaming of the property. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCIceCandidateStats.address' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidateStats - Web APIs
twork socket) associated with the candidate have already been released. For TURN candidates, the TURN allocation is no longer active for deleted candidates. This property is not present for remote candidates. networkType Optional A string from the RTCNetworkType enumerated type which indicates the type of interface used for a local candidate. This property is only present for local candidates.
port Optional The network
port number used by the candidate. priority Optional The candidate's priority, corresponding to RTCIceCandidate.priority. protocol Optional A string specifying the protocol (tcp or udp) used to transmit data on the
port. relayProtocol Optional A string identifying the protocol used by the endpoint for communicating with the TURN server; valid values are tcp, udp, and t...
...e candidate. priority Optional The candidate's priority, corresponding to RTCIceCandidate.priority. protocol Optional A string specifying the protocol (tcp or udp) used to transmit data on the
port. relayProtocol Optional A string identifying the protocol used by the endpoint for communicating with the TURN server; valid values are tcp, udp, and tls. Only present for local candidates. trans
portId Optional A string uniquely identifiying the trans
port object that was inspected in order to obtain the RTCTrans
portStats associated with the candidate correspondin to these statistics. url Optional For local candidates, the url property is the URL of the ICE server from which the candidate was received. This URL matches the one included in the RTCPeerConnectionIceEvent object representing th...
RTCIceComponent - Web APIs
The WebRTC API's RTCIceComponent enumerated type contains DOMString values that each identify a specific ICE component; these are "rtp" and "rtcp". These strings are mapped to corresponding numeric values as they appear in the candidate a-line in SDP. Values "rtp" Identifies an ICE trans
port which is being used for the Real-time Trans
port Protocol (RTP), or for RTP multiplexed with the RTP Control Protocol (RTCP). RTP is defined in RFC 3550. An RTCIceComponent of this value corresponds to the component ID field in the candidate a-line with the value 1. "rtcp" Identifies an ICE trans
port being used for RTCP, which is defined in RFC 3550, section 6. This value of RTCIceComponent corresponds to the component ID 2. Usage notes The RTCIceComponent type is used by the component property o...
...d in RFC 3550. An RTCIceComponent of this value corresponds to the component ID field in the candidate a-line with the value 1. "rtcp" Identifies an ICE trans
port being used for RTCP, which is defined in RFC 3550, section 6. This value of RTCIceComponent corresponds to the component ID 2. Usage notes The RTCIceComponent type is used by the component property of RTCIceCandidate and RTCIceTrans
port objects. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceComponent' in that specification. Candidate Recommendation Initial definition. ...
RTCPeerConnection() - Web APIs
the size of the ICE candidate pool may trigger the beginning of ICE gathering. iceServers Optional An array of RTCIceServer objects, each describing one server which may be used by the ICE agent; these are typically STUN and/or TURN servers. If this isn't specified, the connection attempt will be made with no STUN or TURN server available, which limits the connection to local peers. iceTrans
portPolicy Optional The current ICE trans
port policy; this must be one of the values from the RTCIceTrans
portPolicy enum. If this isn't specified, "all" is assumed. peerIdentity Optional A DOMString which specifies the target peer identity for the RTCPeerConnection. If this value is set (it defaults to null), the RTCPeerConnection will not connect to a remote peer unless it can successfully authent...
...s isn't specified, "all" is assumed. peerIdentity Optional A DOMString which specifies the target peer identity for the RTCPeerConnection. If this value is set (it defaults to null), the RTCPeerConnection will not connect to a remote peer unless it can successfully authenticate with the given name. rtcpMuxPolicy Optional The RTCP mux policy to use when gathering ICE candidates, in order to sup
port non-multiplexed RTCP. The value must be one of those from the RTCRtcpMuxPolicy enum. The default is "require". Return value A newly-created RTCPeerConnection object, configured as described by configuration, if specified; otherwise, configured to appropriate basic defaults. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between Browser...
RTCPeerConnection.canTrickleIceCandidates - Web APIs
returns a Boolean which indicates whether or not the remote peer can accept trickled ICE candidates. ICE trickling is the process of continuing to send candidates after the initial offer or answer has already been sent to the other peer. This property is only set after having called RTCPeerConnection.setRemoteDescription(). Ideally, your signaling protocol provides a way to detect trickling sup
port, so that you don't need to rely on this property. A WebRTC browser will always sup
port trickle ICE. If trickling isn't sup
ported, or you aren't able to tell, you can check for a falsy value for this property and then wait until the value of iceGatheringState changes to "completed" before creating and sending the initial offer. That way, the offer contains all of the candidates. Syntax var canT...
...leIceCandidates; Value A Boolean that is true if the remote peer can accept trickled ICE candidates and false if it cannot. If no remote peer has been established, this value is null. Note: This property's value is determined once the local peer has called RTCPeerConnection.setRemoteDescription(); the provided description is used by the ICE agent to determine whether or not the remote peer sup
ports trickled ICE candidates. Example var pc = new RTCPeerConnection(); // The following code might be used to handle an offer from a peer when // it isn't known whether it sup
ports trickle ICE. pc.setRemoteDescription(remoteOffer) .then(_ => pc.createAnswer()) .then(answer => pc.setLocalDescription(answer)) .then(_ => if (pc.canTrickleIceCandidates) { return pc.localDescription; ...
RTCPeerConnection.createAnswer() - Web APIs
The answer is delivered to the returned Promise, and should then be sent to the source of the offer to continue the negotiation process. ...
...RTCSessionDescriptionInit dictionary which contains the SDP answer to be delivered to the other peer. Example Here is a segment of code taken from the code that goes with the article Signaling and video calling. This code comes from the handler for the message sent to carry an offer to another peer across the signaling channel. Keep in mind that this is part of the signaling process, the trans
port layer for which is an implementation detail that's entirely up to you. In this case, a WebSocket connection is used to send a JSON message with a type field with the value "video-answer" to the other peer, carrying the answer to the device which sent the offer to connect. The contents of the object being passed to the sendToServer() function, along with everything else in the promise fulfillment ...
RTCPeerConnection: icecandidate event - Web APIs
re candidates coming during this negotiation */ } } The remote peer, upon receiving the candidate, will add the candidate to its candidate pool by calling addIceCandidate(), passing in the candidate string you have passed along using the signaling server. Indicating the end of a generation of candidates When an ICE negotiation session runs out of candidates to propose for a given RTCIceTrans
port, it has completed gathering for a generation of candidates. That this has occurred is indicated by an icecandidate event whose candidate string is empty (""). You should deliver this to the remote peer just like any standard candidate, as described under Sharing a new candidate above. This ensures that the remote peer is given the end-of-candidates notification as well. As you see in the code in...
...candidate string. Only candidates for which the event's candidate property is null are not forwarded across the signaling connection. The end-of-candidates indication is described in section 9.3 of the Trickle ICE draft specification (note that the section number is subject to change as the specification goes through repeated drafts). Indicating that ICE gathering is complete Once all ICE trans
ports have finished gathering candidates and the value of the RTCPeerConnection object's iceGatheringState has made the transition to complete, an icecandidate event is sent with the value of complete set to null. This signal exists for backward compatibility purposes and does not need to be delivered onward to the remote peer (which is why the code snippet above checks to see if event.candidate is n...
RTCPeerConnection.onconnectionstatechange - Web APIs
The RTCPeerConnection.onconnectionstatechange property specifies an EventHandler which is called to handle the connectionstatechange event when it occurs on an instance of RTCPeerConnection. This happens whenever the aggregate state of the connection changes. The aggregate state is a combination of the states of all of the individual network trans
ports being used by the connection. Syntax RTCPeerConnection.onconnectionstatechange = eventHandler; Value A function which is called by the browser when the connectionstatechange event occurs on the RTCPeerConnection. The function receives as input a single parameter, which is an object of type Event. The event object contains no special information of note; you can look at the value of the peer connection's connectionState property to determin...
...ct contains no special information of note; you can look at the value of the peer connection's connectionState property to determine what the new state is. Example pc.onconnectionstatechange = function(event) { switch(pc.connectionState) { case "connected": // The connection has become fully connected break; case "disconnected": case "failed": // One or more trans
ports has terminated unexpectedly or in an error break; case "closed": // The connection has been closed break; } } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCPeerConnection.onconnectionstatechange' in that specification. Candidate Recommendation Initial specification.
RTCPeerConnection.setConfiguration() - Web APIs
The most common use case for this method (and even then, probably not a very common use case) is to replace the set of ICE servers to be used. Two potential scenarios in which this might be done: The RTCPeerConnection was instantiated without specifying any ICE servers. ...
...This is then passed into setConfiguration(). ICE negotiation is restarted by calling createOffer(), specifying true as the value of the iceRestart option. From there, we handle the process as usual, by setting the local description to the returned offer and then sending that offer t...
RTCPeerConnection.setRemoteDescription() - Web APIs
handler receives no input parameters. Note: The process of changing descriptions actually involves intermediary steps handled by the WebRTC layer to ensure that an active connection can be changed without losing the connection if the change does not succeed. See Pending and current descriptions in WebRTC connectivity for more details on this process. Exceptions The following exceptions are re
ported to the rejection handler for the promise returned by setRemoteDescription(): InvalidAccessError The content of the description is invalid. InvalidStateError The RTCPeerConnection is closed, or it's in a state which isn't compatible with the specified description's type. For example, if the type is rollback and the signaling state is one of stable, have-local-pranswer, or have-remote-prans...
...with the specified description's type. For example, if the type is rollback and the signaling state is one of stable, have-local-pranswer, or have-remote-pranswer, this exception is thrown, because you can't roll back a connection that's either fully established or is in the final stage of becoming connected. OperationError Any errors that occur which don't match the others specifeid here are re
ported as OperationError. This includes identity validation errors. RTCError An RTCError with the errorDetail set to sdp-syntax-error is re
ported if the SDP specified by RTCSessionDescription.sdp. The error object's sdpLineNumber property indicates the line number within the SDP on which the syntax error was detected. TypeError The specified RTCSessionDescriptionInit or RTCSessionDescription objec...
RTCRtpReceiver.getStats() - Web APIs
The returned statistics include those from all streams which are coming in through the RTCRtpReceiver, as well as any of their dependencies. ...
... The returned statistics include those from all streams which are coming in through the RTCRtpReceiver, as well as any of their dependencies. Example This simple example obtains the statistics for an RTCRtpReceiver and updates an element's innerText to display the number of packets lost. ...
RTCRtpReceiver - Web APIs
The RTCRtpReceiver interface of the WebRTC API manages the reception and decoding of data for a MediaStreamTrack on an RTCPeerConnection. Properties RTCRtpReceiver.track Read only Returns the MediaStreamTrack associated with the current RTCRtpReceiver instance. RTCRtpReceiver.trans
port Read only Returns the RTCDtlsTrans
port instance over which the media for the receiver's track is received. Obsolete properties rtcpTrans
port This property has been removed; the RTP and RTCP trans
ports have been combined into a single trans
port. Use the trans
port property instead. Methods RTCRtpReceiver.getContributingSources() Returns an array of RTCRtpContributingSource instances for each unique CSRC (contributing source) identifier received by the current RTCRtpReceiver in the last ten...
...urns an array of RTCRtpContributingSource instances for each unique CSRC (contributing source) identifier received by the current RTCRtpReceiver in the last ten seconds. RTCRtpReceiver.getParameters() Returns an RTCRtpParameters object which contains information about how the RTC data is to be decoded. RTCRtpReceiver.getStats() Returns a Promise whose fulfillment handler receives a RTCStatsRe
port which contains statistics about the incoming streams and their dependencies. RTCRtpReceiver.getSynchronizationSources() Returns an array including one RTCRtpSynchronizationSource instance for each unique SSRC (synchronization source) identifier received by the current RTCRtpReceiver in the last ten seconds. Static methods RTCRtpReceiver.getCapabilities() Returns the most optimistic view ...
RTCRtpSender.getCapabilities() static function - Web APIs
The static function RTCRtpSender.getCapabilities() returns an RTCRtpCapabilities object describing the codecs and capabilities sup
ported by the RTCRtpSender. You can, similarly, obtain the capabilities of RTCRtpReceivers by calling the static function RTCRtpReceiver.getCapabilities(). Syntax let rtpCapabilities = RTCRtpSender.getCapabilities(kind); Parameters kind A DOMString indicating the type of media for which you wish to get the sender's capability to receive. All browsers sup
port the primary media kinds: audio and video. Return value An RTCRtpCapabilities object stating what capabilities the browser has for sending the specified media kind over an RTCPeerConnection. If the browser doesn't have any sup
port for the given media kind, the returned value is null. Description As ...
...ecs and the like very often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. For that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. Example The function below returns a Boolean indicating whether or not the device sup
ports sending H.264 video on an RTCRtpSender. Since RTCRtpSender.getCapabilities() actually only indicates probable sup
port, H.264 sup
port might still fail even after getting a positive response from this function. function canSendH264() { let capabilities = RTCRtpSender.getCapabilities("video"); capabilities.codecs.forEach((codec) => { if (codec.mimeType === "video/H264") { return ...
RTCRtpStreamStats - Web APIs
nnection.getStats(), RTCRtpSender.getStats(), and RTCRtpReceiver.getStats() methods to provide detailed statistics about WebRTC connectivity. While the dictionary has a base set of properties that are present in each of these cases, there are also additional properties added depending on which interface the method is called on. RTCRtpStreamStats is the base class for all RTP-related statistics re
ports. It's based on RTCStats and adds the following additional fields. Note: This interface was called RTCRTPStreamStats until a specification update in the spring of 2017. Check the Browser compatibility table to know if and when the name change was implemented in specific browsers. Properties The RTCRtpStreamStats dictionary is based on RTCStats, and inherits its properties. In addition, some ...
...property. Previously called mediaType. ssrc The 32-bit integer which identifies the source of the RTP packets this RTCRtpStreamStats object covers. This value is generated per the RFC 3550 specification. trackId A DOMString which uniquely identifies the RTCMediaStreamTrackStats object representing the associated MediaStreamTrack. This is not the same as the value of MediaStreamTrack.id. trans
portId A DOMString uniquely identifying the object which was inspected to produce the RTCTrans
portStats object associated with this RTP stream. Obsolete fields mediaType Renamed to kind in the specification in February 2018. See Browser compatibility in RTCRtpStreamStats.kind to determine when browsers made the transition. Local-only measurements These properties are computed locally, and a...
ResizeObserver - Web APIs
Note: The content box is the box in which content can be placed, meaning the border box minus the padding and border width. The border box encompasses the content, padding, and border. See The box model for further explanation. ResizeObserver avoids infinite callback loops and cyclic dependencies that are often created when resizing via a callback function. It does this by only processing elements deeper in the DOM in subsequent frames. Implementations should, if they follow the specification, invoke resize events before paint and after layout. ...
...sizeObserver.unobserve() Ends the observing of a specified Element. Examples In the resize-observer-text.html (see source) example, we use the resize observer to change the font-size of a header and paragraph as a slider's value is changed causing the containing <div> to change width. This shows that you can respond to changes in an element's size, even if they have nothing to do with the view
port. We also provide a checkbox to turn the observer off and on. If it is turned off, the text will not change in response to the <div>'s width changing. The JavaScript looks like so: const h1Elem = document.querySelector('h1'); const pElem = document.querySelector('p'); const divElem = document.querySelector('body > div'); const slider = document.querySelector('input[type="range"]'); const checkb...
ResizeObserverEntry.contentRect - Web APIs
The contentRect read-only property of the ResizeObserverEntry interface returns a DOMRectReadOnly object containing the new size of the observed element when the callback is run. Note that this is better sup
ported than ResizeObserverEntry.borderBoxSize or ResizeObserverEntry.contentBoxSize, but it is left over from an earlier implementation of the Resize Observer API, is still included in the spec for web compat reasons, and may be deprecated in future versions. Syntax var contentRect = resizeObserverEntry.contentRect; Value A DOMRectReadOnly object containing the new size of the element indicated by the target property. If the target is an HTML Element, the returned contentRect is the element's content box. If the target is an SVGElement, the returned contentRect is the SVG's bounding b...
...e new size of the element indicated by the target property. If the target is an HTML Element, the returned contentRect is the element's content box. If the target is an SVGElement, the returned contentRect is the SVG's bounding box. Examples The following snippet is taken from the resize-observer-text.html (see source) example. This uses a simple feature detection test to see if the browser sup
ports the newer ResizeObserverEntry.contentBoxSize property -- if so, it uses that to get the sizing data it needs. If not, it uses contentRect. const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { if(entry.contentBoxSize) { h1Elem.style.fontSize = Math.max(1.5, entry.contentBoxSize.inlineSize/200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.cont...
ResizeObserverEntry - Web APIs
ontaining the new border box size of the observed element when the callback is run. ResizeObserverEntry.contentBoxSize Read only An object containing the new content box size of the observed element when the callback is run. ResizeObserverEntry.contentRect Read only A DOMRectReadOnly object containing the new size of the observed element when the callback is run. Note that this is better sup
ported than the above two properties, but it is left over from an earlier implementation of the Resize Observer API, is still included in the spec for web compat reasons, and may be deprecated in future versions. ResizeObserverEntry.target Read only A reference to the Element or SVGElement being observed. Note: The content box is the box in which content can be placed, meaning the border box min...
...ontent box is the box in which content can be placed, meaning the border box minus the padding and border width. The border box encompasses the content, padding, and border. See The box model for further explanation. Methods None. Examples The following snippet is taken from the resize-observer-text.html (see source) example. This uses a simple feature detection test to see if the browser sup
ports the newer contentBoxSize property -- if so, it uses that to get the sizing data it needs. If not, it uses the older contentRect property. const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { if(entry.contentBoxSize) { h1Elem.style.fontSize = Math.max(1.5, entry.contentBoxSize.inlineSize/200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.conte...
Sensor APIs - Web APIs
s gracefully so that the user experience is enhanced rather than degraded. The code example below illustrates these principles. The try...catch block catches errors thrown during sensor instantiation. It implements a handler for Sensor.onerror to catch errors thrown during use. The only time anything is shown to the user is when permissions need to be requested and when the sensor type isn't sup
ported by the device. If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. let accelerometer = null; try { accelerometer = new Accelerometer({ referenceFrame: 'device' }); accelerometer.addEventListener('error', e...
...ventListener('reading', () => reloadOnShake(accelerometer)); accelerometer.start(); } catch (error) { // Handle construction errors. if (error.name === 'SecurityError') { // See the note above about feature policy. console.log('Sensor construction was blocked by a feature policy.'); } else if (error.name === 'ReferenceError') { console.log('Sensor is not sup
ported by the User Agent.'); } else { throw error; } } Permissions and Feature Policy Sensor readings may not be taken unless the user grants permission to a specific sensor type. Do this using the Permissions API. A brief example, shown below, requests permission before attempting to use the sensor. navigator.permissions.query({ name: 'accelerometer' }) .then(result => { if (resu...
ServiceWorkerMessageEvent.data - Web APIs
Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features. The data read-only property of the ServiceWorkerMessageEvent interface returns the event's data. It can be any data type. Syntax var myData = ServiceWorkerMessageEventInstance.data; Value Any data type. Examples When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... ...
...s When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... // set up a message channel to communicate with the SW var channel = new MessageChannel(); channel.
port1.onmessage = function(e) { console.log(e); handleChannelMessage(e.data); } mySW = reg.active; mySW.postMessage('hello', [channel.
port2]); }); ...
ServiceWorkerMessageEvent.lastEventId - Web APIs
Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features. The lastEventID read-only property of the ServiceWorkerMessageEvent interface represents, in server-sent events, the last event ID of the event source. Syntax var myLastEventId = ServiceWorkerMessageEventInstance.lastEventId; Value A DOMString. Examples When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... ...
...s When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... // set up a message channel to communicate with the SW var channel = new MessageChannel(); channel.
port1.onmessage = function(e) { console.log(e.lastEventId); handleChannelMessage(e.data); } mySW = reg.active; mySW.postMessage('hello', [channel.
port2]); }); ...
ServiceWorkerMessageEvent.origin - Web APIs
Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features. The origin read-only property of the ServiceWorkerMessageEvent interface returns the origin of the service worker's environment settings object. Syntax var myOrigin = ServiceWorkerMessageEventInstance.origin; Value A DOMString. Examples When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... ...
...s When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... // set up a message channel to communicate with the SW var channel = new MessageChannel(); channel.
port1.onmessage = function(e) { console.log(e.origin); handleChannelMessage(e.data); } mySW = reg.active; mySW.postMessage('hello', [channel.
port2]); }); ...
ServiceWorkerMessageEvent.source - Web APIs
Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features. The source read-only property of the ServiceWorkerMessageEvent returns a reference to the ServiceWorker object of the associated service worker that sent the message. Syntax var mySource = ServiceWorkerMessageEventInstance.source; Value A ServiceWorker or Message
Port object. Examples When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... ...
...s When the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a ServiceWorkerMessageEvent. navigator.serviceWorker.ready.then(function(reg) { ... // set up a message channel to communicate with the SW var channel = new MessageChannel(); channel.
port1.onmessage = function(e) { console.log(e.source); handleChannelMessage(e.data); } mySW = reg.active; mySW.postMessage('hello', [channel.
port2]); }); ...
ServiceWorkerRegistration.pushManager - Web APIs
Syntax var pushManager = serviceWorkerRegistration.pushManager; Value A PushManager object. Examples this.onpush = function(event) { console.log(event.data); // From here we can write the data to IndexedDB, send it to any open // windows, display a notification, etc. ...
... console.log(pushSubscription.endpoint); // The push subscription details needed by the application // server are now available, and can be sent to it using, // for example, an XMLHttpRequest. }, function(error) { // During development it often helps to log errors to the // console. In a production environment it might make sense to // also re
port information about errors back to the // application server. console.log(error); } ); }); Specifications Specification Status Comment Push APIThe definition of 'PushManager' in that specification. Working Draft Initial definition. ...
ServiceWorkerRegistration - Web APIs
ed title. ServiceWorkerRegistration.update() Checks the server for an updated version of the service worker without consulting caches. ServiceWorkerRegistration.unregister() Unregisters the service worker registration and returns a Promise. The service worker will finish any ongoing operations before it is unregistered. Examples In this example, the code first checks whether the browser sup
ports service workers and if so registers one. Next, it adds an updatefound listener in which it uses the service worker registration to listen for further changes to the service worker's state. If the service worker hasn't changed since the last time it was registered, then the updatefound event will not be fired. if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js') .th...
... Working Draft Initial definition. Push APIThe definition of 'PushManager' in that specification. Working Draft Adds the pushManager property. Notifications API Living Standard Adds the showNotification...
SharedWorkerGlobalScope - Web APIs
ties and methods available. Event handlers This interface inherits event handlers from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements event handlers from WindowTimers, WindowBase64, and WindowEventHandlers. SharedWorkerGlobalScope.onconnect Is an EventHandler representing the code to be called when the connect event is raised -- that is, when a Message
Port connection is opened between the associated SharedWorker and the main thread. Methods This interface inherits methods from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements methods from WindowTimers, WindowBase64, and WindowEventHandlers. SharedWorkerGlobalScope.close() Discards any tasks queued in the SharedWorkerGlobalScope's event loop, effectively cl...
...loop, effectively closing this particular scope. Inherited from WorkerGlobalScope WorkerGlobalScope.close() Discards any tasks queued in the WorkerGlobalScope's event loop, effectively closing this particular scope. WorkerGlobalScope.dump() Allows you to write a message to stdout -- i.e. in your terminal. This is the same as Firefox's window.dump, but for workers. WorkerGlobalScope.im
portScripts() Im
ports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example: im
portScripts('foo.js', 'bar.js'); Implemented from other places WindowBase64.atob() Decodes a string of data which has been encoded using base-64 encoding. WindowBase64.btoa() Creates a base-64 encoded ASCII string from a string of binary data. WindowTi...
SourceBuffer.changeType() - Web APIs
The changeType() method of the SourceBuffer interface sets the MIME type that future calls to appendBuffer() should expect the new media data to conform to. This makes it possible to change codecs or container type mid-stream. One scenario in which this is helpful is to sup
port adapting the media source to changing bandwidth availability, by transitioning from one codec to another as resource constraints change. Syntax sourceBuffer.changeType(type); Parameters type A DOMString specifying the MIME type that future buffers will conform to. Return value undefined. Exceptions TypeError The specified string is empty, rather than indicating a valid MIME type. InvalidStateError The SourceBuffer is not a member of the parent media source's sourceBuffers list, or the buffe...
... type that future buffers will conform to. Return value undefined. Exceptions TypeError The specified string is empty, rather than indicating a valid MIME type. InvalidStateError The SourceBuffer is not a member of the parent media source's sourceBuffers list, or the buffer's updating property indicates that a previously queued appendBuffer() or remove() is still being processed. NotSup
portedError The specified MIME type is not sup
ported, or is not sup
ported with the types of SourceBuffer objects present in the MediaSource.sourceBuffers list. Usage notes If the parent MediaSource is in its "ended" readyState, calling changeType() will transition the media source to the "open" readyState and fire a simple event named sourceopen at the parent media source. ...
Streams API concepts - Web APIs
reading underlying byte sources (otherwise known as BYOB, or "bring your own buffer") sources. These allow streams to be read straight into a buffer supplied by the developer, minimizing the copying required. Which underlying stream (and by extension, reader and controller) your code will use depends on how the stream was created in the first place (see the ReadableStream() constructor page). Im
portant: Byte streams are not implemented anywhere as yet, and questions have been raised as to whether the spec details are in a finished enough state for them to be implemented. This may change over time. You can make use of ready-made readable streams via mechanisms like a Response.body from a fetch request, or roll your own streams using the ReadableStream() constructor. Teeing Even though onl...
...table stream that acts as the end point of the pipe chain. The start of the pipe chain is called the original source, and the end is called the ultimate sink. Note: This functionality isn't fully thought through yet, or available in many browsers. At some point the spec writers hope to add something like a TransformStream class to make creating transform streams easier. Backpressure An im
portant concept in streams is backpressure -- this is the process by which a single stream or a pipe chain regulates the speed of reading/writing. When a stream later in the chain is still busy and isn't yet ready to accept more chunks, it sends a signal backwards through the chain to tell earlier transform streams (or the original source) to slow down delivery as appropriate so that you don't end up ...
SubtleCrypto.digest() - Web APIs
ance, meaning that it's hard to come up with two different inputs that have the same digest value. It takes as its arguments an identifier for the digest algorithm to use and the data to digest. It returns a Promise which will be fulfilled with the digest. Syntax const digest = crypto.subtle.digest(algorithm, data); Parameters algorithm is a DOMString defining the hash function to use. ...
...They have a variety of applications in cryptography. ...
TextEncoder - Web APIs
Example const encoder = new TextEncoder() const view = encoder.encode('EUR') console.log(view); // Uint8Array(3) [226, 130, 172] Constructor TextEncoder() Returns a newly constructed TextEncoder that will generate a byte stream with UTF-8 encoding. Properties The TextEncoder interface doesn't inherit any property. TextEncoder.prototype.encodingRead only Always returns "utf-8". Methods The TextEncoder interface doesn't inherit any method. ...
...t8Array containing UTF-8 encoded text. TextEncoder.prototype.encodeInto() Takes a USVString to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding. This is potentially more performant than the older encode() method. Polyfill The below polyfill is compliant with the standard and therefore only sup
ports UTF-8. It is designed to work in IE5 "out of the box". However, in IE5-IE9, it will return a regular Array instead of a TypedArray. In those cases a polyfill might be impractical for large strings. Finally, note that you should run the below code through a minifier (especially closure compiler) to turn sequences like 0x1e << 3 into 0xf0. These sequences are not already precomputed because they s...
Touch - Web APIs
ues are set to describe an ellipse that as closely as possible matches the entire area of contact (such as the user's fingertip). Note: Many of the properties' values are hardware-dependent; for example, if the device doesn't have a way to detect the amount of pressure placed on the surface, the force value will always be 0. This may also be the case for radiusX and radiusY; if the hardware re
ports only a single point, these values will be 1. Constructor Touch() Creates a Touch object. Properties This interface has no parent, and doesn't inherits or implements any other property. Basic properties Touch.identifier Read only Returns a unique identifier for this Touch object. A given touch point (say, by a finger) will have the same identifier for the duration of its movement...
...you ensure that you're tracking the same touch all the time. Touch.screenX Read only Returns the X coordinate of the touch point relative to the left edge of the screen. Touch.screenY Read only Returns the Y coordinate of the touch point relative to the top edge of the screen. Touch.clientX Read only Returns the X coordinate of the touch point relative to the left edge of the browser view
port, not including any scroll offset. Touch.clientY Read only Returns the Y coordinate of the touch point relative to the top edge of the browser view
port, not including any scroll offset. Touch.pageX Read only Returns the X coordinate of the touch point relative to the left edge of the document. Unlike clientX, this value includes the horizontal scroll offset, if any. Touch.pageY Read only ...
TouchEvent - Web APIs
Touches are represented by the Touch object; each touch is described by a position, size and shape, amount of pressure, and target element. ...
... the exact reasons will vary from device to device, as well as browser to browser): An event of some kind occurred that canceled the touch; this might happen if a modal alert pops up during the interaction. The touch point has left the document window and moved into the browser's UI area, a plug-in, or other external content. The user has placed more touch points on the screen than can be sup
ported, in which case the earliest Touch in the TouchList gets canceled. Using with addEventListener() and preventDefault() It's im
portant to note that in many cases, both touch and mouse events get sent (in order to let non-touch-specific code still interact with the user). If you use touch events, you should call preventDefault() to keep the mouse event from being sent as well. The exception to ...
URL.createObjectURL() - Web APIs
n the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so. Using object URLs for media streams In older versions of the Media Source specification, attaching a stream to a <video> element required creating an object URL for the MediaStream. This is no longer necessary, and browsers are removing sup
port for doing this. Im
portant: If you still have code that relies on createObjectURL() to attach streams to media elements, you need to update your code to simply set srcObject to the MediaStream directly. Specifications Specification Status Comment File APIThe definition of 'createObjectURL()' in that specification. Working Draft Initial definition. Media ...
... ...
URL.host - Web APIs
The host property of the URL interface is a USVString containing the host, that is the hostname, and then, if the
port of the URL is nonempty, a ':', followed by the
port of the URL. Note: This feature is available in Web Workers. Syntax const host = url.host url.host = newHost Value A USVString. ...
... a ':', followed by the
port of the URL. Note: This feature is available in Web Workers. Syntax const host = url.host url.host = newHost Value A USVString. Examples let url = new URL('/docs/Web/API/URL/host'); console.log(url.host); // "developer.mozilla.org" url = new URL('https://developer.mozilla.org:443/docs/Web/API/URL/host'); console.log(url.host); // "developer.mozilla.org" // The
port number is not included because 443 is the scheme's default
port url = new URL('https://developer.mozilla.org:4097/docs/Web/API/URL/host'); console.log(url.host); // "developer.mozilla.org:4097" Specifications Specification Status Comment URLThe definition of 'URL.host' in that specification. Living Standard Initial definition ...
URL.origin - Web APIs
For file: URLs, the value is browser dependant. ...
... For file: URLs, the value is browser dependant. ...
USBConfiguration - Web APIs
Constructor USBConfiguration.USBConfiguration() Creates a new USBConfiguration object which contains information about the configuration on the provided USBDevice with the given configuration value. Properties USBConfiguration.configurationValueRead only Returns the configuration value of this configuration. This is equal to the bConfigurationValue field of the configuration descriptor provided by the device defining this configuration. ...
...ration.configurationNameRead only Returns the name provided by the device to describe this configuration. This is equal to the value of the string descriptor with the index provided in the iConfiguration field of the configuration descriptor defining this configuration. USBConfiguration.interfacesRead only Returns an array containing instances of the USBInterface describing each interface sup
ported by this configuration. Specifications Specification Status Comment WebUSBThe definition of 'USBConfiguration' in that specification. Draft Initial definition. ...
USBDevice - Web APIs
ce. USBDevice.productId Read only The manufacturer-defined code that identifies a USB device. USBDevice.productName Read only The manufacturer-defined name that identifies a USB device. USBDevice.serialNumber Read only The manufacturer-defined serial number for the specific USB device. USBDevice.usbVersionMajor Read only One of three properties that declare the USB protocol version sup
ported by the device. The other two properties are USBDevice.usbVersionMinor and USBDevice.usbVersionSubminor. USBDevice.usbVersionMinor Read only One of three properties that declare the USB protocol version sup
ported by the device. The other two properties are USBDevice.usbVersionMajor and USBDevice.usbVersionSubminor. USBDevice.usbVersionSubminor Read only One of three properties that declare...
...The other two properties are USBDevice.usbVersionMajor and USBDevice.usbVersionMinor. USBDevice.vendorId Read only The official usg.org-assigned vendor ID. ...
VRStageParameters - Web APIs
This interface is accessible through the VRDisplay.stageParameters property. Properties VRStageParameters.sittingToStandingTransform Read only Contains a matrix that transforms the sitting-space view matrices of VRFrameData to standing-space. VRStageParameters.sizeX Read only Returns the width of the play-area bounds in meters. VRStageParameters.sizeY Read only Returns the depth of the play-area bounds in meters. ...
...ters.sizeY Read only Returns the depth of the play-area bounds in meters. ...
VTTRegion - Web APIs
The VTTRegion interface--part of the API for handling WebVTT (text tracks on media presentations)--describes a
portion of the video to render a VTTCue onto. Constructor VTTRegion() Returns a newly created VTTRegion object. Properties VTTRegion.id A DOMString that identifies the region. VTTRegion.width A double representing the width of the region, as a percentage of the video. VTTRegion.lines A double representing the height of the region, in number of lines. VTTRegion.regionAnchorX A double representing the region anchor X offset, as a percentage of the region. VTTRegion.regionAnchorY A double representing the region anchor Y offset, as a percentage of the region. VTTRegion.view
portAnchorX A double representing the view
port anchor X offset, as a percentage of the video. ...
...e representing the height of the region, in number of lines. VTTRegion.regionAnchorX A double representing the region anchor X offset, as a percentage of the region. VTTRegion.regionAnchorY A double representing the region anchor Y offset, as a percentage of the region. VTTRegion.view
portAnchorX A double representing the view
port anchor X offset, as a percentage of the video. VTTRegion.view
portAnchorY A double representing the view
port anchor Y offset, as a percentage of the video. VTTRegion.scroll An enum representing how adding new cues will move existing cues. Examples var region = new VTTRegion(); region.width = 50; // Use 50% of the video width region.lines = 4; // Use 4 lines of height. region.view
portAnchorX = 25; // Have the region start at 25% from the left. var cue = ...
WebGLRenderingContext.makeXRCompatible() - Web APIs
text has been lost or there is no available WebXR device. Usage notes Because makeXRCompatible() may involve replacing the underlying WebGL context with a new one that uses the new rendering hardware, the existing contents of the context may be lost and, therefore, would need to be re-rendered. This is why the webglcontextlost and webglcontextrestored events are used: the first gives you the op
portunity to discard anything you won't need anymore, while the second gives you the op
portunity to load resources and prepare to render the scene in its new context. While this method is available through the WebGLRenderingContext interface, it's actually defined by the WebXR Device API rather than by WebGL. Examples This example demonstrates code logic you might find in a game that starts up usin...
...buttons looks lke this: <button class="green button" type="button">Start Game</button> <button class="blue button use-webxr" type="button">Start Game (VR mode)</button> The first button starts the game, continuing to present the game onscreen as usual. The second button will be used to start the game in immersive-vr mode. Note the inclusion of a use-webxr class on the VR mode button. This is im
portant, which we'll explore shortly. JavaScript The code that handles starting up graphics, switching to VR mode, and so forth looks like this: const outputCanvas = document.querySelector(".output-canvas"); const gl = outputCanvas.getContext("webgl"); let xrSession = null; let usingXR = false; let currentScene = "scene1"; let glStartButton; let xrStartButton; window.addEventListener("load", (even...
Detect WebGL - Web APIs
To that end we will try to obtain the WebGL rendering context from a canvas element. The WebGL rendering context is an interface, through which you can set and query the state of the graphics machine, send data to the WebGL, and execute draw commands. Saving the state of the graphics machine within a single context interface is not unique to WebGL. This is also done in other graphics {{Glossary("API")}}, such as the canvas 2D rendering context. ...
...ebGLContext, false); function detectWebGLContext () { // Create canvas element. The canvas is not added to the // document itself, so it is never displayed in the // browser window. var canvas = document.createElement("canvas"); // Get WebGLRenderingContext from canvas element. var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); // Re
port the result. if (gl && gl instanceof WebGLRenderingContext) { paragraph.innerHTML = "Congratulations! Your browser sup
ports WebGL."; } else { paragraph.innerHTML = "Failed to get WebGL context. " + "Your browser or device may not sup
port WebGL."; } } }, false); The source code of this example is also available on GitHub. << PreviousNext >> ...
Simple color animation - Web APIs
tion. The timer and the timer handler function establish the animation loop, a set of drawing commands that are executed at a regular period (typically, every frame; in this case, once per second). ...
...r canvas and button. stopAnimation({type: "click"}); var gl; function drawAnimation () { if (!gl) { var canvas = document.getElementById("canvas-view"); gl = canvas.getContext("webgl") ||canvas.getContext("experimental-webgl"); if (!gl) { clearInterval(timer); alert("Failed to get WebGL context.\n" + "Your browser or device may not sup
port WebGL."); return; } gl.view
port(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); } // Get a random color value using a helper function. var color = getRandomColor(); // Set the WebGLRenderingContext clear color to the // random color. gl.clearColor(color[0], color[1], color[2], 1.0); // Clear the context with the newly set color. g...
WebGL tutorial - Web APIs
WebGL programs consist of control code written in JavaScript and special effects code (shader code) that is executed on a computer's Graphics Processing Unit (GPU). WebGL elements can be mixed with other HTML elements and composited with other parts of the page or page background. This tutorial describes how to use the <canvas> element to draw WebGL graphics, starting with the basics. ...
... element to draw WebGL graphics, starting with the basics. The examples provided should give you some clear ideas what you can do with WebGL and will provide code snippets that may get you started in building your own content. Before you start Using the <canvas> element is not very difficult, but you do need a basic understanding of HTML and JavaScript. The <canvas> element and WebGL are not sup
ported in some older browsers, but are sup
ported in recent versions of all major browsers. In order to draw graphics on the canvas we use a JavaScript context object, which creates graphics on the fly. In this tutorial Getting started with WebGL How to set up a WebGL context. Adding 2D content to a WebGL context How to render simple flat shapes using WebGL. Using shaders to apply color in WebG...
WebGL model view projection - Web APIs
impleProjectionMatrix() method is added. This is called in the draw() method and has the scale factor passed to it. The result should be identical to the last example: CubeDemo.prototype.computeSimpleProjectionMatrix = function(scaleFactor) { this.transforms.projection = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, scaleFactor, 0, 0, 0, scaleFactor ]; }; Although the result is identical, the im
portant step here is in the vertex shader. Rather than modifying the vertex directly, it gets multiplied by an additional projection matrix, which (as the name suggests) projects 3D points onto a 2D drawing surface: // Make sure to read the transformations in reverse order gl_Position = projection * model * vec4(position, 1.0); The results View on JSFiddle The viewing frustum Before we move on...
...ined in these examples. In short, it combines dividing by w (as done with the previous examples) with some ingenious manipulations based on similar triangles. If you want to read a full explanation of the math behind it check out some of the following links: OpenGL Projection Matrix Perspective Projection Trying to understand the math behind the perspective projection matrix in WebGL One im
portant thing to note about the perspective projection matrix used below is that it flips the z axis. In clip space the z+ goes away from the viewer, while with this matrix it comes towards the viewer. The reason to flip the z axis is that the clip space coordinate system is a left-handed coordinate system (wherein the z-axis points away from the viewer and into the screen), while the convention in m...
Writing WebSocket client applications - Web APIs
of "protocolOne" is named in the request for the socket in this example, though this can be omitted. var exampleSocket = new WebSocket("wss://www.example.com/socketserver", "protocolOne"); On return, exampleSocket.readyState is CONNECTING. The readyState will become OPEN once the connection is ready to transfer data. If you want to open a connection and are flexible about the protocols you sup
port, you can specify an array of protocols: var exampleSocket = new WebSocket("wss://www.example.com/socketserver", ["protocolOne", "protocolTwo"]); Once the connection is established (that is, readyState is OPEN), exampleSocket.protocol will tell you which protocol the server selected. Establishing a WebSocket relies on the HTTP Upgrade mechanism, so the request for the protocol upgrade is impli...
...itted on the network. If this value isn't 0, there's pending data still, so you may wish to wait before closing the connection. Security considerations WebSockets should not be used in a mixed content environment; that is, you shouldn't open a non-secure WebSocket connection from a page loaded using HTTPS or vice-versa. Most browsers now only allow secure WebSocket connections, and no longer sup
port using them in insecure contexts. ...
Writing a WebSocket server in C# - Web APIs
n Control Protocol) connection. Luckily, C# has a TcpListener class which does as the name suggests. It is in the System.Net.Sockets namespace. It is a good idea to include the namespace with the using keyword in order to write less. It allows usage of a namespace's classes without typing the full namespace every time. TcpListener Constructor: TcpListener(System.Net.IPAddress localaddr, int
port) localaddr specifies the IP of the listener, and
port specifies the
port. To create an IPAddress object from a string, use the Parse static method of IPAddress. Methods: Start() System.Net.Sockets.TcpClient AcceptTcpClient() Waits for a Tcp connection, accepts it and returns it as a TcpClient object. Here's a barebones server implementation: using System.Net.Sockets; using System.Ne...
...ew Byte[4] {61, 84, 35, 6}; for (int i = 0; i < encoded.Length; i++) { decoded[i] = (Byte)(encoded[i] ^ mask[i % 4]); } Put together wsserver.cs // // csc wsserver.cs // wsserver.exe using System; using System.Net; using System.Net.Sockets; using System.Text; using System.Text.RegularExpressions; class Server { public static void Main() { string ip = "127.0.0.1"; int
port = 80; var server = new TcpListener(IPAddress.Parse(ip),
port); server.Start(); Console.WriteLine("Server has started on {0}:{1}, Waiting for a connection...", ip,
port); TcpClient client = server.AcceptTcpClient(); Console.WriteLine("A client connected."); NetworkStream stream = client.GetStream(); // enter to an infinite cycle to be abl...
Web Animations API Concepts - Web APIs
To learn how to put the API to use, check out its sister article, Using the Web Animations API. The Web Animations API fills the gap between declarative CSS animations and transitions, and dynamic JavaScript animations. ...
...go from one pre-defined state to another, or we can use variables, loops, and callbacks to create interactive animations that adapt and react to changing inputs. History Over a decade ago, Synchronized Multimedia Integration Language, or SMIL (pronounced "smile"), brought animation to SVG. Back then it was the only animation engine browsers had to worry about. While four out of five browsers sup
ported SMIL, it only animated SVG elements, could not be used from CSS, and was very complex -- often leading to inconsistent implementations. Ten years later, the Safari team introduced the CSS Animations and CSS Transitions specs. The Internet Explorer team requested an animations API to consolidate and normalize animation functionality across all browsers, and thus efforts began in earnest among M...
Basic concepts behind Web Audio API - Web APIs
ou enough background to understand why the Web Audio API works like it does. Audio graphs The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources -- with different types of channel layout -- are sup
ported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects. Audio nodes are linked via their inputs and outputs, forming a chain that starts with one or more sources, goes through one or more nodes, then ends up at a destination. Although, you don't have to provide a destination if you, say, just want to visualize some audi...
...the number of full frequency range audio channels that the signal includes. The number after the period indicates the number of those channels which are reserved for low-frequency effect (LFE) outputs; these are often referred to as subwoofers. Each input or output is composed of one or more audio channels, which together represent a specific audio layout. Any discrete channel structure is sup
ported, including mono, stereo, quad, 5.1, and so on. Audio sources can be obtained in a number of ways: Sound can be generated directly in JavaScript by an audio node (such as an oscillator). Created from raw PCM data (the audio context has methods to decode sup
ported audio formats). Taken from HTML media elements (such as <video> or <audio>). Taken directly from a WebRTC MediaStream (such a...
Web audio spatialization basics - Web APIs
ning effect, our StereoPannerNode example (see source code) should give you everything you need. 3D boombox demo To demonstrate 3D spatialization we've created a modified version of the boombox demo we created in our basic Using the Web Audio API guide. see the 3D spatialization demo live (and see the source code also). The boombox sits inside a room (defined by the edges of the browser view
port), and in this demo, we can move and rotate it with the provided controls. When we move the boombox, the sound it produces changes accordingly, panning as it moves to the left or right of the room, or becoming quieter as it is moved away from the user or is rotated so the speakers are facing away from them, etc. This is done by setting the different properties of the PannerNode object instance in ...
...ioCtx.listener; const posX = window.innerWidth/2; const posY = window.innerHeight/2; const posZ = 300; listener.positionX.value = posX; listener.positionY.value = posY; listener.positionZ.value = posZ-5; We could move the listener left or right using positionX, up or down using positionY, or in or out of the room using positionZ. Here we are setting the listener to be in the middle of the view
port and slightly in front of our boombox. We can also set the direction the listener is facing. The default values for these work well: listener.forwardX.value = 0; listener.forwardY.value = 0; listener.forwardZ.value = -1; listener.upX.value = 0; listener.upY.value = 1; listener.upZ.value = 0; The forward properties represent the 3D coordinate position of the listener's forward direction (e.g. th...
Web NFC API - Web APIs
Interfaces NDEFMessage Interface that represents NDEF messages that can be received from or sent to a compatible device or tag via NDEFReader and NDEFWriter objects respectively. ...
... Interfaces NDEFMessage Interface that represents NDEF messages that can be received from or sent to a compatible device or tag via NDEFReader and NDEFWriter objects respectively. ...
window.cancelAnimationFrame() - Web APIs
estAnimationFrame() that requested the callback. ...
...questAnimationFrame; var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame; var start = window.mozAnimationStartTime; // Only sup
ported in FF. Other browsers can use something like Date.now(). var myReq; function step(timestamp) { var progress = timestamp - start; d.style.left = Math.min(progress / 10, 200) + 'px'; if (progress < 2000) { // it's im
portant to update the requestId each time you're calling requestAnimationFrame myReq = requestAnimationFrame(step); } } myReq = requestAnimationFrame(step); // the cancelation uses the last requestId cancelAnimationFrame(myReq); Specifications Specification Status Comment HTML Living StandardThe definition of 'cancelAnimationFrame()' in that specification. Living St...
Window.scrollX - Web APIs
to the left. If the document is rendered on a subpixel-precise device, then the returned value is also subpixel-precise and may contain a decimal component. If the document isn't scrolled at all left or right, then scrollX is 0. If you need an integer value, you can use Math.round() to round it off. In more technical terms, scrollX returns the X coordinate of the left edge of the current view
port. If there is no view
port, the returned value is 0. Example This example checks the current horizontal scroll position of the document. If it's greater than 400 pixels, the window is scrolled back to the beginning. if (window.scrollX > 400) { window.scroll(0,0); } Notes The pageXOffset property is an alias for the scrollX property: window.pageXOffset == window.scrollX; // always true For ...
... greater than 400 pixels, the window is scrolled back to the beginning. if (window.scrollX > 400) { window.scroll(0,0); } Notes The pageXOffset property is an alias for the scrollX property: window.pageXOffset == window.scrollX; // always true For cross-browser compatibility, use window.pageXOffset instead of window.scrollX. Additionally, older versions of Internet Explorer (< 9) do not sup
port either property and must be worked around by checking other non-standard properties. A fully compatible example: var x = (window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft; var y = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || doc...
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
ecution context is returned to the browser's event loop. This lets your code run without interfering with any other, potentially higher priority, code that is pending, but before the browser regains control over the execution context, potentially depending on work you need to complete. You can learn more about how to use microtasks and why you might choose to do so in our microtask guide. The im
portance of microtasks comes in its ability to perform tasks asynchronously but in a specific order. See Using microtasks in JavaScript with queueMicrotask() for more details. Microtasks are especially useful for libraries and frameworks that need to perform final cleanup or other just-before-rendering tasks. queueMicrotask() is exposed on the WindowOrWorkerGlobalScope mixin. Syntax scope.queueMic...
... } }; When queueMicrotask() isn't available The code below is basically a monkey-patch for queueMicrotask() for modern engines. It creates a microtask by using a promise that resolves immediately. if (typeof window.queueMicrotask !== "function") { window.queueMicrotask = function (callback) { Promise.resolve() .then(callback) .catch(e => setTimeout(() => { throw e; })); // re
port exceptions }; } Specifications Specification Status Comment HTML Living StandardThe definition of 'self.queueMicrotask()' in that specification. Living Standard Initial definition ...
WorkerGlobalScope - Web APIs
Also available via the WorkerGlobalScope.onrejectionhandled property. unhandledrejection An event handler for unhandled Promise rejection events. Also available via the WorkerGlobalScope.onunhandledrejection property. Methods This interface inherits methods from the EventTarget interface and WindowOrWorkerGlobalScope and WindowEventHandlers mixins. Standard methods WorkerGlobalScope.im
portScripts() Im
ports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example: im
portScripts('foo.js', 'bar.js'); Non-standard methods WorkerGlobalScope.dump() Allows you to write a message to stdout -- i.e. in your terminal. This is the same as Firefox's window.dump, but for workers. Methods implemented from elsewhere WindowOr...
...was made to stop close() being available on service workers, as it isn't supposed to be used there and always throws an exception when called (see bug 1336043). Example You won't access WorkerGlobalScope directly in your code; however, its properties and methods are inherited by more specific global scopes such as DedicatedWorkerGlobalScope and SharedWorkerGlobalScope. For example, you could im
port another script into the worker and print out the contents of the worker scope's navigator object using the following two lines: im
portScripts('foo.js'); console.log(navigator); Since the global scope of the worker script is effectively the global scope of the worker you are running (DedicatedWorkerGlobalScope or whatever) and all worker global scopes inherit methods, properties, etc. from Work...
XMLHttpRequest.responseType - Web APIs
ng taken from the XMLHttpRequestResponseType enum which specifies what type of data the response contains. When setting responseType to a particular value, the author should make sure that the server is actually sending a response compatible with that format. If the server returns data that is not compatible with the responseType that was set, the value of response will be null. The values sup
ported by responseType are the following: "" An empty responseType string is treated the same as "text", the default type. arraybuffer The response is a JavaScript ArrayBuffer containing binary data. blob The response is a Blob object containing the binary data. document The response is an HTML Document or XML XMLDocument, as appropriate based on the MIME type of the received data. See HTML ...
... MIME type of the received data. See HTML in XMLHttpRequest to learn more about using XHR to fetch HTML content. json The response is a JavaScript object created by parsing the contents of received data as JSON. text The response is a text in a DOMString object. ms-stream The response is part of a streaming download; this response type is only allowed for download requests, and is only sup
ported by Internet Explorer. Exceptions InvalidAccessError An attempt was made to change the value of responseType on anXMLHttpRequest which is in synchronous mode but not in a Worker. For additional details, see Synchronous XHR restrictions below. Usage notes Synchronous XHR restrictions You cannot change the value of responseType in a synchronous XMLHttpRequest except when the request belo...
XRPermissionDescriptor.mode - Web APIs
rmissionDescriptor.mode; Value A DOMString whose value is one of the strings found in the XRSessionMode enumerated type: immersive-ar The session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend the content together. Im
portant: The immersive-ar mode is defined by the WebXR Augmented Reality Module, which is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected...
...f the hardware requires it. inline The output is presented inline within the context of an element in a standard HTML document, rather than occupying the full visual space. Inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. Inline sessions don't require special hardware and should be avalable on any user agent offering WebXR API sup
port. Usage notes Examples The example below checks to ensure that permission has been granted to allow the user to use WebXR for an immersive virtual reality experience. No specific features are specified during this query; see requiredFeatures and optionalFeatures for more information on specifying features during a WebXR permission check. let xrPermissionDesc = { name: "xr", mode: "immersi...
XRPermissionDescriptor.requiredFeatures - Web APIs
This ensures that permissions are checked as applicable to ensure that those features are available upon request. ...
...their origin point. The viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is sup
ported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Usage notes Examples In this example, permissions are ...
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
bject to the point given by originOffset. If the object on which you call this method is an XRBoundedReferenceSpace, the returned object is one as well. The boundsGeometry of the new reference space is set to the original object's boundsGeometry with each of its points multiplied by the inverse of originOffset. Examples Below are some examples showing how to use getOffsetReferenceSpace(). Tele
porting or setting the position of the viewer Upon first creating a scene, you may need to set the user's position within the 3D world. You can do that using getOffsetReferenceSpace(). xrSession.requestReferenceSpace("local") .then((refSpace) => { xrReferenceSpace = refSpace; xrReferenceSpace = xrReferenceSpace.getOffsetReferenceSpace( new XRRigidTransform(startPosition, {x:0, y:0, z:1.0...
...rawFrame); }); In this code, we obtain a local reference space, then use getOffsetReferenceSpace() to create a new space whose origin is adjusted to a position given by startPosition and whose orientation is looking directly along the Z azis. Then the first animation frame is requested using XRSession's requestAnimationFrame(). Implementing rotation based on non-XR inputs The input controls sup
ported directly by WebXR are all dedicated VR or AR input devices. In order to use mouse, keyboard, or other input devices to move or otherwise transform objects in the 3D space--or to allow the user to move through the space--you'll need to write some code to read the inputs and move perform the movements. This is another good use case for getOffsetReferenceSpace(). In this example, we'll show code ...
XRReferenceSpace: reset event - Web APIs
ained tracking, and that their new position represents a correction from the previously emulated values. This is typically the desired behavior if your site or app doesn't simulate motion through the space by expressly changing the position and/or orientation of the viewer (rather than the user's physical movements being used by the XR device to introduce movement). ...
...on of the viewer (rather than the user's physical movements being used by the XR device to introduce movement). However, if that kind of "tele
portation" is being used, you actually want to avoid jumping the user's position after tracking recovery, this can introduce additional and potentially jarring jumping. Instead of allowing this to happen, you can integrate the emulatedPosition into the tele
portation offset calculated prior to calling getOffsetReferenceSpace() to create a new reference space whose updated effective origin is adjusted by the distance the viewer's position jumped since the previous frame. This way, the user's position only changes once rather than twice. The effect of discontinuity size The reset event won't be fired when the discontinuity is small enough that the device...
XRReferenceSpace - Web APIs
The WebXR Device API's XRReferenceSpace interface describes the coordinate system for a specific tracked entity or object within the virtual world using a specified tracking behavior. The tracking behavior is defined by the selected reference space type. It expands upon the base class, XRSpace, by adding sup
port for several different tracking behaviors as well as to request a new reference space which describes the offset transform between the tracked object and another location in the world. All reference spaces--with the sole exception being bounded reference spaces--are described using the XRReferenceSpace type. Bounded spaces are implemented as XRBoundedReferenceSpace objects. These are special spaces which let you establish a perimeter within which it's "safe" for the viewer to move. ...
...their origin point. The viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is sup
ported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Usage notes Creating an XRReferenceSpace There are two...
XRReferenceSpaceType - Web APIs
This type is used when calling the requestReferenceSpace() method to obtain a reference space for an XRSession. Values The reference space returned by XRSession.requestReferenceSpace() is either XRReferenceSpace or XRBoundedReferenceSpace. The "Interface" column in the table below indicates which of the two types is returned for each reference space type constant.. Reference space descriptors The types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them. ...
...their origin point. The viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is sup
ported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Specifications Specification Status Comm...
XRSession.requestReferenceSpace() - Web APIs
their origin point. The viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is sup
ported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Return value A Promise that resolves with an XRReferenc...
...input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Return value A Promise that resolves with an XRReferenceSpace object. Exceptions Rather than throwing true exceptions, requestReferenceSpace() rejects the returned promise with a DOMException whose name is found in the list below: NotSup
portedError The requested reference space is not sup
ported. Specifications Specification Status Comment WebXR Device APIThe definition of 'requestReferenceSpace()' in that specification. Working Draft Initial definition. ...
XRSessionInit - Web APIs
onInit specifies required and/or optional features when requesting a new XRSession by calling the navigator.xr.requestSession() method. Properties The following parameters are all optional. If none are included, the device will use a default feature configuration for all options. optionalFeatures Optional An array of values identifying features which the returned XRSession may optionally sup
port. At this time, all features are identified using strings from the XRReferenceSpaceType enumeration, but future updates to the WebXR standard may add more features. requiredFeatures Optional An array of values which the returned XRSession must sup
port. These values currently must come from the enumerated type XRReferenceSpaceType. More features may be added in future updates to the WebXR standar...
...ture updates to the WebXR standard may add more features. requiredFeatures Optional An array of values which the returned XRSession must sup
port. These values currently must come from the enumerated type XRReferenceSpaceType. More features may be added in future updates to the WebXR standard. Default features Immersive sessions All immersive (both immersive-vr and immersive-ar) sessions sup
port both the viewer and local reference spaces. Because immersive sessions are required to sup
port the local reference space, any request to open an immersive XRSession is required to obtain explicit or implicit user consent. Inline sessions All inline WebXR sessions sup
port the viewer reference space. Security requirements Each reference space or feature type has minimum safety requirements. By...
XRViewerPose.views - Web APIs
For each frame, you should always use the current length of this array rather than caching the value. ...
...ews in the pose; these are most likely the views for the left and right eyes. let pose = frame.getViewerPose(xrReferenceSpace); if (pose) { let glLayer = xrSession.renderState.baseLayer; gl.bindFrameBuffer(gl.FRAMEBUFFER, glLayer.framebuffer); gl.clearColor(0, 0, 0, 1); gl.clearDepth(1); gl.clear(gl.COLOR_BUFFER_BIT, gl.DEPTH_BUFFER_BIT); for (let view of pose.views) { let view
port = glLayer.getView
port(view); gl.view
port(view
port.x, view
port.y, view
port.width, view
port.height); /* render the scene for the eye view.eye */ } } Passing each view to getView
port() returns the WebGL view
port to apply in order to cause the rendered output to be positioned correctly in the framebuffer for renderijng to the corresponding eye on the output device. This code is derived ...
XRWebGLLayerInit.antialias - Web APIs
The Boolean antialias property, if present and set to true in the XRWebGLLayerInit object provided as the XRWebGLLayer() constructor's layerInit parameter, requests that the new WebGL rendering layer sup
port anti-aliasing. If this property is missing or is false, anti-aliasing is not desired. There is no way to request a specific anti-aliasing format or level; this decision is left up to the user agent. Syntax let layerInit = { antialias: boolValue }; let glLayer = new XRWebGLLayer(xrSession, gl, layerInit); let glLayer = new XRWebGLLayer(xrSession, gl, { antialias: boolValue }); Value A Boolean value which can be set to true to request anti-aliasing sup
port in the new WebGL rendering layer. If false, anti-aliasing is not desired. Usage notes The state of anti-aliasing for the co...
...e notes The state of anti-aliasing for the context after being created can be read from the XRWebGLLayer property antialias. Example In this example, before creating a new XRWebGLLayer to use for rendering, the value of a user preference from a configuration interface is obtained using a function called getPreferenceValue() to determine whether the user has enabled or disabled anti-aliasing sup
port; this is passed into the constructor. let options = { antialias: getPreferenceValue("antialiasing") }; let glLayer = new XRWebGLLayer(xrSession, gl, options); if (glLayer) { xrSession.updateRenderState({ baseLayer: glLayer }); } Offering the user features such as the ability to enable or disable things like anti-aliasing can provide them with optiions to try when your app isn't performing...
ARIA Screen Reader Implementors Guide - Accessibility
Live Regions This is just a guide. Live region markup is a complex area which is somewhat open to interpretation. The following is intended to provide implementation guidance that respects screen readers developers' need to try different things. The intention is to strike a balance between providing useful guidance on how to use the markup's intended meaning while sup
porting live regions as an area for screen readers to innovate and compete. Interpreting WAI-ARIA live region markup Live changes are hints: in general live region markup is provided by the author as hints, and the assistive technology may allow for global, site or even region-specific settings, as well as heuristics to help with live changes on pages that have no WAI-ARIA hints. Optionally, create a second, additional ...
...eue remove an earlier event for the same region. It is probably desirable to have at least a tiny timeout before presenting atomic region changes, in order to avoid presenting the region twice for two changes that occur quickly one after the other. Include labels when presenting changes: if the change occurs in something with a semantic label of some kind, speak the label. This is particularly im
portant for changes in data cells, where the column and row headers provide im
portant contextual information. Ideas for Settings and Heuristics Allow for a different voice (in text-to-speech) or other varying presentational characteristics to set live changes apart. When no WAI-ARIA markup is present, automatically present some changes unless the user configures all live changes to off. For exampl...
Using the alertdialog role - Accessibility
ole should be used instead in that case (as the described in the Using the alert role technique). Possible effects on user agents and assistive technology When the alertdialog role is used, the user agent should do the following: Expose the element as a dialog in the operating system's accessibility API. Fire an accessible alert event using the operating system's accessibility API if it sup
ports it. When the alert dialog appears, screen readers should announce the alert. When the alert dialog is correctly labeled and focus is moved to a control inside the dialog, screen readers should announce the dialog's accessible role, name and optionally description before announcing the focused element. Note: Opinions may differ on how assistive technology should handle this technique. The in...
...ndex="0"> <h2 id="dialog1Title">Your login session is about to expire</h2> <p id="dialog1Desc">To extend your session, click the OK button</p> <button>OK</button> </div> </div> Working Examples: TBD Notes ARIA attributes used alertdialog aria-labelledby aria-describedby Related ARIA techniques using the dialog role using the alert role Compatibility TBD: Add sup
port information for common UA and AT product combinations Additional resources ...
Using the aria-labelledby attribute - Accessibility
ded information that the user might need. In addition to form elements, you can use the aria-labelledby attribute to associate static text with widgets, groups of elements, panes, regions that have a heading, definitions, and other types of objects. The Examples section below provides more information on how to use the attribute this way. To improve compatibility with user agents that do not sup
port ARIA, you can use aria-labelledby with the <label> element (using the for attribute). This attribute can be used with any typical HTML form element; it is not limited to elements that have an ARIA role assigned. Value A space-separated list of element IDs Possible effects on user agents and assistive technology When user agents compute the accessible name property of elements that have both...
... <div role="menuitem">Save</div> <div role="menuitem">Save as ...</div> ... </div> ... ...
Using the aria-required attribute - Accessibility
Description The aria-required attribute is used to indicate that user input is required on an element before a form can be submitted. This attribute can be used with any typical HTML form element; it is not limited to elements that have an ARIA role assigned. HTML5 now has the required attribute, but aria-required is still useful for user agents that do not yet sup
port HTML5. Value true or false (Default: false) Possible effects on user agents and assistive technology Screen readers should announce the field as required. Note that this attribute will not automatically change the presentation of the field. Note: Opinions may differ on how assistive technology should handle this technique. The information provided above is one of those opinions and therefore not normative. Ex...
...> <br/> <label for="streetAddress">Street address:</label> <input id="streetAddress" type="text" /> </form> Working Examples: Tooltip example (includes the use of the aria-required attribute) Notes Used in ARIA roles Combobox Gridcell Listbox Radiogroup Spinbutton Textbox Tree Related ARIA techniques Using the aria-invalid attribute Compatibility TBD: Add sup
port information for common UA and AT product combinations Additional resources WAI-ARIA specification for aria-required WAI-ARIA Authoring Practices for forms Constraint validation in HTML5 ...
Using the article role - Accessibility
for example in syndication. Articles can be nested; for example, a web log entry on a site that accepts user-submitted comments could represent the comments as articles nested within the article for the web log entry. The ARIA article role is similar to the HTML5 article element; however the article element should still be given the ARIA role of article, since not all assistive technologies sup
port HTML5 yet. Possible effects on user agents and assistive technology When the user navigates an element assigned the role of article, assistive technologies that typically intercept standard keyboard events SHOULD switch to document browsing mode, as opposed to passing keyboard events through to the web application. Assistive technologies MAY provide a feature allowing the user to navigate the...
...lass="content"> <p>A very interesting post</p> </section> <section class="comments"> <div class="comment" role="article"> <p>Meaningful comment</p> </div> <div class="comment" role="article"> <p>Positive comment</p> </div> </section> </article> Notes ARIA attributes used Related ARIA techniques ARIA Techniques - List of Roles Compatibility TBD: Add sup
port information for common UA and AT product combinations Additional resources WAI-ARIA specification for the article role ...
Using the group role - Accessibility
e of region or a standard landmark role. Possible effects on user agents and assistive technology When the group role is added to an element, or such an element becomes visible, the user agent should do the following: Expose the element as having a group role in the operating system's accessibility API. Fire an accessible group event using the operating system's accessibility API if it sup
ports it. Assistive technology products should listen for such an event and notify the user accordingly: Screen readers should announce the group when focus first lands on a control inside it, and if aria-describedby has been set, the description may be spoken. Following this the focused control may be announced. Screen magnifiers may enlarge the group. Note: Opinons may differ on how assistiv...
...les: File Directory Treeview Example Using Computed Properties Navigation Treeview Example Using Declared Properties Notes Group members that are outside of the DOM subtree of the group need to have explicit relationships assigned to them in order to participate in the group. ARIA attributes used group Related ARIA techniques region role Compatibility TBD: Add sup
port information for common UA and AT product combinations Additional resources ARIA Authoring Practices - Accessible Name Guidance by Role - group ...
Using the link role - Accessibility
ve technology. The link role is used to identify an element that creates a hyperlink to a resource that is in the application or external. When this role is added to an element, tab can be used to change focus to the link, and enter used to execute the link. Note: Where possible, it is recommended that you use a native <a> element rather than the link role, as native elements are more widely sup
ported by older user agents and assistive technology. Native <a> elements also sup
port keyboard and focus requirements by default, without need for additional customization. The tabindex attribute may optionally be used with this role to directly specify the position of the element in the tab order. Possible effects on user agents and assistive technology When the link role is added to an element,...
...he position of the element in the tab order. Possible effects on user agents and assistive technology When the link role is added to an element, or such an element becomes visible, the user agent should do the following: Expose the element as having a link role in the operating system's accessibility API. Fire an accessible link event using the operating system's accessibility API if it sup
ports it. Assistive technology products should listen for such an event and notify the user accordingly: Screen readers should announce the text of the link or its label when it is focused, along with the fact that it is a link. ARIA links should be included in the screen reader's "List Links" function just like ordinary links, and actions in this dialogue list, such as "Activate Link" or "Move t...
Using the log role - Accessibility
ertive" can be set for more aggressive updates. Possible effects on user agents and assistive technology When the log role is added to an element, or such an element becomes visible, the user agent should do the following: Expose the element as having a log role in the operating system's accessibility API. Fire an accessible log event using the operating system's accessibility API if it sup
ports it. Assistive technology products should listen for such an event and notify the user accordingly: Screen readers should announce changes inside a log when the user is idle, unless aria-live="assertive" has been set and in which case the user may be interrupted. Screen magnifiers may visually indicate that a log update has occurred. Note: Opinons may differ on how assistive technology sh...
... </ul> </div> Working Examples: http://websiteaccessibility.donaldevans.com/2011/07/12/aria-log/ Notes Using the log role on an element implies that element has aria-live="polite". ...
ARIA: article role - Accessibility
t, etc. ... </article> <article> ... </article> Description The article role denotes a section of a document, page, or site that, if it were standing on its own, could be viewed as a complete document, page or site. The aim of a set of article sections is to indicate their relationship to one another. Articles are not considered a navigational landmark, but many assistive technologies that sup
port landmarks also sup
port a means to navigate among articles. They may also sup
port indication of nesting relationships within articles. Articles can be nested, indicating that a nested article directly relates to the one it is nested in, but not necessarily to the ones outside the nesting hierarchy. See the examples for specific use cases. If an article is part of a feed, it can have the aria-pos...
...forum or blog post, any an item in a social media feed. Associated WAI-ARIA roles, states, and properties aria-posinset In the context of a feed, indicates the position of this particular article within that feed, based on a count starting at 1. aria-setsize In the context of a feed, indicates how many article items there are within that feed. Keyboard interactions This role does not sup
port any specific keyboard interaction. Required JavaScript features Event handlers This role does not require any event handlers to be present. Changing attribute values When constructing a feed, set the aria-posinset and aria-setsize attributes on each article role to the appropriate values, bearing in mind that aria-posinset is 1-based. Always use native element if available. Instead of a...
ARIA: Complementary role - Accessibility
These sections are frequently presented as sidebars or call-out boxes. If possible, use the HTML <aside> element instead. <div role="complementary"> <h2>Our partners</h2> <!-- complementary section content --> </div> This is a sidebar containing links to event sponsors. Description The complementary role is a landmark role. Landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. Content listed within a container with the complementary landmark role should make sense if separated from the main content of the document. ...
...ions of the document. Landmarks browser extension Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA: Complementary role' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'Complementary landmark role' in that specification. Working Draft Screen reader sup
port TBD ...
ARIA: feed role - Accessibility
mode are responsible for: Indicating which article contains the reading cursor by ensuring the article element or one of its descendants has DOM focus. Providing reading mode keys that move DOM focus to the next and previous articles. Providing reading mode keys for moving the reading cursor and DOM focus past the end and before the start of the feed. Keyboard interaction Sup
porting the following, or a similar, interface is recommended when focus is inside the feed: Page Down: Move focus to next article. Page Up: Move focus to previous article. Control + End: Move focus to the first focusable element after the feed. Control + Home: Move focus to the first focusable element before the feed. If a feed is nested within a feed, such as a comments feed within a feed of...
...cept as required by any attributes. For example, setting aria-busy to true during the update operation if needed, and then to false upon completion. Examples Example Implementation of Feed Pattern Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'feed' in that specification. Recommendation Screen reader sup
port Coming soon ...
ARIA: form role - Accessibility
The form landmark role can be used to identify a group of elements on a page that provide equivalent functionality to an HTML form. <div role="form" id="contact-info" aria-label="Contact information"> <!-- form content --> </div> This is a form that collects and saves a user's contact information. Im
portant: Use an HTML <form> element to contain your form controls, rather than the ARIA form role, unless you have a very good reason. The HTML <form> element is sufficient to tell assistive technologies that there is a form. Description A form landmark identifies a region of content that contains a collection of items and objects that, as a whole, combine to create a form when no other named landmark is appropriate (e.g. main or search). Using the <form> element will automaticall...
...ate to large sections of the document. Landmarks browser extension Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA Form Role' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'Role Form' in that specification. Working Draft Screen reader sup
port TBD ...
ARIA: grid role - Accessibility
teractive content. While it does not imply a specific visual presentation, it implies a relationship among elements. Uses fall into two categories: presenting tabular information (data grids) and grouping other widgets (layout grids). Even though both data grids and layout grids employ the same ARIA roles, states, and properties, differences in their content and purpose surface factors that are im
portant to consider in keyboard interaction design. See ARIA Authoring practices for more details Cell elements have the role gridcell, unless they are a row or column header. Then the elements are rowheader and columnheader, respectively. Cell elements need to be owned by elements with a row role. Rows can be grouped using rowgroups. If the grid is used as an interactive widget, keyboard interactio...
...hat the functionality and interaction needed can be best achieved using the grid role. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'Role Grid' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'Role Grid' in that specification. Working Draft Screen reader sup
port TBD ...
ARIA: gridcell role - Accessibility
If at all possible, utilize native HTML table markup in their place. Best practices The first rule of ARIA is: if a native HTML element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and adding an ARIA role, state or property to m...
... </div> </div> <div role="rowgroup"> <div role="row"> <div role="gridcell">Saturn</div> <div role="gridcell">120,536</div> <div role="gridcell">10.7</div> <div role="gridcell">1433.5</div> <div role="gridcell">62</div> </div> </div> </div> Accessibility concerns Sup
port for gridcell and certain gridcell-related ARIA roles and properties have poor sup
port with assistive technologies. If at all possible, utilize native HTML table markup in their place. Best practices The first rule of ARIA is: if a native HTML element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and adding an ARIA role, state or property to make it accessible. As such, it is recommended to use the utilize native HTML table mar...
ARIA: List role - Accessibility
elements to mark up a list and its listitems -- <ul>/<ol> and <li>. See Best practices for a full example. Associated WAI-ARIA Roles, States, and Properties listitem A single item in a list or directory. Elements with role listitem can only be found in an element with the role list or group. group A collection of related objects, limited to list items when nested in a list, not im
portant enough to have their own place in a pages table of contents. Keyboard Interactions None. Required JavaScript features None. Examples ARIA Lists -- some useful examples and thoughts by Scott O'Hara Best practices Only use role="list" and role="listitem" if you have to -- for example if you don't have control over your HTML but are able to improve accessibility dynamically after the ...
...ed lists, are visible to assistive technologies. Note: If you are marking up a list of items that will function as a tabbed interface, you should instead use the tab, tabpanel, and tablist roles. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'list' in that specification. Recommendation Screen reader sup
port TBD ...
ARIA: Listitem role - Accessibility
for a full example. Associated WAI-ARIA Roles, States, and Properties list A list of items. Elements with role list must have one or more elements with the role listitem as children, a one or more elements with the role of group that have one or more elements with the listitem role as children. group A collection of related objects, limited to list items when nested in a list, not im
portant enough to have their own place in a pages table of contents. Keyboard Interactions None. Required JavaScript features None. Examples ARIA Lists -- some useful examples and thoughts by Scott O'Hara Best practices Only use role="list" and role="listitem" if you have to -- for example if you don't have control over your HTML but are able to improve accessibility dynamically after the ...
...nguish between ordered and unordered lists. Note: If you are marking up a list of items that will function as a tabbed interface, you should instead use the tab, tabpanel, and tablist roles. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'listitem' in that specification. Recommendation Screen reader sup
port TBD ...
ARIA: Main role - Accessibility
s a navigational landmark role identifying the main content of a document. Landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. By classifying and labeling sections of a page, structural information conveyed visually through layout can be represented programmatically. Screen readers use landmark roles to provide keyboard navigation to im
portant sections of a page. For those navigating via landmark roles, the main role is an alternative for "skip to main content" links.There should only be one main landmark role per document. The <main> element has a role of main. Developers should always prefer using the correct semantic HTML element over using ARIA. Documents and applications can be nested in the DOM, which may lead to having more...
...rge sections of the document. Landmarks browser extension Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA Navigtion Role' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'Navigation Landmark Role' in that specification. Working Draft Screen reader sup
port TBD ...
ARIA: Navigation Role - Accessibility
s --> </div> This is a website's main navigation. Description The navigation role is a landmark role. Landmark roles provide a way to identify the organization and structure of a web page. By classifying and labeling sections of a page, structural information conveyed visually through layout is represented programmatically. Screen readers use landmark roles to provide keyboard navigation to im
portant sections of a page. Like the HTML <nav> element, navigation landmarks provide a way to identify groups (e.g. lists) of links that are intended to be used for website or page content navigation. If a page includes more than one navigation landmark, each should have a unique label. If two or more navigational landmark on a page have the same set of links, use the same label for each. It is pref...
...rge sections of the document. Landmarks browser extension Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA Navigtion Role' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'Navigation Landmark Role' in that specification. Working Draft Screen reader sup
port TBD ...
ARIA: Region role - Accessibility
abel="Example"> <!-- region content --> </div> Description The region role is an ARIA landmark role. Landmark roles provide a way to identify the organization and structure of a web page. By classifying and labeling sections of a page, structural information conveyed visually through layout is represented programmatically. Screen readers use landmark roles to provide keyboard navigation to im
portant sections of a page. The region role should be reserved for sections of content sufficiently im
portant that users will likely want to navigate to the section easily and to have it listed in a summary of the page. A region role is a more generic term, and should only be used if the section needing to be identified is not accurately described by one of the other landmark roles, such as banner, m...
...e to large sections of the document. Landmarks browser extension Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA Region Role' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'Region landmark role' in that specification. Working Draft Screen reader sup
port TBD ...
ARIA: search role - Accessibility
sibility concerns Landmark roles are intended to be used sparingly, to identify larger overall sections of the document. Using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. Best practices Prefer HTML Using the <form> element in conjunction with a declaration of role="search" will provide the largest amount of sup
port. Labeling landmarks Multiple landmarks If there is more than one search landmark role in a document, provide a label for each landmark. This label will allow an assitive technology user to be able to quickly understand the purpose of each landmark. <form id="site-search" role="search" aria-label="Sitewide"> <!-- search input --> </form> ... <form id="page-search" role="search" aria-label=...
...igate to large sections of the document. Landmarks browser extension Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA search role' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'ARIA search role' in that specification. Working Draft Screen reader sup
port TBD ...
ARIA: heading role - Accessibility
out showing a page structure.</p> <h2>Introduction</h2> <p>An introductory text.</p> <h2>Chapter 1</h2> <p>Text</p> <h3>Chapter 1.1</h3> <p>More text in a sub section.</p> ...</div> Accessibility concerns If you must use the heading role and aria-level attribute, do not go over level 6 so that you are consistent with HTML. Although theoretically you can go higher, and some screen readers may sup
port it, the results can be unpredictable with other browser/screen reader combinations. Best practices The best way to use this role is to not use it at all, and instead use the native heading tags <h1> through <h6> as shown in the example above. The heading role and aria-level attribute should only be used to retrofit accessibility on legacy code that you cannot make major changes to. Added benef...
...ifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'heading' in that specification. Recommendation Precedence order The heading role overrides the native semantic meaning of the element it is being used for. The aria-level attribute, in addition, determines what level of heading is being exposed. Screen reader sup
port TBD ...
WAI-ARIA Roles - Accessibility
ponse when activated by the user. Adding role="button" will make an element appear as a button control to a screen reader. This role can be used in combination with the aria-pressed attribute to create toggle buttons.ARIA: cell roleThe cell value of the ARIA role attribute identifies an element as being a cell in a tabular container that does not contain column or row header information. To be sup
ported, the cell must be nested in an element with the role of row.ARIA: checkbox roleThe checkbox role is used for checkable interactive controls. Elements containing role="checkbox" must also include the aria-checked attribute to expose the checkbox's state to assistive technology.ARIA: Comment roleThe comment landmark role semantically denotes a comment/reaction to some content on the page, or to a...
...is used for checkable interactive controls. Elements containing role="checkbox" must also include the aria-checked attribute to expose the checkbox's state to assistive technology.ARIA: Comment roleThe comment landmark role semantically denotes a comment/reaction to some content on the page, or to a previous comment.ARIA: Complementary roleThe complementary landmark role is used to designate a sup
porting section that relates to the main content, yet can stand alone when separated. These sections are frequently presented as sidebars or call-out boxes. If possible, use the HTML <aside> element instead.ARIA: contentinfo roleThe contentinfo landmark role is used to identify information repeated at the end of every page of a website, including copyright information, navigation links, and privacy st...
An overview of accessible web applications and widgets - Accessibility
Notice the role and aria-labelledby attributes we've added to describe these panels. --> <div id="ch1Panel" role="tabpanel" aria-labelledby="ch1Tab">Chapter 1 content goes here</div> <div id="ch2Panel" role="tabpanel" aria-labelledby="ch2Tab">Chapter 2 content goes here</div> <div id="quizPanel" role="tabpanel" aria-labelledby="quizTab">Quiz content goes here</div> </div> ARIA is well sup
ported by all major browsers, including Firefox, Safari, Opera, Chrome, and Internet Explorer, and many assistive technologies. Presentational changes Dynamic presentational changes include using CSS to change the appearance of content (such as a red border around invalid data, or changing the background color of a checked checkbox), as well as showing or hiding content. State changes ARIA provide...
...bute in "edit" mode (since <input> elements have their own role semantics). Do not do this. Instead, implement the "view" mode using a different element altogether, such as a <div> or <span> with a role of button, and the << edit >> mode using a text <input> element. Asynchronous content changes Under construction. See also Live Regions Keyboard navigation Often times developers overlook sup
port for the keyboard when they create custom widgets. To be accessible to a variety of users, all features of a web application or widget should also be controllable with the keyboard, without requiring a mouse. In practice, this usually involves following the conventions sup
ported by similar widgets on the desktop, taking full advantage of the Tab, Enter, Spacebar, and arrow keys. Traditionally, ke...
Keyboard - Accessibility
e mouse is not working at the moment, or who simply prefer to use a keyboard for input whenever possible. Focusable elements should have interactive semantics If an element can be focused using the keyboard, then it should be interactive; that is, the user should be able to do something to it and produce a change of some kind (for example, activating a link or changing an option). Note: One im
portant exception to this rule is if the element has role="document" applied to it, inside an interactive context (such as role="application"). In such a case, focusing the nested document is the only way of returning assistive technology to a non-interactive state (often called "browse mode"). Most interactive elements are focusable by default; you can make an element focusable by adding a tabindex...
...own event handler; in most cases, the action taken by event handler should be the same for both types of events. See also tabindex global HTML attribute Global event handlers: onkeydown Global event handlers: onkeyup Interactive elements must be able to be activated using a keyboard If the user can interact with an element using touch or a pointing device, then the element should also sup
port interacting using the keyboard. That is, if you have defined event handlers for touch or click events, you should also define them for keyboard events. The keyboard event handlers should enable the effectively the same interaction as the touch or click handlers. See also Global event handlers: onkeydown Global event handlers: onkeyup Interactive elements must be focusable If the user can ...
Text labels and names - Accessibility
<div role="dialog" aria-label="Personal details updated confirmation"> <p>Your personal details were successfully updated. You can change your details at any time in the user account section.</p> <button>Close</button> </div> See also role="dialog" role="alertdialog" aria-label aria-labelledby WAI-ARIA: dialog role Dialog authoring practices Documents must have a title It is im
portant on each HTML document to include a <title> that describes the page's purpose. A common navigation technique for users of assistive technology is to infer what content a page contains by reading its title. If the title is not available, they have to navigate the page to determine its content, which can be a time consuming and potentially confusing process. Examples The title for the reference...
...ts, both <iframe> and the older, obsolete <frame>, must have a title to describe the contents of the frame. Use the title attribute to label a frame element. Without a title, users of assistive technologies have to navigate into the frame in order to understand what it contains, which can be difficult and confusing. The <frame> element is no longer part of the HTML specification as of HTML5. Sup
port for it may be dropped by browsers in the future. In addition, it is difficult for screen readers to navigate pages with <frame> elements. For best accessibility and future maintenance, redesign any pages that use frames to use CSS to achieve a similar layout. As a best practice, also provide a <title> for the document that is enclosed in the frame, with content identical to the frame's title att...
Understandable - Accessibility
: Help users avoid and correct mistakes This guideline centers around helping users enter correct information when required with the minimum of mistakes. Success criteria How to conform to the criteria Practical resource 3.3.1 Error Identification (A) When a user is filling out a form or choosing between options, any error that is detected should be clearly re
ported to the user, along with the form control that the error relates to. It is advisable to implement client-side error detection and handling, via HTML5 form validation features, and/or JavaScript, whatever is best for your situation. When an error is detected, an intuitive error message should be shown next to the form input that is at fault to help the user correct their inputs. For screenre...
...sages (see 3.3.1). No tutorial suggestions yet. 3.3.4 Error Prevention (Legal, Financial, Data) (AA) In the case of forms involved with entry of sensitive data (such as legal agreements, e-commerce transactions, or personal data), at least one of the following should be true: Submissions are reversible. Data is checked for errors, and the user is given an op
portunity to correct them. A mechanism is available for confirming and correcting information before final submission. Reversible -- for any view where data can be entered, provide an equivalent view that allows you to edit or even delete an entry, as appropriate. Checking data -- as covered in 3.3.1, a combination of client-side and server-side validation should be used to ...
-webkit-mask-attachment - CSS: Cascading Style Sheets
If a -webkit-mask-image is specified, -webkit-mask-attachment determines whether the mask image's position is fixed within the view
port, or scrolls along with its containing block. /* Keyword values */ -webkit-mask-attachment: scroll; -webkit-mask-attachment: fixed; -webkit-mask-attachment: local; /* Multiple values */ -webkit-mask-attachment: scroll, local; -webkit-mask-attachment: fixed, local, scroll; /* Global values */ -webkit-mask-attachment: inherit; -webkit-mask-attachment: initial; -webkit-mask-attachment: unset; Syntax Values scroll If scroll is specified, the mask image scrolls within the view
port along with the block that contains the mask image. fixed If fixed is specified, the mask image does not scroll with its containing element, instead remaining station...
...* Global values */ -webkit-mask-attachment: inherit; -webkit-mask-attachment: initial; -webkit-mask-attachment: unset; Syntax Values scroll If scroll is specified, the mask image scrolls within the view
port along with the block that contains the mask image. fixed If fixed is specified, the mask image does not scroll with its containing element, instead remaining stationary within the view
port. Formal definition Initial valuescrollApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <attachment>#where <attachment> = scroll | fixed | local Examples Fixing a mask image to the view
port body { -webkit-mask-image: url('images/mask.png'); -webkit-mask-attachment: fixed; } Specifications Not part of any standard. ...
-webkit-mask-composite - CSS: Cascading Style Sheets
are replaced by the pixels of the source mask image; all other pixels are cleared. source-out Overlapping pixels in the source mask image and the destination mask image are cleared; all remaining pixels of the source mask image are rendered. source-atop The pixels of the destination mask image are rendered. The pixels of the source mask image are rendered only if they overlap a nontransparent
portion of the destination mask image. This causes the source mask image to have no effect. destination-over The destination mask image is rendered over the source mask image. destination-in Overlapping pixels in the source mask image and the destination mask image remain the pixels of the destination mask image; all other pixels are cleared. destination-out Overlapping pixels in the source mask...
... the pixels of the destination mask image; all other pixels are cleared. destination-out Overlapping pixels in the source mask image and the destination mask image are cleared; all remaining pixels of the source mask image are rendered. destination-atop The pixels of the source mask image are rendered. The pixels of the destination mask image are rendered only if they overlap a nontransparent
portion of the destination mask image. This causes the destination mask image to have no effect. xor Overlapping pixels in the source mask image and the destination mask image become fully transparent if they are both fully opaque. Formal definition Initial valuesource-overApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <composite-style>#where <co...
::-moz-range-progress - CSS: Cascading Style Sheets
Note: Using ::-moz-range-progress with anything but an <input type="range"> doesn't match anything and has no effect. ...
... Note: Using ::-moz-range-progress with anything but an <input type="range"> doesn't match anything and has no effect. ...
::backdrop - CSS: Cascading Style Sheets
The ::backdrop CSS pseudo-element is a box the size of the view
port which is rendered immediately beneath any element being presented in full-screen mode. This includes both elements which have been placed in full-screen mode using the Fullscreen API and <dialog> elements. When multiple elements have been placed into full-screen mode, the backdrop is drawn immediately beneath the frontmost such element, and on top of the older full-screen elements. ...
...into full-screen mode, the backdrop is drawn immediately beneath the frontmost such element, and on top of the older full-screen elements. /* Backdrop is only displayed when dialog is opened with dialog.showModal() */ dialog::backdrop { background: rgba(255,0,0,.25); } All full-screen elements are placed in a last-in/first out (LIFO) stack in the top layer, which is a special layer in the view
port which is always rendered last (and therefore on top) before drawing the view
port's contents to the screen. The ::backdrop pseudo-element makes it possible to obscure, style, or completely hide everything located below the element when it's the topmost one in the top layer. ::backdrop neither inherits from nor is inherited by any other elements. No restrictions are made on what properties apply t...
:not() - CSS: Cascading Style Sheets
or: blue; } The :not() pseudo-class has a number of quirks, tricks, and unexpected results that you should be aware of before using it. Syntax The :not() pseudo-class requires a comma-separated list of one or more selectors as its argument. The list must not contain another negation selector or a pseudo-element. The ability to list more than one selector is experimental and not yet widely sup
ported. :not( <complex-selector-list> )where <complex-selector-list> = <complex-selector>#where <complex-selector> = <compound-selector> [ <combinator>? <compound-selector> ]*where <compound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '~' | [ '|' ]where <type-selector> = <wq-name> | <ns-prefix>? '*'<subclass...
...*/ body :not(.crazy, .fancy) { font-family: sans-serif; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':not()' in that specification. Working Draft Extends its argument to allow some non-simple selectors. Selectors Level 3The definition of ':not()' in that specification. Recommendation Initial...
font-stretch - CSS: Cascading Style Sheets
50% extra-condensed 62.5% condensed 75% semi-condensed 87.5% normal 100% semi-expanded 112.5% expanded 125% extra-expanded 150% ultra-expanded 200% Variable fonts Most fonts have a particular width which corresponds to one of the keyterm values. However some fonts, called variable fonts, can sup
port a range of stretching with more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For this, percentage ranges are useful. For TrueType or OpenType variable fonts, the "wdth" variation is used to implement varying glyph widths. Accessibility concerns People with dyslexia and other cognitive conditions may have difficulty reading fon...
... @font-face { font-family: "Open Sans"; src: local("Open Sans") format("woff2"), url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); font-stretch: 87.5% 112.5%; } Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-stretch' ...
font-weight - CSS: Cascading Style Sheets
ra Light (Ultra Light) 300 Light 400 Normal 500 Medium 600 Semi Bold (Demi Bold) 700 Bold 800 Extra Bold (Ultra Bold) 900 Black (Heavy) Variable fonts Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping. However some fonts, called variable fonts, can sup
port a range of weights with more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying weights. Accessibility concerns People experiencing low vision conditions may have difficulty reading text set with a font-weight value of 100 (Thin/Hairline) or 2...
... @font-face { font-family: "Open Sans"; src: local("Open Sans") format("woff2"), url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); font-weight: 400; } Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-weight' in that specification. Working Draft ...
@font-face - CSS: Cascading Style Sheets
ebfont.woff") format("woff"); } Descriptors font-display Determines how a font face is displayed based on whether and when it is downloaded and ready to use. font-family Specifies a name that will be used as the font face value for font properties. font-stretch A font-stretch value. Since Firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is sup
ported by a font-face, for example font-stretch: 50% 200%; font-style A font-style value. Since Firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is sup
ported by a font-face, for example font-style: oblique 20deg 50deg; font-weight A font-weight value. Since Firefox 61 (and in other modern browsers) this also accepts two values to specify a range that i...
... font-feature-settings Allows control over advanced typographic features in OpenType fonts. ...
-ms-high-contrast - CSS: Cascading Style Sheets
making content as legible as possible by dynamically replacing foreground and background colors with a user-specified theme. For web content, theme colors are mapped to content types. This media feature applies to bitmap media types. It does not accept min/max prefixes. Syntax The -ms-high-contrast media feature is specified as one of the following values. Values none ... No longer sup
ported as of Microsoft Edge 18. active Indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with any color variation. black-on-white Indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a black-on-white color variation. white-on-black Indicates that the subsequent styling ...
...se color keywords in place of other CSS color values. This will ensure that content will always be able to be perceived. Content If at all possible, prefer updating HTML markup over modifying content using CSS2 system color keywords. This helps keep the content more predictable. Specifications Not part of any standard. Remarks As of Microsoft Edge 18, -ms-high-contrast: none is no longer sup
ported. Microsoft Edge versions 18 and higher will be using the forced-colors media feature instead, but the forced-colors media feature specification is still being actively worked on. The -ms-high-contrast media feature works with the -ms-high-contrast-adjust property. The -ms-high-contrast media feature was introduced in Windows 8. ...
-webkit-transform-2d - CSS: Cascading Style Sheets
The -webkit-transform-2d Boolean CSS media feature is a Chrome extension whose value is true if vendor-prefixed CSS 2D transforms are sup
ported. Apple has a description in Safari CSS Reference. Syntax -webkit-transform-2d is a Boolean CSS media feature whose value is true if the browser sup
ports -webkit prefixed CSS 2D transforms. Values true The browser sup
ports the 2D CSS transforms with the -webkit prefix. false The 2D CSS transforms prefixed with -webkit are not sup
ported by the browser. ...
...se value is true if the browser sup
ports -webkit prefixed CSS 2D transforms. Values true The browser sup
ports the 2D CSS transforms with the -webkit prefix. false The 2D CSS transforms prefixed with -webkit are not sup
ported by the browser. Examples Basic example @media (-webkit-transform-2d) { div { -webkit-transform: translate(100px, 100px); } } This media feature is only sup
ported by WebKit. If possible, use an @sup
ports feature query instead: @sup
ports (-webkit-transform: translate(100px, 100px)) { div { -webkit-transform: translate(100px, 100px); } } Specifications Not part of any standard. ...
-webkit-transition - CSS: Cascading Style Sheets
The -webkit-transition Boolean CSS media feature is a Chrome extension whose value is true if the browsing context sup
ports CSS transitions. It was never sup
ported in browsers not based on WebKit or Blink. Apple has a description in Safari CSS Reference; this is now called simply transition there. Note: You should not use this media feature; it was never specified, has never been widely implemented, and has been removed from all browsers. Use an @sup
ports feature query instead. Syntax @media (-webkit-transition) { /* CSS to use if transitions are sup
ported */ } Examples Use @sup
ports instead Do not use the -webkit-transition media feature. ...
...n there. Note: You should not use this media feature; it was never specified, has never been widely implemented, and has been removed from all browsers. Use an @sup
ports feature query instead. Syntax @media (-webkit-transition) { /* CSS to use if transitions are sup
ported */ } Examples Use @sup
ports instead Do not use the -webkit-transition media feature. Instead, test for transition sup
port using the CSS @sup
ports at-rule, like this: @sup
ports (transition: initial) { /* CSS to use if transitions are sup
ported */ } Obsolete example Before this became obsolete, you could use -webkit-transition in your CSS like this: @media (-webkit-transition) { /* CSS to use if transitions are sup
ported */ } Specifications Not part of any standard. ...
aspect-ratio - CSS: Cascading Style Sheets
The aspect-ratio CSS media feature can be used to test the aspect ratio of the view
port. Syntax The aspect-ratio feature is specified as a <ratio> value representing the width-to-height aspect ratio of the view
port. It is a range feature, meaning you can also use the prefixed min-aspect-ratio and max-aspect-ratio variants to query minimum and maximum values, respectively. Examples The example below is contained in an <iframe>, which creates its own view
port. Resize the <iframe> to see aspect-ratio in action. HTML <div id='inner'> Watch this element as you resize your view
port's width and height. </div> CSS /* Minimum aspect ratio */ @media (min-aspect-ratio: 8/5) { div { background: #9af; /* blue */ } } /* Maximum aspect ratio */ @media (max-aspect-ratio: 3/2) { div { ...
..."w">height:165</label> <input id="h" name="h" type="range" min="100" max="250" step="5" value="165"> <iframe id="outer" src="data:text/html,<style> @media (min-aspect-ratio: 8/5) { div { background: %239af; } } @media (max-aspect-ratio: 3/2) { div { background: %239ff; } } @media (aspect-ratio: 1/1) { div { background: %23f9a; } }</style><div id='inner'> Watch this element as you resize your view
port's width and height.</div>"> </iframe> CSS iframe{ display:block; } JavaScript outer.style.width=outer.style.height="165px" w.onchange=w.oninput=function(){ outer.style.width=w.value+"px" wf.textContent="width:"+w.value } h.onchange=h.oninput=function(){ outer.style.height=h.value+"px" hf.textContent="height:"+h.value } Result Specifications Specification Statu...
forced-colors - CSS: Cascading Style Sheets
Syntax The forced-colors media feature indicates whether or not the browser is currently in forced-colors mode. Values none Forced colors mode is not active; the page's colors are not being forced into a limited palette. active Indicates that forced colors mode is active. ...
...r column-rule-color scrollbar-color -webkit-tap-highlight-color box-shadow text-shadow You can use system color keywords with any property other than those listed above, to ensure that the rest of the page integrates with the restricted color palette available in forced colors mode. User preferences Currently no user agent implements this feature, although various operating systems do sup
port such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating system in use. Examples Note: No browser currently implements this feature so the following example will not work. This example has an annoying color palette by default. This example does not take advantage of the colors provided by the user agent. HTML <div c...
height - CSS: Cascading Style Sheets
The height CSS media feature can be used to apply styles based on the height of the view
port (or the page box, for paged media). Syntax The height feature is specified as a <length> value representing the view
port height. It is a range feature, meaning that you can also use the prefixed min-height and max-height variants to query minimum and maximum values, respectively. ...
... to apply styles based on the height of the view
port (or the page box, for paged media). Syntax The height feature is specified as a <length> value representing the view
port height. It is a range feature, meaning that you can also use the prefixed min-height and max-height variants to query minimum and maximum values, respectively. ...
monochrome - CSS: Cascading Style Sheets
tax The monochrome feature is specified as an <integer> representing the number of bits per pixel in the monochrome frame buffer. If the device is not a monochrome device, the value is zero. It is a range feature, meaning that you can also use the prefixed min-monochrome and max-monochrome variants to query minimum and maximum values, respectively. ...
...he number of bits per pixel in the monochrome frame buffer. If the device is not a monochrome device, the value is zero. It is a range feature, meaning that you can also use the prefixed min-monochrome and max-monochrome variants to query minimum and maximum values, respectively. ...
orientation - CSS: Cascading Style Sheets
The orientation CSS media feature can be used to test the orientation of the view
port (or the page box, for paged media). Note: This feature does not correspond to device orientation. Opening the soft keyboard on many devices in
portrait orientation will cause the view
port to become wider than it is tall, thereby causing the browser to use landscape styles instead of
portrait. Syntax The orientation feature is specified as a keyword value chosen from the list below. Keyword values
portrait The view
port is in a
portrait orientation, i.e., the height is greater than or equal to the width. landscape The view
port is in a landscape orientation, i.e., the width is greater than the height. Examples HTML <div>Box 1</div> <div>Box 2</div> <div>Box 3</div> CSS body { display: flex...
... Candidate Recommendation No change. ...
width - CSS: Cascading Style Sheets
The width CSS media feature can be used to test the width of the view
port (or the page box, for paged media). Syntax The width feature is specified as a <length> value representing the view
port width. It is a range feature, meaning that you can also use the prefixed min-width and max-width variants to query minimum and maximum values, respectively. ...
...ia feature can be used to test the width of the view
port (or the page box, for paged media). Syntax The width feature is specified as a <length> value representing the view
port width. It is a range feature, meaning that you can also use the prefixed min-width and max-width variants to query minimum and maximum values, respectively. ...
max-zoom - CSS: Cascading Style Sheets
The max-zoom CSS descriptor sets the maximum zoom factor of a document defined by the @view
port at-rule. The browser will not zoom in any further than this, whether automatically or at the user's request. A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed in. Smaller values are zoomed out. Syntax /* Keyword value */ max-zoom: auto; /* <number> values */ max-zoom: 0.8; max-zoom: 2.0; /* <percentage> value */ max-zoom: 150%; Values auto The user agent will set the document's upper zoom factor limit. <number> A non-negative number limiting the maximum value of the zoom factor. <percentage> A non-negative percentage limiting the maximum value of the zoom factor. ...
...x-zoom: auto; /* <number> values */ max-zoom: 0.8; max-zoom: 2.0; /* <percentage> value */ max-zoom: 150%; Values auto The user agent will set the document's upper zoom factor limit. <number> A non-negative number limiting the maximum value of the zoom factor. <percentage> A non-negative percentage limiting the maximum value of the zoom factor. Formal definition Related at-rule@view
portInitial valueautoPercentagesthe zoom factor itselfComputed valueauto, or a non-negative number or percentage as specified Formal syntax auto | <number> | <percentage> Examples Setting max-zoom @view
port { max-zoom: 1.5; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"max-zoom" descriptor' in that specification. Worki...
min-zoom - CSS: Cascading Style Sheets
The min-zoom CSS descriptor sets the minimum zoom factor of a document defined by the @view
port at-rule. The browser will not zoom out any further than this, whether automatically or at the user's request. A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed in. Smaller values are zoomed out. Syntax /* Keyword value */ min-zoom: auto; /* <number> values */ min-zoom: 0.8; min-zoom: 2.0; /* <percentage> value */ min-zoom: 150%; Values auto The user agent will set the document's lower zoom factor limit. <number> A non-negative number limiting the minimum value of the zoom factor. <percentage> A non-negative percentage limiting the minimum value of the zoom factor. ...
...n-zoom: auto; /* <number> values */ min-zoom: 0.8; min-zoom: 2.0; /* <percentage> value */ min-zoom: 150%; Values auto The user agent will set the document's lower zoom factor limit. <number> A non-negative number limiting the minimum value of the zoom factor. <percentage> A non-negative percentage limiting the minimum value of the zoom factor. Formal definition Related at-rule@view
portInitial valueautoPercentagesthe zoom factor itselfComputed valueauto, or a non-negative number or percentage as specified Formal syntax auto | <number> | <percentage> Examples Setting min zoom factor @view
port { min-zoom: 2.0; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"min-zoom" descriptor' in that specification. W...
orientation - CSS: Cascading Style Sheets
The orientation CSS descriptor controls the orientation of a document defined by @view
port. /* Keyword values */ orientation: auto; orientation:
portrait; orientation: landscape; For a UA/device where the orientation is changed upon tilting the device, an author can use this descriptor to inhibit the orientation change. Syntax Values auto The user agent will set the document's orientation automatically, typically based on the device's orientation as determined by an accelerometer (if the device has such a hardware sensor), although there is often a user-controlled, OS-level "Lock orientation" setting that will trump the accelerometer reading.
portrait The document should be locked into
portrait orientation. landscape The document should be locked into landscape orientation. For...
...device's orientation as determined by an accelerometer (if the device has such a hardware sensor), although there is often a user-controlled, OS-level "Lock orientation" setting that will trump the accelerometer reading.
portrait The document should be locked into
portrait orientation. landscape The document should be locked into landscape orientation. Formal definition Related at-rule@view
portInitial valueautoPercentagesrefer to the size of bounding boxComputed valueas specified Formal syntax auto |
portrait | landscape Examples Setting view
port orientation @view
port { orientation: landscape; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"orientation" descriptor' in that specification. Working Draft Init...
user-zoom - CSS: Cascading Style Sheets
The user-zoom CSS descriptor controls whether or not the user can change the zoom factor of a document defined by @view
port. /* Keyword values */ user-zoom: zoom; user-zoom: fixed; Syntax Values zoom The user can zoom in or out. fixed The user cannot zoom in or out. Accessibility concerns Disabling zooming capabilities prevents people experiencing low vision conditions from being able to read and understand page content. ...
... zoom The user can zoom in or out. fixed The user cannot zoom in or out. Accessibility concerns Disabling zooming capabilities prevents people experiencing low vision conditions from being able to read and understand page content. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | Understanding WCAG 2.0 Formal definition Related at-rule@view
portInitial valuezoomPercentagesrefer to the size of bounding boxComputed valueas specified Formal syntax zoom | fixed Examples Disabling user zoom @view
port { user-zoom: fixed; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"user-zoom" descriptor' in that specification. Working Draft Initial definition ...
zoom - CSS: Cascading Style Sheets
The zoom CSS descriptor sets the initial zoom factor of a document defined by the @view
port at-rule. A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed in. Smaller values are zoomed out. Syntax /* Keyword value */ zoom: auto; /* <number> values */ zoom: 0.8; zoom: 2.0; /* <percentage> values */ zoom: 150%; Values auto The user agent will set the document's initial zoom factor. The user agent may use the size of canvas area on which the document is rendered to determine that factor. <number> A non-negative number used as the zoom factor. <percentage> A non-negative percentage value used as the zoom factor. ...
...2.0; /* <percentage> values */ zoom: 150%; Values auto The user agent will set the document's initial zoom factor. The user agent may use the size of canvas area on which the document is rendered to determine that factor. <number> A non-negative number used as the zoom factor. <percentage> A non-negative percentage value used as the zoom factor. Formal definition Related at-rule@view
portInitial valueautoPercentagesthe zoom factor itselfComputed valueauto, or a non-negative number or percentage as specified Formal syntax auto | <number> | <percentage> Examples Setting view
port zoom factor @view
port { zoom: 2.0; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"zoom" descriptor' in that specification. Wor...
Alternative style sheets - CSS: Cascading Style Sheets
Chrome requires an extension to use the feature (as of version 48). The web page can also provide its own user interface to let the user switch styles. ...
... Style sheets linked with the same title are part of the same choice. Style sheets linked without a title attribute are always applied. Use rel="stylesheet" to link to the default style, and rel="alternate stylesheet" to link to alternative style sheets. This tells the browser which style sheet title should be selected by default, and makes that default selection apply in browsers that do not sup
port alternate style sheets. Specifications Specification Status Comment HTML Living StandardThe definition of 'link type "alternate"' in that specification. Living Standard HTML Living StandardThe definition of 'alternative stylesheet' in that specification. Living Standard HTML Living StandardThe definition of 'the "title" attribute for t...
Coordinate systems - CSS: Cascading Style Sheets
occurred. For example, when a mouse event occurs, the position of the mouse as specified in the event's offsetX and offsetY properties are given relative to the top-left corner of the node to which the event has been delivered. The origin is inset by the distances specified by padding-left and padding-top. Client The "client" coordinate system uses as its origin the top-left corner of the view
port or browsing context in which the event occurred. This is the entire viewing area in which the document is presented. Scrolling is not a factor. On a desktop computer, for example, the MouseEvent.clientX and MouseEvent.clientY properties indicate the position of the mouse cursor at the moment the event occurred, relative to the top-left corner of the browser window. The top-left corner of the win...
...e systems. JavaScript Let's look at the script in two sections. First, the code that logs the coordinates to the screen. This code will be called by the event handler for the various mouse events we watch. Displaying the coordinates As we'll see in the HTML, the inner box (the one we're watching for events on) contains several paragraphs; one for each of the four coordinate systems we'll be re
porting on. let inner = document.querySelector(".inner"); let log = document.querySelector(".log"); function setCoords(e, type) { let idX = type + "X"; let idY = type + "Y"; document.getElementById(idX).innerText = e[idX]; document.getElementById(idY).innerText = e[idY]; } A reference to the <div> inside the inner box which contains the paragraphs that will show the coordinate information...
Using CSS animations - CSS: Cascading Style Sheets
render at a given time during the animation sequence. Since the timing of the animation is defined in the CSS style that configures the animation, keyframes use a <percentage> to indicate the time during the animation sequence at which they take place. 0% indicates the first moment of the animation sequence, while 100% indicates the final state of the animation. Because these two times are so im
portant, they have special aliases: from and to. Both are optional. If from/0% or to/100% is not specified, the browser starts or finishes the animation using the computed values of all attributes. You can optionally include additional keyframes that describe intermediate steps between the start and end of the animation. Examples Note: Some older browsers (pre-2017) may need prefixes; the live exam...
...0%; width: 100%; } } In this example the style for the <p> element specifies that the animation should take 3 seconds to execute from start to finish, using the animation-duration property, and that the name of the @keyframes at-rule defining the keyframes for the animation sequence is named "slidein". If we wanted any custom styling on the <p> element to appear in browsers that don't sup
port CSS animations, we would include it here as well; however, in this case we don't want any custom styling other than the animation effect. The keyframes are defined using the @keyframes at-rule. In this case, we have just two keyframes. The first occurs at 0% (using the alias from). Here, we configure the left margin of the element to be at 100% (that is, at the far right edge of the containing e...
CSS Animations - CSS: Cascading Style Sheets
can be controlled by specifying their timing function, duration, their number of repetitions, and other attributes. Reference CSS Properties animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function CSS At-rules @keyframes Guides Detecting CSS animation sup
port Describes a technique for detecting if a browser sup
ports CSS animations. Using CSS animations Step-by-step tutorial about how to create animations using CSS. This article describes each relevant CSS property and at-rule and explains how they interact with each other. CSS animations tips and tricks Tips and tricks to help you get the most out of CSS animations. Currently offers a technique f...
...s Step-by-step tutorial about how to create animations using CSS. This article describes each relevant CSS property and at-rule and explains how they interact with each other. CSS animations tips and tricks Tips and tricks to help you get the most out of CSS animations. Currently offers a technique for replaying an animation which has already run through to completion, which the API doesn't sup
port inherently. Specifications Specification Status Comment CSS Animations Working Draft Initial definition. ...
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
how box alignment works in the context of block layout, including floated, positioned, and table elements. As this page aims to detail things which are specific to block layout and box alignment, it should be read in conjunction with the main Box Alignment page, which details the common features of box alignment across layout methods. Note: At the time of writing (May 2018), there is no real sup
port for the box alignment properties in block layout. This document details how the specification expects these properties to be implemented for completeness, and is likely to change as the specification and browser implementations develop. align-content and justify-content The justify-content property does not apply to block containers or table cells. The align-content property applies to the bl...
... axis. It also does not apply to table cells. Absolutely positioned elements The alignment container is the positioned block, accounting for the offset values of top, left, bottom, and right. The normal keyword resolves to stretch, unless the positioned item is a replaced element, in which case it resolves to start. Aligning in these layout methods today As we do not currently have browser sup
port for box alignment in block layout, your options for alignment are either to use one of the existing alignment methods or, to make even a single item inside a container a flex item in order to use the alignment properties as specified in flexbox. Alignment of blocks horizontally prior to flexbox was typically achieved by way of setting auto margins on the block. A margin of auto will absorb all a...
Spanning and Balancing Columns - CSS: Cascading Style Sheets
Spanning the Columns To cause an item to span across columns use the property column-span with a value of all. This will cause the element to span all of the columns. ...
...s of text. The other value for column-fill is auto. In this case, rather than filling all the columns equally so their heights are balanced, the columns are filled sequentially. In the example below we have changed column-fill to auto and the columns are now filled, in order, to the height of the multicol container, leaving some columns empty at the end. Note that column balancing is not sup
ported by all browsers. Check that you are getting the sort of effect that you expect in the browsers you sup
port. In the next guide you will learn how multicol handles overflow, both within columns and where there are more columns than will fit the container. ...
Using multi-column layouts - CSS: Cascading Style Sheets
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum </div> CSS #wid { column-width: 100px; } Result The exact details are described in the CSS3 specification. In a multi-column block, content is automatically flowed from one column into the next as needed. All HTML, CSS and DOM functionality is sup
ported within columns, as are editing and printing. The columns shorthand Most of the time, a Web designer will use one of the two CSS properties: column-count or column-width. As values for these properties do not overlap, it is often convenient to use the shorthand columns. E.g. The CSS declaration column-width: 12em can be replaced by columns: 12em. Example 3 HTML <div id="col_short"> Lore...
...odo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum </div> CSS #column_gap { column-count: 5; column-gap: 2em; } Result Graceful Degradation The column properties will just be ignored by non-columns-sup
porting browsers. Therefore it's relatively easy to create a layout that will display in a single column in those browsers and use multiple columns in sup
porting browsers. Conclusion CSS3 columns are a layout primitive that will help Web developers make the best use of screen real estate. Imaginative developers may find many uses for them, especially with the automatic height balancing feature. ...
CSS Containment - CSS: Cascading Style Sheets
styles such as you would get with the Shadow DOM. The main use case is to prevent situations where a CSS Counter could be changed in an element, which could then affect the rest of the tree. Using contain: style would ensure that the counter-increment and counter-set properties created new counters scoped to that subtree only. Note: style containment is "at-risk" in the spec and may not be sup
ported everywhere (it's not currently sup
ported in Firefox). Special values There are two special values of contain: content strict We encountered the first in the example above. Using contain: content turns on layout and paint containment. The specification describes this value as being "reasonably safe to apply widely". It does not apply size containment, so you would not be at risk of a bo...
...on describes this value as being "reasonably safe to apply widely". ...
CSS Device Adaptation - CSS: Cascading Style Sheets
CSS Device Adaptation is a module of CSS that lets you define the size, zoom factor, and orientation of the view
port. ...
... CSS Device Adaptation is a module of CSS that lets you define the size, zoom factor, and orientation of the view
port. ...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
ace is split into four. Two parts are given to the first track and one part each to the next two tracks. .wrapper { display: grid; grid-template-columns: 2fr 1fr 1fr; } In this final example, we mix absolute sized tracks with fraction units. The first track is 500 pixels, so the fixed width is taken away from the available space. The remaining space is divided into three and assigned in pro
portion to the two flexible tracks. .wrapper { display: grid; grid-template-columns: 500px 1fr 2fr; } Track listings with repeat() notation Large grids with many tracks can use the repeat() notation, to repeat all or a section of the track listing. For example the grid definition: .wrapper { display: grid; grid-template-columns: 1fr 1fr 1fr; } Can also be written as: .wrapper { displ...
...t(3, 1fr); column-gap: 10px; row-gap: 1em; } Note: When grid first shipped in browsers the column-gap, row-gap and gap were prefixed with the grid- prefix as grid-column-gap, grid-row-gap and grid-gap respectively. Browsers are updating to remove this prefix, however the prefixed versions will be maintained as aliases making them safe to use. At the present time, some browsers do not sup
port the unprefixed versions which is why the live examples in this guide use grid- prefixed versions. <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> * {box-sizing: border-box;} .wrapper { grid-column-gap: 10px; grid-row-gap: 1em; border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper...
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
.item2 { grid-area: b; } .item3 { grid-area: c; } .item4 { grid-area: d; } <div class="wrapper"> <div class="item1">Item 1</div> <div class="item2">Item 2</div> <div class="item3">Item 3</div> <div class="item4">Item 4</div> </div> Alignment and auto margins Another way to align items inside their area, is to use auto margins. If you have ever centered your layout in the view
port, by setting the right and left margin of the container block to auto, you know that an auto margin absorbs all of the available space. By setting the margin to auto on both sides, it pushes the block into the middle as both margins attempt to take all of the space. In this next example, I have given item 1 a left margin of auto. You can see how the content is now pushed over to the right side of...
...tify-content: start would be for grid tracks to start on the right hand side of the grid. Setting auto margins, using margin-right or margin-left however, or absolutely positioning items using the top, right, bottom and left offsets would not honor writing modes. In the next guide, we will look further into this interaction between CSS grid layout, box alignment and writing modes. This will be im
portant to understand, if you develop sites that are then displayed in multiple languages, or if you want to mix languages or writing modes in a design. ...
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
For this guide, we will look at this feature of grid and other modern layout methods, learning a little about writing modes and logical vs. physical properties as we do so. Logical and physical properties and values CSS is full of physical positioning keywords - left and right, top and bottom. If we position an item using absolute positioning, we use these physical keywords as offset values to push the item around. ...
...guide to alignment, becomes very useful. If you can start to see layout in terms of block and inline, the way things work in grid start to make a lot more sense. CSS writing modes I'm going to introduce another specification here, that I will be using in my examples: the CSS Writing Modes specification. This spec details how we can use these different writing modes in CSS, not just for the sup
port of languages that have a different writing mode to English, but also for creative purposes. I'll be using the writing-mode property to make changes to the writing mode applied to our grid, in order to demonstrate how the logical values work. If you want to dig into writing modes further, however, then I would recommend that you read Jen Simmons excellent article on CSS Writing Modes. This goes in...
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
The fr unit, when combined with the minmax() function can give us very similar behavior to the flex properties in flexbox while still enabling the creation of a layout in two dimensions. If we look back at the example where I demonstrated the difference between one and two-dimensional layouts, you can see there is a difference betwe...
...solutely positioned child has a grid container as a parent but that container does not create a new positioning context, then it is taken out of flow as in the previous example. The positioning context will be whatever element creates a positioning context as is common to other layout methods. In our case, if we remove position: relative from the wrapper above, positioning context is from the view
port, as shown in this image. Once again the item no longer participates in the grid layout in terms of sizing or when other items are auto-placed. With a grid area as the parent If the absolutely positioned item is nested inside a grid area then you can create a positioning context on that area. In the below example we have our grid as before but this time I have nested an item inside .box3 of t...
Consistent list indentation - CSS: Cascading Style Sheets
n leads to frustration, because what works in one browser often doesn't have the same effect in another. For example, if you declare that lists have no left margin, they move over in Internet Explorer, but sit stubbornly in place in Gecko-based browsers.This article will help you understand the problems that can occur and how to avoid them. In order to understand why this is the case, and more im
portantly how to avoid the problem altogether, it's necessary to examine the details of list construction. Making a List First, we consider a single, pure list item. This list item has no marker (otherwise known as a "bullet") and is not yet part of a list itself. It hangs alone in the void, simple and unadorned, as shown in Figure 1. That dotted red border represents outer edges of the content-a...
...dotted blue border shows us the edges of the <ul> element's content area. Since we have no padding for the <ul> element, its content wraps snugly around the three list items. Now we add the list item markers. Since this is an unordered list, we'll add traditional filled-circle "bullets," as shown in Figure 4. Visually, the markers are outside the content area of the <ul>, but that's not the im
portant part here. What's key is that the markers are placed outside the "principal box" of the <li> elements, not the <ul>. They're sort of like appendages to the list items, hanging outside the content-area of the <li> but still attached to the <li>. This is why, in every browser except Internet Explorer for Windows, markers are placed outside any border set for an <li> element, assuming the value ...
Shapes from box values - CSS: Cascading Style Sheets
CSS box model The values listed above correspond to the various parts of the CSS Box Model. A box in CSS has content, padding, border, and margin. ...
...fines the shape enclosed by the outside content edge. Each corner radius of this box is the larger of 0 or border-radius - border-width - padding. This Means that it is impossible to have a negative value here. When to use the box values Using box values is a simple way to create shapes, however this is by nature only going to work with very simple shapes that can be defined using the well-sup
ported border-radius property. The examples shown above show one such use case. You can create a circular shape using border-radius and then curve text around it. You can create some interesting effects however with just this simple technique. In my final example of this section, I have floated two elements left and right, giving each a border-radius of 100% in the direction closest to the text. F...
Overview of CSS Shapes - CSS: Cascading Style Sheets
e-outside property to it with a value of circle(50%). The result is that the content now curves around the circular shape rather than following the rectangle created by the box of the image. As in this level of the specification an element has to be floated in order to apply <basic-shape> to it; this has the side-effect of creating a simple fallback for many cases. If you do not have Shapes sup
port in the browser, the user will see content flowing around the sides of a rectangular box as before. If they do have Shapes sup
port then the visual display is enhanced. Basic Shapes The value circle(50%) is an example of a Basic Shape. The specification defines four <basic-shape> values, which are: inset() circle() ellipse() polygon() Using the value inset() wraps text around a rectangula...
...f you want to create a shape using an image, and also clip away part of that image, you can use the same values. The image below is a square image with a blue background. We have defined a shape using shape-outside: ellipse(40% 50%); and also used clip-path: ellipse(40% 50%); to clip away the same area that we have used to define the shape. Developer Tools for Shapes Along with CSS Shapes sup
port in the browser, Firefox are shipping a Shape Path Editor in the Firefox DevTools. This tool means that you can inspect any shapes on your page, and even change the values in the live page. If your polygon isn't quite right you can use the Shapes Editor to tweak it, then copy the new value back into your CSS. The Shape Path Editor will be enabled by default in Firefox 60 for shapes generated via ...
Using CSS transitions - CSS: Cascading Style Sheets
: div { transition-property: opacity, left; transition-duration: 3s, 5s; } Using transitions when highlighting menus A common use of CSS is to highlight items in a menu as the user hovers the mouse cursor over them. It's easy to use transitions to make the effect even more attractive. ...
...o make the effect even more attractive. Before we look at code snippets, you might want to take a look at the live demo (assuming your browser sup
ports transitions). First, we set up the menu using HTML: <nav> <a href="#">Home</a> <a href="#">About</a> <a href="#">Contact Us</a> <a href="#">Links</a> </nav> Then we build the CSS to implement the look and feel of our menu. The relevant
portions are shown here: a { color: #fff; background-color: #333; transition: all 1s ease-out; } a:hover, a:focus { color: #333; background-color: #fff; } This CSS establishes the look of the menu, with the background and text colors both changing when the element is in its :hover and :focus states. JavaScript examples Care should be taken when using a transition immediately after: ...
Questions about CSS - CSS: Cascading Style Sheets
of style definition for a given document element are in this order of precedence: The STYLE attribute on an individual element tag The STYLE element that defines a specific style sheet containing style declarations or a LINK element that links to a separate document containing the STYLE element. In a Web page, the STYLE element is placed between the TITLE statement and the BODY statement. ...
...ent element are in this order of precedence: The STYLE attribute on an individual element tag The STYLE element that defines a specific style sheet containing style declarations or a LINK element that links to a separate document containing the STYLE element. In a Web page, the STYLE element is placed between the TITLE statement and the BODY statement. An im
ported style sheet, using the CSS @im
port notation to automatically im
port and merge an external style sheet with the current style sheet Style attributes specified by the viewer to the browser The default style sheet assumed by the browser In general, the Web page creator's style sheet takes precedence, but it's recommended that browsers provide ways for the viewer to override the style attributes in some respects. Since it's likely...
Media queries - CSS: Cascading Style Sheets
Media queries let you adapt your site or app depending on the presence or value of various device characteristics and parameters. They are a key component of responsive design. For example, a media query can shrink the font size on small devices, increase the padding between paragraphs when a page is viewed in
portrait mode, or bump up the size of buttons on touchscreens. In CSS, use the @media at-rule to conditionally apply part of a style sheet based on the result of a media query. Use @im
port to conditionally apply an entire style sheet. Media queries in HTML In HTML, media queries can be applied to various elements: In the <link> element's media attribute, they define the media to which a linked resource (typically CSS) should be applied. In the <source> element's media attribute,...
...dow.matchMedia() method to test the window against a media query. You can also use MediaQueryList.addListener() to be notified whenever the state of a query changes. With this functionality, your site or app can respond to changes in the device configuration, orientation, or state. You can learn more about programmatically using media queries in Testing media queries. Reference At-rules @im
port @media Guides Using media queries Introduces media queries, their syntax, and the operators and media features which are used to construct media query expressions. Testing media queries programmatically Describes how to use media queries in your JavaScript code to determine the state of a device, and to set up listeners that notify your code when the results of media queries change (suc...
Pseudo-elements - CSS: Cascading Style Sheets
selector::pseudo-element { property: value; } You can use only one pseudo-element in a selector. It must appear after the simple selectors in the statement. Note: As a rule, double colons (::) should be used instead of a single colon (:). This distinguishes pseudo-classes from pseudo-elements. ...
...C spec, most browsers sup
port both syntaxes for the original pseudo-elements. ...
Shorthand properties - CSS: Cascading Style Sheets
property, but only as a whole, not as a keyword for one value or another. That means that the only way to make some specific value to be inherited is to use the longhand property with the keyword inherit. Shorthand properties try not to force a specific order for the values of the properties they replace. This works well when these properties use values of different types, as the order has no im
portance, but this does not work as easily when several properties can have identical values. Handling of these cases are grouped in several categories: Shorthands handling properties related to edges of a box, like border-style, margin or padding, always use a consistent 1-to-4-value syntax representing those edges: The 1-value syntax: border-width: 1em -- The unique value ...
...its parent element. Effectively, this "turns on inheritance". initial Sets the property value applied to a selected element to the initial value of that property. unset Resets the property to its natural value, which means that if the property is naturally inherited it acts like inherit, otherwise it acts like initial. Note: There is also a newer value, revert, which has limited browser sup
port. Note: See Origin of CSS declarations in Introducing the CSS Cascade for more information on each of these and how they work. We can look at a list of links and explore how the universal values work. The live example below allows you to play with the CSS and see what happens when you make changes. Playing with code really is the best way to get to grips with HTML and CSS. For example: Th...
Cubic Bezier Generator - CSS: Cascading Style Sheets
of 0.1 tick on the rulers var scaling; //LIMITATION: scaling is computed once: if canvas.height/canvas.width change it won't be recalculated var dragSM = 0; // Drag state machine: 0 = nodrag, others = object being dragged function initCanvas() { // get the canvas element using the DOM var canvas = document.getElementById('bezier'); // Make sure we don't execute when canvas isn't sup
ported if (canvas.getContext) { // use getContext to use the canvas for drawing var ctx = canvas.getContext('2d'); scaling = Math.min(canvas.height - rulers - margin, canvas.width - rulers - margin); canvas.onmousedown = mouseDown; canvas.onmouseup = mouseUp; } else { alert('You need Safari or Firefox 1.5+ to see this demo.'); } } function...
...rgin - y) / scaling + 1; } function lY(y) { // Used when drawing horizontal lines to prevent subpixel blur var result = cY(y); return Math.round(result) == result ? ...
background-image - CSS: Cascading Style Sheets
s, supply multiple values, separated by a comma: background-image: linear-gradient(to bottom, rgba(255,255,0,0.5), rgba(0,0,255,0.5)), url('https://mdn.mozillademos.org/files/7693/catfront.png'); Values none Is a keyword denoting the absence of images. <image> Is an <image> denoting the image to display. There can be several of them, separated by commas, as multiple backgrounds are sup
ported. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is im
portant primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the...
...artransparent.gif"), url("https://mdn.mozillademos.org/files/7693/catfront.png"); background-color: transparent; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'background-image' in that specification. Candidate Recommendation From CSS2 Revision 1, the property has been extended to sup
port multiple backgrounds and any <image> CSS data type. CSS Level 2 (Revision 1)The definition of 'background-image' in that specification. Recommendation From CSS1, the way images with and without intrinsic dimensions are handled is now described. CSS Level 1The definition of 'background-image' in that specification. Recommendation Initial definition. ...
background - CSS: Cascading Style Sheets
chment> See background-attachment <box> See background-clip and background-origin <background-color> See background-color <bg-image> See background-image <position> See background-position <repeat-style> See background-repeat <bg-size> See background-size. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is im
portant primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 For...
...ing { background: pink; } .topbanner { background: url("https://mdn.mozillademos.org/files/11983/starsolid.gif") #99f repeat-y fixed; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'background' in that specification. Candidate Recommendation The shorthand property has been extended to sup
port multiple backgrounds and the new background-size, background-origin and background-clip properties. CSS Level 2 (Revision 1)The definition of 'background' in that specification. Recommendation No significant changes CSS Level 1The definition of 'background' in that specification. Recommendation Initial definition ...
clamp() - CSS: Cascading Style Sheets
MAX) is resolved as max(MIN, min(VAL, MAX)) The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note that using clamp() for font sizes, as in these examples, allows you to set a font-size that grows with the size of the view
port, but doesn't go below a minimum font-size or above a maximum font-size. It has the same effect as the code in Fluid Typography but in one line, and without the use of media queries. Syntax The clamp() function takes three comma separated expressions as its parameter, in the order of minimum value, preferred value, maximum value. The minimum value is the smallest (most negative) value. This is ...
...auctor sapien iaculis sit amet. Fusce iaculis, libero quis elementum viverra, nulla ante accumsan lectus, sit amet convallis lacus ipsum vel est. Curabitur et urna non est consectetur pulvinar vel id risus. Ut vestibulum, sem in semper aliquet, felis arcu euismod sapien, ac imperdiet massa nisl quis sem. Vestibulum ac elementum felis, in tempor velit. Pellentesque purus ex, mattis at ornare quis,
porta condimentum mi. Donec vestibulum ligula vel nulla blandit, quis euismod nulla vestibulum. Suspendisse potenti. Nunc neque mauris, tempor sed facilisis at, ultrices eget nulla. Pellentesque convallis ante nec augue
porttitor, id tempus ante luctus.</p> <p>Integer rutrum sollicitudin tellus, quis cursus nulla scelerisque nec. Nunc eu facilisis lorem. Maecenas faucibus sapien eleifend, semper tell...
conic-gradient() - CSS: Cascading Style Sheets
, the center of the gradient, and then specifying a list of color-stops. Unlike linear and radial gradients, whose color-stops are placed by specifying a length, the color-stops of a conic gradient are specified with an angle. Units include deg for degrees, grad for gradients, rad for radians, and turn for turns. There are 360 degrees, 400 gradians, 2? radians, and 1 turn in a circle. Browsers sup
porting conic gradients also accept percent values, with 100% equaling 360 degrees, but this is not in the specification. Similar to radial gradients, the conic gradient syntax provides for positioning the center of the gradient anywhere within, or even outside, the image. The values for the position are similar to the syntax for 2-value background-position. The gradient arc is the circumference of ...
...ur times across and four times down) you can make a checkerboard. conic-gradient(#fff 90deg, #000 0.25turn 0.5turn, #fff 1rad 1.5rad, #000 300grad); background-size: 25% 25%; And, yes, you can mix and match different angle units, but don't. The above is hard to read. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is im
portant primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. While it is possible to create pie charts, checkerboards, and other effects with conic gradients, CSS images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. If the im...
contain - CSS: Cascading Style Sheets
nt can be sized without the need to examine its descendants' sizes. layout Indicates that nothing outside the element may affect its internal layout and vice versa. style Indicates that, for properties that can have effects on more than just an element and its descendants, those effects don't escape the containing element. Note that this value is marked "at-risk" in the spec and may not be sup
ported everywhere. paint Indicates that descendants of the element don't display outside its bounds. If the containing box is offscreen, the browser does not need to paint its contained elements -- these must also be offscreen as they are contained completely by that box. And if a descendant overflows the containing element's bounds, then that descendant will be clipped to the containing element's b...
... <article> <h2>Another heading of another article</h2> <img src="graphic.jpg" alt="photo"> <p>More content here.</p> </article> Each <article> and <img> is given a border, and the images are floated: img { float: left; border: 3px solid black; } article { border: 1px solid black; } Float interference If we were to insert another image at the bottom of the first article, a large
portion of the DOM tree may be re-laid out or repainted, and this would also interfere with the layout of the second article: <h1>My blog</h1> <article> <h2>Heading of a nice article</h2> <p>Content here.</p> <img src="i-just-showed-up.jpg" alt="social"> </article> <article> <h2>Another heading of another article</h2> <img src="graphic.jpg" alt="photo"> <p>More content here.</p> </article...
content - CSS: Cascading Style Sheets
esting for quotes. Accessibility concerns CSS-generated content is not included in the DOM. Because of this, it will not be represented in the accessibility tree and certain assistive technology/browser combinations will not announce it. If the content conveys information that is critical to understanding the page's purpose, it is better to include it in the main document. Accessibility sup
port for CSS generated content - Tink Explanation of WCAG, Guideline 1.3 - MDN Understanding Success Criterion 1.3.1 | W3C Understanding WCAG 2.0 Formal definition Initial valuenormalApplies to::before and ::after pseudo-elementsInheritednoComputed valueOn elements, always computes to normal. On ::before and ::after, if normal is specified, computes to none. Otherwise, for URI values, the absolut...
...n image. You can replace the contents of an element with either a <url> or an <image> value. Content added with ::before or ::after will not be generated as the contents of the element have been replaced. HTML <div id="replaced">Mozilla</div> CSS #replaced { content: url("https://mdn.mozillademos.org/files/12668/MDN.svg"); } #replaced::after { /* will not show if element replacement is sup
ported */ content: " (" attr(id) ")"; } Result Specifications Specification Status Comment CSS Generated Content Module Level 3The definition of 'content' in that specification. Working Draft Adds sup
port for alt-text CSS Level 2 (Revision 1)The definition of 'content' in that specification. Recommendation Initial definition ...
counters() - CSS: Cascading Style Sheets
The counters() CSS function enables nested counters, returning a concatenated string representing the current values of the named counters, if there are any. The counters() function has two forms: 'counters(name, string)' or 'counters(name, string, style)'. It is generally used with pseudo-elements, but can be used, theoretically, anywhere a <string> value is sup
ported. The generated text is the value of all counters with the given name, from outermost to innermost, separated by the specified string. The counters are rendered in the style indicated, defaulting to decimal if no style is specified. /* Simple usage - style defaults to decimal */ counters(countername, '-'); /* changing the counter display */ counters(countername, '.', upper-roman) A counter has no visible effect by itself. Th...
...e is specified. /* Simple usage - style defaults to decimal */ counters(countername, '-'); /* changing the counter display */ counters(countername, '.', upper-roman) A counter has no visible effect by itself. The counters() function (and counter() function) is what makes it useful by returning developer defined content. Note: The counters() function can be used with any CSS property, but sup
port for properties other than content is experimental, and sup
port for the type-or-unit parameter is sparse. Check the Browser compatibility table carefully before using this in production. Syntax Values <custom-ident> A name identifying the counters, which is the same case-sensitive name used for the counter-reset and counter-increment. The name cannot start with two dashes and can't be non...
cursor - CSS: Cascading Style Sheets
using <url> values, providing <x><y> coordinates for the second one, and falling back to the progress keyword value if neither image can be loaded: cursor: url(one.svg), url(two.svg) 5 5, progress; Values <url> A url(...) or a comma separated list url(...), url(...), ..., pointing to an image file. More than one <url> may be provided as fallbacks, in case some cursor image types are not sup
ported. A non-URL fallback (one or more of the keyword values) must be at the end of the fallback list. See Using URL values for the cursor property for more details. <x> <y> Optional x- and y-coordinates. Two unitless nonnegative numbers less than 32. Keyword values Move your mouse over values to see their live appearance in your browser: Category CSS value Example D...
...e nesw-resize nwse-resize Zooming zoom-in Something can be zoomed (magnified) in or out. zoom-out Usage notes Although the specification does not define any size limitations for cursor, individual user agents may choose to do so. Cursor changes using images which are outside the size range sup
ported by the browser will generally just be ignored. Check the Browser compatibility table for any notes on cursor size limits. Formal definition Initial valueautoApplies toall elementsInheritedyesComputed valueas specified, but with <url> values made absoluteAnimation typediscrete Formal syntax [ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait...
font-weight - CSS: Cascading Style Sheets
400 Normal (Regular) 500 Medium 600 Semi Bold (Demi Bold) 700 Bold 800 Extra Bold (Ultra Bold) 900 Black (Heavy) 950 Extra Black (Ultra Black) Variable fonts Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping. ...
...numbers in Common weight name mapping. However some fonts, called variable fonts, can sup
port a range of weights with a more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying widths. For the example below to work, you'll need a browser that sup
ports the CSS Fonts Level 4 syntax in which font-weight can be any number between 1 and 1000. HTML <header> <input type="range" id="weight" name="weight" min="1" max="1000" /> <label for="weight">Weight</label> </header> <div class="container"> <p class="sample">...it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn H...
font - CSS: Cascading Style Sheets
CSS Level 1The definition of 'font' in that specification. Recommendation Initial definition. ...
...Fragment + "}"; document.body.appendChild(css); } setCss(); Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font' in that specification. Candidate Recommendation Added sup
port for font-stretch values. CSS Level 2 (Revision 1)The definition of 'font-weight' in that specification. Recommendation Added sup
port for keywords. CSS Level 1The definition of 'font' in that specification. Recommendation Initial definition. ...
grid-template-columns - CSS: Cascading Style Sheets
percentage must be treated as auto. The intrinsic size contributions of the track may be adjusted to the size of the grid container and increase the final size of the track by the minimum amount that would result in honoring the percentage. <flex> Is a non-negative dimension with the unit fr specifying the track's flex factor. Each <flex>-sized track takes a share of the remaining space in pro
portion to its flex factor. When appearing outside a minmax() notation, it implies an automatic minimum (i.e. minmax(auto, <flex>)). max-content Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track. min-content Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) ...
...nt)), except that the track size is clamped at argument if it is greater than the auto minimum. repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) Represents a repeated fragment of the track list, allowing a large number of columns that exhibit a recurring pattern to be written in a more compact form. subgrid The subgrid value indicates that the grid will adopt the spanned
portion of its parent grid in that axis. Rather than being specified explicitly, the sizes of the grid rows/columns will be taken from the parent grid's definition. The subgrid value is from Level 2 of the Grid specification and currently only has implementation in Firefox 71 and onwards. Formal definition Initial valuenoneApplies togrid containersInheritednoPercentagesrefer to corresponding dime...
grid-template-rows - CSS: Cascading Style Sheets
percentage must be treated as auto. The intrinsic size contributions of the track may be adjusted to the size of the grid container, and increase the final size of the track by the minimum amount that would result in honoring the percentage. <flex> Is a non-negative dimension with the unit fr specifying the track's flex factor. Each <flex>-sized track takes a share of the remaining space in pro
portion to its flex factor. When appearing outside a minmax() notation, it implies an automatic minimum (i.e. minmax(auto, <flex>)). max-content Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track. min-content Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) Is...
...ntent)), except that the track size is clamped at argument if it is greater than the auto minimum. repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) Represents a repeated fragment of the track list, allowing a large number of rows that exhibit a recurring pattern to be written in a more compact form. subgrid The subgrid value indicates that the grid will adopt the spanned
portion of its parent grid in that axis. Rather than being specified explicitly, the sizes of the grid rows/columns will be taken from the parent grid's definition. The subgrid value is from Level 2 of the Grid specification and currently only has implementation in Firefox 71 and onwards. Formal definition Initial valuenoneApplies togrid containersInheritednoPercentagesrefer to corresponding dim...
<length> - CSS: Cascading Style Sheets
sions, there is no space between the unit literal and the number. The length unit is optional after the number 0. Note: Some properties allow negative <length>s, while others do not. Units Relative length units Relative lengths represent a measurement in terms of some other distance. Depending on the unit, this can be the size of a specific character, the line height, or the size of the view
port. Font-relative lengths Font-relative lengths define the <length> value in terms of the size of a particular character or font attribute in the font currently in effect in an element or its parent. Note: These units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the font size. cap Represents th...
... root element font-size, it represents its initial value (a common browser default is 16px, but user-defined preferences may modify this). rlh Equal to the computed value of the line-height property on the root element (typically <html>), converted to an absolute length. When used on the font-size or line-height properties of the root element, it refers to the properties' initial value. View
port-percentage lengths View
port-percentage lengths define the <length> value relative to the size of the view
port, i.e., the visible
portion of the document. View
port lengths are invalid in @page declaration blocks. vh Equal to 1% of the height of the view
port's initial containing block. vw Equal to 1% of the width of the view
port's initial containing block. vi Equal to 1% of the size of t...
mask-border-slice - CSS: Cascading Style Sheets
Initial value0Applies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoPercentagesrefer to size of the mask border imageComputed valueas specifiedAnimation typediscrete Formal syntax <number-percentage>{1,4} fill?where <number-percentage> = <number> | <percentage> Examples Basic usage This property doesn't appear to be sup
ported anywhere yet. When it eventually starts to be sup
ported, it will serve to define the size of the slices taken from the source image, and used to create the border mask. mask-border-slice: 30 fill; Chromium-based browsers sup
port an outdated version of this property -- mask-box-image-slice -- with a prefix: -webkit-mask-box-image-slice: 30 fill; Note: The mask-border page features a working...
... Note: The fill keyword needs to be included if you want the element's content to be visible. ...
mask-border-source - CSS: Cascading Style Sheets
olor-stop-length>?<linear-color-hint> = <length-percentage><length-percentage> = <length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-length> = <length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> Examples Basic usage This property doesn't appear to be sup
ported anywhere yet. When it eventually starts to be sup
ported, it will serve to define the source of the border mask. mask-border-source: url(image.jpg); Chromium-based browsers sup
port an outdated version of this property -- mask-box-image-source -- with a prefix: -webkit-mask-box-image-source: url(image.jpg); Note: The mask-border page features a working example (using the out-of-date prefixed...
... Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask-border-source' in that specification. ...
mask-border-width - CSS: Cascading Style Sheets
e defs element and all graphics elementsInheritednoPercentagesrelative to width/height of the mask border image areaComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typediscrete Formal syntax [ <length-percentage> | <number> | auto ]{1,4}where <length-percentage> = <length> | <percentage> Examples Basic usage This property doesn't appear to be sup
ported anywhere yet. When it eventually starts to be sup
ported, it will serve to define the width of the border mask -- setting this to a different value to mask-border-slice will cause the slices to be scaled to fit the border mask. mask-border-width: 30 fill; Chromium-based browsers sup
port an outdated version of this property -- mask-box-image-width -- with a prefix: -webkit-mask-box-image-width...
...g this to a different value to mask-border-slice will cause the slices to be scaled to fit the border mask. mask-border-width: 30 fill; Chromium-based browsers sup
port an outdated version of this property -- mask-box-image-width -- with a prefix: -webkit-mask-box-image-width: 20px; Note: The mask-border page features a working example (using the out-of-date prefixed border mask properties sup
ported in Chromium), so you can get an idea of the effect. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask-border-width' in that specification. Candidate Recommendation Initial definition ...
mask-border - CSS: Cascading Style Sheets
sn't it?</div> CSS To match the size of a single diamond, we will use a value of 90 divided by 3, or 30, for slicing the image into corner and edge regions. A repeat value of round will make the mask slices fit evenly, i.e., without clipping or gaps. ...
...; padding: 10px; /* Prefixed longhand properties currently sup
ported in Chromium -webkit-mask-box-image-source: url(https://udn.realityripple.com/samples/2d/fd08a3134c.png); -webkit-mask-box-image-slice: 30 fill; -webkit-mask-box-image-width: 20px; -webkit-mask-box-image-repeat: round; -webkit-mask-box-image-outset: 1px; */ /* Prefixed shorthand property currently sup
ported in Chromium */ -webkit-mask-box-image: url("https://udn.realityripple.com/samples/2d/fd08a3134c.png") /* source */ 30 fill / /* slice */ 20px / /* width */ 1px /* outset */ round; /* repeat */ /* Updated standard shorthand property, not sup
ported anywhere yet */ mask-border: url("https://udn.realityripple.com/samples/2d/fd08a31...
Guide to scroll anchoring - CSS: Cascading Style Sheets
pened because large images or some other elements have just loaded further up in the content. Scroll anchoring is a browser feature that aims to solve this problem of content jumping, which happens if content loads in after the user has already scrolled to a new part of the document. How does it work? Scroll anchoring adjusts the scroll position to compensate for the changes outside of the view
port. This means that the point in the document the user is looking at remains in the view
port, which may mean their scroll position actually changes in terms of how far they have moved through the document. How do I turn on scroll anchoring? You don't! The feature is enabled by default in sup
porting browsers. In most cases anchored scrolling is exactly what you want -- content jumping is a poor exp...
...n anchor, you can exclude it using overflow-anchor, as described below. What if I need to disable it? The specification provides a new property, overflow-anchor, which can be used to disable scroll anchoring on all or part of the document. It's essentially a way to opt out of the new behavior. The only possible values are auto or none: auto is the initial value; as long as the user has a sup
ported browser the scroll anchoring behavior will happen, and they should see fewer content jumps. none means that you have explicitly opted the document, or part of the document, out of scroll anchoring. To opt out the entire document, you can set it on the <body> element: body { overflow-anchor: none; } To opt out a certain part of the document use overflow-anchor: none on its container eleme...
overflow-wrap - CSS: Cascading Style Sheets
m the list of values below. Values normal Lines may only break at normal word break points (such as a space between two words). anywhere To prevent overflow, an otherwise unbreakable string of characters -- like a long word or URL -- may be broken at any point if there are no otherwise-acceptable break points in the line. No hyphenation character is inserted at the break point. ...
...table break points in the line. No hyphenation character is inserted at the break point. Soft wrap op
portunities introduced by the word break are considered when calculating min-content intrinsic sizes. break-word The same as the anywhere value, with normally unbreakable words allowed to be broken at arbitrary points if there are no otherwise acceptable break points in the line, but soft wrap op
portunities introduced by the word break are NOT considered when calculating min-content intrinsic sizes. Formal definition Initial valuenormalApplies tonon-replaced inline elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | break-word | anywhere Examples Comparing overflow-wrap, word-break, and hyphens This example compares the results of overflow-wrap,...
overflow - CSS: Cascading Style Sheets
keywords chosen from the list of values below. If two keywords are specified, the first applies to overflow-x and the second to overflow-y. Otherwise, both overflow-x and overflow-y are set to the same value. Values visible Content is not clipped and may be rendered outside the padding box. hidden Content is clipped if necessary to fit the padding box. No scrollbars are provided, and no sup
port for allowing the user to scroll (such as by dragging or using a scroll wheel) is allowed. The content can be scrolled programmatically (for example, by setting the value of a property such as offsetLeft), so the element is still a scroll container. clip Like for hidden, the content is clipped to the element's padding box. The difference between clip and hidden is that the clip keyword also fo...
...ent changes. Printers may still print overflowing content. auto Depends on the user agent. If content fits inside the padding box, it looks the same as visible, but still establishes a new block formatting context. Desktop browsers provide scrollbars if content overflows. overlay Behaves the same as auto, but with the scrollbars drawn on top of content instead of taking up space. Only sup
ported in WebKit-based (e.g., Safari) and Blink-based (e.g., Chrome or Opera) browsers. Mozilla extensions -moz-scrollbars-none [1] Use overflow: hidden instead. -moz-scrollbars-horizontal [1] Use overflow-x: scroll and overflow-y: hidden, or overflow: hidden scroll instead. -moz-scrollbars-vertical [1] Use overflow-x: hidden and overflow-y: scroll, or overflow: scroll hidden instead. -m...
place-content - CSS: Cascading Style Sheets
tent: last baseline right; /* Distributed alignment */ place-content: space-between space-evenly; place-content: space-around space-evenly; place-content: space-evenly stretch; place-content: stretch space-evenly; /* Global values */ place-content: inherit; place-content: initial; place-content: unset; The first value is the align-content property value, the second the justify-content one. Im
portant: If the second value is not present, the first value is used for both, provided it is a valid value for both. If it is invalid for one or the other, the whole value will be invalid. Values start The items are packed flush to each other toward the start edge of the alignment container in the appropriate axis. end The items are packed flush to each other toward the end edge of the alignm...
...items. space-evenly The items are evenly distributed within the alignment container. The spacing between each pair of adjacent items, the main-start edge and the first item, and the main-end edge and the last item, are all exactly the same. ...
repeating-conic-gradient() - CSS: Cascading Style Sheets
specified by indicating a rotation angle, the center of the gradient, and then specifying a list of color-stops. Like non-repeating conic gradients, the color-stops of a repeating conic gradient are specified with an <angle>. Units include deg for degrees, grad for gradients, rad for radians, and turn for turns. There are 360 degrees, 400 gradians, 2? radians, and 1 turn in a circle. Browsers sup
porting repeating conic gradients also accept percent values, with 100% equaling 360 degrees, but this is not in the specification. Radial and conic gradient syntax provides for positioning the center of the gradient anywhere within, or even outside, the image. The values for the position are similar to the syntax for 2-value background-position. The gradient arc is part of the circumference of the ...
...of the color transition should be. If two or more color stops are at the same location, the transition will be a hard line between the first and last colors declared at that location. While you can mix and match different angle units, don't. It makes CSS hard to read. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is im
portant primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. While it is possible to create pie charts, checkerboards, and other effects with conic gradients, CSS images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. If the im...
scroll-padding-block - CSS: Cascading Style Sheets
k shorthand property sets the scroll padding of an element in the block dimension. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The scroll-padding properties define offsets for the optimal viewing region of the scroll
port: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scroll
port that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scroll
port. Constituent properties This property is a shorthand for the following CSS prope...
...scroll-padding-block-start Syntax /* Keyword values */ scroll-padding-block: auto; /* <length> values */ scroll-padding-block: 10px; scroll-padding-block: 1em .5em; scroll-padding-block: 10%; /* Global values */ scroll-padding-block: inherit; scroll-padding-block: initial; scroll-padding-block: unset; Values <length-percentage> An inwards offset from the corresponding edge of the scroll
port, as a valid length or a percentage. auto The offset is determind by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scroll
portComputed valueas specifiedAnimation typeby computed val...
scroll-padding-inline - CSS: Cascading Style Sheets
shorthand property sets the scroll padding of an element in the inline dimension. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The scroll-padding properties define offsets for the optimal viewing region of the scroll
port: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scroll
port that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scroll
port. Constituent properties This property is a shorthand for the following CSS prop...
...adding-inline-start Syntax /* Keyword values */ scroll-padding-inline: auto; /* <length> values */ scroll-padding-inline: 10px; scroll-padding-inline: 1em .5em; scroll-padding-inline: 10%; /* Global values */ scroll-padding-inline: inherit; scroll-padding-inline: initial; scroll-padding-inline: unset; Values <length-percentage> An inwards offset from the corresponding edge of the scroll
port, as a valid length or a percentage. auto The offset is determind by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scroll
portComputed valueas specifiedAnimation typeby computed val...
scroll-padding - CSS: Cascading Style Sheets
element at once, much like the padding property does for padding on an element. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The scroll-padding-* properties define offsets for the optimal viewing region of the scroll
port: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scroll
port that are obscured by other content (such as fixed-positioned toolbars or sidebars), or simply to put more breathing room between a targeted element and the edges of the scroll
port. Constituent properties This property is a shorthand for the following CSS prop...
...croll-padding-left scroll-padding-right scroll-padding-top Syntax /* Keyword values */ scroll-padding: auto; /* <length> values */ scroll-padding: 10px; scroll-padding: 1em .5em 1em 1em; scroll-padding: 10%; /* Global values */ scroll-padding: inherit; scroll-padding: initial; scroll-padding: unset; Values <length-percentage> An inwards offset from the corresponding edge of the scroll
port, as a valid <length> or a <percentage>. auto The offset is determind by the user agent. This will generally be 0px, but the user agent is free to detect and do something else if a non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scroll
portComputed valueas specifiedAnimation typeby comput...
scroll-snap-align - CSS: Cascading Style Sheets
The two values specify the snapping alignment in the block axis and inline axis, respectively. If only one value is specified, the second value defaults to the same value. ...
...snap-align: none; scroll-snap-align: start end; /* when two values set first is block, second inline */ scroll-snap-align: center; /* Global values */ scroll-snap-align: inherit; scroll-snap-align: initial; scroll-snap-align: unset; Values none The box does not define a snap position in that axis. start The start alignment of this box's scroll snap area, within the scroll container's snap
port is a snap position in this axis. end The end alignment of this box's scroll snap area, within the scroll container's snap
port is a snap position in this axis. center The center alignment of this box's scroll snap area, within the scroll container's snap
port is a snap position in this axis. Safari currently has the two value syntax in the wrong order, the first value being inline the second ...
scroll-snap-type-x - CSS: Cascading Style Sheets
ny precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* Keyword values */ scroll-snap-type-x: none; scroll-snap-type-x: mandatory; scroll-snap-type-x: proximity; /* Global values */ scroll-snap-type-x: inherit; scroll-snap-type-x: initial; scroll-snap-type-x: unset; Syntax Values none When the visual view
port of this scroll container is scrolled horizontally, it must ignore snap points. mandatory The visual view
port of this scroll container will rest on a snap point if it isn't currently scrolled horizontally. That means it snaps on that point when the scroll action finished, if possible. If content is added, moved, deleted or resized the scroll offset will be adjusted to maintain the resting on tha...
...If content is added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. ...
scroll-snap-type-y - CSS: Cascading Style Sheets
ny precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* Keyword values */ scroll-snap-type-y: none; scroll-snap-type-y: mandatory; scroll-snap-type-y: proximity; /* Global values */ scroll-snap-type-y: inherit; scroll-snap-type-y: initial; scroll-snap-type-y: unset; Syntax Values none When the visual view
port of this scroll container is scrolled vertically, it must ignore snap points. mandatory The visual view
port of this scroll container will rest on a snap point if it isn't currently scrolled vertically. That means it snaps on that point when the scroll action finished, if possible. If content is added, moved, deleted or resized the scroll offset will be adjusted to maintain the resting on that sn...
...If content is added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. ...
scrollbar-color - CSS: Cascading Style Sheets
olor: light; /* <color> values */ scrollbar-color: rebeccapurple green; /* Two valid colors. The first applies to the thumb of the scrollbar, the second to the track. */ /* Global values */ scrollbar-color: inherit; scrollbar-color: initial; scrollbar-color: unset; Values <scrollbar-color> Defines the color of the scrollbar. auto Default platform rendering for the track
portion of the scrollbar, in the absence of any other related scrollbar color properties. dark Show a dark scrollbar, which can be either a dark variant of scrollbar provided by the platform, or a custom scrollbar with dark colors. light Show a light scrollbar, which can be either a light variant of scrollbar provided by the platform, or a custom scrollbar with light co...
...r with dark colors. light Show a light scrollbar, which can be either a light variant of scrollbar provided by the platform, or a custom scrollbar with light colors. <color> <color> Applies the first color to the scrollbar thumb, the second to the scrollbar track. Note: User Agents must apply any scrollbar-color value set on the root element to the view
port. Accessibility concerns When using scrollbar-color property with specific color values, authors should ensure the specified colors have enough contrast between them. For keyword values, UAs should ensure the colors they use have enough contrast. See Techniques for WCAG 2.0: G183: Using a contrast ratio of 3:1. Formal definition Initial valueautoApplies toscrolling boxesInheritedyesComput...
text-decoration-skip - CSS: Cascading Style Sheets
The text-decoration-skip CSS property sets what parts of an element's content any text decoration affecting the element must skip over. It controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors. Note: Most other browsers are converging on sup
porting the simpler text-decoration-skip-ink property. /* Keyword values */ text-decoration-skip: none; text-decoration-skip: objects; text-decoration-skip: spaces; text-decoration-skip: edges; text-decoration-skip: box-decoration; /* Multiple keywords */ text-decoration-skip: objects spaces; text-decoration-skip: leading-spaces trailing-spaces; text-decoration-skip: objects edges box-decoration; /* Global values */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decoratio...
...ng or word-spacing. leading-spaces The same as spaces, except that only leading spaces are skipped. trailing-spaces The same as spaces, except that only trailing spaces are skipped. edges The start and end of the text decoration is inset slightly (e.g., by half of the line thickness) from the content edge of the decorating box. Thus, adjacent elements receive separate underlines. (This is im
portant in Chinese, where underlining is a form of punctuation.) box-decoration The text decoration is skipped over the box's margin, border, and padding areas. This only has an effect on decorations imposed by an ancestor; a decorating box never draws over its own box decoration. Formal definition Initial valueobjectsApplies toall elementsInheritedyesComputed valueas specifiedAnimation typedis...
text-decoration - CSS: Cascading Style Sheets
ng through it.</p> <p>This <a class="plain" href="#">link will not be underlined</a>, as links generally are by default. Be careful when removing the text decoration on anchors since users often depend on the underline to denote hyperlinks.</p> <p class="underover">This text has lines above <em>and</em> below it.</p> <p class="thick">This text has a really thick purple underline in sup
porting browsers.</p> <p class="blink">This text might blink for you, depending on the browser you use.</p> Specifications Specification Status Comment CSS Text Decoration Module Level 4 Working Draft Adds text-decoration-thickness; note that this isn't yet officially part of the shorthand -- this is as yet unspecified. CSS Text Decoration Module Lev...
...fication Status Comment CSS Text Decoration Module Level 4 Working Draft Adds text-decoration-thickness; note that this isn't yet officially part of the shorthand -- this is as yet unspecified. CSS Text Decoration Module Level 3The definition of 'text-decoration' in that specification. Candidate Recommendation Transformed into a shorthand property. Added sup
port for the value of text-decoration-style. CSS Level 2 (Revision 1)The definition of 'text-decoration' in that specification. Recommendation No significant changes. CSS Level 1The definition of 'text-decoration' in that specification. Recommendation Initial definition. ...
text-overflow - CSS: Cascading Style Sheets
tion fade(), which is passed a <length> or a <percentage> to control the fade distance a <string>. Values clip The default for this property. This keyword value will truncate the text at the limit of the content area, therefore the truncation can happen in the middle of a character. To clip at the transition between characters you can specify text-overflow as an empty string, if that is sup
ported in your target browsers: text-overflow: '';. ellipsis This keyword value will display an ellipsis ('...', U+2026 Horizontal Ellipsis) to represent clipped text. The ellipsis is displayed inside the content area, decreasing the amount of text displayed. If there is not enough space to display the ellipsis, it is clipped. <string> The <string> to be used to represent clipped text. The strin...
...ntax [ clip | ellipsis | <string> ]{1,2} Examples CSS p { width: 200px; border: 1px solid; padding: 2px 5px; /* BOTH of the following are required for text-overflow */ white-space: nowrap; overflow: hidden; } .overflow-visible { white-space: initial; } .overflow-clip { text-overflow: clip; } .overflow-ellipsis { text-overflow: ellipsis; } .overflow-string { /* Not sup
ported in most browsers, see the 'Browser compatibility' section below */ text-overflow: " [..]"; } HTML <p class="overflow-visible">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-clip">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-ellipsis">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-st...
text-size-adjust - CSS: Cascading Style Sheets
o; /* <percentage> value */ text-size-adjust: 80%; /* Global values */ text-size-adjust: inherit; text-size-adjust: initial; text-size-adjust: unset; Because many websites have not been developed with small devices in mind, mobile browsers differ from desktop browsers in the way they render web pages. Instead of laying out pages at the width of the device screen, they lay them out using a view
port that is much wider, usually 800 or 1000 pixels. To map the extra-wide layout back to the original device size, they either show only part of the whole render or scale the view
port down to fit. Since text that has been scaled down to fit a mobile screen may be very small, many mobile browsers apply a text inflation algorithm to enlarge the text to make it more readable. When an element containing...
...one, auto, or a <percentage>. Values none Disables the browser's inflation algorithm. auto Enables the browser's inflation algorithm. This value is used to cancel a none value previously set with CSS. <percentage> Enables the browser's inflation algorithm, specifying a percentage value with which to increase the font size. ...
text-transform - CSS: Cascading Style Sheets
d, so for example text-transform: uppercase will change ar aon tsli to AR AON tSLI and not, as one might expect, AR AON TSLI (Firefox only). In some cases, a hyphen is also removed upon uppercasing: an t-uisce transforms to AN tUISCE (and the hyphen is correctly reinserted by text-transform: lowercase). The language is defined by the lang HTML attribute or the xml:lang XML attribute. Note: Sup
port for language-specific cases varies between browsers, so check the browser compatibility table. Syntax /* Keyword values */ text-transform: none; text-transform: capitalize; text-transform: uppercase; text-transform: lowercase; text-transform: full-width; text-transform: full-size-kana; /* Global values */ text-transform: inherit; text-transform: initial; text-transform: unset; capitalize ...
...her browsers did not. Both Webkit and Gecko incorrectly considered letter-based symbols like (a) to be real letters. Internet Explorer 9 was the closest to the CSS 2 definition, but with some weird cases.) By precisely defining the correct behavior, CSS Text Level 3 cleans this mess up. The capitalize line in the browser compatibility table contains the version the different engines started to sup
port this now precisely-defined behavior. uppercase Is a keyword that converts all characters to uppercase. lowercase Is a keyword that converts all characters to lowercase. none Is a keyword that prevents the case of all characters from being changed. full-width Is a keyword that forces the writing of a character -- mainly ideograms and Latin scripts -- inside a square, allowing them to be ...
url() - CSS: Cascading Style Sheets
s a parameter in another CSS function */ background-image: cross-fade(20% url(first.png), url(second.png)); mask-image: image(url(mask.png), skyblue, linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* as part of a non-shorthand multiple value */ content: url(star.svg) url(star.svg) url(star.svg) url(star.svg) url(star.svg); /* at-rules */ @document url("https://www.example.com/") { ... } @im
port url("https://www.example.com/style.css"); @namespace url(http://www.w3.org/1999/xhtml); Relative URLs, if used, are relative to the URL of the stylesheet (not to the URL of the web page). The url() function can be included as a value for background, background-image, list-style, list-style-image, content, cursor, border, border-image, border-image-source, mask, mask-image, src as part of a @fo...
...re all valid and equivalent: <css_property>: url("https://example.com/image.png") <css_property>: url('https://example.com/image.png') <css_property>: url(https://example.com/image.png) path References the ID of an SVG shape -- circle, ellipse, line, path, polygon, polyline, or rect -- using the shape's geometry as the path. <url-modifier> In the future, the url() function may sup
port specifying a modifier, an identifier or a functional notation, which alters the meaning of the URL string.This is not sup
ported and not fully defined in the specification. Formal syntax url( <string> <url-modifier>* ) Examples content property HTML <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> CSS li::after { content: ' - ' url(https://mdn.mozillademos.org/files/1676...
will-change - CSS: Cascading Style Sheets
It should not be used to anticipate performance problems. ...
...epare for the possible change. This will lead to worse performance. Give it sufficient time to work. This property is intended as a method for authors to let the user-agent know about properties that are likely to change ahead of time. Then the browser can choose to apply any ahead-of-time optimizations required for the property change before the property change actually happens. So it is im
portant to give the browser some time to actually do the optimizations. Find some way to predict at least slightly ahead of time that something will change, and set will-change then. Be aware, that will-change may actually influence the visual appearance of elements, when used with property values, that create a stacking context (e.g. will-change: opacity), as the stacking context is created up ...
Event reference
h API The spoken utterance reaches a named SSML "mark" tag. message MessageEvent WebSocket A message is received through a WebSocket. message MessageEvent Web Workers A message is received from a Web Worker. message MessageEvent Server Sent Events A message is received through an event source. messageerror MessageEvent Message
Port, Web Workers, Broadcast Channel, Window A message error is raised when a message is received by an object. message ServiceWorkerMessageEvent or ExtendableMessageEvent, depending on context. Service Workers A message is received from a service worker, or a message is received in a service worker from another context. mousedown MouseEvent DOM L3 A pointing d...
...line Event HTML5 offline The browser has gained access to the network (but particular websites might be unreachable). open Event WebSocket A WebSocket connection has been established. open Event Server Sent Events An event source connection has been established. orientationchange Event Screen Orientation The orientation of the device (
portrait/landscape) has changed. pagehide PageTransitionEvent HTML5 A session history entry is being traversed from. pageshow PageTransitionEvent HTML5 A session history entry is being traversed to. paste ClipboardEvent Clipboard Data has been transferred from the system clipboard to the document. pause Event HTML5 media Playbac...
Ajax - Developer guides
Getting Started An introduction to Ajax. Asynchronous JavaScript and XML, while not a technology in itself, is a term coined in 2005 by Jesse James Garrett, that describes a "new" approach to using a number of existing technologies together, including HTML or XHTML, CSS, JavaScript, DOM, XML, XSLT, and most im
portantly the XMLHttpRequest object. When these technologies are combined in the Ajax model, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page. This makes the application faster and more responsive to user actions. Although X in Ajax stands for XML, JSON is used more than XML nowadays because of its many advantages such as being lighter and a part of JavaScript. Both JSON and XML are used for packaging ...
...the user's computer, using File or Blob objects to specify the file or data to read. File objects may be obtained from a FileList object returned as a result of a user selecting files using the <input> element, from a drag and drop operation's DataTransfer object, or from the mozGetAsFile() API on an HTMLCanvasElement. HTML in XMLHttpRequest The XMLHttpRequest specification adds HTML parsing sup
port to XMLHttpRequest, which originally sup
ported only XML parsing. This feature allows Web apps to obtain an HTML resource as a parsed DOM using XMLHttpRequest. View All... Tools axios Promise based HTTP client, which uses XMLHttpRequest internally. See also Ajax: A New Approach to Web Applications Jesse James Garrett, of Adaptive Path, wrote this article in February 2005, introducing...
Video player styling basics - Developer guides
e the <button> elements, <progress> also has a default border, which is removed here. It is also given a slight rounded corner for aesthetic reasons. The color property is also defined here as Internet Explorer uses this defined colour for styling the progress bar's background colour as it increases. ...
...or the immediate styling; the next task is making a number of JavaScript changes to ensure that everything works as expected. Control visibility The first change is simple: the data-state for showing the video controls when JavaScript is available to the browser now needs to be set: // Display the user defined video controls videoControls.setAttribute('data-state', 'visible'); Progress bar sup
port A check also needs to be made to set up the "fake" progress bar if the browser doesn't sup
port the <progress> element: var sup
portsProgress = (document.createElement('progress').max !== undefined); if (!sup
portsProgress) progress.setAttribute('data-state', 'fake'); Button functionality This section looks at the JavaScript required for implementing the button functionality. Play/Pause and Mut...
Challenge solutions - Developer guides
This page provides solutions to the challenges posed in the CSS Getting Started tutorial. These are not the only possible solutions. The sections below correspond to the titles of the tutorial sections. Why use CSS Colors Challenge Without looking up a reference, find five more color names that work in your stylesheet. Solution CSS sup
ports common color names like orange, yellow, blue, green, or black. It also sup
ports some more exotic color names like chartreuse, fuschia, or burlywood. See CSS Color value for a complete list as well as other ways of specifying colors. How CSS works DOM inspector Challenge In DOMi, click on a STRONG node. Use DOMi's right-hand pane to find out where the node's color is set to red, and where its appearance is made bolder than normal te...
...enge Change the stylesheet to make the table have a green border around only the data cells. Solution The following rule puts borders around only <td> elements that are inside the <tbody> element of the table with id=demo-table: #demo-table tbody td { border:1px solid #7a7; } Media Separate print style file Challenge Move the print-specific style rules to a separate CSS file and im
port them into your style4.css stylesheet. Solution Cut and paste the lines between /* print only */ and /* end print only */ into a file named style4_print.css. In style4.css, add the following line at the beginning of the file: @im
port url("style4_print.css") print; Heading hover color Challenge Make the headings turn blue when the mouse pointer is over them. Solution The following rul...
Orientation and motion data explained - Developer guides
This article provides details about the coordinate systems at play and how you use them. About coordinate frames A coordinate frame is a system whereby the orientation of the three axes (X, Y, and Z) are defined in reference to an object. There are two coordinate frames to consider when using orientation and motion events: Earth coordinate frame The Earth coordinate frame is the coordinate frame fixed on the center of the Earth; that is, the axes are aligned based on the pull of gravity and the standard magnetic north orientation. ...
...he right and negative toward the left. The y axis is in the plane of the screen and is positive toward the top and negative toward the bottom. The z axis is perpendicular to the screen or keyboard, and is positive extending outward from the screen. Note: On a phone or tablet, the orientation of the device is always considered in relation to the standard orientation of the screen; this is the "
portrait" orientation on most devices. On a laptop computer, the orientation is considered in relation to the keyboard. If you want to detect changes in device orientation in order to compensate, you can use the orientationchange event. About rotation Rotation is described about any given axis in terms of the number of degrees of difference between the device's coordinate frame and the Earth coordin...
Introduction to Web development - Developer guides
Basic structure of a web page -- the doctype and document 'tree' Fundamental HTML elements -- structural, head, list, form elements and more, explained by category. HTML beginners tutorial -- a tutorial and exercise that recap and take you through the basics you've learned above. HTML elements reference guide -- a comprehensive guide to HTML elements with details on how browsers sup
port them CSS Getting started with CSS -- an absolute beginners guide to CSS covers basic concepts and fundamentals CSS reference guide -- a complete guide to CSS with details on the level of Gecko/Firefox sup
port for each. The W3C introduction to styling with CSS -- a brief guide to styling web pages for beginners. Common CSS questions -- common questions and answe...
...s of JavaScript. Resources W3C Web Education Community Group Wiki Covers web design, HTML and HTML5, CSS, JavaScript and accessibility. This is a good starting point for beginners wishing to learn web development fundamentals across a number of areas. SitePoint A reliable reference site for learning HTML, CSS and JavaScript which also mentions feature sup
port across different browsers and known browser bugs. HTMLDog An excellent and comprehensive reference site on HTML and CSS for beginners. Google's HTML, CSS, and Javascript from the Ground Up These easily digestible video tutorials from Google's expert web developers cover the basics of HTML, CSS and JavaScript. CSSTutorial.net Beginner Tutorials A broad range of useful...
HTML attribute: multiple - HTML: Hypertext Markup Language
value="doc@woodworkers.com">Doc</option> </datalist> input:invalid {border: red solid 3px;} If and only if the multiple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. Any trailing and leading whitespace is removed from each address in the list. If the required attribute is present, at least one email address is required. Some browsers sup
port the appearance of the list of options from the associated <datalist> for subsequent email addresses when multiple is present. Others do not. file input When multiple is set on the file input type, the user can select one or more files: <form method="post" enctype="multipart/form-data"> <p> <label for="uploads"> Choose the images you want to upload: </label> <input type="...
...ting system, mouse users can hold the Ctrl, Command, or Shift keys and then click multiple options to select/deselect them. Keyboard users can select multiple contiguous items by focusing on the <select> element, selecting an item at the top or bottom of the range they want to select using the Up and Down cursor keys to go up and down the options. The selection of non-contiguous is not as well sup
ported: items should be able to be selected and deselected by pressing Space , but sup
port varies between browsers. Specifications Specification Status Comment HTML Living StandardThe definition of 'multiple attribute' in that specification. Living Standard HTML5The definition of 'multiple attribute' in that specification. Recommendation Acce...
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
ngElement Attributes These elements only include the global attributes. The align attribute is obsolete; don't use it. Usage notes Heading information may be used by user agents, for example, to construct a table of contents for a document automatically. Avoid using heading tags to resize text. Instead, use the CSS font-size property. Headings use size to indicate their relative im
portance, but CSS is preferred for general-purpose resizing. Avoid skipping heading levels: always start from <h1>, next use <h2> and so on. You should only use one <h1> per page. Using more than one will not result in an error, but using only one is seen as a best practice. It makes logical sense -- <h1> is the most im
portant heading, and tells you what the purpose of the overall page is. You would...
... <h2>Examples</h2> <h3>Example 1</h3> <p>Some text here...</p> <h3>Example 2</h3> <p>Some text here...</p> <h2>See also</h2> <p>Some text here...</p> Here is the result of this code: Accessibility concerns Navigation A common navigation technique for users of screen reading software is jumping from heading to heading to quickly determine the content of the page. Because of this, it is im
portant to not skip one or more heading levels. Doing so may create confusion, as the person navigating this way may be left wondering where the missing heading is. Don't <h1>Heading level 1</h1> <h3>Heading level 3</h3> <h4>Heading level 4</h4> Do <h1>Heading level 1</h1> <h2>Heading level 2</h2> <h3>Heading level 3</h3> Nesting Headings may be nested as subsections to reflect the organizatio...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
hrasing content, palpable content Permitted content Phrasing content Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM Interface HTMLElement Attributes This element only sup
ports the global attributes. The title attribute has a specific semantic meaning when used with the <abbr> element; it must contain a full human-readable description or expansion of the abbreviation. This text is often presented by browsers as a tooltip when the mouse cursor is hovered over the element. Each <abbr> element you use is independent from all others; providing a title for one does not aut...
...bbr> in concert with <dfn> to establish definitions for terms which are abbreviations or acronyms. See the example Defining an abbreviation below. Grammar considerations In languages with grammatical number (that is, languages where the number of items affects the grammar of a sentence), use the same grammatical number in your title attribute as inside your <abbr> element. This is especially im
portant in languages with more than two numbers, such as Arabic, but is also relevant in English. Default styling The purpose of this element is purely for the convenience of the author and all browsers display it inline (display: inline) by default, though its default styling varies from one browser to another: Some browsers, like Internet Explorer, do not style it differently than a <span> elem...
<area> - HTML: Hypertext Markup Language
he resource: "no-referrer" meaning that the Referer: header will not be sent. "no-referrer-when-downgrade" meaning that no Referer: header will be sent when navigating to an origin without TLS (HTTPS). This is a user agent's default behavior, if no policy is otherwise specified. "origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the
port. "origin-when-cross-origin" meaning that navigations to other origins will be limited to the scheme, the host and the
port, while navigations on the same origin will include the referrer's path. "unsafe-url" meaning that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe because it can leak origins and paths from TLS-protected...
.... Use this attribute only if the href attribute is present. shape The shape of the associated hot spot. The specifications for HTML defines the values rect, which defines a rectangular region; circle, which defines a circular region; poly, which defines a polygon; and default, which indicates the entire region beyond any defined shapes. Many browsers, notably Internet Explorer 4 and higher, sup
port circ, polygon, and rectangle as valid values for shape, but these values are non-standard. target A keyword or author-defined name of the browsing context to display the linked resource. The following keywords have special meanings: _self (default): Show the resource in the current browsing context. _blank: Show the resource in a new, unnamed browsing context. _parent: Show the resourc...
<basefont> - HTML: Hypertext Markup Language
ements which are descended from its parent element. With this set, the font's size can then be varied relative to the base size using the <font> element. You should not use this element; instead, you should use CSS properties such as font, font-family, font-size, and color to change the font configuration for an element and its contents. Attributes Like all other HTML elements, this element sup
ports the global attributes. color This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. face This attribute contains a list of one or more font names. The document text in the default style is rendered in the first font face that the client's browser sup
ports. If no font listed is installed on the local system, the browser typicall...
...es. color This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. face This attribute contains a list of one or more font names. The document text in the default style is rendered in the first font face that the client's browser sup
ports. If no font listed is installed on the local system, the browser typically defaults to the pro
portional or fixed-width font for that system. size This attribute specifies the font size as either a numeric or relative value. Numeric values range from 1 to 7 with 1 being the smallest and 3 the default. Usage notes Do not use this element! Though once (imprecisely) normalized in HTML 3.2, it wasn't sup
ported in all major browsers. Further, browsers, and even successive versions of browsers, ...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
ARIA roles Any DOM interface HTMLCanvasElement Attributes This element's attributes include the global attributes. height The height of the coordinate space in CSS pixels. Defaults to 150. moz-opaque Lets the canvas know whether or not translucency will be a factor. If the canvas knows there's no translucency, painting performance can be optimized. ...
...Providing a useful fallback text or sub DOM helps to make the the canvas more accessible. Required </canvas> tag Unlike the <img> element, the <canvas> element requires the closing tag (</canvas>). ...
<em>: The Emphasis element - HTML: Hypertext Markup Language
ot be used simply to apply italic styling; use the CSS font-style property for that purpose. Use the <cite> element to mark the title of a work (book, play, song, etc.). Use the <i> element to mark text that is in an alternate tone or mood, which covers many common situations for italics such as scientific names or words in other languages. Use the <strong> element to mark text that has greater im
portance than surrounding text. <i> vs. <em> New developers are often confused at seeing multiple elements that produce similar results. <em> and <i> are a common example, since they both italicize text. What's the difference? Which should you use? By default, the visual result is the same. However, the semantic meaning is different. The <em> element represents stress emphasis of its contents, whil...
... situation. Neither is for purely decorational purposes, that's what CSS styling is for. An example for <em> could be: "Just do it already!", or: "We had to do something about it". A person or software reading the text would pronounce the words in italics with an emphasis, using verbal stress. An example for <i> could be: "The Queen Mary sailed last night". Here, there is no added emphasis or im
portance on the word "Queen Mary". It is merely indicated that the object in question is not a queen named Mary, but a ship named Queen Mary. Another example for <i> could be: "The word the is an article". Example The <em> element is often used to indicate an implicit or explicit contrast. <p> In HTML 5, what was previously called <em>block-level</em> content is now called <em>flow</em> conte...
<font> - HTML: Hypertext Markup Language
L5. Starting with HTML 4, HTML does not convey styling information anymore (outside the <style> element or the style attribute of each element). For any new web development, styling should be written using CSS only. The former behavior of the <font> element can be achieved, and even better controlled using the CSS Fonts CSS properties. Attributes Like all other HTML elements, this element sup
ports the global attributes. color This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. face This attribute contains a comma-separated list of one or more font names. The document text in the default style is rendered in the first font face that the client's browser sup
ports. If no font listed is installed on the local system, the ...
...is attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. face This attribute contains a comma-separated list of one or more font names. The document text in the default style is rendered in the first font face that the client's browser sup
ports. If no font listed is installed on the local system, the browser typically defaults to the pro
portional or fixed-width font for that system. size This attribute specifies the font size as either a numeric or relative value. Numeric values range from 1 to 7 with 1 being the smallest and 3 the default. It can be defined using a relative value, like +2 or -3, which set it relative to the value of the size attribute of the <basefont> element, or relative to 3, the default value, if none does exi...
<html>: The HTML Document / Root element - HTML: Hypertext Markup Language
l> element will help screen reading technology determine the proper language to announce. The identifying language tag should describe the language used by the majority of the content of the page. Without it, screen readers will typically default to the operating system's set language, which may cause mispronunciations. Including a valid lang declaration on the <html> element also ensures that im
portant metadata contained in the page's <head>, such as the page's <title>, are also announced properly. MDN Understanding WCAG, Guideline 3.1 explanations Understanding Success Criterion 3.1.1 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of '<html>' in that specification. Living Standard ...
...unced properly. MDN Understanding WCAG, Guideline 3.1 explanations Understanding Success Criterion 3.1.1 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of '<html>' in that specification. Living Standard HTML5The definition of '<html>' in that specification. Recommendation Added sup
port for the manifest attribute (deprecated later). Obsoleted the version attribute HTML 4.01 SpecificationThe definition of '<html>' in that specification. Recommendation Deprecated the version attribute ...
<input type="password"> - HTML: Hypertext Markup Language
th which the wrong one can be pressed, especially on virtual keyboards. Note: Any forms involving sensitive information like passwords (e.g. login forms) should be served over HTTPS; Many browsers now implement mechanisms to warn against insecure login forms; see Insecure passwords. ...
...dation for more information. Note: The line feed (U+000A) and carriage return (U+000D) characters are not permitted in a password value. When setting the value of a password control, line feed and carriage return characters are stripped out of the value. ...
<keygen> - HTML: Hypertext Markup Language
specified in IETF RFC 3279. The user may be given a choice of DSA key sizes, allowing the user to choose one of the sizes defined in the DSA standard. For EC keys, the keyparams parameter specifies the name of the elliptic curve on which the key will be generated. It is normally a string from the table in nsKeygenHandler.cpp. (Note that only a subset of the curves named there may actually be sup
ported in any particular browser.) If the keyparams parameter string is not a recognized curve name string, then a curve is chosen according to the user's chosen key strength (low, medium, high), using the curve named "secp384r1" for high, and the curve named "secp256r1" for medium keys. (Note: choice of the number of key strengths, default values for each strength, and the UI by which the user is off...
...this specification.) The <keygen> element is only valid within an HTML form. It will cause some sort of selection to be presented to the user for selecting key size. The UI for the selection may be a menu, radio buttons, or possibly something else. The browser presents several possible key strengths. Currently, two strengths are offered, high and medium. If the user's browser is configured to sup
port cryptographic hardware (e.g. "smart cards") the user may also be given a choice of where to generate the key, i.e., in a smart card or in software and stored on disk. When the submit button is pressed, a key pair of the selected size is generated. The private key is encrypted and stored in the local key database. PublicKeyAndChallenge ::= SEQUENCE { spki SubjectPublicKeyInfo, challenge ...
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
Whitespace inside this element is displayed as written. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, palpable content. Permitted content Phrasing content. ...
...; to achieve such an effect, use CSS width instead. wrap Is a hint indicating how the overflow must happen. In modern browser this hint is ignored and no visual effect results in its present; to achieve such an effect, use CSS white-space instead. Example HTML <p>Using CSS to change the font color is easy.</p> <pre> body { color: red; } </pre> Result Accessibility concerns It is im
portant to provide an alternate description for any images or diagrams created using preformatted text. The alternate description should clearly and concisely describe the image or diagram's content. People experiencing low vision conditions and browsing with the aid of assistive technology such as a screen reader may not understand what the preformatted text characters are representing when they are...
<style>: The Style Information element - HTML: Hypertext Markup Language
ument, they will be applied to the DOM in the order they are included in the document -- make sure you include them in the correct order, to avoid unexpected cascade issues. In the same manner as <link> elements, <style> elements can include media attributes that contain media queries, allowing you to selectively apply internal stylesheets to your document depending on media features such as view
port width. Attributes This element includes the global attributes. type This attribute defines the styling language as a MIME type (charset should not be specified). This attribute is optional and defaults to text/css if it is not specified; values other than the empty string or text/css are not used. Note: There is very little reason to include this attribute in modern web documents. media T...
... <!doctype html> <html> <head> <style> p { color: white; background-color: blue; padding: 5px; border: 1px solid black; } </style> <style media="all and (max-width: 500px)"> p { color: blue; background-color: yellow; } </style> </head> <body> <p>This is my paragraph.</p> </body> </html> Technical summary...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
L specification, the default style for <summary> elements includes display: list-item. This makes it possible to change or remove the icon displayed as the disclosure widget next to the label from the default, which is typically a triangle. You can also change the style to display: block to remove the disclosure triangle. See the Browser compatibility section for details, as not all browsers sup
port full functionality of this element yet. Examples Below are some examples showing <summary> in use. You can find more examples in the documentation for the <details> element. Basic example A simple example showing the use of <summary> in a <details> element: <details open> <summary>Overview</summary> <ol> <li>Cash on hand: $500.00</li> <li>Current invoice: $75.30</li> <li>Due ...
...rning: Because the <summary> element has a default role of button (which strips all roles from child elements), this example will not work for users of assistive technologies such as screen readers. The <h4> will have its role removed and thus will not be treated as a heading for these users. HTML in summaries This example adds some semantics to the <summary> element to indicate the label as im
portant: <details open> <summary><strong>Overview</strong></summary> <ol> <li>Cash on hand: $500.00</li> <li>Current invoice: $75.30</li> <li>Due date: 5/6/19</li> </ol> </details> Specifications Specification Status Comment HTML Living StandardThe definition of '<summary>' in that specification. Living Standard HTML 5.1The definition ...
<title>: The Document Title element - HTML: Hypertext Markup Language
sults page. A few guidelines and tips for composing good titles: Avoid one- or two-word titles. Use a descriptive phrase, or a term-definition pairing for glossary or reference-style pages. Search engines typically display about the first 55-60 characters of a page title. Text beyond that may be lost, so try not to have titles longer than that. If you must use a longer title, make sure the im
portant parts come earlier and that nothing critical is in the part of the title that is likely to be dropped. Don't use "keyword blobs." If your title is just a list of words, algorithms often reduce your page's position in the search results. Try to make sure your titles are as unique as possible within your own site. Duplicate--or near-duplicate--titles can contribute to inaccurate search results...
...arch results. Try to make sure your titles are as unique as possible within your own site. Duplicate--or near-duplicate--titles can contribute to inaccurate search results. Example <title>Awesome interesting stuff</title> This example establishes a page whose title (as displayed at the top of the window or in the window's tab) as "Awesome interesting stuff". Accessibility concerns It is im
portant to provide a title value that describes the page's purpose. A common navigation technique for users of assistive technology is to read the page title and infer the content the page contains. This is because navigating into a page to determine its content can be a time consuming and potentially confusing process. Example <title>Menu - Blue House Chinese Food - FoodYum: Online takeout today!
dir - HTML: Hypertext Markup Language
ectionality, then applies that directionality to the whole element. Usage notes: This attribute is mandatory for the <bdo> element where it has a different semantic meaning. This attribute is not inherited by the <bdi> element. If not set, its value is auto. This attribute can be overridden by the CSS properties direction and unicode-bidi, if a CSS page is active and the element sup
ports these properties. As the directionality of the text is semantically related to its content and not to its presentation, it is recommended that web developers use this attribute instead of the related CSS properties when possible. That way, the text will display correctly even on a browser that doesn't sup
port CSS or has the CSS deactivated. The auto value should be used for data with...
...specification. Recommendation Snapshot of HTML Living Standard, no change from HTML5 HTML5The definition of 'dir' in that specification. Recommendation Snapshot of HTML Living Standard, from HTML 4.01 Specification it added the auto value, and is now a true global attribute. HTML 4.01 SpecificationThe definition of 'dir' in that specification. Recommendation Sup
ported on all elements but <applet>, <base>, <basefont>, <bdo>, <br>, <frame>, <frameset>, <iframe>, <param>, and <script>. ...
itemtype - HTML: Hypertext Markup Language
This vocabulary defines a standard set of type names and property names. ...
...l be defined to use the same vocabulary. The itemtype attribute can only be specified on elements which have an itemscope attribute specified. The itemid attribute can only be specified on elements which have both an itemscope attribute and an itemtype attribute specified. They must only be specified on elements with an itemscope attribute, whose itemtype attribute specifies a vocabulary not sup
porting global identifiers for items, as defined by that vocabulary's specification. The exact meaning of a global identifier is determined by the vocabulary's specification. It is left to such specifications to define whether multiple items of the same global identifier (whether on the same page or different pages) are allowed to exist, and what processing rules for that vocabulary are, with respect...
title - HTML: Hypertext Markup Language
If a tooltip effect is desired, it is better to use a more accessible technique that can be accessed with the above browsing methods. 3.2.5.1. The title attribute | W3C HTML 5.2: 3. Semantics, structure, and APIs of HTML documents Using the HTML title attribute - updated | The Paciello Group Tooltips & T...
...n of 'title' in that specification. Recommendation Snapshot of HTML Living Standard, no change from HTML5 HTML5The definition of 'title' in that specification. Recommendation Snapshot of HTML Living Standard. From HTML 4.01 Specification, it is now a true global attribute. HTML 4.01 SpecificationThe definition of 'title' in that specification. Recommendation Sup
ported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, and <title>. ...
Link types - HTML: Hypertext Markup Language
y an icon (auditory or visual). In the browser, it is usually referred to as the favicon. If there are multiple <link rel="icon">s, the browser uses their media, type, and sizes attributes to select the most appropriate icon. If several icons are equally appropriate, the last one is used. If the most appropriate icon is later found to be inappropriate, for example because it uses an unsup
ported format, the browser proceeds to the next-most appropriate, and so on. Note: Apple's iOS does not use this link type, nor the sizes attribute, like others mobile browsers do, to select a webpage icon for Web Clip or a start-up placeholder. Instead it uses the non-standard apple-touch-icon and apple-touch-startup-image respectively. The shortcut link type is often seen before ic...
...e sizes attribute, like others mobile browsers do, to select a webpage icon for Web Clip or a start-up placeholder. Instead it uses the non-standard apple-touch-icon and apple-touch-startup-image respectively. The shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. <link> <a>, <area>, <form> im
port HTML Im
ports <link> <a>, <area>, <form> index Obsolete since HTML5 Indicates that the page is part of a hierarchical structure and that the hyperlink leads to the top level resource of that structure. If one or several up link types are also present, the number of these up indicates the depth of the current page in the hierarchy. <a>, <area>, <link> <form> ...
Quirks Mode and Standards Mode - HTML: Hypertext Markup Language
existing sites on the web. Browsers therefore introduced two modes to treat new standards compliant sites differently from old legacy sites. There are now three modes used by the layout engines in web browsers: quirks mode, almost standards mode, and full standards mode. In quirks mode, layout emulates nonstandard behavior in Navigator 4 and Internet Explorer 5. This is essential in order to sup
port websites that were built before the widespread adoption of web standards. In full standards mode, the behavior is (hopefully) the behavior described by the HTML and CSS specifications. In almost standards mode, there are only a very small number of quirks implemented. How do browsers determine which mode to use? For HTML documents, browsers use a DOCTYPE in the beginning of the document to deci...
... the application/xhtml+xml MIME type in the Content-Type HTTP header, you do not need a DOCTYPE to enable standards mode, as such documents always use full standards mode. Note however that serving your pages as application/xhtml+xml will cause Internet Explorer 8 to show a download dialog box for an unknown format instead of displaying your page, as the first version of Internet Explorer with sup
port for XHTML is Internet Explorer 9. If you serve XHTML-like content using the text/html MIME type, browsers will read it as HTML, and you will need the DOCTYPE to use standards mode. How do I see which mode is used? In Firefox, select View Page Info from the context menu, and look for Render Mode. In Internet Explorer, press F12, and look for Document Mode. What are the differences between the...
Data URLs - HTTP
nt, or to incorrectly encode the data into base64 format. Formatting in HTML A data URL provides a file within a file, which can potentially be very wide relative to the width of the enclosing document. As a URL, the data should be formatable with whitespace (linefeed, tab, or spaces), but there are practical issues that arise when using base64 encoding. Length limitations Although Firefox sup
ports data URLs of essentially unlimited length, browsers are not required to sup
port any particular maximum length of data. For example, the Opera 11 browser limited URLs to 65535 characters long which limits data URLs to 65529 characters (65529 characters being the length of the encoded data, not the source, if you use the plain data:, without specifying a MIME type). Lack of error handling Invali...
... length of data. For example, the Opera 11 browser limited URLs to 65535 characters long which limits data URLs to 65529 characters (65529 characters being the length of the encoded data, not the source, if you use the plain data:, without specifying a MIME type). Lack of error handling Invalid parameters in media, or typos when specifying 'base64', are ignored, but no error is provided. No sup
port for query strings, etc. The data
portion of a data URL is opaque, so an attempt to use a query string (page-specific parameters, with the syntax <url>?parameter-data) with a data URL will just include the query string in the data the URL represents. Security issues A number of security issues (e.g. phishing) have been associated with data URLs, and navigating to them in the browser's top l...
Identifying resources on the Web - HTTP
Resource Names view-source Source code of the resource ws/wss (Encrypted) WebSocket connections Authority www.example.com is the domain name or authority that governs the namespace. It indicates which Web server is being requested. Alternatively, it is possible to directly use an IP address, but because it is less convenient, it is not often used on the Web.
Port :80 is the
port in this instance. It indicates the technical "gate" used to access the resources on the web server. It is usually omitted if the web server uses the standard
ports of the HTTP protocol (80 for HTTP and 443 for HTTPS) to grant access to its resources. Otherwise it is mandatory. Path /path/to/myfile.html is the path to the resource on the Web server. In the early days of...
... the part after the #, also known as fragment identifier, is never sent to the server with the request. Usage notes When using URLs in HTML content, you should generally only use a few of these URL schemes. When referring to subresources -- that is, files that are being loaded as part of a larger document -- you should only use the HTTP and HTTPS schemes. Increasingly, browsers are removing sup
port for using FTP to load subresources, for security reasons. FTP is still acceptable at the top level (such as typed directly into the browser's URL bar, or the target of a link), although some browsers may delegate loading FTP content to another application. Examples https://developer.mozilla.org/docs/Learn tel:+1-816-555-1212 git@github.com:mdn/browser-compat-data.git ftp://example.org/resource...
HTTP conditional requests - HTTP
entical if the content is equivalent. For example, a page that would differ from another only by a different date in its footer, or different advertising, would be considered identical to the other with weak validation. These same two versions are considered different when using strong validation. Building a system of etags that creates weak validation may be complex, as it involves knowing the im
portance of the different elements of a page, but is very useful towards optimizing cache performance. Conditional headers Several HTTP headers, called conditional headers, lead to conditional requests. These are: If-Match Succeeds if the ETag of the distant resource is equal to one listed in this header. By default, unless the etag is prefixed with 'W/', it performs a strong validation. If-Non...
...validators on the server side, this mechanism is transparent: all browsers manage a cache and send such conditional requests without any special work to be done by Web developers. Integrity of a partial download Partial downloading of files is a functionality of HTTP that allows to resume previous operations, saving bandwidth and time, by keeping the already obtained information: A server sup
porting partial downloads broadcasts this by sending the Accept-Ranges header. Once this happens, the client can resume a download by sending a Ranges header with the missing ranges: The principle is simple, but there is one potential problem: if the downloaded resource has been modified between both downloads, the obtained ranges will correspond to two different versions of the resource, and the f...
List of default Accept values - HTTP
e Accept Header (IEInternals' MSDN blog) Internet Explorer 9 image/png,image/svg+xml,image/*;q=0.8, */*;q=0.5 See Fiddler is better with Internet Explorer 9 (IEInternals' MSDN blog) Values for a video When a video is requested, via the <video> HTML element, most browsers use specific values. User Agent Value Comment Firefox earlier than 3.6 no sup
port for <video> Firefox 3.6 and later video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5 See bug 489071 source Chrome */* source Internet Explorer 8 or earlier no sup
port for <video> Values for audio resources When an audio file is requested, like via the <audio> HTML element, most browsers use specific values. ...
...udio resources When an audio file is requested, like via the <audio> HTML element, most browsers use specific values. User Agent Value Comment Firefox 3.6 and later audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5 See bug 489071 source Safari, Chrome */* source Internet Explorer 8 or earlier no sup
port for <audio> Internet Explorer 9 ? Values for scripts When a script is requested, like via the <script> HTML element, some browsers use specific values. User Agent Value Comment Firefox */* See bug 170789 Safari, Chrome */* source Internet Explorer 8 or earlier */* See IE and the Accept Header (IEInternals' MS...
Using HTTP cookies - HTTP
authenticated or a CSRF token is correct, this effectively acts as a defence measure against session fixation. On the application server, the web application must check for the full cookie name including the prefix--user agents do not strip the prefix from the cookie before sending it in a request's Cookie header. For more information about cookie prefixes and the current state of browser sup
port, see the Prefixes section of the Set-Cookie reference article. JavaScript access using Document.cookie New cookies can be created via JavaScript using the Document.cookie property, and existing cookies can be accessed from JavaScript as well, if the HttpOnly flag is not set. document.cookie = "yummy_cookie=choco"; document.cookie = "tasty_cookie=strawberry"; console.log(document.cookie); // lo...
...tion/confidentiality mechanisms such as JSON Web Tokens. Ways to mitigate attacks involving cookies: Use the HttpOnly attribute to prevent access to cookie values via JavaScript. Cookies that are used for sensitive information (such as indicating authentication) should have a short lifetime, with the SameSite attribute set to Strict or Lax. (See SameSite cookies, above.) In browsers that sup
port SameSite, this has the effect of ensuring that the authentication cookie is not sent with cross-origin requests, so such a request is effectively unauthenticated to the application server. Tracking and privacy Third-party cookies A cookie is associated with a domain. If this domain is the same as the domain of the page you are on, the cookie is called a first-party cookie. If the domain is di...
Accept-Encoding - HTTP
The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand. Using content negotiation, the server selects one of the proposals, uses it and informs the client of its choice with the Content-Encoding response header. Even if both the client and the server sup
ports the same compression algorithms, the server may choose not to compress the body of a response, if the identity value is also acceptable. Two common cases lead to this: The data to be sent is already compressed and a second compression won't lead to smaller data to be transmitted. This may be the case with some image formats; The server is overloaded and cannot afford the computational overhead induced by the compression requirement. Typically, Micr...
...eflate compression algorithm. br A compression format using the Brotli algorithm. identity Indicates the identity function (i.e. no compression, nor modification). This value is always considered as acceptable, even if not present. * Matches any content encoding not already listed in the header. This is the default value if the header is not present. It doesn't mean that any algorithm is sup
ported; merely that no preference is expressed. ;q= (qvalues weighting) Any value is placed in an order of preference expressed using a relative quality value called weight. Examples Accept-Encoding: gzip Accept-Encoding: gzip, compress, br Accept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1 Specifications Specification Title RFC 7231, section 5.3.4: Accept-Encoding Hypert...
Accept-Ranges - HTTP
The Accept-Ranges response HTTP header is a marker used by the server to advertise its sup
port of partial requests. The value of this field indicates the unit that can be used to define a range. In presence of an Accept-Ranges header, the browser may try to resume an interrupted download, rather than to start it from the start again. Header type Response header Forbidden header name no Syntax Accept-Ranges: <range-unit> Accept-Ranges: none Directives <range-unit> Defines the range unit the server sup
ports. Though bytes is the only range unit formally defined by RFC 7233, additional range units may be registered in the HTTP Range Unit Registry. ...
... the start again. Header type Response header Forbidden header name no Syntax Accept-Ranges: <range-unit> Accept-Ranges: none Directives <range-unit> Defines the range unit the server sup
ports. Though bytes is the only range unit formally defined by RFC 7233, additional range units may be registered in the HTTP Range Unit Registry. none No range unit is sup
ported, this makes the header equivalent of its own absence and is therefore rarely used, though some browsers, like IE9, it is used to disable or remove the pause buttons in the download manager. Examples Accept-Ranges: bytes Specifications Specification Title RFC 7233, section 2.3: Accept-Ranges Hypertext Transfer Protocol (HTTP/1.1): Range Requests ...
Cross-Origin-Embedder-Policy - HTTP
none | require-corp Directives unsafe-none This is the default value. Allows the document to fetch cross-origin resources without giving explicit permission through the CORS protocol or the Cross-Origin-Resource-Policy header. require-corp A document can only load resources from the same origin, or resources explicitly marked as loadable from another origin. If a cross origin resource sup
ports CORS, the crossorigin attribute or the Cross-Origin-Resource-Policy header must be used to load it without being blocked by COEP. Examples Certain features depend on cross-origin isolation You can only access certain features like SharedArrayBuffer objects or Performance.now() with unthrottled timers, if your document has a COEP header with the value require-corp value set. Cross-Origin-Emb...
...et as well. To check if cross origin isolation has been successful, you can test against the crossOriginIsolated property available to window and worker contexts: if (crossOriginIsolated) { // Post SharedArrayBuffer } else { // Do something else } Avoiding COEP blockage with CORS If you enable COEP using require-corp and have a cross origin resource that needs to be loaded, it needs to sup
port CORS and you need to explicitly mark the resource as loadable from another origin to avoid blockage from COEP. For example, you can use the crossorigin attribute for this image from a third-party site: <img src="https://thirdparty.com/img.png" crossorigin> Specifications Specification HTML Living StandardThe definition of 'Cross-Origin-Embedder-Policy header' in that spec...
Forwarded - HTTP
y must be kept in mind when deploying this header. Header type Request header Forbidden header name no Syntax Forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https> Directives <identifier> An identifier disclosing the information that is altered or lost when using a proxy. This can be either: an IP address (v4 or v6, optionally with a
port, and ipv6 quoted and enclosed in square brackets), an obfuscated identifier (such as "_hidden" or "_secret"), or "unknown" when the preceding entity is not known (and you still want to indicate that forwarding of the request was made). by=<identifier> The interface where the request came in to the proxy server. for=<identifier> The client that initiated the request and subsequent prox...
...https"). Examples Using the Forwarded header Forwarded: for="_mdn" # case insensitive Forwarded: For="[2001:db8:cafe::17]:4711" # separated by semicolon Forwarded: for=192.0.2.60;proto=http;by=203.0.113.43 # multiple values can be appended using a comma Forwarded: for=192.0.2.43, for=198.51.100.17 Transitioning from X-Forwarded-For to Forwarded If your application, server, or proxy sup
ports the standardized Forwarded header, the X-Forwarded-For header can be replaced. Note that IPv6 address are quoted and enclosed in square brackets in Forwarded. X-Forwarded-For: 123.34.567.89 Forwarded: for=123.34.567.89 X-Forwarded-For: 192.0.2.43, "[2001:db8:cafe::17]" Forwarded: for=192.0.2.43, for="[2001:db8:cafe::17]" Specifications Specification Title RFC 7239, ...
Large-Allocation - HTTP
other similar methods without rel="noopener" or the "noopener" feature being set. This is for the same reason as above, namely that they can communicate and thus we cannot allow them to switch processes. A Large-Allocation header was ignored due to the document not being loaded out of process. Firefox has moved to a multiprocess architecture, and this architecture is required in order to sup
port the Large-Allocation header. Some legacy Addons can prevent Firefox from using this new, faster, multiprocess architecture. If you have one of these Addons installed, then we will continue to use the old single process architecuture for compatibility, and cannot handle the Large-Allocation header. This page would be loaded in a new process due to a Large-Allocation header, however Large-Allocati...
...s new, faster, multiprocess architecture. If you have one of these Addons installed, then we will continue to use the old single process architecuture for compatibility, and cannot handle the Large-Allocation header. This page would be loaded in a new process due to a Large-Allocation header, however Large-Allocation process creation is disabled on non-Win32 platforms. Firefox currently only sup
ports the Large-Allocation header in our 32-bit Windows builds, as memory fragmentation is not an issue in 64-bit builds. If you are running a non-win32 version of Firefox, this error will appear. This check can be disabled with the "dom.largeAllocation. forceEnable" boolean preferece in about:config. Specifications Not part of any current specifications. An explainer of the ideas behind this he...
NEL - HTTP
The HTTP NEL response header is used to configure network request logging. ...
... The HTTP NEL response header is used to configure network request logging. ...
Referrer-Policy - HTTP
Specifications ...
...xample.com/page?q=123 Specifying a fallback policy If you want to specify a fallback policy in any case the desired policy hasn't got wide enough browser sup
port, use a comma-separated list with the desired policy specified last: Referrer-Policy: no-referrer, strict-origin-when-cross-origin In the above scenario, no-referrer will only be used if strict-origin-when-cross-origin is not sup
ported by the browser. Specifying multiple values is only sup
ported in the Referrer-Policy HTTP header, and not in the referrerpolicy attribute. Specifications Specification Status Referrer Policy Editor's draft ...
Transfer-Encoding - HTTP
Transfer-Encoding is a hop-by-hop header, that is applied to a message between two nodes, not to a resource itself. Each segment of a multi-node connection can use different Transfer-Encoding values. If you want to compress data over the whole connection, use the end-to-end Content-Encoding header instead. ...
...is used by almost no browsers today, partly because of a patent issue (which expired in 2003). deflate Using the zlib structure (defined in RFC 1950), with the deflate compression algorithm (defined in RFC 1951). gzip A format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC. This is originally the format of the UNIX gzip program. The HTTP/1.1 standard also recommends that the servers sup
porting this content-encoding should recognize x-gzip as an alias, for compatibility purposes. identity Indicates the identity function (i.e. no compression, nor modification). This token, except if explicitly specified, is always deemed acceptable. Examples Chunked encoding Chunked encoding is useful when larger amounts of data are sent to the client and the total size of the response may not b...
About JavaScript - JavaScript
What is JavaScript? JavaScript(R) (often shortened to JS) is a lightweight, interpreted, object-oriented language with first-class functions, and is best known as the scripting language for Web pages, but it's used in many non-browser environments as well. It is a prototype-based, multi-paradigm scripting language that is dynamic, and sup
ports object-oriented, imperative, and functional programming styles. JavaScript runs on the client side of the web, which can be used to design / program how the web pages behave on the occurrence of an event. JavaScript is an easy to learn and also powerful scripting language, widely used for controlling web page behavior. Contrary to popular misconception, JavaScript is not "Interpreted Java". In a nutshell, JavaScript is a dynamic scripting language su...
...tyles. JavaScript runs on the client side of the web, which can be used to design / program how the web pages behave on the occurrence of an event. JavaScript is an easy to learn and also powerful scripting language, widely used for controlling web page behavior. Contrary to popular misconception, JavaScript is not "Interpreted Java". In a nutshell, JavaScript is a dynamic scripting language sup
porting prototype based object construction. The basic syntax is intentionally similar to both Java and C++ to reduce the number of new concepts required to learn the language. Language constructs, such as if statements, for and while loops, and switch and try ... catch blocks function the same as in these languages (or nearly so). JavaScript can function as both a procedural and an object oriented l...
Grammar and types - JavaScript
et myList = ['home', , 'school', ]; In the following example, the length of the array is four, and myList[0] and myList[2] are missing. let myList = [ ,'home', , 'school']; In the following example, the length of the array is four, and myList[1] and myList[3] are missing. Only the last comma is ignored. let myList = ['home', , 'school', , ]; Understanding the behavior of extra commas is im
portant to understanding JavaScript as a language. However, when writing your own code, you should explicitly declare the missing elements as undefined. Doing this increases your code's clarity and maintainability. Boolean literals The Boolean type has two literal values: true and false. Be careful: Do not confuse the primitive Boolean values true and false with the true and false values of the B...
... Together, these also bring object literals and class declarations closer together, and allow object-based design to benefit from some of the same conveniences. var obj = { // __proto__ __proto__: theProtoObj, // Shorthand for...
Groups and ranges - JavaScript
ing group: Matches x and remembers the match. For example, /(foo)/ matches and remembers "foo" in "foo bar". A regular expression may have multiple capturing groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes im
portant when capturing groups are nested. Matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). String.match() won't return groups if the /.../g flag is s...
... Specifications Specification ECMAScript (ECMA-262)The definition of 'RegExp: Ranges' in that specification. ...
Using Promises - JavaScript
catch(failureCallback); The arguments to then are optional, and catch(failureCallback) is short for then(null, failureCallback). You might see this expressed with arrow functions instead: doSomething() .then(result => doSomethingElse(result)) .then(newResult => doThirdThing(newResult)) .then(finalResult => { console.log(`Got the final result: ${finalResult}`); }) .catch(failureCallback); Im
portant: Always return results, otherwise callbacks won't catch the result of a previous promise (with arrow functions () => x is short for () => { return x; }). Chaining after a catch It's possible to chain after a failure, i.e. a catch, which is useful to accomplish new actions even after an action failed in the chain. Read the following example: new Promise((resolve, reject) => { console.log...
... moreCriticalStuff()) .catch(e => console.error("Critical failure: " + e.message)); Note that the optional steps here are nested, not from the indentation, but from the precarious placement of the outer ( and ) around them. The inner neutralizing catch statement only catches failures from doSomethingOptional() and doSomethingExtraNice(), after which the code resumes with moreCriticalStuff(). Im
portantly, if doSomethingCritical() fails, its error is caught by the final (outer) catch only. Common mistakes Here are some common mistakes to watch out for when composing promise chains. Several of these mistakes manifest in the following example: // Bad example! Spot 3 mistakes! doSomething().then(function(result) { doSomethingElse(result) // Forgot to return promise from inner chain + unnec...
Classes - JavaScript
s and function declarations, the class syntax has two components: class expressions and class declarations. Class declarations One way to define a class is using a class declaration. To declare a class, you use the class keyword with the name of the class ("Rectangle" here). class Rectangle { constructor(height, width) { this.height = height; this.width = width; } } Hoisting An im
portant difference between function declarations and class declarations is that function declarations are hoisted and class declarations are not. You first need to declare your class and then access it, otherwise code like the following will throw a ReferenceError: const p = new Rectangle(); // ReferenceError class Rectangle {} Class expressions A class expression is another way to define a class...
... this.height = height; this.width = width; } } Static (class-side) data properties and prototype data properties must be defined outside of the ClassBody declaration: Rectangle.staticWidth = 20; Rectangle.prototype.prototypeWidth = 25; Field declarations Public and private field declarations are an experimental feature (stage 3) proposed at TC39, the JavaScript standards committee. Sup
port in browsers is limited, but the feature can be used through a build step with systems like Babel. Public field declarations With the JavaScript field declaration syntax, the above example can be written as: class Rectangle { height = 0; width; constructor(height, width) { this.height = height; this.width = width; } } By declaring fields up-front, class definitions become mor...
TypeError: cyclic object value - JavaScript
The JavaScript exception "cyclic object value" occurs when object references were found in JSON. JSON.stringify() doesn't try to solve them and fails accordingly. Message TypeError: cyclic object value (Firefox) TypeError: Converting circular structure to JSON (Chrome and Opera) TypeError: Circular reference in value argument not sup
ported (Edge) Error type TypeError What went wrong? The JSON format per se doesn't sup
port object references (although an IETF draft exists), hence JSON.stringify() doesn't try to solve them and fails accordingly. Examples Circular references In a circular structure like the following var circularReference = {otherData: 123}; circularReference.myself = circularReference; JSON.stringify() will fail JSON.stringify(circularReference); // TypeError: cycl...
...hence JSON.stringify() doesn't try to solve them and fails accordingly. Examples Circular references In a circular structure like the following var circularReference = {otherData: 123}; circularReference.myself = circularReference; JSON.stringify() will fail JSON.stringify(circularReference); // TypeError: cyclic object value To serialize circular references you can use a library that sup
ports them (e.g. cycle.js) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values. The snippet below illustrates how to find and filter (thus causing data loss) a cyclic reference by using the replacer parameter of JSON.stringify(): const getCircularReplacer = () => { const seen = new WeakSet(); return (key, value)...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
standard generic String methods are deprecated and have been removed in Firefox 68 and later. String generics provide String instance methods on the String object allowing String methods to be applied to any object. ...
...c String methods are deprecated and have been removed in Firefox 68 and later. String generics provide String instance methods on the String object allowing String methods to be applied to any object. ...
Functions - JavaScript
tion. arguments.callee : The currently executing function. arguments.caller : The function that invoked the currently executing function. arguments.length: The number of arguments passed to the function. Defining method functions Getter and setter functions You can define getters (accessor methods) and setters (mutator methods) on any standard built-in object or user-defined object that sup
ports the addition of new properties. The syntax for defining getters and setters uses the object literal syntax. get Binds an object property to a function that will be called when that property is looked up. set Binds an object property to a function to be called when there is an attempt to set that property. Method definition syntax Starting with ECMAScript 2015, you are able to define...
...ction zero() { // DANGER: compatibility risk console.log("This is zero."); } } ES2015 says that if shouldDefineZero is false, then zero should never be defined, since the block never executes. However, it's a new part of the standard. Historically, this was left unspecified, and some browsers would define zero whether the block executed or not. In strict mode, all browsers that sup
port ES2015 handle this the same way: zero is defined only if shouldDefineZero is true, and only in the scope of the if-block. A safer way to define functions conditionally is to assign a function expression to a variable: var zero; if (shouldDefineZero) { zero = function() { console.log("This is zero."); }; } Examples Returning a formatted number The following function returns a str...
Array.prototype[@@iterator]() - JavaScript
arr[Symbol.iterator]() Return value The initial value given by the values() iterator. By default, using arr[Symbol.iterator] will return the values() function. ...
...Iterable].prototype.values method. This could be a built-in object like String object or a custom object. ...
Array.from() - JavaScript
erty and indexed elements); or iterable objects (objects such as Map and Set). Array.from() has an optional parameter mapFn, which allows you to execute a map() function on each element of the array being created. More clearly, Array.from(obj, mapFn, thisArg) has the same result as Array.from(obj).map(mapFn, thisArg), except that it does not create an intermediate array. This is especially im
portant for certain array subclasses, like typed arrays, since the intermediate array would necessarily have values truncated to fit into the appropriate type. The length property of the from() method is 1. In ES2015, the class syntax allows sub-classing of both built-in and user-defined classes. As a result, static methods such as Array.from() are "inherited" by subclasses of Array, and create new ...
... subclasses of Array, and create new instances of the subclass, not Array. Polyfill Array.from() was added to the ECMA-262 standard in the 6th Edition (ES2015). As such, it may not be present in other implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of Array.from() in implementations that don't natively sup
port it. Polyfill Notes: This algorithm is exactly as specified in ECMA-262 6th Edition (assuming Object and TypeError have their original values and that callback.call() evaluates to the original value of Function.prototype.call()). In addition, since true iterables cannot be polyfilled, this implementation does not sup
port generic iterables as defined in the 6th Edition of ECMA-262. // Producti...
Array.prototype.map() - JavaScript
which map was called upon is sparse, resulting array will also be sparse keeping same indices blank. Polyfill map was added to the ECMA-262 standard in the 5th edition. Therefore, it may not be present in all implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of map in implementations which do not natively sup
port it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming Object, TypeError, and Array have their original values and that callback.call evaluates to the original value of Function.prototype.call. // Production steps of ECMA-262, Edition 5, 15.4.4.19 // Reference: http://es5.github.io/#x15.4.4.19 if (!Array.prototype.map) { Array.prototype.map = function(callback/*, t...
... // list containing kValue, k, and O. mappedValue = callback.call(T, kValue, k, O); // iii. Call the DefineOwnProperty internal method of A with arguments // Pk, Property Descriptor // { Value: mappedValue, // Writable: true, // Enumerable: true, // Configurable: true }, // and false. // In browsers that sup
port Object.defineProperty, use the following: // Object.defineProperty(A, k, { // value: mappedValue, // writable: true, // enumerable: true, // configurable: true // }); // For best browser sup
port, use the following: A[k] = mappedValue; } // d. Increase k by 1. k++; } // 9. return A return A; }...
Array.prototype.slice() - JavaScript
The original array will not be modified. The source for this interactive demo is stored in a GitHub repository. If you'd like to contribute to the interactive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax arr.slice([start[, end]]) Parameters start Optional Zero-based index at which to start extraction. A negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. ...
.... If a referenced object changes, the changes are visible to both the new and original arrays. For strings, numbers and booleans (not String, Number and Boolean objects), slice copies the values into the new array. Changes to the string, number, or boolean in one array do not affect the other array. If a new element is added to either array, the other array is not affected. Examples Return a
portion of an existing array let fruits = ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango'] let citrus = fruits.slice(1, 3) // fruits contains ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango'] // citrus contains ['Orange','Lemon'] Using slice> In the following example, slice creates a new array, newCar, from myCar. Both include a reference to the object myHonda. When the color of myHonda is changed t...
BigInt - JavaScript
When tested against typeof, a BigInt will give "bigint": typeof 1n === 'bigint' // true typeof BigInt('1') === 'bigint' // true When wrapped in an Object, a BigInt will be considered as a normal "object" type: typeof Object(1n) === 'object' // true Operators The following operators may be used with BigInts (or object-wrapped BigInts): +, *, -, **, %. Bitwise operators are sup
ported as well, except >>> (zero-fill right shift) as all BigInts are signed. Also unsup
ported is the unary operator (+), in order to not break asm.js. const previousMaxSafe = BigInt(Number.MAX_SAFE_INTEGER) // ? 9007199254740991n const maxPlusOne = previousMaxSafe + 1n // ? 9007199254740992n const theFuture = previousMaxSafe + 2n // ? 9007199254740993n, this works now! const multi = previousMaxS...
...Int.prototype.valueOf() Returns the primitive value of the specified object. Overrides the Object.prototype.valueOf() method. Usage recommendations Coercion Because coercing between Number and BigInt can lead to loss of precision, it is recommended to only use BigInt when values greater than 253 are reasonably expected and not to coerce between the two types. Cryptography The operations sup
ported on BigInts are not constant time. BigInt is therefore unsuitable for use in cryptography. Use within JSON Using JSON.stringify() with any BigInt value will raise a TypeError as BigInt values aren't serialized in JSON by default. However, you can implement your own toJSON method if needed: BigInt.prototype.toJSON = function() { return this.toString() } Instead of throwing, JSON.stringify no...
Date.prototype.toDateString() - JavaScript
The toDateString() method returns the date
portion of a Date object in English in the following format separated by spaces: First three letters of the week day name First three letters of the month name Two digit day of the month, padded on the left a zero if necessary Four digit year (at least), padded on the left with zeros if necessary E.g. "Thu Jan 01 1970". The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.toDateString() Return value A string representing the date
portion of the given Date object in human readable form in English. Description Date instances refer to a specific point in...
...ub.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.toDateString() Return value A string representing the date
portion of the given Date object in human readable form in English. Description Date instances refer to a specific point in time. Calling toString() will return the date formatted in a human readable form in English. In SpiderMonkey, this consists of the date
portion (day, month, and year) followed by the time
portion (hours, minutes, seconds, and time zone). Sometimes it is desirable to obtain a string of the time
portion; such a thing can be accomplished with the toTimeString() method. The toDateString() method is especially useful because compliant engines implementing ECMA-262 may differ in the string obtained from toString() for Date objects, as the ...
Date.prototype.toTimeString() - JavaScript
The toTimeString() method returns the time
portion of a Date object in human readable form in American English. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.toTimeString() Return value A string representing the time
portion of the given date in human readable form in American English. Description Date instances refer to a specific point in time. Calling toString() will return the date formatted in a human readable form in American English. In SpiderMonkey, this consists of the date
portion (day, month, and year) followed by the time
portion (hours, minutes, seconds, and time zone). Sometimes i...
...an readable form in American English. Description Date instances refer to a specific point in time. Calling toString() will return the date formatted in a human readable form in American English. In SpiderMonkey, this consists of the date
portion (day, month, and year) followed by the time
portion (hours, minutes, seconds, and time zone). Sometimes it is desirable to obtain a string of the time
portion; such a thing can be accomplished with the toTimeString() method. The toTimeString() method is especially useful because compliant engines implementing ECMA-262 may differ in the string obtained from toString() for Date objects, as the format is implementation-dependent; simple string slicing approaches may not produce consistent results across multiple engines. Examples A basic usage of to...
Intl.Collator.prototype.resolvedOptions() - JavaScript
ties reflecting the locale and collation options computed during the initialization of the given Collator object. Description The resulting object has the following properties: locale The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are sup
ported for this locale are included in locale. usage sensitivity ignorePunctuation The values provided for these properties in the options argument or filled in as defaults. collation The value requested using the Unicode extension key "co", if it is sup
ported for locale, or "default". numeric caseFirst The values requested for these properties in the options argument or using the Unicode ext...
... values provided for these properties in the options argument or filled in as defaults. collation The value requested using the Unicode extension key "co", if it is sup
ported for locale, or "default". numeric caseFirst The values requested for these properties in the options argument or using the Unicode extension keys "kn" and "kf" or filled in as defaults. If the implementation does not sup
port these properties, they are omitted. Examples Using the resolvedOptions method var de = new Intl.Collator('de', { sensitivity: 'base' }) var usedOptions = de.resolvedOptions(); usedOptions.locale; // "de" usedOptions.usage; // "sort" usedOptions.sensitivity; // "base" usedOptions.ignorePunctuation; // false usedOptions.collation; // "default" usedOptions.n...
Intl.DateTimeFormat() constructor - JavaScript
'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax new Intl.DateTimeFormat([locales[, options]]) Parameters locales Optional A string with a BCP 47 language tag, or an array of such strings. To use the browser's default locale, omit this argument or pass undefined. Unicode extension are sup
ported (for example "en-US-u-ca-buddhist"). For the general form and interpretation of the locales argument, see the Intl page. The following Unicode extension keys are allowed: nu Numbering system. Possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", ...
... both options have been specified. formatMatcher The format matching algorithm to use. Possible values are "basic" and "best fit"; the default is "best fit". See the following paragraphs for information about the use of this property. The following properties describe the date-time components to use in formatted output, and their desired representations. Implementations are required to sup
port at least the following subsets: weekday, year, month, day, hour, minute, second weekday, year, month, day year, month, day year, month month, day hour, minute, second hour, minute Implementations may sup
port other subsets, and requests will be negotiated against all available subset-representation combinations to find the best match. Two algorithms are available for this nego...
Intl.DateTimeFormat - JavaScript
enable language-sensitive date and time formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.DateTimeFormat() Creates a new DateTimeFormat object. Static methods Intl.DateTimeFormat.sup
portedLocalesOf() Returns an array containing those of the provided locales that are sup
ported without having to fall back to the runtime's default locale. Instance methods Intl.DateTimeFormat.prototype.format() Getter function that formats a date according to the locale and formatting options of this DateTimeFormat object. Intl.DateTimeFormat.prototype.formatToParts() Returns an Array of obj...
...c in most Arabic speaking countries uses real Arabic digits console.log(new Intl.DateTimeFormat('ar-EG').format(date)); // -> "???/???/????" // for Japanese, applications may want to use the Japanese calendar, // where 2012 was the year 24 of the Heisei era console.log(new Intl.DateTimeFormat('ja-JP-u-ca-japanese').format(date)); // -> "24/12/19" // when requesting a language that may not be sup
ported, such as // Balinese, include a fallback language, in this case Indonesian console.log(new Intl.DateTimeFormat(['ban', 'id']).format(date)); // -> "19/12/2012" Using options The date and time formats can be customized using the options argument: var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0, 200)); // request a weekday along with a long date var options = { weekday: 'long', year: 'num...
Intl.NumberFormat - JavaScript
r objects that enable language sensitive number formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.NumberFormat() Creates a new NumberFormat object. Static methods Intl.NumberFormat.sup
portedLocalesOf() Returns an array containing those of the provided locales that are sup
ported without having to fall back to the runtime's default locale. Instance methods Intl.NumberFormat.prototype.format() Getter function that formats a number according to the locale and formatting options of this NumberFormat object. Intl.NumberFormat.prototype.formatToParts() Returns an Array of objects...
...berFormat('ar-EG').format(number)); // -> ?????????? // India uses thousands/lakh/crore separators console.log(new Intl.NumberFormat('en-IN').format(number)); // -> 1,23,456.789 // the nu extension key requests a numbering system, e.g. ...
Intl.PluralRules - JavaScript
Instance methods Intl.PluralRules.prototype.resolvedOptions() Returns a new object with properties reflecting the locale and collation options computed during initialization of the object. ...
... Instance methods Intl.PluralRules.prototype.resolvedOptions() Returns a new object with properties reflecting the locale and collation options computed during initialization of the object. ...
JSON - JavaScript
JSON is a syntax for serializing objects, arrays, numbers, strings, booleans, and null. It is based upon JavaScript syntax but is distinct from it: some JavaScript is not JSON. Objects and Arrays Property names must be double-quoted strings; trailing commas are forbidden. Numbers Leading zeros are prohibited. A decimal point must be followed by at least one digit. NaN and Infinity are unsup
ported. Any JSON text is a valid JavaScript expression... ...But only in JavaScript engines that have implemented the proposal to make all JSON text valid ECMA-262. In engines that haven't implemented the proposal, U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are allowed in string literals and property keys in JSON; but their use in these features in JavaScript string literals is a SyntaxErr...
... to be thrown. The reviver option allows for interpreting what the replacer has used to stand in for other datatypes. JSON.stringify(value[, replacer[, space]]) Return a JSON string corresponding to the specified value, optionally including only certain properties or replacing property values in a user-defined manner. By default, all instances of undefined are replaced with null, and other unsup
ported native data types are censored. The replacer option allows for specifying other behavior. Examples Example JSON { "browsers": { "firefox": { "name": "Firefox", "pref_url": "about:config", "releases": { "1": { "release_date": "2004-11-09", "status": "retired", "engine": "Gecko", "engine_version": "1.7" } } ...
Map - JavaScript
in earlier drafts. See "Value equality for -0 and 0" in the Browser compatibility table for details. Objects vs. Maps Object is similar to Map--both let you set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. For this reason (and because there were no built-in alternatives), Objects have been used as Maps historically. However, there are im
portant differences that make Map preferable in certain cases: Map Object Accidental Keys A Map does not contain any keys by default. It only contains what is explicitly put into it. An Object has a prototype, so it contains default keys that could collide with your own keys if you're not careful. Note: As of ES5, this can be bypassed by using Object.
... Maps can be merged, maintaining key uniqueness: let first = new Map([ [1, 'one'], [2, 'two'], [3, 'three'], ]) let second = new Map([ [1, 'uno'], [2, 'dos'] ]) // Merge two maps. The last repeated key wins. // Spread operator essentially converts a Map to an Array let merged = new Map([...first, ...second]) console.log(merged.ge...
Object.keys() - JavaScript
Return value An array of strings that represent all the enumerable properties of the given object. Description Object.keys() returns an array whose elements are strings corresponding to the enumerable properties found directly upon object. The ordering of the properties is the same as that given by looping over the properties of the object manually. ...
...ll the enumerable properties of the given object. Description Object.keys() returns an array whose elements are strings corresponding to the enumerable properties found directly upon object. The ordering of the properties is the same as that given by looping over the properties of the object manually. ...
Object.prototype.__proto__ - JavaScript
ng, and are not limited to simply the time spent in obj.__proto__ = ... statements, but may extend to any code that has access to any object whose [[Prototype]] has been altered. If you care about performance you should avoid setting the [[Prototype]] of an object. Instead, create a new object with the desired [[Prototype]] using Object.create(). Warning: While Object.prototype.__proto__ is sup
ported today in most browsers, its existence and exact behavior has only been standardized in the ECMAScript 2015 specification as a legacy feature to ensure compatibility for web browsers. For better sup
port, use Object.getPrototypeOf() instead. The __proto__ property of Object.prototype is an accessor property (a getter function and a setter function) that exposes the internal [[Prototype]] (eith...
...rnal [[Prototype]] (either an object or null) of the object through which it is accessed. The use of __proto__ is controversial and discouraged. It was never originally included in the ECMAScript language spec, but modern browsers implemented it anyway. Only recently was the __proto__ property standardized by the ECMAScript 2015 specification for compatibility with web browsers, so it will be sup
ported into the future. It is deprecated in favor of Object.getPrototypeOf/Reflect.getPrototypeOf and Object.setPrototypeOf/Reflect.setPrototypeOf (though still, setting the [[Prototype]] of an object is a slow operation that should be avoided if performance is a concern). The __proto__ property can also be used in an object literal definition to set the object [[Prototype]] on creation, as an altern...
Promise() constructor - JavaScript
The source for this interactive demo is stored in a GitHub repository. If you'd like to contribute to the interactive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax new Promise(executor) Parameters executor A function to be executed by the constructor, during the process of constructing the promiseObj. The executor is custom code that ties an outcome to a promise. You, the programmer, write the executor. ...
...ecutor. The signature of this function is expected to be: function(resolutionFunc, rejectionFunc){ // typically, some asynchronous operation. } At the time when the constructor generates the new promiseObj, it also generates a corresponding pair of functions for resolutionFunc and rejectionFunc; these are "tethered" to the promiseObj. Therefore, the code within the executor has the op
portunity to perform some operation and then reflect the operation's outcome(If the value is not another Promise object) as either "fulfilled" or "rejected" by terminating with an invocation of either the resolutionFunc or the rejectionFunc, respectively. The executor has no meaningful return value. It communicates via the side-effect caused by resolutionFunc or rejectionFunc. The side-effect is that...
handler.getOwnPropertyDescriptor() - JavaScript
ndler.getOwnPropertyDescriptor() method is a trap for Object.getOwnPropertyDescriptor(). Interceptions This trap can intercept these operations: Object.getOwnPropertyDescriptor() Reflect.getOwnPropertyDescriptor() Invariants If the following invariants are violated, the proxy will throw a TypeError: getOwnPropertyDescriptor() must return an object or undefined. A property cannot be re
ported as non-existent, if it exists as a non-configurable own property of the target object. A property cannot be re
ported as non-existent, if it exists as an own property of the target object and the target object is not extensible. A property cannot be re
ported as existent, if it does not exists as an own property of the target object and the target object is not extensible. A property cannot be...
...as non-existent, if it exists as a non-configurable own property of the target object. A property cannot be re
ported as non-existent, if it exists as an own property of the target object and the target object is not extensible. A property cannot be re
ported as existent, if it does not exists as an own property of the target object and the target object is not extensible. A property cannot be re
ported as non-configurable, if it does not exists as an own property of the target object or if it exists as a configurable own property of the target object. The result of Object.getOwnPropertyDescriptor(target) can be applied to the target object using Object.defineProperty() and will not throw an exception. Examples Trapping of getOwnPropertyDescriptor The following code traps Object.getOwnPro...
Proxy - JavaScript
w.selected = document.getElementById('item-2'); console.log(i1.getAttribute('aria-selected')); // 'false' console.log(i2.getAttribute('aria-selected')); // 'true' Note: even if selected: !null, then giving oldval.setAttribute is not a function Value correction and an extra property The products proxy object evaluates the passed value and converts it to an array if needed. The object also sup
ports an extra property called latestBrowser both as a getter and a setter. let products = new Proxy({ browsers: ['Internet Explorer', 'Netscape'] }, { get: function(obj, prop) { // An extra property if (prop === 'latestBrowser') { return obj.browsers[obj.browsers.length - 1]; } // The default behavior to return the value return obj[prop]; }, set: function(obj, prop...
...es, we will try to proxify a non-native object that is particularly suited to this type of operation: the docCookies global object created by the "little framework" published on the document.cookie page. /* var docCookies = ... ...
String.fromCodePoint() - JavaScript
ode code point is given (e.g. "RangeError: NaN is not a valid code point"). Description This method returns a string (and not a String object). Because fromCodePoint() is a static method of String, you must call it as String.fromCodePoint(), rather than as a method of a String object you created. Polyfill The String.fromCodePoint() method has been added to ECMAScript 2015 and may not be sup
ported in all web browsers or environments yet. Use the code below for a polyfill: if (!String.fromCodePoint) (function(stringFromCharCode) { var fromCodePoint = function(_) { var codeUnits = [], codeLen = 0, result = ""; for (var index=0, len = arguments.length; index !== len; ++index) { var codePoint = +arguments[index]; // correctly handles all cases including `NaN...
...= codeUnits.push( (codePoint >> 10) + 0xD800, // highSurrogate (codePoint % 0x400) + 0xDC00 // lowSurrogate ); } if (codeLen >= 0x3fff) { result += stringFromCharCode.apply(null, codeUnits); codeUnits.length = 0; } } return result + stringFromCharCode.apply(null, codeUnits); }; try { // IE 8 only sup
ports `Object.defineProperty` on DOM elements Object.defineProperty(String, "fromCodePoint", { "value": fromCodePoint, "configurable": true, "writable": true }); } catch(e) { String.fromCodePoint = fromCodePoint; } }(String.fromCharCode)); Examples Using fromCodePoint() Valid input: String.fromCodePoint(42); // "*" String.fromCodePoint(65, 90); // "AZ" St...
String.prototype.substr() - JavaScript
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax str.substr(start[, length]) Parameters start The index of the first character to include in the returned substring. length Optional. The number of characters to extract. Return value A new string containing the specified part of the given string. Description substr() extracts length characters from a str, counting from the start index. ...
...pt, negative values of the start argument are not considered to refer to the end of the string. If length is omitted, substr() extracts characters to the end of the string. If length is undefined, substr() extracts characters to the end of the string. If length is a negative number, it is treated as 0. For both start and length, NaN is treated as 0. Polyfill Microsoft's JScript does not sup
port negative values for the start index. To use this feature in JScript, you can use the following code: // only run when the substr() function is broken if ('ab'.substr(-1) != 'b') { /** * Get the substring of a string * @param {integer} start where to start the substring * @param {integer} length how many characters to return * @return {string} */ String.prototype.sub...
Symbol - JavaScript
The data type symbol is a primitive data type. The Symbol() function returns a value of type symbol, has static properties that expose several members of built-in objects, has static methods that expose the global symbol registry, and resembles a built-in object class, but is incomplete as a constructor because it does not sup
port the syntax "new Symbol()". Every symbol value returned from Symbol() is unique. A symbol value may be used as an identifier for object properties; this is the data type's primary purpose, although other use-cases exist, such as enabling opaque data types, or serving as an implementation-sup
ported unique identifier in general. Some further explanation about purpose and usage can be found in the glossary entry for Symbol. Description To create a new primitive s...
... objects The method Object.getOwnPropertySymbols() returns an array of symbols and lets you find symbol properties on a given object. Note that every object is initialized with no own symbol properties, so that this array will be empty unless you've set symbol properties on the object. Constructor Symbol() Creates a new Symbol object. It is incomplete as a constructor because it does not sup
port the syntax "new Symbol()". Static properties Symbol.asyncIterator A method that returns the default AsyncIterator for an object. Used by for await...of. Symbol.hasInstance A method determining if a constructor object recognizes an object as its instance. Used by instanceof. Symbol.isConcatSpreadable A Boolean value indicating if an object should be flattened to its array elements. Used ...
parseInt() - JavaScript
g begins with "0x" or "0X" (a zero, followed by lowercase or uppercase X), radix is assumed to be 16 and the rest of the string is parsed as a hexidecimal number. If the input string begins with "0" (a zero), radix is assumed to be 8 (octal) or 10 (decimal). Exactly which radix is chosen is implementation-dependent. ECMAScript 5 clarifies that 10 (decimal) should be used, but not all browsers sup
port this yet. For this reason, always specify a radix when using parseInt. If the input string begins with any other value, the radix is 10 (decimal). If the first character cannot be converted to a number, parseInt returns NaN. For arithmetic purposes, the NaN value is not a number in any radix. You can call the isNaN function to determine if the result of parseInt is NaN. If NaN is passed on to...
...ix. Leading whitespace in string is ignored. If radix is undefined or 0, it is assumed to be 10 except when the number begins with the character pairs 0x or 0X, in which case a radix of 16 is assumed. This differs from ECMAScript 3, which merely discouraged (but allowed) octal interpretation. Many implementations have not adopted this behavior as of 2013. And, because older browsers must be sup
ported, always specify a radix. A stricter parse function It is sometimes useful to have a stricter way to parse integers. Regular expressions can help: function filterInt(value) { if (/^[-+]?(\d+|Infinity)$/.test(value)) { return Number(value) } else { return NaN } } console.log(filterInt('421')) // 421 console.log(filterInt('-421')) // -421 console.log...
Destructuring assignment - JavaScript
Destructuring assignment allows you to unpack the parts out of this array easily, ignoring the full match if it is not needed. function parseProtocol(url) { const parsedURL = /^(\w+)\:\/\/([^\/]+)\/(.*)$/.exec(url); if (!parsedURL) { return false; } console.log(parsed...
...Destructuring assignment allows you to unpack the parts out of this array easily, ignoring the full match if it is not needed. function parseProtocol(url) { const parsedURL = /^(\w+)\:\/\/([^\/]+)\/(.*)$/.exec(url); if (!parsedURL) { return false; } console.log(parsedURL); // ["https://developer.mozi...
Object initializer - JavaScript
teractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax let o = {} let o = {a: 'foo', b: 42, c: {}} let a = 'foo', b = 42, c = {} let o = {a: a, b: b, c: c} let o = { property: function (parameters) {}, get property() {}, set property(value) {} }; New notations in ECMAScript 2015 Please see the compatibility table for sup
port for these notations. In non-sup
porting environments, these notations will lead to syntax errors. // Shorthand property names (ES2015) let a = 'foo', b = 42, c = {}; let o = {a, b, c} // Shorthand method names (ES2015) let o = { property(parameters) {} } // Computed property names (ES2015) let prop = 'foo' let o = { [prop]: 'hey', ['b' + 'ar']: 'there' } Description An object initialize...
...e generator functions: let o = { *generator() { ........... } }; Which is equivalent to this ES5-like notation (but note that ECMAScript 5 has no generators): let o = { generator: function* () { ........... } }; For more information and examples about methods, see method definitions. Computed property names Starting with ECMAScript 2015, the object initializer syntax also sup
ports computed property names. That allows you to put an expression in brackets [], that will be computed and used as the property name. This is reminiscent of the bracket notation of the property accessor syntax, which you may have used to read and set properties already. Now you can use a similar syntax in object literals, too: // Computed property names (ES2015) let i = 0 let a = { ['foo' + ++i...
delete operator - JavaScript
s (perhaps due to other programming languages like delete in C++), the delete operator has nothing to do with directly freeing memory. Memory management is done indirectly via breaking references. See the memory management page for more details. The delete operator removes a given property from an object. On successful deletion, it will return true, else false will be returned. However, it is im
portant to consider the following scenarios: If the property which you are trying to delete does not exist, delete will not have any effect and will return true. If a property with the same name exists on the object's prototype chain, then, after deletion, the object will use the property from the prototype chain (in other words, delete only has an effect on own properties). Any property declared...
...variable1); // true // SyntaxError in strict mode. console.log(delete variable2); // false function func(param) { // SyntaxError in strict mode. console.log(delete param); // false } // SyntaxError in strict mode. console.log(delete func); // false Cross-browser notes Although ECMAScript makes iteration order of objects implementation-dependent, it may appear that all major browsers sup
port an iteration order based on the earliest added property coming first (at least for properties not on the prototype). However, in the case of Internet Explorer, when one uses delete on a property, some confusing behavior results, preventing other browsers from using simple objects like object literals as ordered associative arrays. In Explorer, while the property value is indeed set to undefined, ...
for...in - JavaScript
than the property currently being visited. There is no guarantee whether an added property will be visited, whether a modified property (other than the current one) will be visited before or after it is modified, or whether a deleted property will be visited before it is deleted. Array iteration and for...in Note: for...in should not be used to iterate over an Array where the index order is im
portant. Array indexes are just enumerable properties with integer names and are otherwise identical to general object properties. There is no guarantee that for...in will return the indexes in any particular order. The for...in loop statement will return all enumerable properties, including those with non-integer names and those that are inherited. Because the order of iteration is implementation-...
...all enumerable properties, including those with non-integer names and those that are inherited. Because the order of iteration is implementation-dependent, iterating over an array may not visit elements in a consistent order. Therefore, it is better to use a for loop with a numeric index (or Array.prototype.forEach() or the for...of loop) when iterating over arrays where the order of access is im
portant. Iterating over own properties only If you only want to consider properties attached to the object itself, and not its prototypes, use getOwnPropertyNames() or perform a hasOwnProperty() check (propertyIsEnumerable() can also be used). Alternatively, if you know there won't be any outside code interference, you can extend built-in prototypes with a check method. Why Use for...in? Given tha...
with - JavaScript
peated object references. Note, however, that in many cases this benefit can be achieved by using a temporary variable to store a reference to the desired object. Contra: The with statement forces the specified object to be searched first for all name lookups. Therefore all identifiers that aren't members of the specified object will be found more slowly in a 'with' block. Where performance is im
portant, 'with' should only be used to encompass code blocks that access members of the specified object. Ambiguity contra Contra: The with statement makes it hard for a human reader or JavaScript compiler to decide whether an unqualified name will be found along the scope chain, and if so, in which object. So given this example: function f(x, o) { with (o) { console.log(x); } } Only when ...
...object. Consider this example: function f(foo, values) { with (foo) { console.log(values); } } If you call f([1,2,3], obj) in an ECMAScript 5 environment, then the values reference inside the with statement will resolve to obj. However, ECMAScript 2015 introduces a values property on Array.prototype (so that it will be available on every array). So, in a JavaScript environment that sup
ports ECMAScript 2015, the values reference inside the with statement could resolve to [1,2,3].values. However, in this particular example, Array.prototype has been defined with values in its Symbol.unscopables object. If it were not, one can see how this would be a difficult issue to debug. Examples Using with The following with statement specifies that the Math object is the default object. The ...
orientation - Web app manifests
Type String Mandatory No The orientation member defines the default orientation for all the website's top-level browsing contexts. Note: orientation and/or its specific values might not be sup
ported by a user agent on various display modes because sup
porting them does not make sense for the particular context. Note: The orientation can be changed at runtime via the Screen Orientation API. ...
...exts. Note: orientation and/or its specific values might not be sup
ported by a user agent on various display modes because sup
porting them does not make sense for the particular context. Note: The orientation can be changed at runtime via the Screen Orientation API. Values orientation can take one of the following values: any natural landscape landscape-primary landscape-secondary
portrait
portrait-primary
portrait-secondary Examples "orientation": "
portrait-primary" Specification Specification Status Comment Feedback Web App ManifestThe definition of 'orientation' in that specification. Working Draft Initial definition. Web App Manifest Working Group drafts ...
Guide to streaming audio and video - Web media technologies
, your server, and the options you use while performing the streaming to bring out the best quality and performance possible. <<<...XXXXXX...>>> Protocols In addition to the configuration of the server and the streaming code, there are sometimes special protocols which can be used to optimize performance. HTTPS Live Streaming HTTPS Live Streaming (HLS) is a protocol developed by Apple and sup
ported by Safari on all of their platforms. HLS may also be sup
ported in other environments, although in some cases this sup
port is conditional. For example, because many web sites' mobile-specific content assume that mobile browsers sup
port HLS, Firefox for Android does as well, in order to avoid strange compatibility errors from occurring due to this assumption being incorrect. The desktop version ...
... HLS uses playlists to allow the user to not only select the media to stream, but also to choose among versions or forms of the same media. For example, HLS lets the server stream a video with multiple audio streams which the user can choose from, in order to hear their own language. ...
Using images in HTML - Web media technologies
images into an HTML document, while the <picture> element enables responsive images. In this guide you'll find links to resources that deal with adding images to websites. References These articles cover some of the HTML elements and CSS properties that are used to control how images are displayed on the web. HTML <img> The HTML <img> element is used to embed an image in a webpage. It sup
ports a wide range of attributes that control how the image behaves and allows you to add im
portant information like alt text for people who don't see the image. <picture> The HTML <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. The browser considers each child <source> element and chooses the...
...ment's box. Areas of the box which aren't covered by the replaced element's object will show the element's background. background-image The background-image CSS property sets one or more background images for an element. Guides These articles provide guidance on selecting and configuring image types. Image file type and format guide A guide to the various image file types commonly sup
ported by web browsers including details about their individual use cases, capabilities, and compatibility factors. Additionally, this article provides guidance for selecting the best image file type for a given situation. Mapping the width and height attributes of media container elements to their aspect-ratio This changes how browsers load images so their aspect ratios are calculated by the browse...
Animation performance and frame rate - Web Performance
se problems when they occur. Users expect all interface interactions to be smooth and all user interfaces to be responsive. Animation can help make a site feel faster and responsive, but animations can also make a site feel slower and janky if not done correctly. Responsive user interfaces have a frame rate of 60 frames per second (fps). While it is not always possible to maintain 60fps, it is im
portant to maintain a high and steady frame rate for all animations. Let's take a look at how we can use browser tools to inspect the frame rate. We'll also discuss some tips to create and maintain a fast and steady frame rate. The developer tool's frame rate and waterfall charts provide insight into the work the browser is performing to animate code. Using these tools you can measure an application'...
...r style recalculation. Frame rate Compared with the version that uses margin, this is looking pretty good. We're averaging nearly 60fps, and apart from one dip near the start, we're getting a consistently high frame rate. Waterfall The timeline view shows the reason for the improved frame rate. Compared with the version that uses margin, we're not spending any time time in layout or (more im
portantly in this case) in paint: In this case, using transform significantly improved the site's performance, and the performance tools were able to show how and why it did. ...
Recommended Web Performance Timings: How long is too long? - Web Performance
3G network and 1.5 seconds on an office T1 line, with even more ambitious page load goals for subsequent page loads, leveraging service workers and caching. There are different suggested times for initially loading the page versus loading additional assets, responding to user interaction, and ensuring smooth animations: Idling goal Browsers are single threaded (though background threads are sup
ported for web workers). This means that user interaction, painting, and script execution are all on the same thread. If the thread is busy doing complex JavaScript execution, the main thread will not be available to react to user input, such as pressing a button. For this reason, script execution should be limited in scope, divided into chunks of code that can be executed in 50ms or less. This makes ...
...content repaints should occur at 60 frames per second (60fps), which is once every 16.7ms. The 16.7 milliseconds includes scripting, reflow, and repaint. Realize a document takes about 6ms to render a frame, leaving about 10ms for the rest. Anything less than 60fps, especially an un-even or changing frame rate, will appear janky. Responsiveness goal When the user interacts with content, it is im
portant to provide feedback and acknowledge the user's response or interaction and to do so within 100ms, preferably within 50ms. 50ms seconds feels immediate. The acknowledgment of user interaction should often feel immediate, such as a hover or button press, but that doesn't mean the completed response should be instantaneous. While a slower than 100ms reaction may create a disconnect between the us...
Using dns-prefetch - Web Performance
ield: Link: <https://fonts.gstatic.com/>; rel=dns-prefetch Third, consider pairing dns-prefetch with the preconnect hint. While dns-prefetch only performs a DNS lookup, preconnect establishes a connection to a server. This process includes DNS resolution, as well as establishing the TCP connection, and performing the TLS handshake--if a site is served over HTTPS. Combining the two provides an op
portunity to further reduce the perceived latency of cross-origin requests. You can safely use them together like so: <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin> <link rel="dns-prefetch" href="https://fonts.gstatic.com/"> Note: If a page needs to make connections to many third-party domains, preconnecting them all is counterproductive. The preconnect hint is best used for...
...rel="dns-prefetch" href="https://fonts.gstatic.com/"> Note: If a page needs to make connections to many third-party domains, preconnecting them all is counterproductive. The preconnect hint is best used for only the most critical connections. For the others, just use <link rel="dns-prefetch"> to save time on the first step -- the DNS lookup. The logic behind pairing these hints is because sup
port for dns-prefetch is better than sup
port for preconnect. Browsers that don't sup
port preconnect will still get some added benefit by falling back to dns-prefetch. Because this is an HTML feature, it is very fault-tolerant. If a non-sup
porting browser encounters a dns-prefetch hint--or any other resource hint--your site won't break. You just won't receive the benefits it provides. Some resources s...
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
You may specify SVG in styles either within the same document or an external style sheet. There are 3 properties you can use: mask, clip-path, and filter. Note: References to SVG in external files must be to the same origin as the referencing document. Using embedded SVG To apply an SVG effect using CSS styles, you first need to create the CSS style that references the SVG to apply. <style>p { mask: url(#my-mask); }</style> In the above example, all paragraphs are masked by an SVG <mask> with the ID my-mask. ...
... ...
calcMode - SVG: Scalable Vector Graphics
for strings), the calcMode attribute is ignored and discrete interpolation is used. Four elements are using this attribute: <animate>, <animateColor>, <animateMotion>, and <animateTransform> Usage notes Value discrete | linear | paced | spline Default value linear Animatable No discrete This specifies that the animation function will jump from one value to the next without any interpolation. ...
... Animatable No discrete This specifies that the animation function will jump from one value to the next without any interpolation. linear Simple linear interpolation between values is used to calculate the animation function. Except for <animateMotion>, this is the default value. paced Defines interpolation to produce an even pace of change across the animation. This is only sup
ported for values that define a linear numeric range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). If paced is specified, any keyTimes or keySplines will be ignored. For <animateMotion>, this is the default value. spline Interpolates from one value in the values list to the next according to a time function defined by a cubic Bezier s...
clip - SVG: Scalable Vector Graphics
The clip attribute is a presentation attribute defining the visible region of an element. This attribute has the same parameter values as defined for the css clip property. Unitless values, which indicate current user coordinates, are permitted on the coordinate values on the rect(). The value of auto defines a clipping path along the bounds of the view
port created by the given element. As a presentation attribute, it can be applied to any element but it has effect only on the following six elements: <svg>, <symbol>, <image>, <foreignObject>, <pattern>, <marker> html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- Auto clipping --> <svg x="0" width="10" height="10" clip="auto"> <circle cx="5" cy="5" r="4" stroke="green" /> <...
...m, left) clipping --> <svg x="10" width="10" height="10" clip="rect(1, 9, 8, 2)"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> </svg> Usage notes Warning: This property is deprecated. Use clip-path instead. Value auto | rect() Default value auto Animatable Yes The value auto defines a clipping path along the bounds of the view
port created by the given element.The value rect() defines a clipping rectangle following the following syntax: rect(<top>, <right>, <bottom>, <left>). The <top> and <bottom> values specify offsets from the top border edge of the element view
port, while <right> and <left> specify offsets from the left border edge of the element view
port. Specifications Specification Status Comment ...
string - SVG: Scalable Vector Graphics
The available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg". See the src descriptor of the @font-face at-rule for more information. ...
... The available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg". See the src descriptor of the @font-face at-rule for more information. ...
stroke-opacity - SVG: Scalable Vector Graphics
To avoid this effect, it is possible to apply a global opacity with the opacity attribute or to put the stro...
...een" style="stroke-opacity: .3;" /> </svg> Usage notes Value [0-1] | <percentage> Default value 1 Animatable Yes Note: SVG2 introduces percentage values for stroke-opacity, however, it is not widely sup
ported yet (See Browser compatibility below) as a consequence, it is best practices to set opacity with a value in the range [0-1]. It's im
portant to know that the stroke partially covers the fill of a shape, so a stroke with an opacity different than 1 will partially show the fill underneath. To avoid this effect, it is possible to apply a global opacity with the opacity attribute or to put the stroke behind the fill with the paint-order attribute. Browser compatibility The compatibility table on this page is generated from structured...
x - SVG: Scalable Vector Graphics
h> | <percentage> Default value 0% Animatable Yes filter For <filter>, x defines the x coordinate of the upper left corner for the rendering area of the filter. Value <length> | <percentage> Default value -10% Animatable Yes foreignObject For <foreignObject>, x defines the x coordinate of the uper left corner of its view
port. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for <foreignObject>. glyphRef Warning: As of SVG2 <glyphRef> is deprecated and shouldn't be used. For <glyphRef>, x defines the x-axis coordinate of the glyph. Value <n...
... rect For <rect>, x defines the x coordinate of the uper left corner of the shape. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for rectangles. svg For <svg>, x defines the x coordinate of the uper left corner of its view
port. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. text For <text>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. The content text position is usualy a point on...
y - SVG: Scalable Vector Graphics
th> | <percentage> Default value 0% Animatable Yes filter For <filter>, y defines the y coordinate of the upper left corner for the rendering area of the filter. Value <length> | <percentage> Default value -10% Animatable Yes foreignObject For <foreignObject>, y defines the y coordinate of the uper left corner of its view
port. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for <foreignObject>. glyphRef Warning: As of SVG2 <glyphRef> is deprecated and shouldn't be used. For <glyphRef>, y defines the y-axis coordinate of the glyph. Value <n...
... rect For <rect>, y defines the y coordinate of the uper left corner of the shape. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for rectangles. svg For <svg>, y defines the y coordinate of the uper left corner of its view
port. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. text For <text>, if it contain a single value, y defines the y coordinate on where the content text position must be placed. The content text position is usualy a point on...
<clipPath> - SVG: Scalable Vector Graphics
vg { height:100% } <svg viewBox="0 0 100 100"> <clipPath id="myClip"> <!-- Everything outside the circle will be clipped and therefore invisible. --> <circle cx="40" cy="35" r="35" /> </clipPath> <!-- The original black heart, for reference --> <path id="heart" d="M10,30 A20,20,0,0,1,50,30 A20,20,0,0,1,90,30 Q90,60,50,90 Q10,60,10,30 Z" /> <!-- Only the
portion of the red heart inside the clip circle is visible. --> <use clip-path="url(#myClip)" xlink:href="#heart" fill="red" /> </svg> /* With a touch of CSS for browsers who * * implemented the r Geometry Property. */ @keyframes openYourHeart {from {r: 0} to {r: 60px}} #myClip circle { animation: openYourHeart 15s infinite; } A clipping path is conceptually equivalent to a custom vi...
...n of the red heart inside the clip circle is visible. --> <use clip-path="url(#myClip)" xlink:href="#heart" fill="red" /> </svg> /* With a touch of CSS for browsers who * * implemented the r Geometry Property. */ @keyframes openYourHeart {from {r: 0} to {r: 60px}} #myClip circle { animation: openYourHeart 15s infinite; } A clipping path is conceptually equivalent to a custom view
port for the referencing element. Thus, it affects the rendering of an element, but not the element's inherent geometry. The bounding box of a clipped element (meaning, an element which references a <clipPath> element via a clip-path property, or a child of the referencing element) must remain the same as if it were not clipped. By default, pointer-events are not dispatched on clipped regions. For ex...
<marker> - SVG: Scalable Vector Graphics
ts="10,10 10,90 90,90" fill="none" stroke="black" marker-start="url(#arrow)" marker-end="url(#arrow)" /> <!-- Data line with polymarkers --> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="grey" marker-start="url(#dot)" marker-mid="url(#dot)" marker-end="url(#dot)" /> </svg> Attributes markerHeight This attribute defines the height of the marker view
port. Value type: <length> ; Default value: 3; Animatable: yes markerUnits This attribute defines the coordinate system for the attributes markerWidth, markerHeight and the contents of the <marker>. Value type: userSpaceOnUse|strokeWidth ; Default value: strokeWidth; Animatable: yes markerWidth This attribute defines the width of the marker view
port. Value type: <length> ; Default value: 3; Ani...
...able: yes refX This attribute defines the x coordinate for the reference point of the marker. Value type: left|center|right|<coordinate> ; Default value: 0; Animatable: yes refY This attribute defines the y coordinate for the reference point of the marker. Value type: top|center|bottom|<coordinate> ; Default value: 0; Animatable: yes viewBox This attribute defines the bound of the SVG view
port for the current SVG fragment. Value type: <list-of-numbers> ; Default value: none; Animatable: yes Global attributes Core Attributes Most notably: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor...
SVG animation with SMIL - SVG: Scalable Vector Graphics
Although Chrome 45 deprecated SMIL in favor of CSS animations and Web animations, the Chrome developers have since suspended that deprecation. Firefox 4 introduced sup
port for animating SVG using Synchronized Multimedia Integration Language (SMIL). SMIL allows you to: animate the numeric attributes of an element (x, y, ...) animate transform attributes (translation or rotation) animate color attributes follow a motion path This is done adding an SVG element like <animate> inside the SVG element to animate. Below are examples for the four different ways. ...
...ransform attributes (translation or rotation) animate color attributes follow a motion path This is done adding an SVG element like <animate> inside the SVG element to animate. Below are examples for the four different ways. Animating attributes of an element The following example animates the cx attribute of a circle. To do so, we add an <animate> element inside the <circle> element. The im
portant attributes for <animate> are: attributeName The name of the attribute to animate. from The initial value of the attribute. to The final value. dur The duration of the animation (for example, write '5s' for 5 seconds). If you want to animate more attributes inside the same element, just add more <animate> elements. <svg width="300" height="100"> <title>Attribute Animation with SM...
SVG as an Image - SVG: Scalable Vector Graphics
External resources (e.g. images, stylesheets) cannot be loaded, though they can be used if inlined through data: URIs. ...
... External resources (e.g. images, stylesheets) cannot be loaded, though they can be used if inlined through data: URIs. ...
SVG In HTML Introduction - SVG: Scalable Vector Graphics
nvalid attribute on the <body>, and a style rule changes the gradient end-stop color to red. ...
...setAttributeNS to set href. Like in the following example: var img = document.createElementNS("http://www.w3.org/2000/svg", "image"); img.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "move.png"); Details The viewBox attribute establishes a logical coordinate system which the SVG picture's coordinates are relative to. In this case our picture is laid out in a 100 by 100 view
port. The preserveAspectRatio attribute specifies that the aspect ratio must be preserved by centering the picture in the available size, sizing to the maximum of the height or width and then cutting off any overflow. The style attribute pins the SVG element to the background of the form. Related Links Another SVG in HTML example: A swarm of motes Working example that works in both Mozilla and ...
Texts - SVG: Scalable Vector Graphics
mage, and the other are SVG fonts. The latter may be described in a later section of the tutorial, while we will focus completely on the first part: Bringing text into an SVG image. Basics We have seen in the introducing example, that the text element can be used to put arbitrary text in SVG documents: <text x="10" y="10">Hello World!</text> The x and y attributes determine, where in the view
port the text will appear. The attribute text-anchor, which can have the values "start", "middle", "end" or "inherit", decides in which direction the text flows from this point. The attribute dominant-baseline decides the vertical alignment. Like with the shape elements text can be colorized with the fill attribute and given a stroke with the stroke attribute. Both may also refer to gradients or patt...
...a set of attributes, many similar to their CSS counterparts, to enable font selection. Each of the following properties can be set as an attribute or via a CSS declaration: font-family, font-style, font-weight, font-variant, font-stretch, font-size, font-size-adjust, kerning, letter-spacing, word-spacing and text-decoration. Other text-related elements tspan This element is used to mark up sub-
portions of a larger text. It must be a child of a text element or another tspan element. A typical usecase is to paint one word of a sentence bold red. <text> This is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> Playable code <svg width="350" height="60" xmlns="http://www.w3.org/2000/svg"> <text> This is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> ...
Securing your site - Web security
number of things you can do to help secure your site. This article offers an assortment of suggestions, as well as links to other articles providing more useful information. Note: This article is a work in progress, and is neither complete nor does following its suggestions guarantee your site will be fully secure. User information security How to turn off form autocompletion Form fields sup
port autocompletion in Gecko; that is, their values can be remembered and automatically brought back the next time the user visits your site. For certain types of data, you may wish to disable this feature. Privacy and the :visited selector This article discusses changes made to the getComputedStyle() method that eliminates the ability for malicious sites to figure out the user's browsing history. ...
...algorithms (such as md5 and sha). This article showcases best practices to use when storing passwords. Content security Properly configuring server MIME types There are several ways incorrect MIME types can cause potential security problems with your site. This article explains some of those and shows how to configure your server to serve files with the correct MIME types. HTTP Strict Trans
port Security The Strict-Trans
port-Security: HTTP header lets a website specify that it may only be accessed using HTTPS. HTTP access control The Cross-Origin Resource Sharing standard provides a way to specify what content may be loaded from other domains. You can use this to prevent your site from being used improperly; in addition, you can use it to establish resources that other sites are expre...
Types of attacks - Web security
ed value. If there is a mismatch, the request should be aborted. This method of protection relies on an attacker being unable to predict the user's assigned CSRF token. The token should be regenerated on sign-in. Cookies that are used for sensitive actions (such as session cookies) should have a short lifetime with the SameSite attribute set to Strict or Lax. (See SameSite cookies above). In sup
porting browsers, this will have the effect of ensuring that the session cookie is not sent along with cross-site requests and so the request is effectively unauthenticated to the application server. Both CSRF tokens and SameSite cookies should be deployed. This ensures all browsers are protected and provides protection where SameSite cookies cannot help (such as attacks originating from a separate s...
...is available on a sub-domain, this mechanism can be abused in a session fixation attack. When the user visits a page on the parent domain (or another subdomain), the application may trust the existing value sent in the user's cookie. This could allow an attacker to bypass CSRF protection or hijack a session after the user logs in. Alternatively, if the parent domain does not use HTTP Strict-Trans
port-Security with includeSubdomains set, a user subject to an active MitM (perhaps connected to an open WiFi network) could be served a response with a Set-Cookie header from a non-existent sub-domain. The end result would be much the same, with the browser storing the illegitimate cookie and sending it to all other pages under example.com. Session fixation should primarily be mitigated by regenerat...
xml:base - XML: Extensible Markup Language
e base URL of a element can be queried from a script using Node.baseURI. The base URI of an element is: the base URI specified by an xml:base attribute on the element, if one exists, otherwise the base URI of the element's parent element within the document entity or external entity, if one exists, otherwise the base URI of the document entity or external entity containing the element. Sup
port was removed from blink (Chrome and Opera) in 2015: Chromium bug 341854 blink-dev mailing list post And from Firefox 66 in bug 903372. Use cases If you have an inline SVG you use as icons that needs to work in a document with a HTML BaseElement , you can reset the URI on your icon sprite by setting the xml:base. <html> <head> <base href="https://mydomain.com"> <style> .link { stro...
...12" dx="0" class="s9_999" >r</text> <style type="text/css"><![CDATA[ @font-face { font-family: ZapfDingbats_ghr; src: url("fonts/ZapfDingbats_ghr.woff") format("woff"); } ]]></style> </svg> Setting the xml:base on the SVG Element means you can inline the SVG and thereby bypass CORS issue while not changing the base URI for your entire document. Work-arounds xml:base sup
port in old browsers https://gist.github.com/leonderijke/c5cf7c5b2e424c0061d2 Specifications Specification Status Comment XML Base (Second Edition) Recommendation ...
Axes - XPath
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes There are thirteen different axes in the XPath specification. An axis represents a relationship to the context node, and is used to locate nodes relative to that node on the tree. The following is an extremely brief description of the thirteen available axes and the degree of sup
port available in Gecko. For further information on using XPath expressions, please see the For Further Reading section at the end of Transforming XML with XSLT document. Also see the 'axes' section in the xpath spec. ancestor Indicates all the ancestors of the context node beginning with the parent node and traveling through to the root node. ancestor-or-self Indicates the context node and all of its ancestors, inc...
...arent of an attribute node is an element node, but attribute nodes are not the children of their parents. following Indicates all the nodes that appear after the context node, except any descendant, attribute, and namespace nodes. following-sibling Indicates all the nodes that have the same parent as the context node and appear after the context node in the source document. namespace (not sup
ported) Indicates all the nodes that are in scope for the context node. In this case, the context node must be an element node. parent Indicates the single node that is the parent of the context node. It can be abbreviated as two periods (..). preceding Indicates all the nodes that precede the context node in the document except any ancestor, attribute and namespace nodes. preceding-sibling Ind...
addon-page - Archive of obsolete content
ly the content in an HTML file in your add-on's "data" directory. Note: This module has no effect on Fennec. For pages like this, navigational elements such as the Awesome Bar, Search Bar, or Bookmarks Toolbar are not usually relevant and distract from the content you are presenting. The addon-page module provides a simple way to have a page which excludes these elements. To use the module im
port it using require(). After this, the page loaded from "data/index.html" will not contain navigational elements: var addontab = require("sdk/addon-page"); var data = require("sdk/self").data; require("sdk/tabs").open(data.url("index.html")); This only affects the page at "data/index.html": all other pages are displayed normally. ...
selection - Archive of obsolete content
iterating over the selection module itself. Each iteration yields a Selection object from which text, html, and isContiguous properties can be accessed. Private Windows If your add-on has not opted into private browsing, then you won't see any selections made in tabs that are hosted by private browser windows. To learn more about private windows, how to opt into private browsing, and how to sup
port private browsing, refer to the documentation for the private-browsing module. Examples Log the current contiguous selection as text: var selection = require("sdk/selection"); if (selection.text) console.log(selection.text); Log the current discontiguous selections as HTML: var selection = require("sdk/selection"); if (!selection.isContiguous) { for (var subselection in selection) { ...
self - Archive of obsolete content
rt name. It comes from the name property in the main package's package.json file. version This property contains the add-on's version string. It comes from the version property set in the package.json file in the main package. loadReason This property contains of the following strings describing the reason your add-on was loaded: install enable startup upgrade downgrade isPrivateBrowsingSup
ported This property indicates whether or not the add-on sup
ports private browsing. It comes from the private-browsing key in the add-on's package.json file. data The data object is used to access data that was bundled with the add-on. This data lives in the add-on's data/ directory, immediately below the package.json file. All files in this directory will be copied into the XPI and made available ...
url - Archive of obsolete content
).URL("https://developer.mozilla.org/Add-ons?example=true&visible=yes#top"); console.log(url.scheme); // https userPass The username:password part of the URL, null if not present. host The host of the URL, null if not present. For example: var url = require("sdk/url").URL("https://developer.mozilla.org/Add-ons?example=true&visible=yes#top"); console.log(url.host); // developer.mozilla.org
port The
port number of the URL, null if none was specified. path The path component of the URL. Contains everything after the host of the URL. Compare with pathname. For example: var url = require("sdk/url").URL("https://developer.mozilla.org/Add-ons?example=true&visible=yes#top"); console.log(url.path); // /Add-ons?example=true&visible=yes#top hostname The domain of the URL, as a string. Mirr...
content/content - Archive of obsolete content
Deprecated in Firefox 32. Re-ex
ports three objects from three other modules: Loader, Worker, and Symbiont. These objects are used in the internal implementations of SDK modules which use content scripts to interact with web content, such as the panel or page-mod modules. ...
content/loader - Archive of obsolete content
Loader adds code to initialize and validate a set of properties for managing content scripts: contentURL contentScript contentScriptFile contentScriptWhen contentScriptOptions allow When certain of these properties are set, the Loader emits a propertyChange event, enabling its users to take the appropriate action. ...
event/target - Archive of obsolete content
also throws exception then such exceptions are logged into a console. Chaining Emitters can also have their methods chained: target.on('message', handleMessage) .on('data', parseData) .on('error', handleError); EventTarget EventTarget is an exemplar for creating an objects that can be used to add / remove event listeners on them. Events on these objects may be emitted via emit function ex
ported by event/core module. Methods initialize() Method initializes this event source. It goes through properties of a given options and registers listeners for the ones that look like event listeners. on(type, listener) Registers an event listener that is called every time events of specified type are emitted. worker.on('message', function (data) { console.log('data received: ' + data) }); ...
frame/hidden-frame - Archive of obsolete content
Experimental Creates Firefox frames (i.e. XUL <iframe> elements) that are not displayed to the user. This is useful in the construction of APIs that load web content not intended to be directly seen or accessed by users, like page-worker. It is also useful in the construction of APIs that load web content for intermittent display, such as panel. Usage The module ex
ports a constructor function, HiddenFrame, and two other functions, add and remove. HiddenFrame constructs a new hidden frame. add registers a hidden frame, preparing it to load content. remove unregisters a frame, unloading any content that was loaded in it. The following code creates a hidden frame, loads a web page into it, and then logs its title: var hiddenFrames = require("sdk/frame/hidden-frame"); let hiddenFrame = hi...
frame/utils - Archive of obsolete content
Experimental Provides helper functions for working with platform internals like frames and browsers. Usage Module ex
ports create function that takes the nsIDOMDocument of a privileged document and creates a browser element in its documentElement: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,Foo'); let frame = create(window.document); Optionally create can be passed set of options to configure created frame even further. Execution of scripts may easily be enabled: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,top'); let frame = create(window.document, { uri: 'data:text/html,<script>console.log("running");</script>', allowJavascr...
io/file - Archive of obsolete content
hardcode Windows-style paths, be sure to escape backslashes in strings. For example, to specify the file at C:\Users\Myk, you need to use the string "C:\\Users\\Myk", not "C:\Users\Myk". Read more about escaping characters in strings. Globals Functions basename(path) The path parameter must be an absolute path, relative paths will cause an error. Use the fs/path module for relative path sup
port. Returns the last component of the given path. For example, basename("/foo/bar/baz") returns "baz". If the path has no components, the empty string is returned. Parameters path : string The path of a file. Returns string : The last component of the given path. dirname(path) Returns the path of the directory containing the given file. If the file is at the top of the volume, the empty str...
lang/functional - Archive of obsolete content
ecution once(fn) Creates a version of the input function that can only be called one time. Repeated calls to the modified function will have no effect, returning the value from the original call. Useful for initialization functions, instead of having to set a boolean flag and checking it later. ...
places/history - Archive of obsolete content
Access the user's browsing history. Usage This module ex
ports a single function, search(), which synchronously returns a PlacesEmitter object which then asynchronously emits data and end or error events that contain information about the state of the operation. Example let { search } = require("sdk/places/history"); // Simple query search( { url: "https://developers.mozilla.org/*" }, { sort: "visitCount" } ).on("end", function (results) { // results is an array of objects containing // data about visits to any site on developers.mozilla.org // ordered by visit count }); // Complex query // The query objects are OR'd together // Let's say we want to retrieve all visits from before a week ago // with the query of 'ruby', but from last week onwards, we want // all results with ...
tabs/utils - Archive of obsolete content
turns tabContainer : getTabs(window) Returns the tabs for the specified window. If you omit window, this function will return tabs across all the browser's windows. However, if your add-on has not opted into private browsing, then the function will exclude all tabs that are hosted by private browser windows. To learn more about private windows, how to opt into private browsing, and how to sup
port private browsing, refer to the documentation for the private-browsing module. Parameters window : nsIWindow Optional. Returns Array : An array of tab elements. getActiveTab(window) Given a browser window, get the active, or selected, tab. Parameters window : window A browser window. Returns tab : The currently selected tab. getOwnerWindow(tab) Get the browser window that owns the sp...
test/httpd - Archive of obsolete content
This module was removed in Firefox 36, please use the addon-httpd npm module instead. An HTTP server for the Mozilla platform, which can be used in unit tests. Usage The most basic usage is: var { startServerAsync } = require("sdk/test/httpd"); var srv = startServerAsync(
port, basePath); require("sdk/system/unload").when(function cleanup() { srv.stop(function() { // you should continue execution from this point. }) }); This starts a server in background (assuming you're running this code in an application that has an event loop, such as Firefox). The server listens at http://localhost:
port/ and serves files from the specified directory. You can serve static content or use SJS scripts, as described in documentation on developer.mozilla.org. You can also use nsHttpServer to start th...
util/uuid - Archive of obsolete content
For more details about UUID representations and what they are used for by the platform see the MDN documentation for JSID. Generate UUID To generate a new UUID, call uuid() with no arguments: let uuid = require('sdk/util/uuid').uuid(); Parsing UUID To convert a string representation of a UUID to an nsID, pass the string representation to uuid(): let { uuid } = require('sdk/util/uuid'); let firefoxUUID = uuid('{ec8030f7-c20a-464f-9b0e-13a3a9e97384}'); Globals Functions uuid(stringId) Generate a new UUID, or convert a string representation of a UUID to an nsID. ...
window/utils - Archive of obsolete content
d into private browsing, so you need to take care not to store any user data derived from private browser windows. The exception is the windows() function which returns an array of currently opened windows. Private windows will not be included in this list if your add-on has not opted into private browsing. To learn more about private windows, how to opt into private browsing, and how to sup
port private browsing, refer to the documentation for the private-browsing module. Globals Functions getMostRecentBrowserWindow() Get the topmost browser window, as an nsIDOMWindow instance. Returns nsIDOMWindow: the topmost browser window. getInnerId(window) Returns the ID of the specified window's current inner window. This function wraps nsIDOMWindowUtils.currentInnerWindowID. Parameters ...
Low-Level APIs - Archive of obsolete content
s to them in future releases. /loader Create CommonJS module loaders. chrome The chrome module gives an Add-on SDK add-on access to the Components object, which in turn gives it access to a large set of privileged low-level Firefox APIs. console/plain-text Constructor for a console instance. console/traceback Functionality similar to Python's traceback module. content/content Re-ex
ports three objects from three other modules: Loader, Worker, and Symbiont. content/loader Provides one of the building blocks for those modules that use content scripts to interact with web content, such as panel and page-mod. content/mod Provides functions to modify a page content. content/symbiont Used by SDK modules that can load web content and attach content scripts to it. content/worker ...
Release notes - Archive of obsolete content
r require("sdk/self").data.url("my-file") Added the ability to attach stylesheets to individual tabs. Details GitHub commits made between Firefox 33 and Firefox 34. This will not include any uplifts made after this release entered Aurora. Bugs fixed between Firefox 33 and Firefox 34. This will not include any uplifts made after this release entered Aurora. Firefox 33 Highlights Added sup
port for context menus in panels via a new option in the Panel constructor. Added tab.readyState. Added a BrowserWindow parameter to sidebar.show() and sidebar.hide(), to control the window for which the sidebar will be shown or hidden. Details GitHub commits made between Firefox 32 and Firefox 33. This will not include any uplifts made after this release entered Aurora. Bugs fixed between Firef...
jpm-mobile - Archive of obsolete content
You can use jpm and jpm-mobile for Firefox 38 and onwards. This article is the reference for jpm-mobile. The Node-based replacement for cfx --force-mobile. Enables you to run and test add-ons for Firefox Mobile (aka Fennec). jpm usage is: jpm-mobile [command] [options] jpm sup
ports the following global options: -h, --help - show a help message and exit -V, --version - print the jpm version number Installation jpm-mobile is distributed using the node package manager npm, so to get jpm-mobile you need to have npm installed, if you haven't already. npm is included in Node.js, so to install npm, visit nodejs.org and click the Install button. After that you can install jpm just as you would any other npm package: npm install jpm-mobile -g Depending on your setup, you mig...
Tools - Archive of obsolete content
cfx to jpm A guide to working with jpm if you're already familiar with cfx. console Enables your add-on to log error, warning or informational messages. jpm jpm is a command-line tool that enables you to test, run, and package add-ons. jpm-mobile The Node-based replacement for cfx --force-mobile. Enables you to run and test add-ons for Firefox Mobile (aka Fennec). ...
Troubleshooting - Archive of obsolete content
wn issues or search for specific keywords. Contact the Project Team and User Group SDK users and project team members discuss problems and proposals on the project mailing list. Someone else may have had the same problem you do, so try searching the list. You're welcome to post a question, too. You can also chat with other SDK users in #jetpack on Mozilla's IRC network. And if you'd like to re
port a bug in the SDK, that's always welcome! You will need to create an account with Bugzilla, Mozilla's bug tracker. ...
Using XPCOM without chrome - Archive of obsolete content
o bookmarks and tags) , (Creating Event Targets). However, with the sdk module , we can remove this need. Below is an example, where we extend the xpcom module's Unknown class with an nsINavBookmarkObserverinterface and one of its optional interface methods (onItemchanged). We can then create an object from it and add it as an observer to the bookmarks service. ...
Bootstrapped extensions - Archive of obsolete content
ying the application user interface chrome.manifest in bootstrapped add-ons You can use a chrome.manifest file in bootstrapped add-ons to: Make your add-on's content available via a chrome:// URL (using the content, locale, and skin instructions in the manifest). Replace existing chrome:// URIs with your content (using the override instruction). Not all chrome.manifest instructions are sup
ported in bootstrapped add-ons, for example you still cannot register XUL Overlays from a bootstrapped add-on. See the chrome.manifest documentation for details. In Firefox 10 and later the chrome.manifest file located in the root of the add-on's XPI (i.e. a sibling of the install.rdf) is loaded automatically. In Firefox 8 and 9 you had to load/unload the manifest manually using nsIComponentManager.a...
Alerts and Notifications - Archive of obsolete content
opup(title, text) { try { Components.classes['@mozilla.org/alerts-service;1'] .getService(Components.interfaces.nsIAlertsService) .showAlertNotification(null, title, text, false, '', null); } catch(e) { // prevents runtime error on platforms that don't implement nsIAlertsService } } If you need to display a comparable alert on a platform that doesn't sup
port nsIAlertsService, you can do this: function popup(title, msg) { var image = null; var win = Components.classes['@mozilla.org/embedcomp/window-watcher;1'] .getService(Components.interfaces.nsIWindowWatcher) .openWindow(null, 'chrome://global/content/alerts/alert.xul', '_blank', 'chrome,titlebar=no,popup=yes', null);...
Bookmarks - Archive of obsolete content
r parentFolderId = bmsvc.getFolderIdForItem(newBkmkId); Observing changes to bookmarks and tags To set up an observer to listen for changes related to bookmarks, you will need to create an nsINavBookmarkObserver object and use the nsINavBookmarksService.addObserver() and nsINavBookmarksService.removeObserver() methods. Note that this example takes advantage of XPCOMUtils to generate the nsISup
ports.QueryInterface() method. // An nsINavBookmarkObserver var myExt_bookmarkListener = { onBeginUpdateBatch: function() {}, onEndUpdateBatch: function() {}, onItemAdded: function(aItemId, aFolder, aIndex) {}, onItemRemoved: function(aItemId, aFolder, aIndex) {}, onItemChanged: function(aBookmarkId, aProperty, aIsAnnotationProperty, aValue) { MyExtension.doSomething(); }, onItemVis...
Canvas code snippets - Archive of obsolete content
'bezierCurveTo', 'clearRect', 'clip', 'closePath', 'drawImage', 'fill', 'fillRect', 'fillText', 'lineTo', 'moveTo', 'quadraticCurveTo', 'rect', 'restore', 'rotate', 'save', 'scale', 'setTransform', 'stroke', 'strokeRect', 'strokeText', 'transform', 'translate']; var getterMethods = ['createPattern', 'drawFocusRing', 'isPointInPath', 'measureText', // drawFocusRing not currently sup
ported // The following might instead be wrapped to be able to chain their child objects 'createImageData', 'createLinearGradient', 'createRadialGradient', 'getImageData', 'putImageData' ]; var props = ['canvas', 'fillStyle', 'font', 'globalAlpha', 'globalCompositeOperation', 'lineCap', 'lineJoin', 'lineWidth', 'miterLimit', 'shadowOffsetX', 'shadowOffsetY', 'shadowBlur', 'sha...
HTML to DOM - Archive of obsolete content
The code snippets on this page will let your site work until these new features are more widely available. Safely parsing simple HTML to DOM When using XMLHttpRequest to get the HTML of a remote webpage, it is often advantageous to turn that HTML string into DOM for easier manipulation. However, there are potential dangers involved in injecting remote content in a privileged context in your extension, so it can be desirable to parse the HTML safely. ...
Running applications - Archive of obsolete content
from your chrome JavaScript code, using Mozilla XPCOM interfaces. There are two ways to run programs. Using nsIProcess The recommended way is to use the nsIProcess interface because it is crossplatform. Using nsILocalFile.launch() This method is not implemented on all platforms, especially not on Unix/Linux! See nsILocalFile.launch() for details and make sure that all your target platforms sup
port this method! This method has the same effect as if you double-clicked the file, so for executable files--it will just run the file without any parameters. For more information on nsIFile/nsILocalFile, see File I/O. var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath("c:\\myapp.exe"); file.launch(...
StringView - Archive of obsolete content
w.forEachChar(function callback, optional object thisObject, optional unsigned long characterOffset, optional unsigned long charactersLength); DOMString stringView.valueOf(); DOMString stringView.toString(); Properties overview Attribute Type Description encoding Read only DOMString A string expressing the encoding type. For actually sup
ported values see here. buffer Read only arrayBuffer The buffer to be shared between stringView.rawData and stringView.bufferView view references. rawData Read only arrayBufferView An arrayBufferView containing the representation of the string as array of 8-bit, 16-bit, or 32-bit integers (depending on the chosen encoding). bufferView Read only ...
Windows - Archive of obsolete content
ns the outer window's unique ID. Similarly, you can get the current inner window ID using the nsIDOMWIndowUtils attribute currentInnerWindowID: var util = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils); var windowID = util.currentInnerWindowID; Programatically modifying HTML When attempting to modify HTML elements, it is im
portant to specify the namespace. For example, the following code will add a horizontal rule. var hr = document.createElementNS("http://www.w3.org/1999/xhtml", "html:hr"); document.getElementById("id1").appendChild(hr); ...
XPath - Archive of obsolete content
turnType,result); //contextNode should be used in the one in which it was created //add by mooring 2008-11-15 16:00 china var xhr = new Ajax('post','demo.xml',parseXML,'xml'); //Ajax is a class written by javascript which return responseXML object to parseXML function function parseXML(obj)//obj is the returnXML object now { if(!obj.documentElement) { alert("Your Browser does't sup
port this script!"); return; } var fields = [];//store the results if(window.ActiveXObject) { var tobj = obj.documentElement.selectNodes("/root/field/item"); for(var i=0;i<tobj.length; i++) { fields.push(tobj[i].text); } } else { var tobj = obj.evaluate("/root/field/item",obj.documentElement,null, XPathResult.ANY_TYPE, null); var tmp = tobj.iterateNext(); while(tmp) { ...
Common Pitfalls - Archive of obsolete content
There are some common pitfalls that should be avoided when writing either extensions or core Mozilla code. These are the sort of things that super-review should be catching for code that goes into the tree; avoiding these to start with saves super-reviewers a lot of effort. The first couple of items deal with loading content from a URI. It's im
portant to create the URI correctly, and then check that it's secure to load. This will shield you from loading <tt>javascript:</tt> or <tt>chrome:</tt> URIs when you shouldn't. How to create a URI object In almost all cases, when creating a URI object you want to use the newURI method on the nsIIOService interface, like so: JavaScript: try { var ioServ = Components.classes["@mozilla.org/network/io-service;1"] .get...
Communication between HTML and your extension - Archive of obsolete content
as the something that I wanted the extension to find. There were only a handful of events that seemed relevant (Load, Change, DOMInsertNode, DOMInsertNodeIntoDocument, DOMActivate) and I tried them all in many different ways. Some of the events only apply to certain types of elements so I included trying to modify the result of the AJAX request to be of the appropriate element type (img, which sup
ports "onLoad," rather than span, which doesn't, for example). The problem with the events is the timing. I wasn't sure about the difference between the capture or bubbling flag that you pass to addEventListener but every time I would catch the event in the extension, the element from the AJAX request wasn't fully updated into the HTML page. What that meant is that everytime the extension went looking...
Deploying a Plugin as an Extension - Archive of obsolete content
interface. In this article, we will create an extension for the Rhapsody Player Engine. Normally, this plugin is installed in a local directory, and a registry item is used to let Firefox know about the plugin. First, let's take a look at the structure of the XPI file used for a browser plugin. RhapsodyPlayerEngine_Inst_Win.xpi install.rdf plugins/ license.rtf nprhapengine.dll The im
portant file here is the install.rdf file. This contains information about our extension; all extensions have one. Here's what a basic install.rdf file looks like: <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>RhapsodyPlayerEngine@rhapsody.com</em:id> <em:name>Rhapsody Pl...
Developing add-ons - Archive of obsolete content
la based software display content they can't handle natively. Jetpack Browser extension development for everyone. Jetpack developers only need to know the tools of the modern web: HTML, CSS, and JavaScript. Themes Themes let users customize the appearance of the user interface presented by Mozilla-based applications. Search engine plugins Firefox sup
ports search engine plugins, which enable the search box to sup
port different search engines. addons.mozilla.org (AMO) API Developers' Guide The AMO Developers' Guide describes how to use the AMO API to fetch information about add-ons from the addons.mozilla.org site. The Mozilla platform Information about the Mozilla platform, including all of its APIs and technologies, as well as...
Extension Packaging - Archive of obsolete content
This can be accomplished on Windows using the registry. Multi-item extension XPIs In some cases, a single XPI file may wish to install multiple extensions/themes. A special kind of extension XPI, called the Multiple Item Package, explains how to create this kind of package. (Firefox 1.5/XULRunner 1.8 required.) From the release of Firefox 53, multiple item extension packages are no longer sup
ported and will not load. As a consequence, these packages are no longer accepted by AMO. Official references for Toolkit API Structure of an Installable Bundle: describes the common structure of installable bundles, including extensions, themes, and XULRunner applications Extension Packaging: specific information about how to package extensions Theme Packaging: specific information about h...
Jetpack Processes - Archive of obsolete content
d-write. onInvalidate A callback to call when the handle is garbage collected, either through an explicit call to invalidate() or being unrooted and then unreachable. The callback is only called from the process that the handle was not garbage collected in. Read-write. Special Messages core:process-error(context) When the jetpack process crashes, this message is sent to the parent. If a crash re
port minidump is available, the context.dumpID property will list the minidump ID of the crash re
port that was collected. core:exception(error) When an exception occurs in a Jetpack script and is not caught, this message is sent to the parent. The error object contains the following properties: fileName, lineNumber, and message. History See bug 556846 and bug 578821 for details. Sample Code For examp...
Listening to events in Firefox extensions - Archive of obsolete content
ge, the pagehide event from each frame fires before the pagehide event in the main document. For navigation that occurs inside a single frame, events fire only in the affected frame. Web progress listeners For more information about web loads a web progress listener can be used; these provide more details about the progress of loading data from the web. Both browser and tabbrowser elements sup
port the following: var progressListener = { // add nsIWebProgressImplementation here } b.addProgressListener(progressListener); Where b is the browser or tabbrowser you want to listen to events for. There are code snippets available that give more detail on using web progress listeners. For a tabbrowser, the above code will only get events from the browser that is currently displayed at the ti...
Multiple item extension packaging - Archive of obsolete content
As a consequence, these packages are no longer accepted by AMO. A multiple Item package provides the ability to package multiple installable bundles which can then be downloaded and installed by a user, or provided pre-packaged with an application or by an external program. Every multiple item package must provide an install.rdf file (not old-style install.js!) and has the same requirements as an extension except as noted below. There is currently no feature to prevent or warn the user when installing an older version of an extension. ...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
the HTML document by manipulating strings, but using the DOM makes it possible to manipulate XML documents in a way that better matches JavaScript's object-oriented nature. In addition, XUL lacks any equivalent for the innerHTML property, so if it weren't for the DOM, dynamic processing would be impossible. There are a number of levels to the DOM with different levels of functionality. Gecko sup
ports nearly all of DOM Level 2 and some of DOM Level 3. With the DOM, the contents of an XML document are handled as a "DOM tree," a collection of element nodes and other nodes. Listing 4 shows an example that deletes the second child element of the element with the "toolbar" id, adds a new button element as a substitute, and sets a label attribute. We do not go into the details of the various APIs...
Adding sidebars - Archive of obsolete content
the sidebar can hold any content you want and it's no different from other XUL windows or overlays. One minor difference is that the XUL sidebar should be defined using the << XUL Reference << root element instead of window or dialog. The load event is fired every time the sidebar is opened, and unload every time it's closed, so you can use those for initialization and clean up . Another, more im
portant difference to take into account is that users can resize the sidebar to their liking, and in most cases, the sidebar is going to be fairly narrow. You should design the content of your sidebar carefully, so that it is usable and appealing regardless of width. There are ways to limit the size boundaries of your sidebar with CSS or even disable resizing altogether, but none of those are good pra...
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
+ only. * @param {nsIURI} baseURI The base URI relative to which resource * URLs should be processed. Note that this will not work for * XML fragments. * @param {boolean} isXML If true, parse the fragment as XML. */ function parseHTML(doc, html, allowStyle, baseURI, isXML) { let PARSER_UTILS = "@mozilla.org/parserutils;1"; // User the newer nsIParserUtils on versions that sup
port it. if (PARSER_UTILS in Cc) { let parser = Cc[PARSER_UTILS] .getService(Ci.nsIParserUtils); if ("parseFragment" in parser) return parser.parseFragment(html, allowStyle ? parser.SanitizerAllowStyle : 0, !!isXML, baseURI, doc.documentElement); } return Cc["@mozilla.org/feed-unescapehtml;1...
Introduction - Archive of obsolete content
erful outreach more commonly seen in less open companies. Version 1.0 of Firefox was released in November 2004, version 2.0 in October 2006, and version 3.0 in June 2008. This tutorial was written after Firefox 3 was released, and has been updated with time. While most of it should still work for creating extensions in Firefox 3 (and even Firefox 2), it is strongly recommended that you aim to sup
port modern Firefox versions, to encourage users to stay up to date with security fixes. A release that is more than 6 months old is likely vulnerable to published security bugs. Firefox and other Mozilla applications can be seen as composed of two different parts: a user interface layer that is distinct for each project, and a common platform on top of which the interface layer is built. The user in...
Local Storage - Archive of obsolete content
derstand at least a little about RDF when you read the documentation about templates. Templates Templates are a very powerful tool in Firefox. They allow you to automatically generate XUL content using information from a datasource, and automatically update the content once the datasource changes. They were designed with RDF datasources in mind, but since Firefox 3 they have been extended to sup
port SQLite datasources as well. Handling templates can also be complicated, but it is worth the effort if you need to display long lists or trees with complex data. If you manage to get your display code to use templates, you will have saved a lot of coding. Since templates are not necessary for most extensions and they're a complicated subject, it's better that you read it from the experts. There's...
Useful Mozilla Community Sites - Archive of obsolete content
stem (WTS) and volunteers around the world translate them to different languages. The community is very active, and you can be sure to get translations for the most commonly used languages within a few days of submitting your extension. You'll also receive feedback that you wouldn't notice by testing only in one language, which can reveal other bugs in your locale handling. There's a significant
portion of users that use a localized version of Firefox, so you shouldn't neglect them. Using Babelzilla takes little time and is very valuable. Mozdev mozdev.org provides free project hosting and software development tools for Mozilla applications and add-ons. It is the only hosting service tailored to the needs of the Mozilla community. It offers many necessary services such as bug tracking, sou...
Session store API - Archive of obsolete content
Session store makes it possible for extensions to easily save and restore data across Firefox sessions. There is a simple API that lets extensions access the session store feature. One key scenario in which sup
porting this feature can be crucial for an extension: Firefox 2 lets users undo the closing of tabs. In order to properly restore your extension's state when a tab is restored, it needs to use the session store API's setTabValue() method to save any data it will need in order to restore its state, and then call getTabValue() to retrieve the previous setting when the tab is restored. The Session Store API is implemented using the nsISessionStore interface. Knowing when to restore Each time Firefox is about to restore a tab, an event of type SSTabRestoring is sent. If your extension w...
Adding preferences to an extension - Archive of obsolete content
tensions. Second, we call nsIPrefService.getBranch(). This lets us specify a specific branch of the preference tree to access. By default, we would have access to all preferences, but we only want access to those belonging to our own extension, so we specify that we want to access the "extensions.stockwatcher2" branch. After getting the preference branch for our extension, we call the nsISup
ports.QueryInterface() method on it to be able to use the methods of the nsIPrefBranch2 interface. The next step is to register a preference observer by calling the addObserver() method to establish that whenever any events occur on the preferences, our object (this) receives notification. When events occur, such as a preference being altered, our observe() method will be called automatically. Now t...
Creating reusable content with CSS and XBL - Archive of obsolete content
> </bindings> Make a new CSS file, bind6.css. This separate stylesheet contains style for the binding. Copy and paste the content from here: /*** XBL demonstration ***/ [anonid="square"] { width: 20em; height: 20em; border: 2px inset gray; } [anonid="button"] { margin-top: 1em; padding: .5em 2em; } Open the document in your browser and press the button. This wiki does not sup
port JavaScript in pages, so it is not possible to show the demonstration here. It looks something like this, before and after you press the button: Notes about this demonstration: The HTML document links the document stylesheet as usual, but it does not link any JavaScript code. The document does not contain any buttons. It only contains the text of the button's label. The butt...
chargingtimechange - Archive of obsolete content
e read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.chargingTime double (float) The remaining time in seconds until the system's battery is fully charged. Returns 0 if the battery is fully charged. Returns positive infinity, if the battery is discharging or if the implementation is unable to re
port the remaining charging time. Read only. Example navigator.getBattery().then(function(battery) { console.log("Battery charging time: " + battery.chargingTime + " seconds"); battery.addEventListener('chargingtimechange', function() { console.log("Battery charging time: " + battery.chargingTime + " seconds"); }); }); Related events chargingchange dischargingtimechange lev...
dischargingtimechange - Archive of obsolete content
read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.dischargingTime double (float) the remaining time in seconds until the system's battery is completely discharged and the system is about to be suspended. Returns positive infinity if the battery is charging, if the implementation is unable to re
port the remaining discharging time, or if there is no battery attached to the system. Read only. Example navigator.getBattery().then(function(battery) { console.log("Battery discharging time: " + battery.dischargingTime + " seconds"); battery.addEventListener('dischargingtimechange', function() { console.log("Battery discharging time: " + battery.dischargingTime + " seconds"); });...
levelchange - Archive of obsolete content
but properties can be read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.level double (float) The system's battery charging level scaled from 0 to 1.0. Returns 0 if the battery is empty and the system is about to suspend. Returns 1.0 if the battery is full, if the implementation is unable to re
port the battery's level, or if there is no battery attached to the system. Read only. Example navigator.getBattery().then(function(battery) { console.log("Battery level: " + battery.level * 100 + " %"); battery.addEventListener('levelchange', function() { console.log("Battery level: " + battery.level * 100 + " %"); }); }); Related events chargingchange chargingtimechange d...
Install.js - Archive of obsolete content
root of your XPI file. If you want your extension to install in Firefox 0.9 and later and/or Thunderbird 0.7 and later only, you don't need install.js, you need an install.rdf instead. See also this article from XulPlanet's Main Tutorial. There is a different sample install.js template located at http://downloads.mozdev.org/xsidebar/mods/. This version has been developed as part of the effort to
port Firefox extensions to SeaMonkey from the xSidebar Project. Pros: This version consolidates all the changable information at the top of the file. And it also knows how to install packaged components, search engines and default preferences. Cons: Code is bloated since it has to cater for several different ways an extension author can package the .JAR file contained in the .XPI file. XPI file struc...
Makefile - .mk files - Archive of obsolete content
Makefile Description client.mk Top level makefile which controls the overall build config/android-common.m config/autoconf.mk config/rules.mk Targets (ex
port, deps, libs, tools) and generic build rules config/static-checking-config.mk config/version.mk Makefile Description config/myconfig.mk User defined build configuration values config/myrules.mk User defined makefile rules for building $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk Application specific build configuration ...
Monitoring WiFi access points - Archive of obsolete content
; } var c = document.getElementById("c"); c.innerHTML = "<p>" + count++ + "</p>"; }, onError: function (value) { alert("error: " +value); }, QueryInterface: function(iid) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (iid.equals(Components.interfaces.nsIWifiListener) || iid.equals(Components.interfaces.nsISup
ports)) return this; throw Components.results.NS_ERROR_NO_INTERFACE; }, } netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var listener = new test(); var wifi_service = Components.classes["@mozilla.org/wifi/monitor;1"].getService(Components.interfaces.nsIWifiMonitor); wifi_service.startWatching(listener); </script> </head> <body> <div id="d"...
Blackwood - Archive of obsolete content
The Blackwood project, started by engineers at Sun Microsystems, is an attempt to better integrate the Java platform with the Mozilla browser. Blackwood consists of a series of Java-based extensions to Mozilla. Blackwood's mission is to put Java sup
port in Mozilla on a par with JavaScript sup
port. Active Subprojects Webclient Java DOM API Java Pluglet API Defunct Subprojects BlackConnect -- Blackconnect was superseeded by JavaXPCOM ...
Bonsai - Archive of obsolete content
the various options on the main Bonsai Query page. If you're updating our cvs tree you'll need to learn about Hacking with Bonsai. Bonsai Source Code The source code to the Bonsai tool itself is also available, check out the information available at the Bonsai project page. Original Document Information Author(s): Jamie Zawinski Last Updated Date: September 8, 2004 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Bookmark Keywords - Archive of obsolete content
These searches can be as complex as Google will tolerate, since the entered data will be converted to URL-encoded text before it's sent to the Google servers. Thus we could type any of the following into the address bar and get back useful results: <tt>google geitost</tt> <tt>google Mozilla Keyword Bookmark</tt> <tt>google bookmark site:developer.netscape.com</tt> <tt>google netscape XML sup
port -site:netscape.com</tt> A Few Examples In the course of writing this article, a number of potentially useful bookmarks were considered as possible examples. Instead of just throwing them away, we're providing them for you in the following table. Even better, you can file them for future use by right-clicking (or holding down the control key and clicking on the link) and filing the bookmarks us...
Creating a Firefox sidebar extension - Archive of obsolete content
escription> </em:targetApplication> </Description> </RDF> The other manifest file is chrome.manifest, the chrome manifest file. The chrome manifest creates a lookup for all the resource types used by the extension. The manifest also tells Firefox that the extension has an overlay that needs to be merged into the browser. For more information on chrome manifests and the properties they sup
port, see the Chrome Manifest reference. The manifest used in this extension is listed in Example 6. Example 6. chrome.manifest content emptysidebar chrome/content/ locale emptysidebar en-US chrome/locale/ skin emptysidebar classic/1.0 chrome/skin/ overlay chrome://browser/content/browser.xul chrome://emptysidebar/content/firefoxOverlay.xul Test While you're developing your sidebar, you will ne...
Finding the file to modify - Archive of obsolete content
Language (and is pronounced like "Zool"), is an XML-based language specifically designed for describing application interfaces. It contains elements for all common UI widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees, browsers, color pickers). Each window and dialog box in Mozilla is defined by a single XUL file (in some cases other XUL files called overlays contribute
portions of another window's structure). To add a tinderbox status icon to Mozilla, we need to find the XUL file that defines the structure of the browser window. The best way to find a XUL file for a window is to use the DOM Inspector. The DOM Inspector is a tool bundled with Mozilla that allows you to examine the DOM of web pages and XUL windows. To access it, go to the "Tools" menu, select the "We...
Making it into a static overlay - Archive of obsolete content
rface. Static overlays are added to a XUL file via a reference at the top of the file (much like stylesheets and JavaScript scripts). Dynamic overlays are added to a XUL file via a reference in the chrome registry. Overlays provide a way to break up a large XUL file into several different files (one that describes the overall structure of an application window and the others to implement specific
portions of the window) to improve code readability, maintainability, and extensability. Dynamic overlays also make it possible to modify a XUL file without actually changing the code of the file itself, which is necessary when installing an extension like ours. We'll first make the file into a static overlay, then we'll make it into a dynamic overlay. To make the file into a static overlay, we need t...
Getting Started - Archive of obsolete content
skin skin simply contains another directory, classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\communicator communicator contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\editor editor contains files of Composer. skin\classic\global global contains almost all of the im
portant CSS files that define the appearance of the suite. This is the most critical directory in a theme. skin\classic\help help contains all the files for theming the help dialog window. skin\classic\messenger messenger contains styles of the mail client. skin\classic\messenger-newsblog messenger-newsblog contains the only CSS file. skin\classic\mozapps mozapps contains all the styles and icons for ...
Creating a Release Tag - Archive of obsolete content
rom to the new tag you are creating. mozilla/client.mk Check the build scripts back in to the mini-branch. cvs ci mozilla/client.mk Create the tag. find . -type d \! -name CVS | xargs -l -P10 cvs tag -l MOZILLA_0_9_4_1_RELEASE >& ../taglog Original Document Information Author(s): Dawn Endico Last Updated Date: November 1, 2005 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
ectory, classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\browser browser contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\communicator Doesn't do a whole lot and can typically be forgotten about promptly. skin\classic\global global contains almost all of the im
portant CSS files that define the appearance of the browser. This is the most critical directory in a theme. skin\classic\help help contains all the files for theming the help dialog window. skin\classic\mozapps mozapps contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard. Install Your New Theme Before you can see the changes you make to ...
Creating regular expressions for a microsummary generator - Archive of obsolete content
a sequence of characters) that matches patterns of characters in other strings. Microsummary generators use them to identify the pages that the generators know how to summarize by matching patterns in those pages' URLs. In this tutorial, we'll explain how to make regular expressions that match the URLs for eBay auction item pages. By the end of the tutorial, you should know some basics about regular expressions and understand how to create expressions that match URLs. For detailed documentation about regular expressions, see Core_JavaScript_1.5_Reference:Global_Objects:RegExp. ...
Dehydra Frequently Asked Questions - Archive of obsolete content
e Dehydra come from? Initially Dehydra was written as an easy way to look for patterns in Control Flow Graphs (CFGs). Images of those graphs reminded me of the multiheaded Hydra monster. Thus De-hydra can be thought of as a decapitating tool for slaying CFGs. Currently Dehydra does not provide the CFG functionality, this functionality is now provided by Treehydra. What is the status of GCC 4.5 sup
port? Development version of Dehydra should work with GCC 4.5 on any C++ codebase. If you encounter bugs or crashes, re
port them. Where does one re
port Dehydra bugs? Use this link to file bugs. For crashes re
ports attach a minimized input file. Use either a source files that rely on standard headers or a compressed .ii file (pass -save-temps to GCC to get .ii files). Where can I find JS code for real-...
Dehydra - Archive of obsolete content
analyses of C++ code. In the simplest sense, Dehydra could be thought of as a semantic grep tool. It presented a wealth of semantic information that can be queried with concise JavaScripts. It was also useful to find bugs in source code as it allows for much more error checking than C++ is capable of by itself. Dehydra was built as a GCC plugin, thus it is easy to use for projects that already sup
port GCC. Dehydra is also useful for generating language bindings and is used to bootstrap Treehydra, a heavy-duty static analysis GCC plugin. Documentation Installing Dehydra Download, installation and dependency info for Dehydra Using Dehydra Examples for getting started writing analysis scripts. Dehydra Function Reference Callback and utility fu...
External CVS snapshots in mozilla-central - Archive of obsolete content
pies of external software modules that it depends on. The following list of directories (incomplete) contain them. Those directories shall be considered read-only, changes shall be delivered to the upstream software projects. Eventually we'd like to have ACLs, but as of today there is no protection for accidental commits to those directories. Such changes will get overwritten without warning on im
porting the next updated version. NSPR nsprpub NSS dbm security/dbm security/coreconf security/nss Special procedures must be used to update these to newer snapshots of the upstream software projects. The procedure for NSPR and NSS is documented here. ...
Building Firefox with Rust code - Archive of obsolete content
s of all dependent crates are compatible. Cargo.lock files have also been checked in, so you will need to update those as well when appropriate. Crates for unit tests can be added in a similar fashion to the files in toolkit/library/gtest/rust/. If your crate has optional features that aren't normally turned on, you are strongly encouraged to remove dependencies for those features when im
porting code so the build system doesn't require that (unused) code to live in-tree. The build system will check that there's only one copy of a given crate in a build; this was a deliberate decision to try and avoid code bloat in libxul. If this turns out to be a serious problem in practice, we can look into ways of relaxing that check. If you need to locally patch a third-party crate, you'll ne...
Downloading Nightly or Trunk Builds - Archive of obsolete content
e doing is to constantly check that the current source can be built into an executable and that that executable passes a certain more-or-less fixed set of tests. nightly builds. The same machines produce about every 24 hours a "nightly" build which can be downloaded by anyone if you know where to get it: these are the nightly builds, and testers all over the world download them and test them, re
porting as they go along on any bugs that hit them. Anyone can be a tester, you don't need to get approval before you can start testing. When people talk of "nightlies", they often mean "trunk nightlies", though there exist also "branch nightlies" which are somewhat less buggy but also not as "newest & greatest". For instance, one may use a Thunderbird "branch nightly" as one's main e-mail client. No...
JSS build instructions for OSX 10.6 - Archive of obsolete content
didn't work to build on OSX 10.6.7. HOWTO successfully compile JSS and NSS for 32 and 64 bits on OSX 10.6 (10.6.7) USEFUL LINKS: https://developer.mozilla.org/en/NSS_reference/Building_and_installing_NSS/Build_instructions https://developer.mozilla.org/jss_build_4.3.html ftp://ftp.mozilla.org/pub/mozilla.org/ <componente> /releases http://www.mozilla.org/projects/secu...using_jss.html STEPS: Ex
port all this: BUILD_OPT="1" CVSROOT=":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" JAVA_HOME=$(/usr/libexec/java_home") NO_MDUPDATE="1" NSDISTMODE="copy" NS_USE_GCC="1" Create working dir: mkdir nss-jss cd nss-jss Obtain source: Altought manual said NSPR_4_6_4_RTM, NSS_3_11_4_RTM, JSS_4_2_5_RTM, they didnt work for OSX, giving many compiling errors. cvs login cvs co -r NSPR...
Using microformats - Archive of obsolete content
to know how to parse the document itself. Firefox 3 implements a global Microformats object that provides access to microformats. This object and its API make finding and reading microformats easy to do. Loading the microformats API The Microformats object is created using the new JavaScript script loader added to Firefox 3. To use the API, you need to first load the object: Components.utils.im
port("resource://gre/modules/Microformats.js"); Once you've loaded the microformats API, you can manage microformats using the methods listed here; for information about parsing microformats, see Parsing microformats in JavaScript. Predefined microformats Firefox 3 provides definitions implementing several common microformats: adr Represents an address (such as a street or mailing address). g...
slideBar - Archive of obsolete content
Note: This page documents the Jetpack Prototype, which is no longer under active development. Read the experiment re
port for what we learned from it and the blog post announcing the first SDK release for what we're up to next! slideBar is a reinvention of the old sidebar features of browsers. They allow quick access to a wide range of both temporary and permanent information at the side of your browser window. When a slideBar feature is selected its contents will be revealed from behind the current webpage. It currently under development and lives in the future. jetpack.future.im
port("slideBar"); Methods append(iconurihtmlhtml/xmlurluriwidthintpersistboolautoReloadboolonClickfunctiononSelectfunctiononReadyfunction)This is a list of options to specify modifications to your slideBar ins...
Mac OS X Build Prerequisites/fink - Archive of obsolete content
It doesn't seem to be as well maintained (in terms of available packages) as mac
ports, so it is strongly suggested that you use mac
ports instead of fink. You may download the most recent version of Fink that is compatible with your operating system release. Fink installs in /sw by default. The installer should configure the Fink environment for you, making it available in any new Terminal window. If you perform a major operating system upgrade on your computer, such as an upgrade from Tiger to Leopard, you should remove the /sw directory and re-install Fink and the packages below. libIDL, GLib Using Fink. ...
Measuring add-on startup performance - Archive of obsolete content
Using about:startup The About Startup add-on provides a much simpler way to measure startup performance. Once installed, it will gather startup data and display it in the about:startup page. The add-on is very lightweight, so it shouldn't have a noticeable negative effect on your baseline and add-on tests. To test with about:startup, you should set up a new Firefox profile, install this add-on, and then open and quit Firefox repeatedly. If you want to match Talos, you should do this 20 times. Then look at the results in the about:startup page. This should provide your baseline numbers. Then repeat the process with both About Startup and your add-on installed. ...
Message Summary Database - Archive of obsolete content
e in a thread, which message a message is in reply to, etc. This allows us to store watch/ignore information on a thread object, and avoids having to generate threading information whenever a folder is open. This has arguably been more trouble than it's been worth, especially when we've threaded incorrectly. Meta Information The nsIDBFolderInfo interface handles the folder meta data. This also sup
ports generic properties. There is a method on nsIMsgDatabase to get the dbFolderInfo. Mork - the Good, the Bad, and the Ugly Mork has a horrible reputation and we're always asked why we don't just replace it with some other db. The bottom line is that we haven't been able to justify the very large cost of doing so because there won't be any benefit to the end-user, at least in the short term. Here a...
Microsummary XML grammar reference - Archive of obsolete content
A microsummary generator is an XML document that describes how to pull specific information from a web page to be presented in summary form as a bookmark whose title changes based on the content of the page it targets. Warning: Microsummary sup
port was removed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) This article provides detailed information about the XML grammar used to build microsummary generators, describing each element and their attributes. For an introduction to how to create a microsummary, read the article Creating a Microsummary. Example The microsummary generator created in the Creating a Microsummary tutorial: <?xml version="1.0" encoding="UTF-8"?> <generator xmlns="http://www.mozilla.org/microsummaries/0.1" name="Firefox Download Count"> <template...
Microsummary topics - Archive of obsolete content
Warning: Microsummary sup
port was removed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Programmatically installing a microsummary generator To programmatically install a microsummary generator -- for example, in an extension that helps users create custom generators for their favorite sites -- obtain a reference to the nsIMicrosummaryService interface implemented by the nsIMicrosummaryService component, then call its installGenerator() method, passing it an XML document containing the generator. For example, the following code snippet installs the microsummary generator from the Creating a Microsummary tutorial: var generatorText = ' \ <?xml version="1.0" encoding="UTF-8"?> \ <generator xmlns="http://www.mozilla.org/microsummaries/0.1" \ name="Firefox D...
Plug-n-Hack Get Involved - Archive of obsolete content
While this project has been started by the Mozilla Security Team and has been validated with Firefox and OWASP ZAP, this is an open project and we welcome involvement from anyone, especially people working on other browsers and security tools. If you would like to add PnH sup
port to a browser or tool, or even get involved in onward PnH development, then please get in touch and we will give you whatever assistance we can. To contribute or keep up to date with Plug-n-Hack changes please joion the Mozilla Plug-n-Hack Google Group. You can also talk to the Mozilla Security Team about this project on the #websectools irc channel. Related links Plug-n-Hack Overview ...
BlogPosts - Archive of obsolete content
Just Browsing: Mozilla Prism Update ThansCorner: Mozilla Prism - Webrunner with Pazzaz Mozilla Prism - A Revolution in Web Apps ThansCorner: Mozilla WebRunner 0.7 Site Specific Browsers WebRunner Using WebRunner WebRunner + Gears = Offline Desktop Reader WebRunner 0.5 WebRunner 0.5 - Mac Sup
port WebRunner 0.5 - Linux Install WebRunner, Google Reader, and Google Notebook Distraction Free GTD - 32+ web app files for online todo lists Mozilla WebRunner: a one-window, tabless browser with no URL bar WebRunner becomes Prism - A Mozilla Labs Project Mozilla Labs: Prism Alex Faaborg: Prism Mozilla Prism: Bringing Web Apps to the Desktop Everyone should use Site Specific Browsers Mozilla Prism
Portable (Spanish) Prism, l'avenir des applications Web selon Mozilla (French) Mozilla Prism : bundle...
Build - Archive of obsolete content
mk build Once the build is done, there will be a directory called mozilla-obj. Go into the prism/ directory and create a .mozconfig file mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/mozilla-obj/prism ac_add_options --with-libxul-sdk=../dist ac_add_options --enable-application=prism You need to define an environment variable to point the build to the new .mozconfig. This variable is called MOZCONFIG ex
port MOZCONFIG=$PWD/.mozconfig #this should point to mozilla/prism/.mozconfig Go back to the mozilla/ directory and do another build, this time, prism will get built cd ../ make -f client.mk build Congratulations, you have just built prism. You can now find the executable in mozilla-obj/prism/dist/bin/prism. If you want to create a package, go to mozilla-obj/prism and call make package You will fin...
Configuration - Archive of obsolete content
tring. Separate multiple uris with commas: *google.com, *yahoo.com exclude urls that should be opened in the default browser, rather than in the web app. Syntax is the same as for include. trayicon Indicates that a system tray (notification area) icon should be displayed for the application on Windows: yes or no. iconic Specifies that the application should be opened in iconic state. Currently sup
port only on Windows in conjunction with the trayicon, causes the application to open minimized to the system tray: yes or no. Launch Prism with -webapp [bundle] to load the specified web profile and install the webapp to your Prism profile folder. Once the webapp is installed, it can be launched using -webapp [webapp-id] and Prism will skip the installation and run the webapp directly. Any of the pr...
HostWindow - Archive of obsolete content
bar - Section of window area used to display ancillary web content, including web applications. When the sidebar is displayed, the splitter can be used to change the width or quickly collapse it. The splitter itself cannot be hidden as it is the only UI to show a collapsed sidebar. When not displayed the entire sidebar area, including the splitter are hidden. Note: The sidebar is currently not sup
ported. We are considering whether to sup
port a sidebar in future versions of Prism and welcome input on this subject. Status - Area of the statusbar that displays the loading status message and a "percent complete" progress bar, as well as the "gear" menu that provides access to Prism commands such as displaying the error console. To display the status bar, the statusbar option in webapp.ini must be ...
Styling - Archive of obsolete content
lication's native styles. Simply add the webapp.css to the bundle and it will be injected into the web application, regardless of the platform or OS. It is also possible to create platform-specific styles. In this scenario, the CSS file is specific to an OS. This allows Prism webapps to take on an OS-specific look. To use platform-specific styles, create a folder in the bundle archive for each sup
ported OS and place a webapp.css file in the folder. The folder names MUST match the following: Windows - winnt Mac OS X - darwin Linux - linux The folder names are pulled from Mozilla and are the same as those used in other Mozilla projects, such as extension and XUL applications. NOTE: you can also include a root level webapp.css which will be used if a platform-specific version is not found. ...
Hacking wiki - Archive of obsolete content
To be able to hack the MDC wiki software, you'll need a local webserver install, which can run MediaWiki. Checking out First, check out the <tt>developer.mozilla.org</tt> project from SVN. For anonymous access use: svn co http://svn.mozilla.org/projects/deve...lla.org/trunk/ To see the skins properly, you'll need to also check out <tt>mozilla-org/css</tt> to get the CSS files needed: ex
port CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/www cvs login cvs co mozilla-org/css (when prompted to enter a password, type <tt>anonymous</tt>) Setting up Copy the contents of the <tt>trunk</tt> folder and the <tt>css</tt> folder (Note: the folder itself) into the <tt>www</tt> directory on your server. The contents of the <tt>trunk</tt> directory you just checked out is a slightly modifi...
New Skin Notes - Archive of obsolete content
minor-nit. --Callek I couldn't find a quick "logout" link accessible from everywhere. --mmondor 12:25, 26 Aug 2005 (PDT) What pages can you not find a logout link from, I see it on nearly all devMo wiki pages in the "upper right: along with "My Talk" "Preferences" etc. Oh, I went back to login page, logged in and then from there went to the /tes...
PyDOM - Archive of obsolete content
ou to use Python code (almost) anywhere you can use JavaScript. Globals and namespaces This is taken from a mail to the pyxpcom list - it should be expanded, but a copy-paste will do for now Normal module semantics don't exist here. The globals are 'bound' to the global object (i.e., the window), instead of to a module's __dict__ as you expect in the Python world. Note that we don't actually 'im
port' anything here - the scripts and event handlers do not exist in a Python module. The intent is to provide similar semantics to JS. For example, when a top-level window has something like: <window ... script="foo = 1" ... An event handler like: <button onclick="print foo"/> Should be able to reference 'foo' via globals as shown. Note that you can stick arbitrary values on any DOM object - thi...
Remote XUL - Archive of obsolete content
This also means you can't load XUL using file:// URLs unless you set the preference dom.allow_XUL_XBL_for_file to true. However, there is a whitelist that lets you specify sites that can still use remote XUL. ...
Remote debugging - Archive of obsolete content
being wasted: the crash is a real bug in Firefox. (That is, there's a legitimate reason it happens only on some computers, but that reason just hasn't been discovered.) The crash victim, in turn, trusts the developer with full access to his computer. A good place to start is a detailed stack (in gdb, use bt followed by bt full). There give more information about the stack than a Breakpad crash re
port: not only the names of the functions on the stack, but also the values they were passed. Core dump A core dump includes all of the memory of a crashed program. It allows you to see the crash in a debugger even after the program has long exited. Transferring a core dump is tricky, because it is large and can contain private information. Core dumps on Mac and Linux To generate a core dump on Mac, t...
Rsyncing the CVS Repository - Archive of obsolete content
Here's how to do it: rsync -az --delete --stats cvs-mirror.mozilla.org::mozilla ~/cvs-mirror This will mirror the CVS repository into ~/cvs-mirror. Optionally, the --progress option will show the progress for each file, and a percentage of the total files that are transferred. At the time of this writing, this will take 2.8 GB of disk space. ...
Safely loading URIs - Archive of obsolete content
d on the nsIScriptSecurityManager interface and are called checkLoadURI, checkLoadURIWithPrincipal, and checkLoadURIStr. All three methods take three arguments: the first argument identifies the source of the URI, the second argument is the URI that one plans to load, and the third argument is a set of flags that can be used to impose additional restrictions on the URIs that may be loaded. It's im
portant to make sure that the first argument to these methods identifies the source of the URI. So if you're implementing a context menu and you add a "View Image" option, the source of the image URI would be the page the image is in, not the chrome document the context menu code is in. Differences between the methods The three methods differ from each other in how the source of the URI is identifie...
Space Manager High Level Design - Archive of obsolete content
elements that flow around the floated bits. The Space Manager works in concert with several other classes to do its job. The classes that are considered part of the Space Manager are: nsSpaceManager nsBandData nsBlockBandData BandRect / BandList (private structs) FrameInfo (private struct) nsBandtrapezoid Outside of the Space Manager itself, the clients of the Space Manager also play an im
portant part in the management of he available and used space. The primary classes that interact with the Space Manager are: nsBlockReflowState nsBlockFrame nsBoxToBlockAdaptor The general interaction model is to create a Space Manager for a block frame in the context of a Reflow, and to associate it with the BlockReflowState so it is passed down to child frames' reflow methods. After reflow, the...
Standalone XPCOM - Archive of obsolete content
1.0 Optional exclusion of specific features into standalone XPCOM like registry, xpconnect. Tweeking these options will cause reduction in memory requirements and size. Get xpcom/tests directory upto date and documented. Update this document for Mac. API freeze and documentation Original Document Information Author: Suresh Duddi Last Updated Date: 15 May 2000 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Table Cellmap - Archive of obsolete content
nsCellMap::RowIsSpannedInto Users of nsCellmap::GetDataAt outside nsCellMap.cpp The border collapse code relies on the cellmap. The collapsing of rows and columns uses the cellmap. and finally the line iterator methods which are used for arrow navigation through a table. Original Document Information Author(s): Bernd Mielke Last Updated Date: September 27, 2003 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Abc Assembler Tests - Archive of obsolete content
zilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is [Open Source Virtual Machine.]. * * The Initial Developer of the Original Code is * Adobe System Incorporated. *
Portions created by the Initial Developer are Copyright (C) 2009 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adobe AS3 Team * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the...
Tamarin Acceptance Test Template - Archive of obsolete content
zilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is [Open Source Virtual Machine.]. * * The Initial Developer of the Original Code is * Adobe System Incorporated. *
Portions created by the Initial Developer are Copyright (C) 2005-2010 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adobe AS3 Team * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which cas...
Actionscript Performance Tests - Archive of obsolete content
splayed in [], faster time is displayed in the output column, and the 95% confidence interval is calculated. The 95% confidence interval is the calculated percentage of the mean value to fall within 95% of the measured results. For example if the mean is 100 and the 95% confidence interval is 2%, 95% of the expected values should fall between 98 and 102. To compare two vms against each other ex
port AVM2=<path to 2nd vm> or use --avm2=<path to 2nd vm>. The percentage difference is calculated between the two vms. See the --help usage for more details about performance tests. # to run a group of tests (e.g. sunspider) $ ./runtests.py sunspider/*.as sunspider/as3/*.as test avm metric sunspider/access-binary-trees.as 584 ...
Tamarin Build System Documentation - Archive of obsolete content
ld yellow box at the bottom of a set of buildsteps to see the result of all of the buildsteps for a build and the time each buildstep took scroll down to see previous builds triggered at the bottom of the page click on the [next page] link to display more previous builds What are the goals of the build system (QOS)? to provide quick and accurate results of building and testing tamarin on sup
ported platforms and configurations to represent the build results in a clear and concise manor Please give use feedback if you have any comments or suggestions to improve the build system How to add tests to the smokes? The list of smoke tests are located in the tamarin-repository, test/run-smokes.txt, assume the start directory is test format is cd testdir; command to run test above the test shou...
Tamarin-central rev 703:2cee46be9ce0 - Archive of obsolete content
Tamarin-Central rev 703:2cee46be9ce0 was declared stable on 12/02/08. The announcement sent to tamarin-devel can be read here. Testing Summary Acceptance tests have passed on the following sup
ported platforms: * Windows, 32 & 64 bit * Mac OX X PPC & Intel, 32 bit * Linux, 32 bit * Windows Mobile ARM Version ASC-4200 of the ActionScript Compiler was used for all tests. Performance Testsuite TIME metric The following is a comparison of the current tamarin-central (tc-703) versus the prior build (tc-700) as well as current against the vm in Flash Player 10. The key takeaway is that the interpreter is much improved. OSdefault-jitinterpretedAggressive jit mac (OS/X 10.4 in...
Tamarin Roadmap - Archive of obsolete content
ions are welcome and encouraged via the tamarin-devel mailing list. TC Jan '09 Feature Links Status Integrate the TT String class Tamarin:String implementation Tamarin:Strings bug 465506 Complete Enhanced C++ profiler Enhance memory profiler to work in Release builds and be more performant In Progress Enable LIR for ARM targets bug 460764 Complete AMD64 NanoJit bug 464476 In Progress
Port NanoJit to PowerPC bug 458077 Complete Add mac-x64 and linux-x64 buildbots Complete fail build on assertion in acceptance tests Complete Merge tracking bug bug 469836 In Progress TC Feb '09 Spring backlog tbd. ...
Tamarin - Archive of obsolete content
SpiderMonkey, which is Mozilla's JavaScript engine in Firefox. Tamarin is available under the MPL/GPL/LGPL tri-license. Releases Release Tracking Information on current, past, and upcoming releases of Tamarin. Documentation Adobe ActionScript Virtual Machine 2 (AVM2) Overview (PDF, 400K) The instructions, architecture, and file format sup
ported by the AVM2. See also the possible errata. Tamarin Build Documentation How to get, build, and use Tamarin. Tamarin Build System Documentation Documentation on how the Tamarin build system works and how to modify. Tamarin commit hook Instructions for installing and using the mercurial hook for Tamarin. Tamarin Acceptance Testing Instructi...
The life of an HTML HTTP request - Archive of obsolete content
ences to the presentation context and a rendering context to do the drawing on. The rendering context implementation is a native class (nsGtkRenderingContext on unix) that knows how to draw in a window. TODO: Views, ViewManager, EventStateManager? Diagram created with DIA. Original Document Information Author(s): Alexander Larsson Last Updated Date: October 8, 1999 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Treehydra Manual - Archive of obsolete content
ESP Abstract Interpretation Library Treehydra includes a library for creating abstract interpretation analyses based on ESP. Users only need to define their ESP property variables, abstract values, and the flow semantics of GIMPLE statements, and the library will do all of the substate tracking and fixed-poin...
URIScheme - Archive of obsolete content
moz-icon://.ext?size=32 : you can replace ext by your some file extension like js, css, xul, xml, etc. and the size number by 1 to 127 mailto:emailaddress@domain.com about: chrome:// ... Preferences See gecko.handlerService.schemes.* Scripting Interface See nsIProtocolHandler to create a new protocol/scheme. about: about: about:config about:crashes about:mozilla about:plugins about:robots ... ...
[Deprecated] The Mozilla build VM - Archive of obsolete content
Thanks to significant improvements in our build environment setup process, it's much simpler and easier to get set up and stay up to date by starting with Building Firefox instead. Other links of interest may include: Developer guide (documentation about developing on and for Mozilla projects). Mentored bugs have a mentor who commits to helping you every step of the way. Generally, there should be enough information in the bug to get started. Whenever you need help, contact the mentor via Matrix, in the bug itself, or by email. When you've completed the bug, they will help you get your code into the tree. ...
Venkman Internals - Archive of obsolete content
"script"); then extract the URLs from the src attributes. ScriptWrapper newsgroup, 2002, rgrinda Here is a bit more information about how Venkman tracks files and functions... A scriptWrapper is a pure JS object defined only inside Venkman. As you pointed out, there is a 1:1 relationship between scriptWrappers and functions. scriptWrapper has-a jsdScript property, which is an object which sup
ports the jsdIScript interface. jsdIScript is a lower level access to the function than the scriptWrapper. In order to set a breakpoint in a particular function, you'll want to call scriptWrapper.setBreakpoint(pc[, parentBP]); where |pc| is the program counter location to set the breakpoint, and |parentBP| is an optional "future breakpoint" object to use as the parent for this breakpoint. If you set t...
Using Breakpoints in Venkman - Archive of obsolete content
ear in the Loaded Scripts list.) Venkman also indicates that one or more breakpoints have been set in the Loaded Scripts View, where red dots appear next to the files in which breakpoints have been set, along with the line number where the function begins whose code is being stopped. Using Breakpoints to Debug When you set a breakpoint, you give Venkman (or whatever debugger you're using) the op
portunity to display information about the execution environment. One of the most im
portant aspects of debugging a script or software program is the ability to examine variables--function return values, errors, counters, variable scopes--as they change over the course of the script execution. The onFlipX function in Figure 1, for example, uses the variable newSign to figure out what image to use for t...
Video presentations - Archive of obsolete content
the Mozilla project, including building, testing, and debugging. How the Build Works (Part 1, Part 2, Part 2; second camera, slides) This presentation covers how the Mozilla build system works, how to configure the build system, and how to build Mozilla projects. (as QuickTime; 127 MB, 50 MB, and 68 MB) The Life Cycle of a Bug (Part 1, Part 2) Mike Connor describes how a bug goes from bug re
port to patch to implemented fix. Learn how to properly file a good bug re
port, how the bug re
ports are handled, and how to submit and get reviews for patches. (as QuickTime; 122 MB and 110 MB) Release Builds - From Source Tree to EXE (Part 1, Part 2) Learn how release builds of Firefox are created. (as QuickTime; 105 MB and 34 MB) Other Videos (might be obsolete) Mozilla Video Presentations (2...
Mozilla Web Developer Community - Archive of obsolete content
are at http://devedge-temp.mozilla.org/community/news/ Feeds Recent Changes RSS Feed Warning: This feed is updated very often. Mozilla Developer News Feed Actually, there are no other feeds available for developer.mozilla.org. Looking for feed ideas? The list of old DevEdge feeds is at http://devedge-temp.mozilla.org/comm.../feedlist.html Feedback Hendrix MDNProduct Feedback Bugzilla - Re
port a bug in a Mozilla product For questions related to this website (but not technical questions), please send your message to the MDC mailing list. ...
When To Use ifdefs - Archive of obsolete content
s/shistory/) is a hodgepodge mess of "toolkit" and "application-specific" code. This code is all going to be moved elsewhere (most of it to toolkit/ or suite/), but for the time being most application-specific ifdefs are allowed because we can't help it. If you're not sure, ask Benjamin Smedberg. For an example of an application-specific ifdef that is bad and should be removed, see nsNativeAppSup
portWin.cpp. Types of ifdef There are two major types of ifdef: preprocessor ifdefs and makefile ifdefs. Preprocessor ifdefs are generally easy to spot: in C, C++, and plaintext preprocessed code there will be an #ifdef or #if instruction. Makefile ifdefs, however, are sometimes harder to spot and can cause hidden issues that are much more serious. Makefile ifdefs are used to build or not-build cer...
Binding Implementations - Archive of obsolete content
roperty is requested. A setter contains a script that is invoked when a new value is assigned to the property. In script, the word val is used to represent the new value. Properties can be designated as constant using the readonly attribute. When set to true, the property's value cannot be altered. If a property is readonly and a setter is defined, then the setter is ignored. Properties also sup
port a shorthand syntax for defining getters and setters that forward requests or assignments to an anonymous content element. The element attribute specifies the ID of anonymous content underneath the bound element that should be used when obtained the property or setting the property. On the anonymous content element, the property can be obtained either from an attribute on the element or from a pr...
Example Sticky Notes - Archive of obsolete content
master/gatekeeper/there.is.only.xul" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- In above only XBL namespace declaration is mandatory. The others are only needed if you plan to handle XUL (XML User Interface Language) or/and SVG (Scalable Vector Graphics) in your bindings; xlink in XML also may come useful sometimes. All namespaces above are sup
ported by default and they do not require any additional downloads or initializations. --> <binding id="default"> <!-- A separate binding. You add a binding file using -moz-binding style rule and you address a particular binding by its ID: -moz-binding: url(notes.xml#default) This ID is local within the binding file (not visible in the target document DOM tree). --> <resources> <!-- Obt...
deleteRegisteredFile - Archive of obsolete content
Method of Install object Syntax int deleteRegisteredFile (String registryName); Parameters The deleteRegisteredFile method has the following parameter: registryName The pathname in the Client Version Registry for the file that is to be deleted. Returns An integer error code. For a list of possible values, see Return Codes. Description The deleteRegisteredFile method deletes the specified file and removes the file's entry from the Client Version Registry. ...
textbox.type - Archive of obsolete content
For more information about autocomplete textboxes, see the autocomplete documentation (XPFE [Thunderbird/SeaMonkey]) (Firefox) number A textbox that only allows the user to enter numbers. ...
Dynamically modifying XUL-based user interface - Archive of obsolete content
ulated through DOM APIs. A logical structure of every document is a tree, with nodes being elements, attributes, processing instructions, comments, etc. Use the DOM Inspector tool to see the tree representation of any document. Todo: simple example of a XUL document and a tree You can think of a document as an in-memory representation of valid HTML or well-formed XML such as XHTML or XUL. It is im
portant to remember that different web pages (and even different instances of the same web page) correspond to different documents. Each XUL window has its own distinct document, and there may even be a few different documents in a single window, when there is an <iframe>, <browser>, or a <tabbrowser> element. You must be sure to always manipulate the correct document. (Read more about this in Working...
Working With Directories - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. A reference to a directory may be created in the same wa...
IO - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. Files and Streams This section describes how to access a...
TOC - Archive of obsolete content
File and Stream Guide: [ nsIScriptableIO | Accessing Files | Getting File Information | Reading from Files | Writing to Files | Moving, Copying and Deleting Files | Uploading and Downloading Files | Working With Directories ] Im
portant note: The pages from the File and Stream Guide use the IO object (nsIScriptableIO), which was not available in any released version of the platform (pending some fixes). There are alternative XPCOM APIs you can use, your help in updating this pages to use the sup
ported API is very much welcome! Other documentation on files and I/O not using the unavailable nsIScriptableIO APIs: Code snippets: File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. ...
findbar - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData close() Return type: no return value Closes the notification or findbar and removes it from its e...
International characters in XUL JavaScript - Archive of obsolete content
This means that such script files can use any character from virtually any language of the world. For example, they can contain a line: var text = "Ein schones Beispiel eines mehrsprachigen Textes: ???"; This mixes German and Japanese characters. Earlier versions always interpreted JS files loaded from XUL as ISO-8859-1 (Latin-1), in both local and remote cases. Unicode escapes, as discussed below, have always worked. ...
List of commands - Archive of obsolete content
ser:AddBookmarkAs Browser:AddGroupmarkAs Browser:Back Browser:EditPage Browser:Find Browser:FindAgain Browser:FindPrev Browser:Forward Browser:Home Browser:ManageBookmark Browser:Open Browser:OpenFile Browser:Print Browser:PrintPreview Browser:SavePage Browser:SearchInternet Browser:SendPage Browser:UploadFile cmd_bm_copy cmd_bm_cut cmd_bm_delete cmd_bm_expandfolder cmd_bm_ex
port cmd_bm_find cmd_bm_im
port cmd_bm_managefolder cmd_bm_movebookmark cmd_bm_newbookmark cmd_bm_newfolder cmd_bm_newseparator cmd_bm_open cmd_bm_openinnewtab cmd_bm_openinnewwindow cmd_bm_paste cmd_bm_properties cmd_bm_rename cmd_bm_selectAll cmd_bm_setnewbookmarkfolder cmd_bm_setnewsearchfolder cmd_bm_setpersonaltoolbarfolder cmd_bm_sortfolder cmd_bm_sortfolderbyname cmd_close c...
openPopup - Archive of obsolete content
d_before, end_after, overlap, and after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values. x, y For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the view
port of the document containing the popup node. In this case, the position and attributesOverride arguments are ignored. isContextMenu The isContextMenu argument should be true for context menus and false for all other types of popups. It affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesO...
setSelectionRange - Archive of obsolete content
<< XUL Reference home setSelectionRange( start, end ) Return type: no return value Sets the selected
portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
Methods - Archive of obsolete content
t.getAttributeNodeNS DOM:element.getAttributeNS DOM:element.getElementsByTagName DOM:element.getElementsByTagNameNS DOM:element.getFeature FIXME: brokenLink DOM:element.getUserData DOM:element.hasAttribute DOM:element.hasAttributeNS DOM:element.hasAttributes DOM:element.hasChildNodes DOM:element.insertBefore DOM:element.isEqualNode DOM:element.isSameNode DOM:element.isSup
ported DOM:element.lookupNamespaceURI DOM:element.lookupPrefix DOM:element.normalize DOM:element.removeAttribute DOM:element.removeAttributeNode DOM:element.removeAttributeNS DOM:element.removeChild DOM:element.removeEventListener DOM:element.replaceChild DOM:element.setAttribute DOM:element.setAttributeNode DOM:element.setAttributeNodeNS DOM:element.setAttributeNS DOM:elem...
Namespaces - Archive of obsolete content
nt and attribute names can occur when an XML document contains elements and attributes from two or more different XML schemas (or DTDs). To quote Wikipedia: "In general, a namespace is an abstract container providing context for the items ... it holds and allows disambiguation of items having the same name." If you are familiar with C++ namespaces, Java packages, perl packages, or Python module im
porting, you are already familiar with the namespace concept. An XML namespace is identified by an unique name (called a URI, not a URL, even though it can look like a URL). An URI is any string, although most people choose a URL-based URI because URLs are an easy way to hope for uniqueness. Although there's nothing preventing someone else from using the namespace http://www.mozilla.org/keymaster/gate...
Node - Archive of obsolete content
CE_NODE 5 short ENTITY_NODE 6 short PROCESSING_INSTRUCTION_NODE 7 short COMMENT_NODE 8 short DOCUMENT_NODE 9 short DOCUMENT_TYPE_NODE 10 short DOCUMENT_FRAGMENT_NODE 11 short NOTATION_NODE 12 Methods Node appendChild ( Node newChild ) Node cloneNode ( boolean deep ) boolean hasAttributes ( ) boolean hasChildNodes ( ) Node insertBefore ( Node newChild , Node refChild ) boolean isSup
ported ( String feature , String version ) void normalize ( ) Node removeChild ( Node oldChild ) Node replaceChild ( Node newChild , Node oldChild ) ...
Floating Panels - Archive of obsolete content
tohide="true" titlebar="normal"> <label control="name" value="Name:"/> <textbox id="name"/> </panel> The noautohide attribute is used to indicate that the panel is not temporary. When set to true, the popup will not close when the user clicks outside of it, nor when the user presses the Escape key. The titlebar attribute creates a panel with a titlebar. Currently, only the value normal is sup
ported, which creates a default titlebar. In the future, a distinction will be available to sup
port titlebars of differing styles. The floating panel can be placed and moved independently of the main window, however it will always appear above the main window. On Mac, floating panels are invisible when another application is made active, and become visible again when the XUL application is made active...
Using Recursive Templates - Archive of obsolete content
<< PreviousNext >> You may recall that templates generate content recursively. After the data is generated, each result is used as the new reference point for a nested iteration of the template. This is usually used to generate content in a tree or menu. Both the RDF and XML datasource types sup
port recursion. For example, using this XML datasource: <people> <group name="Male"> <person name="Napoleon Bonaparte"/> <person name="Julius Caesar"/> <person name="Ferdinand Magellan"/> </group> <group name="Female"> <person name="Cleopatra"/> <person name="Laura Secord"/> </group> </people> We could display this data in a flat list by using the right query: <query expr="group/person/"> Or, we could display one level for the two groups, and use another leve...
Things I've tried to do with XUL - Archive of obsolete content
ible rect of an element. HTML elements have the non-standard clientWidth/clientHeight properties (see http://www.mozilla.org/docs/dom/domr...entHeight.html); no equivalent exists for XUL. Enn: most people would use the box object width and height properties, or do you want something else? Vlad: the boxObject width/height are the actual width and height of the box, regardless of the actual visible
portion of the box (clipped by the window borders, for example). This is assuming no scrolling is going on. Resize event problems Going with the inability to obtain the clientWidth/clientHeight of XUL elements, it's impossible to handle the "resize" event yourself to grow/shrink content as needed -- as you grow the content, when you shrink the window, the content will simply be clipped (because now...
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
the overlay file and the Customize Toolbar window. To attach it to the overlay, put this processing instruction (PI) at the top of the overlay file: <?xml-stylesheet href="chrome://myextension/skin/toolbar-button.css" type="text/css"?> Note: The CSS file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file. This is very im
portant because the toolbar customization dialog won't work correctly without this. To include the style on your chrome.manifest file: style chrome://global/content/customizeToolbar.xul chrome://myextension/skin/toolbar-button.css If you are developing for Firefox 1.0, attach it to the Customize Toolbar window (chrome://global/content/customizeToolbar.xul) using skin/contents.rdf. The code looks l...
Accesskey display rules - Archive of obsolete content
menuitems.insertseparatorbeforeaccesskeys" pref value. If the value is "true" (string), a spece will be inserted before accesskey text. Don't change the pref value from your XUL applications too. Don't include accesskey text in labels XUL applications should use DTD for localizable UI resource. At that time, accesskeys are specified by independent entity from their label. Be aware, this is very im
portant thing. When you cannot use DTD, e.g., when you need to generate some UIs dynamically, you can use .properties file or something. Then, you should provide a way for specifying accesskeys which are independent from their labels. Note that using '&' in label text is bad way. Because Japanese localizers "&Cancel" need to localize to "?????(&C)". This label will be displayed as "?????(C)(C)" on th...
Adding Buttons - Archive of obsolete content
led. You can switch the disabled state of the button using JavaScript. accesskey This should be set to a letter that is used as a shortcut key. This letter should appear in the label text and will typically be drawn underlined. When the user presses ALT (or a similar key that varies on each platform) and the access key, the button will be focused from anywhere in the window. Note: Buttons sup
port more attributes than those listed above. Others will be discussed later. Some examples of buttons Example 1 : Source View <button label="Normal"/> <button label="Disabled" disabled="true"/> The examples above will generate the buttons in the image. The first button is a normal button. The second button is disabled so it appears greyed out. We'll start by creating a simple Find button for ...
Adding Event Handlers - Archive of obsolete content
nt where the event actually occured. In the example we display an alert containing the target's tag name. The target is useful when using a bubbling event so that you could have a set of buttons which are all handled by a single script. You might notice that the attribute syntax is similar to that used for events in HTML documents. In fact, both HTML and XUL share the same event mechanism. One im
portant difference is that while the 'click' event (or the onclick attribute) is used in HTML to respond to buttons, in XUL the command event should be used instead. XUL does have a click event, but it only responds to mouse clicks, not to keyboard usage. Thus, the click event should be avoided in XUL, unless you have a reason to have an element that can only be handled with a mouse. In addition, wher...
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
it is simply passed to the inner content as usual. The general handler syntax is as follows: <binding id="binding-name"> <handlers> <handler event="event-name" action="script"/> </handlers> </binding> Place all of your handlers within the handlers element. Each handler element defines the action taken for a particular event specified by its event attribute. Valid event types are those sup
ported by XUL and JavaScript, such as click and focus. Use the event name without the 'on' in front of it. A common reason to set handlers is to modify the custom properties when an event occurs. For example, a custom checkbox might have a checked property which needs to be changed when the user clicks the checkbox: <handlers> <handler event="mouseup" action="this.checked=!this.checked"/> </handlers...
Adding HTML Elements - Archive of obsolete content
<html:input id="rtd" type="checkbox"/> <html:label for="rtd">Remember This Decision</html:label> </html:p> </html:p> In this case, one p tag was used to place the text in and another was used to break apart the text into multiple lines. Text outside of HTML blocks Example 3 : Source View <html:div> Would you like to save the following documents? <html:hr/> </html:div> Expense Re
port 1 What I Did Last Summer <button id="yes" label="Yes"/> <button id="no" label="No"/> As can be seen in the image, the text inside the div tag was displayed but the other text (Expense Re
port 1 and What I Did Last Summer) was not. This is because there is no HTML or XUL element capable of displaying text enclosing it. To have this text appear, you would need to put it inside the div tag, or enclo...
Adding Methods to XBL-defined Elements - Archive of obsolete content
ox element with the id of outer, you willl find that it has has 4 children. These correspond to its four buttons, even though those buttons are drawn inside the stack. The stack has only one child, the children element itself. The length of the anonymous array of the outer box is two, the first element the description element and the second the stack element. Constructors and Destructors XBL sup
ports two special methods created with separate tags, constructor and destructor. A constructor is called whenever the binding is attached to an element. It is used to initialize the content such as loading preferences or setting the default values of fields. The destructor is called when a binding is removed from an element. This might be used to save information. There are two points when a binding...
Anonymous Content - Archive of obsolete content
mage src="images/happy.jpg"/> <xul:image src="images/angry.jpg"/> </xul:box> <xul:button label="Zoom Out"/> </xul:box> </content> </binding> From the DOM's perspective, the child elements are still in their original location. That is, the outer XUL box has two children, which are the two images. The inner box with the border has one child, the children tag. This is an im
portant distinction when using the DOM with XBL. This also applies to CSS selector rules. Multiple Children Elements You can also use multiple children elements and have certain elements be placed in one location and other elements placed in another. By adding a includes attribute and setting it to a vertical bar-separated list of tags, you can make only elements in that list be placed at that locatio...
Broadcasters and Observers - Archive of obsolete content
all of the places where a Back action could be. If someone added a new Back button using an extension, it wouldn't be handled. It is convenient to simply disable the Back action and have all the elements that issue the Back action disable themselves. We can use the attribute forwarding of commands to accomplish this. Broadcasters There is a similar element called a broadcaster. Broadcasters sup
port attribute forwarding in the same way that commands do. They work the same as commands except that a command is used for actions, while a broadcaster is instead used for holding state information. For example, a command would be used for an action such as Back, Cut or Delete. A broadcaster would be used to hold, for instance, a flag to indicate whether the user was online or not. In the former cas...
Content Panels - Archive of obsolete content
d so forth with a tabbrowser forming the main area. This inner area displays a web page, but the web page cannot access the XUL around it. This is because it uses the second type of browser, specified by setting the type attribute to the value content. This prevents the content from traversing up to the XUL window. An example: <browser src="http://www.mozilla.org" type="content" flex="1" /> Im
portant: You must set the type attribute correctly if you are going to be displaying remote web sites inside the browser element. The tabbrowser sets the content type automatically on all tabbed browsers that it creates. So you don't have to set this explicitly for tabbed browsers. The third type is used when your window contains multiple browser elements, for example if you have a sidebar displaying ...
Creating an Installer - Archive of obsolete content
was installed with a result of " + result); } var xpi = new Object(); xpi["Calendar"] = "calendar.xpi"; InstallTrigger.install(xpi,doneFn); First, we define a callback function doneFn() which will be called when the install is complete. You can name the function whatever you like of course. This function has two arguments. The first is the name of the package that was just installed. This is im
portant if you are installing multiple components. The second argument is a result code. If the result is 0, the installation completed successfully. If the result is non-zero, an error occured and the value is an error code. The function doneFn() here just displays an alert box to the user. Next, we create an array xpi which will hold the name (Calendar) and URL (calendar.xpi) of the installer. You ...
Element Positioning - Archive of obsolete content
he size of an element in a window. There are a number of features that allow you to control the size of an element. The quick way is to simply add the width and height attributes on an element, much like you might do on an HTML img tag. An example is shown below: Example 1: Source View <button label="OK" width="100" height="40"/> However, it is not recommended that you do this. It is not very
portable and may not fit in with some themes. A better way is to use style properties, which work similarly to style sheets in HTML. The following CSS properties can be used. width This specifies the width of the element. Note that the CSS global skin of the XUL application may also specify a min-width for the buttons and other elements, thus if simply setting the width property does not set the b...
Focus and Selection - Archive of obsolete content
fit in the textbox. The change event is similar in that it fires only when the field is changed. However it only fires once the textbox loses the focus, thus, only once per set of changes. Text Selection When working with a textbox, you may wish to retrieve not the entire contents of a field but only what the user has selected. Or, you may wish to change the current selection. XUL textboxes sup
port a way to retrieve and modify the selection. The simplest one is to select all of the text in a textbox. This involves using the select method of the textbox. tbox.select(); However, you may wish to select only part of the text. To do this you can use the setSelectionRange function. It takes two parameters, the first is the starting character and the second is the character after the last one tha...
List Controls - Archive of obsolete content
abel="Chocolate Chip" value="chocchip" /> <listitem label="Raspberry Ripple" value="raspripple" /> <listitem label="Squash Swirl" value="squash" /> </listbox> The example has been changed to display only 3 rows at a time. Values have also been added to each item in the list. List boxes have some additional features, which will be described later. Multi-Column List Boxes The listbox also sup
ports multiple columns. Each cell may have arbitrary content within it, although usually only text is used. When the user selects an item in the list, the entire row is selected. You cannot have a single cell selected. Two tags are used to specify the columns in the listbox. The listcols element is used to hold the column information, each of which is specified using a listcol element. You will need o...
Manipulating Lists - Archive of obsolete content
This interface provides a number of functions specifically for handling multiple selection. For example the selectedItems property holds a list of the items that are selected, while the selectedCount property holds the number of items selected. Typically, you will use these properties to iterate over the lis...
Numeric Controls - Archive of obsolete content
alue, min, max and increment may all be used in a similar fashion. The scale does not actually show the value as a number, but it may be used in a script. A scale will fire a change event whenever the scales's value is modified. <scale value="40" min="1" max="50"/> This scale defaults to a value of 40 and has a range between 1 and 50. A numeric textbox would normally be used when the value was im
portant to the user, for instance, a field to enter a number of days, or the maximum size of a file. A scale would be used when the actual value isn't im
portant, just that sliding the scale decreases or increases a state. For instance, a volume slider or a zoom level. The default arrangement of a scale is horizontal with lower values to the left and higher values to the right. However, you can change ...
Stacks and Decks - Archive of obsolete content
ame text 'Shadowed' again but slightly offset from the other. The second description element is drawn in red so the effect is more visible. This method has advantages over using text-shadow because you could completely style the shadow apart from the main text. It could have its own font, underline or size. (You could even make the shadow blink). It is also useful as Mozilla doesn't currently sup
port CSS text shadowing. A disadvantage is that the area taken up by the shadow makes the size of the stack larger. Shadowing is very useful for creating the disabled appearance of buttons: Example 2 : Source View <stack style="background-color: #C0C0C0"> <description value="Disabled" style="color: white; padding-left: 1px; padding-top: 1px;"/> <description value="Disabled" style="color: grey;"/...
Templates - Archive of obsolete content
efine a rule for each variation of elements that we want to have created. In our case, we would need a rule for bookmarks and a rule for separators. Attributes placed on the rule element determine which rules apply to which RDF resource. When scanning for which rule applies to the data, each rule element is checked in sequence for a match. That means that the order in which you define rules is im
portant. Earlier rules will override later rules. Rule Example The following example demonstrates the earlier example with two rules: Example 4 : Source <window id="example-window" title="Bookmarks List" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox datasourc...
Tree Box Objects - Archive of obsolete content
at a specific location. The getRowAt() function takes two arguments, the x and y coordinates to use. tree.boxObject.getRowAt( 50, 100 ); This example will return the index of the row with a horizontal position of 50 and a vertical position of 100. Naturally, it doesn't really matter what the value of the x coordinate is since rows always take up the entire horizontal space of the tree. One im
portant thing to note is that the coordinates are measured from the upper left corner of the containing document, not the edge of the tree itself. This makes it easy to pass event coordinates directly to these functions, as in the following example of the getCellAt() function. Example 2 : Source View <script> function updateFields(event){ var row = {}, column = {}, part = {}; var tree = documen...
Using Spacers - Archive of obsolete content
section, we will find out how to add some spacing in between the elements we have created. Adding Spacers One of the problems with developing user interfaces is that each user has a different display. Some users may have larger displays with higher resolutions and others may have lower resolutions. In addition, different platforms may have special requirements on the user interface. If adding sup
port for multiple languages, the text for one language may require more room than another. Applications that need to sup
port multiple platforms and languages usually have their windows laid out with lots of space to allow for this. Some platforms and user interface toolkits provide components that are smart enough to resize and re-position themselves to fit the needs of the user. (Java uses layout man...
XBL Inheritance - Archive of obsolete content
nds from the XUL textbox element. The URL given in the extends attribute above is the URL of the textbox binding. This means that we inherit all of the content and behavior provided by the textbox binding. In addition, we add a handler which responds to the keypress event. Autocompleting TextBoxes The example above is similar to how the URL autocomplete feature works in Mozilla. A textbox that sup
ports autocomplete is just one with a XBL binding that extends the basic textbox. The autocomplete textbox adds extra event handling so that when a URL is typed, a menu will pop up with possible completions. You can use it in your own applications too. Just create a textbox with two extra attributes. <textbox type="autocomplete" searchSessions="history"/> Set the type to autocomplete to add the autoc...
Using spell checking in XUL - Archive of obsolete content
Spell checking functionality is available starting in Firefox 2. This document describes how to use the mozISpellCheckingEngine component to add spell checking capabilities to your Firefox extension. See Controlling spell checking in HTML forms for details on adding spell check sup
port to HTML forms for your website. Checking the spelling of a word To check the spelling of a word, you must first create an interface to the mozISpellCheckingEngine component and then call the check() method on the string you wish to test. This method returns true if the word is correctly spelled, or false if it's not. You may also want to check to see if the word is in the user's personal dictionary, since sometimes a word might be correctly spelled but in the dictionary. // Different versions of Firefox ha...
Window icons - Archive of obsolete content
obal icon files currently take precedence and bundles are only searched for icons which are not provided by the application. Starting with Firefox 3.0, XULRunner 3.0, Thunderbird 3.0 and SeaMonkey 2.0 you can now specify PNG format icons instead of XPM format on Linux. You can specify up to 4 different sizes of PNG icons using the suffixes .png, 16.png, 32.png and 48.png. Older versions To sup
port older applications, such as Firefox 1.0, you need to copy the icons to app_dir/chrome/icons/default manually on the first start (example code). ...
XUL Parser in Python/source - Archive of obsolete content
Source code for the XUL Parser in Python. im
port sys, glob, xmllib im
port os, re el_list = {} w = open('res.html', 'w') # Unfortunately, I had to put this hack in here to suppress the printing out of the resolved namespace: # "xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul window", etc. def strip(snip): t = re.sub('http://.*?\s', '', snip) return t class XULParser(xmllib.XMLParser): def unknown_starttag(self, t, a): name = strip(t) if name not in el_list: el_list[name] = {} for attr,val in a.items(): el_list[name][strip(attr)] = strip(val) def syntax_error(self, message): pass p = XULParser() cmd = 'dir /s /b *.xul' CHROME_DIR = 'C:\Program Files\Netscape\Netscape 6\chrome' os.chdir(CHROME_DIR) files = os.popen(cmd).readlines() for file i...
XUL element attributes - Archive of obsolete content
implemented in XBL. The element should fire change, command, or input event when the value is changed so that the preference will update accordingly. See the pref system documentation for more information. querytype Type: string Indicates the type of datasource used in a template. Firefox 3 provides 3 built-in datasources: 'rdf', default, 'xml' and 'storage'. Extensions may provide sup
port for additional datasources. ref Type: URI For template-generated elements, this attribute is used to specify the root RDF node where content generation begins. This will correspond to the value of an about attribute on an RDF container. This attribute should be placed alongside the datasources attribute. removeelement Type: id When placed on an element in an overlay, it indicate...
Accessibility/XUL Accessibility Reference - Archive of obsolete content
/> Note that in the third example, only the first label is read browser JAWS 7.10 issues To use a browser element with HTML, the type="content" attribute should be specified. However, this attribute causes any XUL loaded in the browser to have issues with JAWS 7.10. We believe they are using the window class to determine that it is content rather than dialog, but does not sup
port content mode for XUL. Therefore, with JAWS 7.10, to use XUL inside of a browser, the type attribute cannot not be used. caption See groupbox checkbox <checkbox label='<!--Label Text-->' /> colorpicker <colorpicker type="button" palettename="standard" /> colorpicker appears to read color values out if the colorpicker can get focu...
XML - Archive of obsolete content
terface widgets, the relationship between them, or grammar, and some built-in flexibility for using extra resources like images, HTML elements, and other standards-based technologies. But this is all you need to build any interface. XUL is timely. Only quite recently have the standards out of which XUL was fashioned matured to a level where they might really be powerful and flexible enough to sup
port the sort of development that XUL provides for. As the figure below indicates, XUL is an amalgam of these different standards: CSS for styling or "skinning", DOM for the object model and scriptable access, JavaScript for the linking and behavior, RDF for resources, XML for the structure, and HTML for the content and some little extras. In this way, it's more like a developmentplatform or framework...
XUL Coding Style Guidelines - Archive of obsolete content
Introduction XUL, pronounced as "zool", stands for "XML-based User Interface Language", is a cross platform way of describing user interface. It could contain XUL specific element types for UI controls, HTML4 markups for content data, and even JavaScript for user event handling. To make XUL files easy to read and maintain, localization friendly, and
portable across user agents, we need to have a set of coding style guidelines to ensure our objectives are achievable. The author has collected a set of guidelines from various sources listed in the References section. While some of the guidelines are recommended practices, the others are mandatory. XML, XUL, HTML, and XHTML guidelines The following are considered good coding style for XML/XUL documents. Disobeying them might not cause a...
XUL Event Propagation - Archive of obsolete content
events in different places in the interface. Introduction XUL events were introduced in a very general way in a previous XULNote. But to use events effectively in XUL, you must be aware of what the actual process for raising, listening to, and handling events is. Collectively, this process is referred to as the event model. Events are used for different purposes, but they play a particularly im
portant role in creating interactive XUL-based user interfaces, since it is events that bring the information about user actions to the code behind the interface. The following image describes in a very basic way how the various actors in the event model interact with one another. The user clicks a button in the interface. This button responds to the user action by raising an event, a message mean...
action - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
assign - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
bbox - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
binding - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related TBD ...
bindings - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related TBD ...
box - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements vbox, hbox ...
broadcaster - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
broadcasterset - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
browser - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addProgressListener( listener ) Return type: no return value Add a progress l...
caption - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements groupbox, checkbox ...
checkbox - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIAccessibleProvider, nsIDOMXULCheckboxElement ...
colorpicker - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIDOMXULControlElement Bugs The onchange Event only fires if Attribute ty...
column - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements grid, columns, rows, row ...
command - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related XUL:List of commands ...
commandset - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
conditions - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
content - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Relacionados TBD ...
datepicker - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIDOMXULControlElement ...
deck - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related stack ...
dialog - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData acceptDialog() Return type: no return value Accepts the dialog and closes it, similar to p...
dialogheader - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements dialog, window ...
dropmarker - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
editor - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIAccessibleProvider ...
grippy - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
groupbox - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIAccessibleProvider ...
hbox - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements box, vbox ...
key - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Details on key, keycode, and modifiers attributes For example, consider the following key: <key ke...
keyset - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
listbox - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addItemToSelection( item ) Return type: no return value Selects the given item, without desele...
listcol - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements listbox, listcell, listcols, listhead, listheader, listitem ...
listcols - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements listbox, listcell, listcol, listhead, listheader, listitem ...
listhead - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements listbox, listcell, listcol, listcols, listheader, listitem ...
listheader - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements listbox, listcell, listcol, listcols, listhead, listitem ...
member - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
menu - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData appendItem( label, value ) Return type: element Creates a new item and adds it ...
menubar - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements menu, menuitem, menulist, menupopup, menuseparator Interfaces nsIAccessibl...
menulist - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData appendItem( label, value, description ) Return type: element Creates a new menuitem element and a...
menuseparator - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements menu, menubar, menuitem, menulist, menupopup Interfaces nsIAccessibleProvi...
notificationbox - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData appendNotification( label , value , image , priority , buttons, eventCallback ) Return type: elem...
observes - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
page - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
param - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
popupset - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements popup, menupopup ...
preference - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Events change When a preference value changes, an onchange/change event is fired on the <prefere...
prefpane - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Events paneload This event is fired on the pane element when the pane is fully loaded ...
progressmeter - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIAccessibleProvider ...
query - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
queryset - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
radio - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements radiogroup, checkbox Interfaces nsIAccessibleProvider, nsIDOMXULSelectCont...
radiogroup - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData appendItem( label, value ) Return type: element Creates a new item and adds it...
resizer - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
rule - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
scale - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData decrease() Return type: no return value Decreases the value of the scale or num...
script - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
scrollbar - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
scrollbox - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
scrollcorner - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
spacer - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements separator, splitter ...
spinbuttons - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
stack - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related deck ...
statusbar - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements statusbarpanel Interfaces nsIAccessibleProvider ...
stringbundle - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related XUL Property Files ...
stringbundleset - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
tab - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Notes Note: Prior to Gecko 1.9, disabling tabs fails; even while disabled, they still accept event...
tabbrowser - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addProgressListener( listener ) Return type: no return value Add a progress lis...
tabs - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData advanceSelectedTab( dir, wrap ) Return type: no return value If the argument dir is set to 1, th...
template - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
textnode - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
timepicker - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfaces nsIDOMXULControlElement ...
titlebar - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
toolbarbutton - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements toolbar, toolbargrippy, toolbaritem, toolbarpalette, toolbarseparator, tool...
toolbargrippy - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements toolbar, toolbarbutton, toolbaritem, toolbarpalette, toolbarseparator, toolbars...
toolbaritem - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements toolbar, toolbarbutton, toolbargrippy, toolbarpalette, toolbarseparator, toolba...
toolbarpalette - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements toolbar, toolbarbutton, toolbargrippy, toolbaritem, toolbarseparator, toolbarse...
toolbarseparator - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements toolbar, toolbarbutton, toolbargrippy, toolbaritem, toolbarpalette, t...
toolbarset - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements toolbar, toolbarbutton, toolbargrippy, toolbaritem, toolbarpalette, t...
toolbarspacer - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements toolbar, toolbarbutton, toolbargrippy, toolbaritem, toolbarpalette, toolbarsepa...
toolbarspring - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements toolbar, toolbarbutton, toolbargrippy, toolbaritem, toolbarpalette, t...
treechildren - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Example <tree flex="1"> <treecols> <treecol id="sender" label="Sender" flex="1"/> <treec...
triple - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
vbox - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements box, hbox ...
where - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
wizard - Archive of obsolete content
ocus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData << XUL Reference home advance( pageID ) Return type: no return value Call this method to ...
wizardpage - Archive of obsolete content
ribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSup
ported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related wizard ...
XUL - Archive of obsolete content
ow to perform drag and drop operations. Overlays Overlays are used to describe extra content for the UI. They provide a powerful mechanism for extending and customizing existing XUL applications. XUL Periodic Table This collection of XUL demos used to be available as a web page, but can no longer be viewed in Firefox since sup
port for Remote XUL was disabled. There is a XULRunner application containing the XUL Periodic Table which can be opened with Gecko based browsers. You can get it here. See: Using Firefox 3 to run XULRunner applications for instructions on running XULRunner apps in Firefox. View All... Community ...
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
nd deploying XULRunner and applications based on XULRunner will be available in future releases. I'm writing a XUL application, how can I deploy that application to my users? Right now Mozilla recommends that XULRunner should be deployed privately with each application. See Deploying XULRunner 1.8 for more information. Where is the source code? Here. I think I've found a bug, how do I re
port it? bugzilla.mozilla.org is used to track bugs in all Mozilla products. Please search to make sure that your bug has not already been re
ported. How can I help? If you want to help with XULRunner but don't know where to start, visit the XULRunner:Community page and ask questions on the newsgroups or the IRC channel. ...
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
eploying XULRunner and applications based on XULRunner will be available in future releases. I'm writing a XUL application, how can I deploy that application to my users? Right now Mozilla recommends that XULRunner should be deployed privately with each application. See Deploying XULRunner 1.8 for more information. Where is the source code? Here. I think I've found a bug, how do I re
port it? bugzilla.mozilla.org is used to track bugs in all Mozilla products. Please search to make sure that your bug has not already been re
ported. How can I help? If you want to help with XULRunner but don't know where to start, visit the XULRunner:Community page and ask questions on the newsgroups or the IRC channel. Interwiki Language Links ...
XULRunner 1.9.1 Release Notes - Archive of obsolete content
will be available in future releases. I'm writing a XUL application, how can I deploy that application to my users? Right now Mozilla recommends that XULRunner should be deployed privately with each application. See Deploying XULRunner for more information. Where is the source code? Here. Where is the SDK? Here. I think I've found a bug, how do I re
port it? bugzilla.mozilla.org is used to track bugs in all Mozilla products. Please search to make sure that your bug has not already been re
ported. How can I help? If you want to help with XULRunner but don't know where to start, visit the XULRunner:Community page and ask questions on the newsgroups or the IRC channel. ...
XULRunner 1.9.2 Release Notes - Archive of obsolete content
ng XULRunner and applications based on XULRunner will be available in future releases. I'm writing a XUL application, how can I deploy that application to my users? Right now Mozilla recommends that XULRunner should be deployed privately with each application. See Deploying XULRunner for more information. Where is the source code? Here. Where is the SDK? Here. I think I've found a bug, how do I re
port it? bugzilla.mozilla.org is used to track bugs in all Mozilla products. Please search to make sure that your bug has not already been re
ported. How can I help? If you want to help with XULRunner but don't know where to start, visit the XULRunner:Community page and ask questions on the newsgroups or the IRC channel. ...
XULRunner 1.9 Release Notes - Archive of obsolete content
unner and applications based on XULRunner will be available in future releases. I'm writing a XUL application, how can I deploy that application to my users? Right now Mozilla recommends that XULRunner should be deployed privately with each application. See Deploying XULRunner for more information. Where is the source code? Here. Where is the SDK? Here. I think I've found a bug, how do I re
port it? bugzilla.mozilla.org is used to track bugs in all Mozilla products. Please search to make sure that your bug has not already been re
ported. How can I help? If you want to help with XULRunner but don't know where to start, visit the XULRunner:Community page and ask questions on the newsgroups or the IRC channel. ...
XULRunner 2.0 Release Notes - Archive of obsolete content
ner will be available in future releases. I'm writing a XUL application, how can I deploy that application to my users? Right now Mozilla recommends that XULRunner should be deployed privately with each application. See Deploying XULRunner for more information. Where is the source code? Here. Where is the SDK? Here. See Gecko SDK for information about the SDK. I think I've found a bug, how do I re
port it? bugzilla.mozilla.org is used to track bugs in all Mozilla products. Please search to make sure that your bug has not already been re
ported. How can I help? If you want to help with XULRunner but don't know where to start, visit the XULRunner:Community page and ask questions on the newsgroups or the IRC channel. ...
Building XULRunner - Archive of obsolete content
XULRunner is built using basically the same process as Firefox or other applications. Please read and follow the general Build Documentation for instructions on how to get sources and set up build prerequisites. By default, XULRunner is built with JavaXPCOM sup
port; the build system must be able to find an appropriate JDK on the system; see the instructions on Building JavaXPCOM for more details. If you do not want to build JavaXPCOM sup
port, specify --disable-javaxpcom in your configuration. On Mac, XULRunner requires Mac OS X 10.3 or higher and XCode 1.5 or higher to build properly. The runtime requirement is Mac OS X 10.2. A basic minimal mozconfig which will build a release configuration of XULRunner is: mk_add_options MOZ_CO_PROJECT=xulrunner mk_add_options MOZ_OBJDIR=@topsrcdir@/obj...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
ion packaging. A complete description can be found in XUL Application Packaging. In this case you can basically copy over the file as is, since once again variables are used for things like the application name and version. But you will have to change the ID to something unique to your app. default-prefs.js - these are the default Mozilla preferences used by XULRunner when running your app. The im
portant ones are described in XULRunner:Specifying Startup Chrome Window. You can add other preferences for things like debugging, as McCoy does (e.g. javascript.options.showInConsole). default.ico and default.xpm - Icons for your app on Windows and Linux. macbuild/ - When Steve Jobs said "think different", we took that to heart, and not just by rejecting useless adverbial endings. We've included a wh...
Getting started with XULRunner - Archive of obsolete content
g any binary XPCOM components, we only need to download and install the XULRunner runtime package, not the SDK. The XULRunner download for Windows is a zip file, not a true install. As a developer, I like the idea that XULRunner only needs to be unzipped onto my machine. I am assuming that it doesn't need to hook into my Windows system and that's a good thing. It also means that the XULRunner is
portable so, if you develop your applications to be
portable you could carry them around on a flash drive or sync them in the cloud. The Mac version of XULRunner is distributed as an tar.bz2 archive. You can extract this to any location you like, but there are many places in the documentation that will assume that you have this installed in /Library/Frameworks. In Ubuntu desktop and its variants (X...
Using LDAP XPCOM with XULRunner - Archive of obsolete content
In any case, you will have to build LDAP XPCOM, by adding --enable-ldap build option. See the Build_Documentation for more information about how to build XULRunner. When Configuring Build Options, just add: ac_add_options --enable-ldap to your .mozconfig file. ...
MacFAQ - Archive of obsolete content
nu item To enable the Mac "Preferences" menu make sure that you use "menu_preferences" as the id for your options/preferences menu item Toolbars Mac windows have a small "jelly bean" button in the top right corner. This button is used to show/hide the toolbar. The toolkit will automatically enable this behavior if you add class="chromeclass-toolbar" to your <toolbar> element. Commandline Sup
port Commandline handlers work great on the Mac IF it's a cold start. Here's how to implement command-line trapping when the app is already running, without getting into AppleEvents or c++ code. This is implemented in a pseudo "hidden window" technique and parsing the window arguments instead of command-line handlers and some of the toolkit singleton window code. Taking advantage of the core code "Op...
Make your xulrunner app match the system locale - Archive of obsolete content
does this by creating a command line handler called DemocracyCLH, and then creating a new object of our PyBridge component. The code described lives in the PyBridge component's onStartup method which gets called automatically. The second step is to figure out the system locale. To be finished later. Then set the locale preference. The following is python code to set this preference. ...
Monitoring plugins - Archive of obsolete content
Summary A new component of the plugin system is now available to measure how long it takes plugins (e.g., Adobe Flash) to execute their calls. This component then re
ports the plugin runtime using the observer service to anyone registered to receive the notifications. This article discusses how developers can make use of this new feature. Runtime Data The runtime information re
ported is always in fractions of a second. Because the component measures the wall clock time it takes for blocking plugin calls to execute, the value includes both CPU time, the wait time between allocation of CPU time to the process as well as any disk I/O time. It is therefore technically incorrect to say that the runtime is a measure of CPU use, however, it is a good representation of overall resources being consu...
Browser-side plug-in API - Archive of obsolete content
nd so forth. The names of all of these methods begin with NPN_ to indicate that they are implemented by the browser and called by the plug-in. For an overview of how these two sides of the plug-in API interact, see the How Plug-ins Work and Overview of Plug-in Structure sections in the introduction. Warning: You must only call these from the main thread; calling them from other threads is not sup
ported and may have unpredictable results. NPN_DestroyStream NPN_ForceRedraw NPN_GetAuthenticationInfo NPN_GetURL NPN_GetURLNotify NPN_GetValue NPN_GetValueForURL NPN_InvalidateRect NPN_InvalidateRegion NPN_MemAlloc NPN_MemFlush NPN_MemFree NPN_NewStream NPN_PluginThreadAsyncCall NPN_PopPopupsEnabledState NPN_PostURL NPN_PostURLNotify NPN_PushPopupsEnabledState NPN_ReloadPlugins NP...
NPN_MemAlloc - Archive of obsolete content
his ensures that the browser can free the saved data at a later time with the equivalent of NPN_MemFree. Since the browser and plug-ins share the same memory space, NPN_MemAlloc allows plug-ins to take advantage of any customized memory allocation scheme the application may have, and allows the application to manage its memory more flexibly and efficiently. Mac OS NPN_MemAlloc is particularly im
portant on Mac OS, since the Mac OS version of the browser frequently fills its memory partition with cached data that is only purged as necessary. Since NPN_MemAlloc automatically frees cached information if necessary to fulfill the request, calls to NPN_MemAlloc may succeed where direct calls to NewPtr fail. Existing calls to NPN_MemFlush have no effect. You only need to use NPN_MemFlush in situatio...
NPN_PostURLNotify - Archive of obsolete content
equest with the subsequent NPP_URLNotify call, which returns this value (see Description below). Returns If successful, the function returns NPERR_NO_ERROR. If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes. Description NPN_PostURLNotify functions identically to NPN_PostURL, with these exceptions: NPN_PostURLNotify sup
ports specifying headers when posting a memory buffer. NPN_PostURLNotify calls NPP_URLNotify upon successful or unsuccessful completion of the request. For more information, see NPN_PostURL. NPN_PostURLNotify is typically asynchronous: it returns immediately and only later handles the request and calls NPP_URLNotify. If this function is called with a target parameter value of _self or a parent to _...
NPN_RequestRead - Archive of obsolete content
mode initially (since the browser must cache all the stream data on disk in order to access it randomly). If NPN_RequestRead() is called on a stream that is not inherently seekable and not initially in mode NP_SEEK, it returns the error code NPERR_STREAM_NOT_SEEKABLE. Typically, the only streams that are inherently seekable are those from in-memory or on-disk data, or from HTTP servers that sup
port byte-range requests. See also NPP_NewStream() NPP_WriteReady() NPP_Write() NPStream ...
NPN_SetValue - Archive of obsolete content
riable parameter and value set to TRUE. By default, the dll will be unloaded from memory preceded by an NP_Shutdown call. Remarks All four variable values are boolean. Although the function prototype has type of value void *, the actual boolean should be placed there, not a pointer to a boolean. The browser code reads this parameter as follows (NPPVpluginWindowBool as an example): NPError NP_EX
PORT _setvalue(NPP npp, NPPVariable variable, void *value) { ... BOOL bWindowless = (value == NULL); ... } So the proper way to call this function from a plug-in would be: BOOL bWindowed = FALSE; NPN_SetValue(npp, NPPVpluginWindowBool, ( void *)bWindowed); See Also NPP_New, NPN_GetValue, NPP_SetValue, NPP_GetValue ...
NPN_Version - Archive of obsolete content
Version. You can use NPN_Version() to inquire on version constants (NPVERS constants), which represent particular browser features. Once the plug-in obtains a version number, it can inquire on a version constant to find out if the feature it represents exists in this version. For example, the plug-in could inquire on the constant NPVERS_HAS_WINDOWLESS to see if it is running in a browser that sup
ports windowless functionality. For more information and an example, see Finding Out if a Feature Exists. For a listing of version constants defined in the plug-in API, see Version Feature Constants. Note: Platform-specific code in the plug-in API files npwin.cpp, npmac.cpp, or npunix.c checks version numbers automatically. A plug-in whose major version is less than the major version of the browser ...
NPP_NewStream - Archive of obsolete content
NPStream* stream, NPBool seekable, uint16* stype); Parameters The function has the following parameters: instance Pointer to current plug-in instance. type Pointer to MIME type of the stream. stream Pointer to new stream. seekable Boolean indicating whether the stream is seekable: true: Seekable. Stream sup
ports random access through calls to NPN_RequestRead (for example, local files or HTTP servers that sup
port byte-range requests). false: Not seekable. The browser must copy data in the stream to the local cache to satisfy random access requests made through NPN_RequestRead. stype Out parameter. The plugin should set this value to request a mode for the stream. For more information about eac...
Entity list - Archive of obsolete content
Note: There are 3 different versions of RSS 0.91. There is Netscape's RSS 0.91 (Revision 1) (N 0.91 R1), Netscape's RSS 0.91 Revision 3 (N 0.91 R3) and Userland's RSS 0.91 (U 0.91). Netscape's RSS 0.91 uses a DTD which defines 96 additional named entities. ...
Syndicating content with RSS - Archive of obsolete content
nd other) feeds use a special icon. It is recommended that you too use this icon when creating the special <a> link to your feed. The icon looks like the following: You can get more icons like this from Feed Icons. (Other sizes and colors, along with their source files, are available too.) Advanced syndication techniques Although this advanced technique for syndication is not required, sup
port of this is recommended, especially for web sites and applications with high performance needs. The HTTP protocol, one of the core technologies behind the web, provides a way of prioritizing the content type that an HTTP client prefers to receive. This technique takes advantage by having the client prefer RSS (over HTML or other formats). Here's a simple example of it being done: Accept: applica...
Why use RSS - Archive of obsolete content
ne is using it. RSS has a huge amount of momentum. People are using it to syndicate all sorts of things: news articles, blogs, bookmarks, Internet Radio shows, Internet Television shows, software updates, e-mails, mailing lists, music playlists, and more. If it is episodic, it can be syndicated with RSS. Software that reads and can make use of RSS is also everywhere. Mozilla Firefox has some sup
port for RSS (with it's Live Bookmark technology.). There are too many desktop and web-based RSS aggregators out there to list them all. Also, custom-made software is also making use of RSS. RSS Aggregators are Everywhere One reason to use RSS to syndicate is because there are an enormous amount of desktop and web-based RSS aggregators out there. (Too many to list.) And if you syndicate using RSS, t...
Proposal - Archive of obsolete content
NOTE: Those in the list below that are marked "In Development" should NOT be implemented. "In Development" means that they are still working on it and trying to come up with a draft. Those labeled with "Draft Exists" can be implemented, but be warned that they could radically change. ...
.htaccess ( hypertext access ) - Archive of obsolete content
tands for "hypertext access". A file with the HTACCESS file extension is an Access Configuration file for apache server. The .htaccess file configures the current directory with things like password protection, URL rewrites & redirects, and more. File Accessing : htaccess files can be opened using any text editor, like Windows Notepad, Vin, Sublime text editor or any other. Syntax highliting sup
port for .htaccess files less. Common Application URL Redirects & rewrite: htaccess files are often used to redirect traffic to a web page to another or from traffic to a directory to another even between domains is possible. It's a fast and efficient way of redirecting traffic, because the redirect happens before the pages are served. Redirects can be made on a temporary basis or permanently by sup...
Debug.msUpdateAsyncCallbackRelation - Archive of obsolete content
de: Debug.MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE Debug.MS_ASYNC_CALLBACK_STATUS_JOIN Debug.MS_ASYNC_CALLBACK_STATUS_CHOOSEANY Debug.MS_ASYNC_CALLBACK_STATUS_CANCEL Debug.MS_ASYNC_CALLBACK_STATUS_ERROR For more information, see Debug Constants. Note: Some debugging tools do not display the information sent to the debugger by this function. Requirements Sup
ported in the Internet Explorer 11 standards document mode. Also sup
ported in Store apps (Windows 8.1 and Windows Phone 8.1). Not sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Not sup
ported in Windows 8. ...
Debug.setNonUserCodeExceptions - Archive of obsolete content
s. Setting this property to false is the same as never having set the property. For more information on debugging, see the Active Script Debugging Overview. Example The following code shows how to set this property. (function () { Debug.setNonUserCodeExceptions = true; try{ var x = null; x.y(); } catch (e) { // Catch the exception. } })(); Requirements Sup
ported in the following document modes: Internet Explorer 10 standards and Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). Not sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards. ...
Debug.write - Archive of obsolete content
script debugger. Note: To run this example, you must have a script debugger installed and the script must run in debug mode. Internet Explorer 8 includes the JavaScript debugger. If you are using an earlier version of Internet Explorer, see How to: Enable and Start Script Debugging from Internet Explorer. var counter = 42; Debug.write("The value of counter is " + counter); Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). ...
Debug.writeln - Archive of obsolete content
ipt Debugger. Note: To run this example, you must have a script debugger installed and the script must run in debug mode. Internet Explorer 8 includes the JavaScript debugger. If you are using an earlier version of Internet Explorer, see How to: Enable and Start Script Debugging from Internet Explorer. var counter = 42; Debug.writeln("The value of counter is " + counter); Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). Applies To: Debug ...
Debug - Archive of obsolete content
s work item and the associated asynchronous operation. Debug.write Sends strings to the script debugger. Debug.writeln Sends strings to the script debugger, followed by a newline character. Examples Print the value of a variable This example uses the write function to display the value of the variable. var counter = 42; Debug.write("The value of counter is " + counter); Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). ...
Error.stackTraceLimit - Archive of obsolete content
ckTraceLimit is set to Infinity, the entire stack is shown. Otherwise, ToUint32 is used to convert the value. Example The following example shows how to set and then get the stack trace limit. try { var err = new Error("my error"); Error.stackTraceLimit = 7; throw err; } catch(e) { document.write("Error stack trace limit: ") document.write(Error.stackTraceLimit); } Requirements Sup
ported in Internet Explorer 10 and in Windows 8.x Store apps. Applies To: Error Object ...
ScriptEngine() - Archive of obsolete content
tEngine function gets the name of the scripting language in use. Syntax ScriptEngine() Remarks The ScriptEngine function returns "JScript", which indicates that JavaScript is the current scripting engine. Example The following example illustrates the use of the ScriptEngine function: if (window.ScriptEngine) { console.log(window.ScriptEngine()); } // Output: JScript Requirements Sup
ported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also sup
ported in Store apps (Windows 8 and Windows Phone 8.1). ...
Microsoft JavaScript extensions - Archive of obsolete content
Warning: These APIs will only work in Microsoft applications, and are not on a standards track. Microsoft browsers (Internet Explorer, and in a few cases, Microsoft Edge) sup
port a number of special Microsoft extensions to the otherwise standard JavaScript APIs. Objects ActiveXObject Debug Enumerator VBArray Functions GetObject ScriptEngine ScriptEngineBuildVersion ScriptEngineMajorVersion ScriptEngineMinorVersion Statements @cc-on @if @set Other Date.getVarDate() Error.description Error.number Error.stackTraceLimit ...
New in JavaScript 1.6 - Archive of obsolete content
The following is a changelog for JavaScript 1.6. This version was included in Firefox 1.5 (Gecko 1.8), which was released in November 2005. The corresponding ECMA standard is ECMA-262 Edition 3 and ECMAScript for XML (E4X) with some additional features. Several new features were introduced: E4X, several new Array methods, and Array and String generics. New features in JavaScript 1.6 Sup
port for ECMAScript for XML (E4X) for creating and processing XML content within JavaScript has been added. See for details. Array.prototype.indexOf() Array.prototype.lastIndexof() Array.prototype.every() Array.prototype.filter() Array.prototype.forEach() Array.prototype.map() Array.prototype.some() Array generics String generics for each...in Changed functionality in JavaScript 1.6 A bug in...
New in JavaScript 1.7 - Archive of obsolete content
g the JavaScript version. New features in JavaScript 1.7 The following features added with JavaScript 1.7 were not part of an ECMA-262 standard at the time. In more recent Firefox versions, the implementation is updated to work with semantics as specified in ECMAScript Edition 6. Please see the reference pages for differences. Iterators and generators Array comprehensions let statement (sup
port for let expression was dropped in Gecko 41, see bug 1023609). const statement Destructuring assignment (sup
port for JS1.7 style destructuring for-in was dropped in Gecko 40, see bug 1083498). ...
New in JavaScript 1.8.1 - Archive of obsolete content
The following is a changelog for JavaScript 1.8.1. This version was included in Firefox 3.5. JavaScript 1.8.1 is a modest update syntactically to JavaScript; the main change in this release is the addition of the Tracemonkey just-in-time compiler, which improves performance. New features in JavaScript 1.8.1 Object.getPrototypeOf() Sup
port for native JSON String.prototype.trim() String.prototype.trimLeft() String.prototype.trimRight() Changed functionality in JavaScript 1.8.1 Implicit setting of properties in object and array initializers no longer execute setters in JavaScript. This makes the behavior of setting the values of properties more predictable. ...
for each...in - Archive of obsolete content
Consider using for...of instead. Firefox now warns about the usage of for each...in and it no longer works starting with Firefox 57. Please see Warning: JavaScript 1.6's for-each-in loops are deprecated for migration help. The for each...in statement iterates a specified variable over all values of object's properties. For each distinct property, a specified statement is executed. Syntax for each (variable in object) { statement } variable Variable to iterate over property values, optionally declared with the var keyword. This variable is local to the function, not to the loop. ...
Packages - Archive of obsolete content
Obsolete since Gecko 16.0 (Firefox 16.0 / Thunderbird 16.0 / SeaMonkey 2.13)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Summary A top-level object used to access Java classes from within JavaScript code. The sup
port for this object was removed in Gecko 16, see LiveConnect for details. Created by The Packages object is a top-level, predefined JavaScript object. You can automatically access it without using a constructor or calling a method. Description The Packages object lets you access the public methods and fields of an arbitrary Java class from within JavaScript. The java, netscape, and sun properties represent the packages java.*, netscape.*, and sun.* respective...
java - Archive of obsolete content
Created by The java object is a top-level, predefined JavaScript object. You can automatically access it without using a constructor or calling a method. ...
ParallelArray - Archive of obsolete content
The goal of ParallelArray was to enable data-parallelism in web applications. The higher-order functions available on ParallelArray attempted to execute in parallel, though they may fall back to sequential execution if necessary. To ensure that your code executes in parallel, it is suggested that the functions should be limited to the parallelizable subset of JS that Firefox sup
ports. Syntax new ParallelArray() new ParallelArray([element0, element1, ...]) new ParallelArray(arrayLength, elementalFunction) ParallelArray instances Properties length Reflects the number of elements in the ParallelArray. Methods map reduce scan scatter filter flatten partition get Examples Using map in parallel var p = new ParallelArray([0, 1, 2, 3, 4]); var m = p.map(function (v) { ...
Standards-Compliant Authoring Tools - Archive of obsolete content
ating cross-browser code upfront will save you lots of time quality testing your web content. The following authoring tools adhere to the W3 standards. If you're using older versions of tools that rely on old browser bugs or generate browser-specific code, it may be time to upgrade: NVu is a standalone editor created from the remains of Mozilla Composer. Currently the work done on NVu is being
ported back to mozilla source code. HTML-Kit is a full-featured, low priced editor designed to help HTML, XHTML and XML authors to edit, format, lookup help, validate, preview and publish web pages. Validation is done with HTML Tidy, so you can verify standards compliance. Macromedia(TM) Dreamweaver(TM) CS6 Style Master and Layout Master by Western Civilisation Some caveats: It appears that tools...
Writing JavaScript for XHTML - Archive of obsolete content
g., you have an & where it should not be), then this method will crash, leaving you with a parser error. Problem: I want to remain forward compatible! Given the direction away from formatting attributes and the possibility of XHTML becoming eventually more prominent (or at least the document author having the possibility of later wanting to make documents available in XHTML for browsers that sup
port it), one may wish to avoid features which are not likely to stay compatible into the future. Solution: Avoid HTML-specific DOM The HTML DOM , even though it is compatible with XHTML 1.0, is not guaranteed to work with future versions of XHTML (perhaps especially the formatting properties which have been deprecated as element attributes). The regular XML DOM provides sufficient methods via the E...
XForms Custom Controls Examples - Archive of obsolete content
"content"></xhtml:div> <children/> </content> <implementation implements="nsIXFormsUIWidget"> <field name="_domparser">null</field> <property name="domparser" readonly="true"> <getter> if (!this._domparser) this._domparser = new DOMParser(); return this._domparser; </getter> </property> <method name="refresh"> <body> // Get new value, parse, and im
port it. var val = this.stringValue; var newdom = this.domparser.parseFromString(val, "text/xml"); var impnode = document.im
portNode(newdom.firstChild, true); // Get content node, clean it, and update it var content = document.getAnonymousElementByAttribute(this, "anonid", "content"); if (content.firstChild) { content.removeChild(content.firstChild); } content.appendChild(impnode); return ...
Developing Mozilla XForms - Archive of obsolete content
should be already installed. Then open your form that causes problems and have a look on the console. Often you'll find the first starting points here or in the Error Console. Schema validation problems The schema-validation extension contains a logging facility that can show some internals on the schema processing. To activate this logging output, set the NSPR_LOG_MODULES environment variable: ex
port NSPR_LOG_MODULES=schemaValidation:5 This only works on a debug build as described above. ...
Troubleshooting XForms Forms - Archive of obsolete content
from the filesystem, make sure that has .xhtml or .xml as the file ending. If you are loading the form from a server, make sure that it serves the files as either application/xhtml+xml or text/xml. Check the XHTML 1.0 Namespace Declaration Mozilla XForms is built upon the XHTML 1.0 specification, which is located at http://www.w3.org/1999/xhtml . Ensure that your <html> element contains the sup
ported namespace declaration: xmlns="http://www.w3.org/1999/xhtml" (instead of the newer, unratified version, XHTML 2.0, located at http://www.w3.org/2002/06/xhtml2 ) Inline Instance, No Controls Get Bound Have you remembered to use the correct namespace for the instance nodes? For an inline instance you most probably need to have <xf:instance xmlns=""> .... Any Instance, No Controls Get Bound ...
XForms Styling - Archive of obsolete content
Just a starting draft. Hopefully someone more proficient in Mozilla XForms and CSS can clean this up Repeats See the Mozilla XForms Specials page for some general points. Switches Can be styled as tabs. Triggers Use appearance="minimal" to be able to style buttons
Portability The Mozilla XForms extension is one of the few XForms processors which allow for styling of the XForms elements directly, using mostly standard CSS. Processors such as Chiba create "old-style" HTML forms from XForms documents, and must be styled accordingly. However, most of the time the transition is straight-forward: View the source after processing of your XForms document, and map the old styles to the new elements. Appearance attributes can also make a big difference. Experimenting with these can g...
XForms Label Element - Archive of obsolete content
put and choices elements must contain a label element. It is valid for a form control to have an empty label element. The label text can be specified in instance data, in a remote document, or as inline text. If more than one source of label text is specified for this element, the order of precedence is: single node binding attributes, linking attributes, inline text. UI behavior accesskey sup
port - if the accesskey attribute is specified on labeled XForms controls or on the label element itself then the label text for the control will contain an indicator as to what the access key is in a standard way. Usually by underlining the accesskey character in the label text. focus behavior - when a label element is clicked or its accesskey is activated then the form control that contains the lab...
XForms Range Element - Archive of obsolete content
Introduction Allows the user to choose a value from within a specific range of values (see the spec). Attributes UI Common appearance - isn't sup
ported. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special incremental - sup
ported, default value is false start - lower bound of possible values end - upper bound of possible values step - is used for incrementing/decrementing values Start/end/step attributes If the value of the bound instance node is outside the range of values specified by the start and end attributes, then the range element receives a xforms-out-of-range event. If the bound value then becomes in range, the range element receives a xforms-in-range event. start Specifies the lower bound of possible values, i.e...
XForms Upload Element - Archive of obsolete content
mit the types of files that the user can select from. Visually, the upload control is shown as a file picker dialog that hides disallowed (filtered) file types. The XForms author can set the filter by using the mediatype attribute directly on the upload element or by placing a mediatype element (see the spec) as a direct child of the upload element. Attributes UI Common appearance - isn't sup
ported. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special mediatype - sup
ported. incremental - isn't sup
ported. Type restrictions The upload element can be bound to a node of type xsd:anyURI, xsd:base64Binary or xsd:hexBinary or any type derived from one of these. Representations The XForms upload element is represented by visually ...
Mozilla XForms User Interface - Archive of obsolete content
Introduction This article is a quick reference of the XForms user interface elements. Mainly this is aimed to document how XForms elements will be presented in Mozilla since the XForms specifications give only a hint of how controls might be rendered. Currently XForms can be hosted by XHTML and XUL in Seamonkey and Firefox. Later we have plans to sup
port XForms hosted by SVG. The XForms specs define two kinds of XForms UI elements, called 'Form Controls' and 'XForms User Interface'. Elements from the "Form Controls" group allows users to interact with instance data. The set of "XForms User Interface" elements exist to aid form authors in combining host language markup and XForms markup together in order to build user interfaces. Some of the 'Form Controls' can have multiple appearances...
Correctly Using Titles With External Stylesheets - Archive of obsolete content
This is because the title attribute on a <link rel="stylesheeet"> element makes it either preferred or an alternative style sheet. This can lead to a stylesheet being ignored, which is typically not what an author intends to do. Why Titles Matter The title attribute affects how your external stylesheet is applied to a document. In fact, the use of the title attribute is so significant that HTML 4.01 categorizes stylesheets according to the presence or absence of a title. ...
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
he stylesheet in question will never validate. This might also be a place to put any Explorer-specific CSS-like rules (such as scrollbar styling rules), which also will not validate. Authors who are not concerned with making sure the rule applies across all namespaces can use a slightly more simplified rule: *:-moz-list-bullet, *:-moz-list-number {font-size: 1em;} Recommendations If it is im
portant to make list item markers match the font size of the content, use one of the suggested rules. In situations where validation is a priority, segregate the rule into a separate stylesheet so that the rule will not confuse CSS validators run against the main stylesheet. Related Links bug 110360 bug 97351 Original Document Information Author(s): Eric A. Meyer, Netscape Communications ...
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
y, to match the user's preferences setting, thus emulating the behavior of old browsers. This only happens when Gecko is in "quirks" mode; in "standards" mode, all styles are inherited by tables as permitted by the CSS specification. In those cases where it is necessary to author documents in "quirks" mode, but the breaking of table inheritance is not desired, authors can use Gecko's standards sup
port to overcome the table-font rule shown above. The value -moz-initial is a proprietary value used to apply the user's (or browser's) default setting for a given property to an element. Because it is not actually part of CSS, it is marked with the prefix -moz- in order to avoid confusion about what is or isn't part of CSS. Overcoming Legacy Behavior All that is needed is a rule that overrides the...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
he problems and how to avoid encountering them. Many authors make use of the CSS2 pseudo-class :hover to style their links. This innovation, first introduced by Microsoft(R) Internet Explorer and later adopted into the CSS specification, is very popular for the styling of text links, particularly those that are supposed to look and act like JavaScript-driven "rollovers." However, advancing CSS sup
port in browsers has caused some unexpectedly aggressive hovering behavior on some pages. Hover and Non-Link Elements Section 5.11.3 of CSS2 defines the three dynamic pseudo-classes (:hover, :active, and :focus) and then goes on to say: CSS doesn't define which elements may be in the above states, or how the states are entered and left. Scripting may change whether elements react to user events or ...
Mozilla's DOCTYPE sniffing - Archive of obsolete content
ow for the following points as well.) Authors writing Web pages to current standards should be able to trigger strict mode. Pages written using any public identifiers in DOCTYPE declarations that appear in the future should be displayed using strict mode. In other words, the algorithm is the best approximation we can find for determining which pages were written after Mozilla became a known im
portant user-agent on the Web. Full Standards Mode The following trigger full standards mode: Any document sent with an XML MIME type such as text/xml, application/xml, or application/xhtml+xml (since sniffing only occurs for documents sent as text/html). Any "DOCTYPE HTML SYSTEM" as opposed to "DOCTYPE HTML PUBLIC", except for the IBM doctype noted below A DOCTYPE declaration without a DTD, i.
XUL Booster - Archive of obsolete content
Create an extension You'll need an extension ID; see Generating GUIDs. Add an Overlay You'll need the chrome address of the content you wish to overlay, ex. chrome://browser/content/browser.xul. Learn more at Creating_a_Mozilla_Extension:Finding_the_file_to_modify To create an XUL:overlay, create a XUL fragment with a top level node that has an ID matching an existing element, ex. ...
Using the DOM File API in chrome code - Extensions
nt can't do it. This protects users from the inherent security risks associated with allowing web content free access to the contents of their disks. If you pass a path to the File constructor from unprivileged code (such as web content), an exception will be thrown. Scope Availability In the JSM scope File is available without needing to do anything special. In Bootstrap scope, this must be im
ported in like so: Cu.im
portGlobalProperties( [ "File" ] ) Accessing a file by hard-coded pathname To reference a file by its path, you can simply use a string literal: var file = File.createFromFileName("path/to/some/file"); Cross platform note: However using hard-coded paths raises cross platform issues since it uses a platform-dependent path separator (here "/"). In the XUL/Mozilla platform t...
Examples - Game development
Lizard Top down Zelda-esque exploration/RPG. QbQbQb A sci-fi themed arcade puzzle game. Bullet Force 3D multiplayer first-person shooter. Elliot Quest 8-bit graphic retro adventure game. RPG MO Isometric MMORPG with similarities to RuneScape Classic and Ultima. Katan.io HTML5 and canvas implementation of Settlers of Catan. Pyramid Solitaire Ancient Egypt Pyramid solitaire app
ported to WebAssembly with Emscripten Assorted demos WaveGL WebGL visualizer for sound sources. Canvas Air
port Simulation Animated map showing planes taking off and landing at air
ports, along with flight path patterns. Animation Physics 3D rendering of terrain and cars, using ammo.js for the physics calculations. Volumetric Particle Flow Physics simulation of flowing liquid. Explosion a...
Publishing games - Game development
ou have to let the world know that you have made something interesting available, which people will enjoy playing. There are many Game promotion techniques -- many of them free -- so even if you're struggling to make a living as an indie dev with zero budget you can still do a lot to let people know about your great new game. Promoting the game helps a lot in monetizing it later on too, so it's im
portant to do it effectively. Game monetization When you spend your time building, publishing and promoting your game, you will at some point consider earning money out of it. Game monetization is essential to anyone who considers their game development work a serious endeavour on the path to becoming an independent game developer able to make a living, so read on and see what your options are. The ...
Bounding volume collision detection with THREE.js - Game development
ich checks whether the Box3 fully wraps another one. Sphere vs. Sphere In a similar fashion as before, there is a Sphere.intersectsSphere method to perform this test. knotBSphere.intersectsSphere(otherSphere); Sphere vs. Box3 Unfortunately this test is not implemented in Three.js, but we can patch Sphere to implement a Sphere vs. AABB intersection algorithm. ...
Explaining basic 3D theory - Game development
entation -- which have to be defined for the newly created scene. Projection transformation (also called perspective transformation) then defines the camera settings. It sets up what can be seen by the camera -- the configuration includes field of view, aspect ratio and optional near and far planes. read the Camera paragraph in the Three.js article to learn about those. The last step is view
port transformation, which involves outputting everything for the next step in the rendering pipeline. Rasterization Rasterization converts primitives (which are connected vertices) to a set of fragments. Those fragments -- which are 3D projections of the 2D pixels -- are aligned to the pixel grid, so eventually they can be printed out as pixels on a 2D screen display during the output merging st...
Crisp pixel art look with image-rendering - Game development
omatically do the up-scaling, which not only solves the blur problem, but also allows you to use the images in their original, smaller size, thus saving download time. Also, some game techniques require algorithms that analyse images, which also benefit from working with smaller images. The CSS property to achieve this scaling is image-rendering. It is still experimental, but there is partial sup
port in most browsers. The steps to achieve this effect are: Create a <canvas> element and set its width and height attributes to the original, smaller resolution. Set its CSS width and height properties to be 2x or 4x the value of the HTML width and height. If the canvas was created with a 128 pixel width, for example, we would set the CSS width to 512px if we wanted a 4x scale. Set the <canvas>...
Square tilemaps implementation: Static maps - Game development
The tilemap data structure To store that map data, we can use a plain object or a custom class. For the sake of simplicity, in the example code a plain object has been used. It contains the basic map properties: cols: The width of the map, in columns. ...
Tiles and tilemaps overview - Game development
lumn = 0; column < map.columns; column++) { for (var row = 0; row < map.rows; row++) { var tile = map.getTile(column, row); var x = column * map.tileSize; var y = row * map.tileSize; drawTile(tile, x, y); } } You can read more about this and see an example implementation in Square tilemaps implementation: Static maps. Scrolling tilemaps Scrolling tilemaps only show a small
portion of the world at a time. They can follow a character -- like in platformers or RPGs -- or allow the player to control the camera -- like in strategy or simulation games. Positioning and camera In all scrolling games, we need a translation between world coordinates (the position where sprites or other elements are located in the level or game world) and screen coordinates (the actual position ...
WebRTC data channels - Game development
This article explains more about this, and shows you how to use libraries to implement data channels in your game. What is a data channel? A WebRTC data channel lets you send text or binary data over an active connection to a peer. In the context of a game, this lets players send data to each other, whether text chat or game status information. Data channels come in two flavors. Reliable channels guarantee that messages you send arrive at the other peer and in the same order in which they're sent. This is analogous to a TCP socket. ...
asm.js - Game development
s an intermediate programming language. asm.js has a very predictable perfomance rate because it is limited to an extremely restricted subset of JavaScript that provides only strictly-typed integers, floats, arithmetic, function calls, and heap accesses. The performance characteristics are closer to native code than that of standard JavaScript. Using a subset of JavaScript asm.js is already sup
ported by major web browsers. Since asm.js runs in a browser it depends heavily on the browser and the hardware. ...
Tools for game development - Game development
ipt language, which can be greatly optimized and run in an ahead-of-time (AOT) compiling engine for much faster performance than your typical JavaScript performance. This is, of course, great for games. Emscripten An LLVM to JavaScript compiler; with Emscripten, you can compile C++ and other languages that can compile to LLVM bytecode into high-performance JavaScript. This is a great tool for
porting applications to the Web! There is a useful Emscripten tutorial available on the wiki. Note that we are aiming to cover Emscripten in its own section of MDN. Gecko profiler The Gecko profiler extension lets you profile your code to help figure out where your performance issues are so that you can make your game run at top speed. Shumway Shumway is a renderer for Adobe Flash built entirely...
Create the Canvas and draw on it - Game development
in our case, red. We're not limited to rectangles -- here's a piece of code for printing out a green circle. Try adding this to the bottom of your JavaScript, saving and refreshing: ctx.beginPath(); ctx.arc(240, 160, 20, 0, Math.PI*2, false); ctx.fillStyle = "green"; ctx.fill(); ctx.closePath(); As you can see we're using the beginPath() and closePath() methods again. Between them, the most im
portant part of the code above is the arc() method. It takes six parameters: x and y coordinates of the arc's center arc radius start angle and end angle (what angle to start and finish drawing the circle, in radians) direction of drawing (false for clockwise, the default, or true for anti-clockwise.) This last parameter is optional. The fillStyle property looks different than before. This is ...
Mouse controls - Game development
will do exactly that. Add the following function to your code, below the previous line you added: function mouseMoveHandler(e) { var relativeX = e.clientX - canvas.offsetLeft; if(relativeX > 0 && relativeX < canvas.width) { paddleX = relativeX - paddleWidth/2; } } In this function we first work out a relativeX value, which is equal to the horizontal mouse position in the view
port (e.clientX) minus the distance between the left edge of the canvas and left edge of the view
port (canvas.offsetLeft) -- effectively this is equal to the distance between the canvas left edge and the mouse pointer. If the relative X pointer position is greater than zero and lower than the Canvas width, the pointer is within the Canvas boundaries, and the paddleX position (anchored on the left edge...
Move the ball - Game development
Let's define these small values as dx and dy and set their values to 2 and -2 respectively. Add the following below your x and y variable definitions: var dx = 2; var dy = -2; The last thing to do is to update x and y with our dx and dy variable on every frame, so the ba...
Paddle and keyboard controls - Game development
each case is set to true. When the key is released, the variable is set back to false. Both functions take an event as a parameter, represented by the e variable. From that you can get useful information: the key holds the information about the key that was pressed. Most browsers use ArrowRight and ArrowLeft for the left/right cursor keys, but we need to also include Right and Left checks to sup
port IE/Edge browsers. If the left cursor is pressed, then the leftPressed variable is set to true, and when it is released, the leftPressed variable is set to false. The same pattern follows with the right cursor and the rightPressed variable. The paddle moving logic We've now set up the variables for storing the info about the pressed keys, event listeners, and relevant functions. Next we'll get i...
Track the score and win - Game development
The document.location.reload() function reloads the page and starts the game again once the alert button is clicked. Compare your code The latest code looks (and works) like this, in case you want to compare and contrast it with yours: Exercise: Add more points per brick hit, print out the number of collected points in the end game alert box. Next steps The gam...
2D breakout game using Phaser - Game development
pt is the best way to get a solid knowledge of web game development. If you are not already familiar with pure JavaScript game development, we would suggest that you first work through this series' counterpart, 2D breakout game using pure JavaScript. After that, you can pick any framework you like and use it for your projects; we have chosen Phaser as it is a good solid framework, with a good sup
port and community available, and a good set of plugins. Frameworks speed up development time and help take care of the boring parts, allowing you to concentrate on the fun stuff. However, frameworks are not always perfect, so if something unexpected happens or you want to write some functionality that the framework does not provide, you will need some pure JavaScript knowledge. Note: This series of...
Game development
ls and technique articles in the main menu on the left, so feel free to explore. We've also included a reference section so you can easily find information about all the most common APIs used in game development. Note: Creating games on the web draws on a number of core web technologies such as HTML, CSS, and JavaScript. The Learning Area is a good place to go to get started with the basics.
Port native games to the Web If you are a native developer (for example writing games in C++), and you are interested in how you can
port your games over to the Web, you should learn more about our Emscripten tool -- this is an LLVM to JavaScript compiler, which takes LLVM bytecode (e.g. generated from C/C++ using Clang, or from another language) and compiles that into asm.js, which can be run on the...
ALPN - MDN Web Docs Glossary: Definitions of Web-related terms
Application-Layer Protocol Negotiation (ALPN) is a TLS extension which indicates what application layer protocol is negotiating the encryped connection without requiring additional round trips. Im
portant protocol identifiers: Protocol Identification sequence HTTP/1.1 0x68 0x74 0x74 0x70 0x2F 0x31 0x2E 0x31 ("http/1.1") HTTP/2 0x68 0x32 ("h2") HTTP/2 over cleartext TCP 0x68 0x32 0x63 ("h2c") Specifications Specification Status Notes RFC 7301 IETF RFC Initial definition. ...
Abstraction - MDN Web Docs Glossary: Definitions of Web-related terms
implementation in complex software systems. It hides the technical complexity of systems behind simpler APIs. Advantages of Data Abstraction Helps the user to avoid writing low level code. Avoids code duplication and increases reusability. Can change internal implementation of class independently without affecting the user. Helps to increase security of an application or program as only im
portant details are provided to the user. Example class ImplementAbstraction { // method to set values of internal members set(x, y) { this.a = x; this.b = y; } display() { console.log('a = ' + this.a); console.log('b = ' + this.b); } } const obj = new ImplementAbstraction(); obj.set(10, 20); obj.display(); // a = 10 // b = 20 Learn more General knowledge Abstractio...
Algorithm - MDN Web Docs Glossary: Definitions of Web-related terms
A cooking recipe is a simple algorithm for humans. A sorting algorithm is often used in computer programming to explain a machine how to sort data. Common algorithms are Pathfinding algorithms such as the Traveling Salesman Problem, Tree Traversal algorithms and so on. There are also Machine Learning algorithms such as Linear Regression, Logistic Regression, Decision Tree, Random Forest, Sup
port Vector Machine, Recurrent Neural Network (RNN), Long Short Term Memory (LSTM) Neural Network, Convolutional Neural Network (CNN), Deep Convolutional Neural Network and so on. Learn more General knowledge Algorithm on Wikipedia Technical reference Explanations of sorting algorithms Explanations of algorithmic complexity ...
Alignment subject - MDN Web Docs Glossary: Definitions of Web-related terms
etween column boxes added to the relevant column gaps. Flex containers For justify-content, the flex items in each flex line. For align-content, the flex lines. Note, this only has an effect on multi-line flex containers. Grid containers The grid tracks in the appropriate axis, with any spacing inserted between tracks added to the relevant gutters. Collapsed gutters are treated as a single op
portunity for space insertion. Learn more CSS Box Alignment ...
Apple Safari - MDN Web Docs Glossary: Definitions of Web-related terms
Safari is a Web browser developed by Apple and bundled with both macOS and iOS. It's based on the open source WebKit engine. Learn more General Knowledge Safari on Wikipedia Safari on apple.com Technical information The WebKit project WebKit nightly build Re
porting a bug for Safari ...
Base64 - MDN Web Docs Glossary: Definitions of Web-related terms
ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. Base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with ASCII. This is to ensure that the data remain intact without modification during trans
port. Base64 is commonly used in a number of applications including email via MIME, and storing complex data in XML. One common application of base64 encoding on the web is to encode binary data so it can be included in a data: URL. In JavaScript there are two functions respectively for decoding and encoding base64 strings: btoa(): creates a base-64 encoded ASCII string from a "string" of binary...
Bootstrap - MDN Web Docs Glossary: Definitions of Web-related terms
Bootstrap is a free, open source HTML, CSS, and JavaScript framework for quickly building responsive websites. Initially, Bootstrap was called Twitter Blueprint and was developed by a team working at Twitter. It sup
ports responsive design and features predefined design templates that you can use out of the box, or customize for your needs with your code. You don't need to worry about compatibility with other browsers either, as Bootstrap is compatible with all modern browsers and newer versions of Internet Explorer. ...
CDN - MDN Web Docs Glossary: Definitions of Web-related terms
static assets) of libraries like Bootstrap, jQuery etc. Using CDN for those library files is preferable for a number of reasons: Serving libraries' static assets over CDN lowers the request burden on an organization's own servers. Most CDNs have servers all over the globe, so CDN servers may be geographically nearer to your users than your own servers. Geographical distance affects latency pro
portionally. CDNs are already configured with proper cache settings. Using a CDN saves further configuration for static assets on your own servers. ...
CSRF - MDN Web Docs Glossary: Definitions of Web-related terms
CSRF (Cross-Site Request Forgery) is an attack that impersonates a trusted user and sends a website unwanted commands. This can be done, for example, by including malicious parameters in a URL behind a link that pur
ports to go somewhere else: <img src="https://www.example.com/index.php?action=delete&id=123"> For users who have modification permissions on https://www.example.com, the <img> element executes action on https://www.example.com without their noticing, even if the element is not at https://www.example.com. There are many ways to prevent CSRF, such as implementing RESTful API, adding secure tokens, etc. Learn more General knowledge Cross-site request forgery on Wikipedia Prevention measures ...
CSS - MDN Web Docs Glossary: Definitions of Web-related terms
ll paragraphs in the document will be affected by that rule */ p { /* The "color" property defines the text color, in this case yellow. */ color: yellow; /* The "background-color" property defines the background color, in this case black. */ background-color: black } "Cascading" refers to the rules that govern how selectors are prioritized to change a page's appearance. This is a very im
portant feature, since a complex website can have thousands of CSS rules. Learn more General knowledge Learn CSS CSS on Wikipedia Technical reference The CSS documentation on MDN The CSS Working Group current work ...
Code splitting - MDN Web Docs Glossary: Definitions of Web-related terms
can be split into multiple smaller files. Then features required at page load can be downloaded immediately with additional scripts being lazy loaded after the page or application is interactive, thus improving performance. While the total amount of code is the same (and perhaps even a few bytes larger), the amount of code needed during initial load can be reduced. Code splitting is a feature sup
ported by bundlers like Webpack and Browserify which can create multiple bundles that can be dynamically loaded at runtime. See Also Bundling Lazy loading HTTP/2 Tree shaking ...
Dominator - MDN Web Docs Glossary: Definitions of Web-related terms
So if the garbage collector found A to be unreachable and eligible for reclaiming, than B would also be unreachable and eligible for reclaiming. So objects that A dominates contribute to the retained size of A: that is, the total amount of memory that could be freed if A itself were freed. ...
FTU - MDN Web Docs Glossary: Definitions of Web-related terms
FTU (First Time Use) is the app that loads when you run a newly-installed version of Gecko on a Firefox OS device. You can use FTU to set many im
portant options (e.g. timezone, WiFi details, default language, im
porting contacts), or take the "Phone Tour" to find out more about your device. ...
Fragmentainer - MDN Web Docs Glossary: Definitions of Web-related terms
Fragmentainers can be pre-defined, or generated as needed. When breakable content would overflow a fragmentainer in the block dimension, it breaks into the next container in its fragmentation context instead. Fragmented contexts are found in CSS Paged Media, where the fragmentainer would be the box which defines a page. ...
Fuzz testing - MDN Web Docs Glossary: Definitions of Web-related terms
Fuzzing is a technique for testing software using automated tools to provide invalid or unexpected input to a program or function in a program, then checking the results to see if the program crashes or otherwise acts inappropriately. This is an im
portant way to ensure that software is stable, reliable, and secure, and we use fuzzing a lot at Mozilla. Jesse's blog posts about fuzzing Wikipedia: Fuzz testing fuzzdb jsfuzz - coverage guided javascript fuzzer ...
Gzip compression - MDN Web Docs Glossary: Definitions of Web-related terms
Gzip is a file format used for file compression and decompression. It is based on the Deflate algorithm that allows files to be made smaller in size which allows for faster network transfers. Gzip is commonly sup
ported by web servers and modern browsers, meaning that servers can automatically compress files with Gzip before sending them, and browsers can uncompress files upon receiving them. Learn more How to enable compression and gzip for page speed. Gzip on Wikipedia ...
Gecko - MDN Web Docs Glossary: Definitions of Web-related terms
Gecko is the layout engine developed by the Mozilla Project and used in many apps/devices, including Firefox and Firefox OS. Web browsers need software called a layout engine to interpret HTML, CSS, JavaScript, and embedded content (like images) and draw everything to your screen. Besides this, Gecko makes sure associated APIs work well on every operating system Gecko sup
ports, and that appropriate APIs are exposed only to relevant sup
port targets. This means that Gecko includes, among other things, a networking stack, graphics stack, layout engine, a JavaScript virtual machine, and
porting layers. Since all Firefox OS apps are Web apps, Firefox OS uses Gecko as its app runtime as well. Learn more General knowledge Gecko on Wikipedia Technical Reference The Gecko documentat...
Gonk - MDN Web Docs Glossary: Definitions of Web-related terms
Firefox OS and consists of a Linux kernel (based on the Android Open Source Project (AOSP)) and userspace hardware abstraction layer (HAL). The kernel and several of the userspace libraries are common open-source projects: Linux, libusb, bluez, and so forth. Some other parts of the HAL are shared with AOSP: GPS, camera, and others. You could call Gonk a very simple Linux distribution. Gonk is a
porting target of Gecko (just as Gecko has been
ported to OS X, Windows, and Android). Since Firefox OS has full control over Gonk, we can expose interfaces to Gecko that aren't accessible on other operating systems, for example the full telephony stack and display frame buffer. Learn more Gonk page on the Firefox OS zone ...
Google Chrome - MDN Web Docs Glossary: Definitions of Web-related terms
Note that the iOS version of Chrome uses that platform's WebView, not Blink. Learn more General knowledge Google Chrome on Wikipedia For Chrome Users Use one of these links if you're an everyday user. Android iOS Desktop For Web Developers If you want to try the latest Chrome features, install one of the pre-stable builds. ...
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
rid or grid-template properties. Tracks are also created in the implicit grid by positioning a grid item outside of the tracks created in the explicit grid. The image below shows the first row track on a grid. Track sizing in the explicit grid When defining grid tracks using grid-template-columns and grid-template-rows you may use any length unit, and also the flex unit, fr which indicates a
portion of the available space in the grid container. The example below demonstrates a grid with three column tracks, one of 200 pixels, the second of 1fr, the third of 3fr. Once the 200 pixels has been subtracted from the space available in the grid container, the remaining space is divided by 4. One part is given to column 2, 3 parts to column 3. * {box-sizing: border-box;} .wrapper { border...
HPKP - MDN Web Docs Glossary: Definitions of Web-related terms
HTTP Public Key Pinning (HPKP) is a security feature that tells a web client to associate a specific cryptographic public key with a certain web server to decrease the risk of MITM attacks with forged certificates. Learn more Public-Key-Pins Public-Key-Pins-Re
port-Only RFC 7469 Wikipedia: HTTP Public Key Pinning ...
HTTP - MDN Web Docs Glossary: Definitions of Web-related terms
he HyperText Transfer Protocol (HTTP) is the underlying network protocol that enables transfer of hypermedia documents on the Web, typically between a browser and a server so that humans can read them. The current version of the HTTP specification is called HTTP/2. As part of a URI, the "http" within "http://example.com/" is called a "scheme". Resources using the "http" schema are typically trans
ported over unencrypted connections using the HTTP protocol. The "https" scheme (as in "https://developer.mozilla.org") indicates that a resource is trans
ported using the HTTP protocol, but over a secure TLS channel. HTTP is textual (all communication is done in plain text) and stateless (no communication is aware of previous communications). This property makes it ideal for humans to read documents ...
HTTP/2 - MDN Web Docs Glossary: Definitions of Web-related terms
HTTP/2 is a major revision of the HTTP network protocol. The primary goals for HTTP/2 are to reduce latency by enabling full request and response multiplexing, minimize protocol overhead via efficient compression of HTTP header fields, and add sup
port for request prioritization and server push. HTTP/2 does not modify the application semantics of HTTP in any way. All the core concepts found in HTTP 1.1, such as HTTP methods, status codes, URIs, and header fields, remain in place. Instead, HTTP/2 modifies how the data is formatted (framed) and trans
ported between the client and server, both of which manage the entire process, and hides application complexity within the new framing layer. As a result, all existing applications can be delivered without modification. ...
I18N - MDN Web Docs Glossary: Definitions of Web-related terms
rom "internationalization", a 20-letter word) is the best practice that enables products or services to be readily adapted to any target culture. Internationalization is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language. ...
ITU - MDN Web Docs Glossary: Definitions of Web-related terms
for video and audio data formats used for streaming, teleconferencing, and other purposes. For example, the ITU and the Moving Picture Experts Group (MPEG) worked together to develop and publish, as well as to maintain, the various MPEG specifications, such as MPEG-2 (ITU H.262), AVC (ITU H.264), and HEVC (ITU H.265). Learn more General knowledge ITU web site Learn about it ITU history
portal ...
Internationalization - MDN Web Docs Glossary: Definitions of Web-related terms
hortened to "i18n", is the adapting of a web site or web application to different languages, regional differences, and technical requirements for different regions and countries. Internationalization is the process of architecting your web application so that it can be quickly and easily adapted to various languages and regions without much engineering effort when new languages and regions are sup
ported. Also so that a user can browse features to translate or localize the application to access all the content without breaking the layout. Internationalization includes sup
port for multiple character sets (usually via Unicode), units of measure (currency, ?C/?F, km/miles, etc.), date and time formats, keyboard layouts, and layout and text directions. ...
JSON - MDN Web Docs Glossary: Definitions of Web-related terms
JSON can represent numbers, booleans, strings, null, arrays (ordered sequences of values), and objects (string-value mappings) made up of these values (or of other arrays and objects). JSON does not natively represent more complex data types like functions, regular expressions, dates, and so on. ...
Java - MDN Web Docs Glossary: Definitions of Web-related terms
Java is statically typed and features a similar syntax to C. It comes with a large library of readily usable functions, the Java Software Development Kit (SDK). Programs are compiled only once ahead of time into a proprietary byte code and package format that runs inside the Java Virtual Machine (JVM). The JVM is available across many platforms, which allows Java programs to run almost everywhere without the need to be compiled or packaged again. This makes it a preferred language in many large enterprises with heterogenous landscapes, but may be perceived "heavy". ...
JavaScript - MDN Web Docs Glossary: Definitions of Web-related terms
he world's most commonly-used languages, owing to the recent growth and performance improvement of APIs available in browsers. Origins and History Conceived as a server-side language by Brendan Eich (then employed by the Netscape Corporation), JavaScript soon came to Netscape Navigator 2.0 in September 1995. JavaScript enjoyed immediate success and Internet Explorer 3.0 introduced JavaScript sup
port under the name JScript in August 1996. In November 1996, Netscape began working with ECMA International to make JavaScript an industry standard. Since then, the standardized JavaScript is called ECMAScript and specified under ECMA-262, whose latest (tenth, ES2019) edition is available as of June 2019. Recently, JavaScript's popularity has expanded even further through the successful Node.js pla...
Microsoft Internet Explorer - MDN Web Docs Glossary: Definitions of Web-related terms
with-internet-explorer-9 http://windows.microsoft.com/en-us/internet-explorer/internet-explorer-help http://windows.microsoft.com/en-us/internet-explorer/make-ie-default-browser#ie=ie-11 Technical reference http://windows.microsoft.com/en-us/internet-explorer/products/ie-8/system-requirements http://windows.microsoft.com/en-us/internet-explorer/products/ie-9/system-requirements http://sup
port.microsoft.com/kb/969393 ...
UDP (User Datagram Protocol) - MDN Web Docs Glossary: Definitions of Web-related terms
UDP (User Datagram Protocol) is a long standing protocol used together with IP for sending data when transmission speed and efficiency matter more than security and reliability. UDP uses a simple connectionless communication model with a minimum of protocol mechanism. UDP provides checksums for data integrity, and
port numbers for addressing different functions at the source and destination of the datagram. It has no handshaking dialogues, and thus exposes the user's program to any unreliability of the underlying network; There is no guarantee of delivery, ordering, or duplicate protection. If error-correction facilities are needed at the network interface level, an application may use the Transmission Control Protocol (TCP) or Stream Control Transmission Protocol (SCTP) which are des...
WebExtensions - MDN Web Docs Glossary: Definitions of Web-related terms
WebExtensions is a cross-browser system for developing browser extensions in Firefox. This system provides APIs, which to a large extent are sup
ported across different browsers like Mozilla Firefox, Google Chrome, Opera Browser, and Microsoft Edge . Learn more Technical reference Browser extensions on MDN ...
WebKit - MDN Web Docs Glossary: Definitions of Web-related terms
WebKit is a framework that displays properly-formatted webpages based on their markup. Apple Safari depends on WebKit, and so do many mobile browsers (since WebKit is highly
portable and customizable). WebKit began life as a fork of KDE's KHTML and KJS libraries, but many individuals and companies have since contributed (including KDE, Apple, Google, and Nokia). WebKit is an Apple trademark, and the framework is distributed under a BSD-form license. However, two im
portant components fall under the LGPL: the WebCore rendering library and the JavaScriptCore engine. Learn more General knowledge WebKit on Wikipedia Technical reference WebKit CSS extensions ...
beacon - MDN Web Docs Glossary: Definitions of Web-related terms
A web beacon is a small object, such as a 1 pixel gif, embedded in markup, used to communicate information back to the web server or to 3rd party servers. Beacons are generally included to provide information about the user for statistical purposes. Beacons are often included within third party scripts for collecting user data, performance metrics and error re
porting. There is a W3C Draft Beacon Specification to standardize the beacon as an interface to asynchronously transfer HTTP data from User Agent to a web server prior to page load without negative performance impact. See Also Real User Monitoring (RUM) ...
Cacheable - MDN Web Docs Glossary: Definitions of Web-related terms
server. Not all HTTP responses can be cached, these are the following constraints for an HTTP response to be cached: The method used in the request is itself cacheable, that is either a GET or a HEAD method. A response to a POST or PATCH request can also be cached if freshness is indicated and the Content-Location header is set, but this is rarely implemented. (For example, Firefox does not sup
port it per https://bugzilla.mozilla.org/show_bug.cgi?id=109553.) Other methods, like PUT or DELETE are not cacheable and their result cannot be cached. The status code of the response is known by the application caching, and it is considered cacheable. The following status code are cacheable: 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501. There are specific headers in the response, like...
Character set - MDN Web Docs Glossary: Definitions of Web-related terms
gnize Character, including letters, numbers, punctuation marks, and whitespace. In earlier times, countries developed their own character sets due to their different languages used, such as Kanji JIS codes (e.g. Shift-JIS, EUC-JP, etc.) for Japanese, Big5 for traditional Chinese, and KOI8-R for Russian. However, Unicode gradually became most acceptable character set for its universal language sup
port. If a character set is used incorrectly (For example, Unicode for an acticle encoded in Big5), you may see nothing but broken characters, which are called Mojibake. ...
firewall - MDN Web Docs Glossary: Definitions of Web-related terms
A firewall is a system that filters network traffic. It can either let it pass or block it, according to some specified rules. For example, it can block incoming connections aimed at a certain
port or outgoing connections to a certain IP address. Firewalls can be as simple as a single piece of software, or more complex, like a dedicated machine whose only function is to act as a firewall. Learn more General knowledge Firewall (computing) on Wikipedia ...
Safe - MDN Web Docs Glossary: Definitions of Web-related terms
In other words, a method is safe if it leads to a read-only operation. Several common HTTP methods are safe: GET, HEAD, or OPTIONS. All safe methods are also idempotent, but not all idempotent methods are safe. For example, PUT and DELETE are both idempotent but unsafe. Even if safe methods have a read-only semantic, servers can alter their state: e.g. they can log or keep statistics. What is im
portant here is that by calling a safe method, the client doesn't request any server change itself, and therefore won't create an unnecessary load or burden for the server. Browsers can call safe methods without fearing to cause any harm to the server; this allows them to perform activities like pre-fetching without risk. Web crawlers also rely on calling safe methods. Safe methods don't need to serv...
About Scriptable Interfaces - Interfaces
this document is based on http://www.mozilla.org/scriptable/ and Creating XPCOM Components Scriptable Interfaces Interfaces allow XPCOM components to expose their functionality to the outside world while hiding the inner details of the component implementation. Interfaces are written in an Interface Description Language. When we label an interface as scriptable, we're saying that components ex
porting this interface can be referenced (through this interface) from scripts (e.g JavaScript), and that we can write new components implementing the interface using script languages. XPConnect XPConnect is a technology that allows scriptable interfaces to be used/implemented from/in JavaScript scripts. No other scripts languages are sup
ported by XPConnect. Python There's an extension extensions/...
Creating fancy letterheaded paper - Learn web development
the bottom of the letter Adds a semi-transparent gradient over the top of both of the previous backgrounds that gives the letter a bit of texture. Make it slightly dark right near the top and bottom, but completely transparent for a large part of the center. Add another background declaration that just adds the top image to the top of the letter, as a fallback for browsers that don't sup
port the previous declaration. Add a white background color to the letter. Add a 1mm top and bottom solid border to the letter, in a color that is inkeeping with the rest of the color scheme. The logo To the <h1>, add the logo as a background image. Add a filter to the logo to give it a subtle drop shadow. Now comment out the filter and implement the drop shadow in a different (slightly more ...
Overflowing content - Learn web development
s with large and small amounts of content. Increase the font sizes of text. Generally ensure that your CSS works in a robust way. Changing the value of overflow to hide content, or to add scrollbars, is likely to be reserved for a few select use cases. (for example, where you intend to have a scrolling box) Test your skills! There is a lot to absorb from this lesson! Can you remember the most im
portant information? To check your understanding, see Test your skills: overflow. Summary This lesson introduced the concept of overflow. You should understand that default CSS avoids making overflowing content invisible. You have discovered that you can manage potential overflow, and also, that you should test work to make sure it does not accidentally cause problematic overflow. Previous Ove...
Attribute selectors - Learn web development
ector will match a value that begins with a -- it only matches the first list item because the other two list items start with an uppercase A. The second selector uses the case-insensitive flag and so matches all of the list items. Note: There is also a newer value s, which will force case-sensitive matching in contexts where matching is normally case-insensitive, however this is less well sup
ported in browsers and isn't very useful in an HTML context. Next steps Now we are done with attribute selectors, you can continue on to the next article and read about pseudo-class and pseudo-element selectors. Previous Overview: Building blocks Next In this module Cascade and inheritance CSS selectors Type, class, and ID selectors Attribute selectors Pseudo-classes and p...
Combinators - Learn web development
hat element in the markup. It is often better to create a simple class and apply that to the element in question. That said, your knowledge of combinators will come in very useful if you need to get to something in your document and are unable to access the HTML, perhaps due to it being generated by a CMS. Test your skills! We have covered a lot in this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Selectors. Moving on This is the last section in our lessons on selectors. Next we will move on to another im
portant part of CSS -- the CSS Box Model. Previous Overview: Building blocks Next In this module Cascade and inheritance CSS selectors...
The box model - Learn web development
when the <a> is hovered. The padding appears to overlap the border on the <ul> element. This is because the <a> is an inline element. Add display: inline-block to the rule with the .links-list a selector, and you will see how it fixes this issue by causing the padding to be respected by other elements. Test your skills! We have covered a lot in this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: The Box Model. Summary That's most of what you need to understand about the box model. You may want to return to this lesson in the future if you ever find yourself confused about how big boxes are in your layout. In the next lesson, we will take a look at...
Test your skills: Media Queries and Responsive Design - Learn web development
if on a phone. Your task is to create a desktop version of this layout which displays when there is enough screen width to accomodate it. You can see the layout you are aiming for in the screenshot below. There are a number of ways that you could create the desktop layout, enjoy experimenting. You could also add a second breakpoint perhaps creating a layout that would work well on a tablet in
portrait mode. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking ...
CSS first steps - Learn web development
TML, as discussed in the Introduction to HTML module. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This module contains the following articles, which will take you through all the basic theory of CSS, and provide op
portunities for you to test out some skills. What is CSS? CSS (Cascading Style Sheets) allows you to create great-looking web pages, but how does it work under the hood? This article explains what CSS is, with a simple syntax example, and also covers some key terms about the language. Getting started with CSS In this article we will take a simple HTML document and apply CSS to it, learning some ...
Using CSS generated content - Learn web development
However, there are situations where it makes sense to specify certain content as part of the stylesheet, not as part of the document. You can specify text or image content within a stylesheet when that content is closely linked to the document's structure. Note: Content specified in a stylesheet does not become part of the DOM. ...
create fancy boxes - Learn web development
right : -60px; /* To make sure that the bottom of the cloud remains flat, we must make the bottom left corner of the right ear square. */ border-bottom-left-radius: 0; } Blockquote A more practical example of using pseudo-elements is to build a nice formatting for HTML <blockquote> elements. So let's see an example with a slightly different HTML snippet (which provide us an op
portunity to see how to also handle design localization): <blockquote>People who think they know everything are a great annoyance to those of us who do. <i>Isaac Asimov</i></blockquote> <blockquote lang="fr">L'intelligence, c'est comme les parachutes, quand on n'en a pas, on s'ecrase. <i>Pierre Desproges</i></blockquote> So here comes our style: blockquote { min-height: 5em; padding : 1em 4em...
Styling text - Learn web development
ing in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. Styling lists Lists behave like any other text for the most part, but there are some CSS properties specific to lists that you need to know about, and some best practices to consider. This article explains all. Styling links When styling links, it is im
portant to understand how to make use of pseudo-classes to style link states effectively, and how to style links for use in common varied interface features such as navigation menus and tabs. We'll look at all these topics in this article. Web fonts Here we will explore web fonts in detail -- these allow you to download custom fonts along with your web page, to allow for more varied, custom text sty...
Learn to style HTML using CSS - Learn web development
acing, drop shadows and other text features. We round off the module by looking at applying custom fonts to your page, and styling lists and links. CSS layout At this point we've already looked at CSS fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. Now it's time to look at how to place your boxes in the right place in relation to the view
port, and one another. We have covered the necessary prerequisites so we can now dive deep into CSS layout, looking at different display settings, modern layout tools like flexbox, CSS grid, and positioning, and some of the legacy techniques you might still want to know about. Solving common CSS problems Use CSS to solve common problems provides links to sections of content explaining how to use CS...
How does the Internet work? - Learn web development
nd the Web. Summary The Internet is the backbone of the Web, the technical infrastructure that makes the Web possible. At its most basic, the Internet is a large network of computers which communicate all together. The history of the Internet is somewhat obscure. It began in the 1960s as a US-army-funded research project, then evolved into a public infrastructure in the 1980s with the sup
port of many public universities and private companies. The various technologies that sup
port the Internet have evolved over time, but the way it works hasn't changed that much: Internet is a way to connect computers all together and ensure that, whatever happens, they find a way to stay connected. Active Learning How the internet Works in 5 minutes: A 5 minute video to understand the very basics ...
How do I use GitHub Pages? - Learn web development
in the Git version control system. You can then collaborate on code projects, and the system is open-source by default, meaning that anyone in the world can find your GitHub code, use it, learn from it, and improve on it. You can do that with other people's code too! This article provides a basic guide to publishing content using Github's gh-pages feature. Publishing content GitHub is a very im
portant and useful community to get involved in, and Git/GitHub is a very popular version control system -- most tech companies now use it in their workflow. GitHub has a very useful feature called GitHub Pages, which allows you to publish website code live on the Web. Basic Github setup First of all, install Git on your machine. This is the underlying version control system software that GitHub w...
What is a Domain Name? - Learn web development
Summary Domain names are a key part of the Internet infrastructure. They provide a human-readable address for any web server available on the Internet. Any Internet-connected computer can be reached through a public IP address, either an IPv4 address (e.g. 173.194.121.32) or an IPv6 address (e.g., 2027:0da8:8b73:0000:0000:8a2e:0370:1337). ...
What is accessibility? - Learn web development
e, so that screen readers read your text properly. Make sure that a user can navigate to all widgets on a page solely with the keyboard, without getting trapped. (At least let them Tab in and out.) And that's just the beginning. Accessibility champions Since 1999, the W3C has operated a working group called the Web Accessibility Initiative (WAI) promoting accessibility through guidelines, sup
port material, and international resources. More details Please refer to: Wikipedia article about accessibility WAI (W3C's Web Accessibility Initiative) Next steps Accessibility can impact both a website's design and technical structure. From a design point of view, we suggest learning about designing for all types of users. If the technical side interests you more, you could learn how to...
What software do I need to build a website? - Learn web development
ssword, and other information needed to connect to their server. Bear in mind that (S)FTP is now somewhat old-fashioned, and other uploading systems are starting to become popular, such as RSync and Git/GitHub. Note: FTP is inherently insecure. You should make sure your hosting provider allows use of a secure connection, e.g. SFTP or RSync over SSH. Uploading files to a web server is a very im
portant step while creating a website, so we cover it in detail in a separate article. For now, here's a short list of free basic (S)FTP clients: Operating system FTP software Windows WinSCP Moba Xterm FileZilla (All OS) Linux Nautilus/Files (Gnome) Dolphin (KDE) Mac OS ...
How do you set up a local testing server? - Learn web development
jump up one directory level if you need to cd .. Enter the command to start up the server in that directory: # If Python version returned above is 3.X python3 -m http.server # On windows try "python" instead of "python3", or "py -3" # If Python version returned above is 2.X python -m SimpleHTTPServer By default, this will run the contents of the directory on a local web server, on
port 8000. You can go to this server by going to the URL localhost:8000 in your web browser. Here you'll see the contents of the directory listed -- click the HTML file you want to run. Note: If you already have something running on
port 8000, you can choose another
port by running the server command followed by an alternative
port number, e.g. python3 -m http.server 7800 (Python 3.x) or python -...
Test your skills: Form validation - Learn web development
rstood our Client-side form validation article. Note: You can try out solutions locally, however it may be helpful to put your code in an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Form validation 1 In this task, we are providing you with a simple sup
port query form, and we want you to add some validation features to it: Make all of the input fields mandatory to complete before the form can be submitted. Change the type of the "Email address" and "Phone number" fields to make the browser apply some more specific validation suitable for the data being asked for. Give the "User name" field a required length of between 5 and 20 characters, the "...
Front-end web developer - Learn web development
information and helping yourself. If you are still stuck, feel free to post a question on our Discourse forum. Let's get started. Good luck! The learning pathway Getting started Time to complete: 1.5-2 hours Prerequisites Nothing except basic computer literacy. How will I know I'm ready to move on? There are no assessments in this part of the course. But make sure you don't skip. It is im
portant to get you set up and ready to do work for exercises later on in the course. Guides Installing basic software -- basic tool setup (15 min read) Background on the web and web standards (45 min read) Learning and getting help (45 min read) Semantics and structure with HTML Time to complete: 35-50 hours Prerequisites Nothing except basic computer literacy, and a basic web development e...
CSS basics - Learn web development
n style an HTML element. (In this example, color is a property of the <p> elements.) In CSS, you choose which properties you want to affect in the rule. Property value To the right of the property--after the colon--there is the property value. This chooses one out of many possible appearances for a given property. (For example, there are many color values in addition to red.) Note the other im
portant parts of the syntax: Apart from the selector, each ruleset must be wrapped in curly braces. ({}) Within each declaration, you must use a colon (:) to separate the property from its value or values. Within each ruleset, you must use a semicolon (;) to separate each declaration from the next one. To modify multiple property values in one ruleset, write them separated by semicolons, like t...
HTML basics - Learn web development
into a list <p>At Mozilla, we're a global community of technologists, thinkers, and builders working together ... </p> We could modify the markup to this <p>At Mozilla, we're a global community of</p> <ul> <li>technologists</li> <li>thinkers</li> <li>builders</li> </ul> <p>working together ... </p> Try adding an ordered or unordered list to your example page. Links Links are very im
portant -- they are what makes the web a web! To add a link, we need to use a simple element -- <a> -- "a" being the short form for "anchor". To make text within your paragraph into a link, follow these steps: Choose some text. We chose the text "Mozilla Manifesto". Wrap the text in an <a> element, as shown below: <a>Mozilla Manifesto</a> Give the <a> element an href attribute, as shown below...
How the Web works - Learn web development
something from. In addition to the client and the server, we also need to say hello to: Your internet connection: Allows you to send and receive data on the web. It's basically like the street between your house and the shop. TCP/IP: Transmission Control Protocol and Internet Protocol are communication protocols that define how data should travel across the internet. This is like the trans
port mechanisms that let you place an order, go to the shop, and buy your goods. In our example, this is like a car or a bike (or however else you might get around). DNS: Domain Name Servers are like an address book for websites. When you type a web address in your browser, the browser looks at the DNS to find the website's real address before it can retrieve the website. The browser needs to find ou...
Installing basic software - Learn web development
e browsers and have them ready for testing. Note: Internet Explorer is not compatible with some modern web features and it may not be able to run your project. You usually don't need to worry about making your web projects compatible with it, as very few people still use it -- certainly don't worry too much about it while you are learning. You might sometimes run into a project that requires sup
port for it. Installing a local web server Some examples will need to be run by a web server to work successfully. You can find out how to do this in How do you set up a local testing server? Overview: Getting started with the web Next In this module Installing basic software What will your website look like? Dealing with files HTML basics CSS basics JavaScript basics Publishing y...
The web and web standards - Learn web development
can make use of it, even if they might not all get the same experience. In short, we are trying to make the web work for all, as much as possible. You'll come across the below concepts at some point in your studies. Cross-browser compatibility is the practice of trying to make sure your webpage works across as many devices as possible. This includes using technologies that all the browsers sup
port, delivering better experiences to browsers that can handle them (progressive enhancement), and/or writing code so that it falls back to a simpler but still usable experience in older browsers (graceful degradation). It also involves a lot of testing to see if anything fails in certain browsers, and then more work to fix those failures. Responsive web design is the practice of making your functio...
Use JavaScript within a webpage - Learn web development
Take your webpages to the next level by harnessing JavaScript. Learn in this article how to trigger JavaScript right from your HTML documents. Prerequisites: You need to be familiar with how to create a basic HTML document. Objective: Learn how to trigger JavaScript in your HTML file, and learn the most im
portant best practices for keeping JavaScript accessible. About JavaScript JavaScript is a programming language mostly used client-side to make webpages interactive. You can create amazing webpages without JavaScript, but JavaScript opens up a whole new level of possibilities. In this article we're going over the HTML code you need to make JavaScript take effect. If you want to learn JavaScript itself, you can start with our JavaScript basics artic...
Using data attributes - Learn web development
and CSS transitions (JSBin example). Data values are strings. Number values must be quoted in the selector for the styling to take effect. Issues Do not store content that should be visible and accessible in data attributes, because assistive technology may not access them. In addition, search crawlers may not index data attributes' values. The main issues to consider are Internet Explorer sup
port and performance. Internet Explorer 11+ provides sup
port for the standard, but all earlier versions do not sup
port dataset. To sup
port IE 10 and under you need to access data attributes with getAttribute() instead. Also, the performance of reading data-attributes compared to storing this data in a regular JS object is poor. That said, though, for custom element-associated metadata, they are a gre...
Use HTML to solve common problems - Learn web development
ge into logical sections How to set up a proper structure of headings and paragraphs Basic text-level semantics HTML specializes in providing semantic information for a document, so HTML answers many questions you might have about how to get your message across best in your document. ...
Structuring a page of content - Learn web development
Prerequisites: Before attempting this assessment you should have already worked through the rest of the course, with a particular emphasis on Document and website structure. Objective: To test knowledge of web page structures, and how to represent a prospective layout design in markup. ...
Test your skills: HTML text basics - Learn web development
into an unordered list, and the second one into an ordered list. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. HTML text basics 3 In this task you are provided with a paragraph, and your aim is to use some inline elements to mark up a couple of appropriate words with strong im
portance, and a couple with emphasis. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an on...
Test your skills: Links - Learn web development
is is not strictly best practice, but we've done it here so that the pages don't open in the embedded <iframe>, getting rid of your example code in the process! Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Links 3 The following links link to an info page about Narwhals, a sup
port email address, and a PDF factfile that is 4MB in size. In this task we want you to: Take the existing paragraphs with poorly-written link text, and rewrite them so that they have good link text. Add a warning to any links that need a warning added. Note: The first and third links in the example have the target="_blank" attribute set on them, so that when you click on them, they open the li...
HTML table advanced features and accessibility - Learn web development
ible to nest a table inside another one, as long as you include the complete structure, including the <table> element. This is generally not really advised, as it makes the markup more confusing and less accessible to screenreader users, and in many cases you might as well just insert extra cells/rows/columns into the existing table. It is however sometimes necessary, for example if you want to im
port content easily from other sources. The following markup shows a simple nested table: <table id="table1"> <tr> <th>title1</th> <th>title2</th> <th>title3</th> </tr> <tr> <td id="nested"> <table id="table2"> <tr> <td>cell1</td> <td>cell2</td> <td>cell3</td> </tr> </table> </td> <td>cell2</td> <td>cell3</td...
HTML table basics - Learn web development
tables should be used for tabular data -- this is what they are designed for. Unfortunately, a lot of people used to use HTML tables to lay out web pages, e.g. one row to contain the header, one row to contain the content columns, one row to contain the footer, etc. You can find more details and an example at Page Layouts in our Accessibility Learning Module. This was commonly used because CSS sup
port across browsers used to be terrible; table layouts are much less common nowadays, but you might still see them in some corners of the web. In short, using tables for layout rather than CSS layout techniques is a bad idea. The main reasons are as follows: Layout tables reduce accessibility for visually impaired users: Screenreaders, used by blind people, interpret the tags that exist in an HTM...
Structuring the web with HTML - Learn web development
example find your location and plot it on a map, make UI elements appear/disappear when you toggle a button, save users' data locally on their computers, and much much more.) Modules This topic contains the following modules, in a suggested order for working through them. You should definitely start with the first one. Introduction to HTML This module sets the stage, getting you used to im
portant concepts and syntax, looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a webpage. Multimedia and embedding This module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a ...
Build your own function - Learn web development
displayMessage('Brian: Hi there, how are you today?','chat'); You can see how useful our (now not so) little function is becoming. Note: If you have trouble getting the example to work, feel free to check your code against the finished version on GitHub (see it running live also), or ask us for help. Test your skills! You've reached the end of this article, but can you remember the most im
portant information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Functions. These tests require skills that are covered in the next article, so you might want to read those first before trying it. Conclusion Congratulations on reaching the end! This article took you through the entire process of building up a practical c...
Test your skills: Loops - Learn web development
nd phone numbers (phonebook) and, if it finds the name, outputs the name and phone number into the paragraph (para) and then exits the loop before it has run its course. You are given three variables to begin with: i -- starts off with a value of 0; intended to be used as an iterator. name -- contains a name to search for para -- contains a reference to a paragraph, which will be used to re
port the results. You should use a type of loop that you've not used in the previous task. Download the starting point for this task to work in your own editor or in an online editor. Loops 3 In this final task, you are provided with the following: i -- starts off with a value of 500; intended to be used as an iterator. para -- contains a reference to a paragraph, which will be used to repo...
Arrays - Learn web development
Conclusion After reading through this article, we are sure you will agree that arrays seem pretty darn useful; you'll see them crop up everywhere in JavaScript, often in association with loops in order to do the same thing to every item in an array.
Introducing JavaScript objects - Learn web development
In JavaScript, most things are objects, from core JavaScript features like arrays to the browser APIs built on top of JavaScript. You can even create your own objects to encapsulate related functions and variables into efficient packages and act as handy data containers. The object-based nature of JavaScript is im
portant to understand if you want to go further with your knowledge of the language, therefore we've provided this module to help you. Here we teach object theory and syntax in detail, then look at how to create your own objects. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this module, you should have some familiarity with HTM...
CSS performance optimization - Learn web development
rs after the render tree is created, which in turn requires both the DOM and the CSSOM trees. To optimize the CSSOM construction, remove unnecessary styles, minify, compress and cache it, and split CSS not required at page load into additional files to reduce CSS render blocking. Optimizing for render blocking CSS can scope styles to particular conditions with media queries. Media queries are im
portant for a responsive web design and help us optimize a critical rendering path. The browser blocks rendering until it parses all of these styles but will not block rendering on styles it knows it will not use, such the print stylesheets. By splitting the CSS into multiple files based on media queries, you can prevent render blocking during download of unused CSS. To create a non-blocking CSS link,...
Server-side website programming first steps - Learn web development
order to respond to requests from a web browser. Now we show how web frameworks can simplify these tasks, and help you choose the right framework for your first server-side web application. Website security Website security requires vigilance in all aspects of website design and usage. This introductory article won't make you a website security guru, but it will help you understand the first im
portant steps you can take to protect your web application against the most common threats. Note: This topic deals with server-side frameworks, and how to use them to create websites. If you are looking for information on client-side JavaScript frameworks, consult our Understanding client-side JavaScript frameworks module. Assessments This "first steps" module doesn't have any assessment because...
Ember app structure and componentization - Learn web development
properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript sup
port in Svelte Deployment and next steps ...
Embedding API for Accessibility
Comments/Questions? Please contact the Mozilla Accessibility Community. Mozilla needs to move in the direction of accessibility. Here is the W3C's definition of accessibility for a user agent like Mozilla. In part, being accessible means sup
porting a built-in accessibility APIs for a platform, such as Microsoft Active Accessibility or ATK for Linux and UNIX desktops. There are many other pieces, such as preferences to allow the user to change foreground and background colors, and font sizes. Mozilla already sup
ports some of these options. This document lays out what we already have, and what we'll need later, in the embedding API to sup
port accessibility. Text Zoom on a Per-Window Basis The nsIDOMWindow::GetTextZoom(float *zoomFactor) and nsIDOMWindow::SetT...
Information for Governments and Other Organizations Evaluating Mozilla
Mozilla's Section 508 Compliance Section 508 is a set of accessibility requirements that help US federal agencies decide what software applications they can use. Mozilla's W3C User Agent Guidelines Evaluation Re
port W3C's WAI is advancing another im
portant set of accessibility standards called UAAG. These guidelines go much further than Section 508 does and Mozilla is further from doing a good job at satisfying them. ...
Index
Party Library Usage Add-ons, Extensions, Review Policy To complete the review process at addons.mozilla.org (AMO), reviewers must be able to verify the code in your extension. You may include third-party libraries in your extension. In that case, when you upload your extension to AMO, you will need to provide links to the library source code. 689 Updates Firefox sup
ports automated updates to add-ons using JSON update manifests. Add-ons hosted on AMO automatically receive updates to new versions posted there. Other add-ons must specify the location of their update manifests. ...
Frequently Asked Questions for Lightweight themes
gallery, you can access it from the Submissions dashboard. From there, you can view your current designs. By clicking on each, you can make changes to each design's settings. What's the maximum file size allowable for my Lightweight theme? The theme you upload may not exceed 300 KB for the header or the footer image. Couldn't find the answer you're looking for? Consider visiting the Firefox sup
port website or the Themes forum for more help. ...
Bugzilla
ation about B.m.o. What to do and what not to do in Bugzilla Tips for how to use Bugzilla, as well as things you should avoid. Bugzilla etiquette A guide to etiquette; this guide will help you understand how best to conduct yourself on b.m.o. and how using proper manners and civility will help ensure your problem gets solved sooner rather than later. How to tell if a bug has already been re
ported It's useful (but not mandatory) for you to check if the problem you're re
porting has been already tracked. This guide will help you do so. View All... Other materials An Introduction to Bugzilla Bugzilla for humans Bugzilla QuickSearch help page. QuickSearch is a quick, easy, and very effective way of quickly querying bugzilla. Testopia - test case management extension bugzilla.org...
Continuous Integration
umber of data replicates. The Talos harness produces a single number per test (typically the median of all the replicates excluding the first 1-5), which are stored in Treeherder's database, and are accessible via the Perfherder interface. Other Performance Systems Autophone (Android) Autophone is a test harness which runs a set of performance tests on a variety of real Android phones. It re
ports to a custom dashboard known as phonedash. Tests currently run are primarily startup tests. Games Benchmarking (Firefox) Under development, the games benchmarking harness (aka mozbench) will allow a number of games-related benchmarks to be run against Firefox and Chrome. Eventually, the system will likely be expanded with sup
port for Android. Post-Job Analysis and Alerts There is some analys...
Cookies Preferences in Mozilla
). If you have the old-style prefs, they will be migrated when starting the application. (The old prefs are network.cookie.lifetime.enabled, network.cookie.lifetime.behavior, and network.cookie.warnAboutCookies.) true = prefs have been migrated false = migrate prefs on next startup Original Document Information Author(s): Mike Connor Last Updated Date: May 22, 2004 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Cookies in Mozilla
ons as to needed documentation can be directed to Mike Connor. Creating a Cookie Log Steps to create and attach a cookie log in order to aid in triaging a bug in cookies. Cookies Preferences in Mozilla Documentation on what the preferences used by the cookies code actually do. Original Document Information Author(s): Mike Connor Last Updated Date: March 15, 2004 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Creating JavaScript callbacks in components
thod, this magic only works for callback interfaces with a single method, like nsIDOMEventListener. The JavaScript function is passed the same arguments as defined by the callback method. So we could convert the example above to accept JavaScript functions in place of the StringParserObserver by making the following changes: [scriptable, function, uuid(...)] interface StringParserObserver : nsISup
ports { void onWord(string word); }; [scriptable, uuid(...)] interface StringParser { void parse(string data); void addObserver(StringParserObserver observer); }; Note the only change was adding function to the interface attributes of the callback interface. Now we can create a callback JavaScript function to handle the onWord event: function handleWord(word) { alert(word); } var stringPar...
Creating a Login Manager storage module
ging output in the console set signon.debug to true using about:config. Sample JavaScript implementation The following code snippet is a JavaScript component that implements a dummy nsILoginManagerStorage interface. See How_to_Build_an_XPCOM_Component_in_Javascript for more details about JavaScript components. ...
Creating a spell check dictionary add-on
and updated without a restart. Parts needed To create a dictionary add-on, you first need two things: A spell check dictionary in Hunspell or Myspell format, with a license which allows you to use it. Such a dictionary consists of two files, one with a .dic and one with an .aff file extension. A locale code to describe the language of the dictionary. For example en-US, de-DE or da. It is im
portant to choose the right locale code, or the spell checker will not be able to match the language of your dictionary against the language of a web page in order to select the right dictionary to use. If you are creating a new dictionary, as opposed to updating an existing one, please make sure that there is not already a dictionary available for your locale. If there already is one, try contactin...
Capturing a minidump
For example, if the application is hanging (not responding to input, but hasn't crashed) then Breakpad is not triggered, and it can be difficult to determine where the problem lies. ...
Building Firefox with Debug Symbols
s set in MOZ_DEBUG_FLAGS Note that this will override the values provided for CFLAGS and CXXFLAGS. Breakpad symbol files After the build is complete, run the following command to generate an archive of Breakpad symbol files: mach buildsymbols The tinderbox uses an additional uploadsymbols target to upload symbols to a socorro server. See https://dxr.mozilla.org/mozilla/source/toolkit/crashre
porter/tools/upload_symbols.sh for more information about the environment variables used by this target. make package If you use make package to package your build, symbols will be stripped. If you want to keep the symbols in the patches, you need to add this to your mozconfig: ac_add_options --disable-install-strip ...
Gmake vs. Pymake
Path issues on Windows On Windows, you must take special care to be able to switch back and forth between gmake and pymake on the same object dir. Gmake uses MSYS paths ("/c/dev/foo"), while pymake uses native Windows paths ("C:\dev\foo"). If you try to switch from gmake to pymake or pymake to gmake the build will fail unless you did a relative configure. A relative configure produces paths that look like "../../foo" which can be understood by gmake and pymake. To configure relatively, invoke configure or client.mk from your objdir. ...
Old Thunderbird build
esent on the system. Check to make sure that the path in which you placed the source code has no spaces, and is not too long. Searched the bug database for issues relating to your problem (e.g., platform-specific issues). Try asking in mozilla.dev.builds - include details of what is in your mozconfig, and what the actual error is. Check if your mozilla/ is a symlink. A symlink there is not sup
ported. Check for @TOPSRCDIR@ or relative paths in your mozconfig. Those have caused several problems historically and tend to be poorly tested when the build system changes. If on Windows you get link errors like "LNK1102: out of memory" or "LNK1318: Unexpected PDB error; OK (0)", try deleting the largest .PDB files before rushing out the door to buy more RAM. Clobbering (see below) will also remov...
Updating NSPR or NSS in mozilla-central
Do not check in individual changes. If you check in an individual change by mistake, your change will be lost when the NSPR and NSS teams push a new HG tag to mozilla-central. ...
pymake
Prerequisites If running Windows, you need to have a Windows build environment installed for using pymake to build Mozilla. On other operating systems (Linux, OS X, etc), pymake itself only requires Python 2.6 or higher (but not Python 3). Please note that Python 2.7 is strongly recommended. Usage If you use mach for everything, you don't have to worry about gmake and pymake: mach will run whatever is best for the current machine. ...
Gecko Logging
g. Many Rust libraries use the log crate to log messages, which works together with env_logger at the application level to control what's actually printed via RUST_LOG. You can set an overall logging level, though it could be quite verbose: set RUST_LOG="debug" You can also target individual modules by path: set RUST_LOG="style::style_resolver=debug" For Linux/MacOS users, you need to use ex
port rather than set. If you're only interested in the content process you can use RUST_LOG_CHILD rather than RUST_LOG. The log crate lists the available log levels: Log Level Purpose Rust Logging Levels error Designates very serious errors. warn Designates hazardous situations. info Designates useful information. debug Designates lo...
Contributing to the Mozilla code base
Firefox for iOs Swift Contribute to Firefox for iOS Firefox Focus for iOs Swift Contribute to Firefox Focus for iOS Mozilla Hubs Javascript and/or HTML/CSS, VR Contribute to Mozilla Hubs Servo Rust Contribute to Servo There are even many ways to contribute to the Mozilla mission without programming. If getting involved in design, sup
port, translation, testing, or other types of contributions sparks your interest please see community webiste. Perhaps you do not know programming yet, but you want to start learning? There are plenty of resources available on the MDN Web Docs! Step 1: Find something to work on Bugs listed as 'Assigned' are not usually a good place to start unless you're sure you have something worthy to contribute...
Index
zilla.org-distributed Firefox builds dependencies, and/or to build Firefox. 143 Multiple Firefox profiles Beginner, Firefox, Guide, Intro, Profiles, QA A profile in Firefox is the collection of settings, customizations, add-ons, and other personalizations that a user has made or installed into their copy of Firefox. You can find details about profiles on Mozilla's end-user sup
port site. 168 Performance best practices for Firefox front-end engineers Best practices, Developing Firefox, Developing Mozilla, Firefox, Front-end, Mozilla, Performance This guide will help Firefox developers working on front-end code produce code which is as performant as possible--not just on its own, but in terms of its impact on other parts of Firefox. Always keep in mind th...
Cross Process Object Wrappers
shims provides the following behavior: whenever chrome code tries to access content directly (for example, through window.content or browser.contentDocument), it is given back a CPOW that wraps the content object. This means that examples like this will actually work, even in multiprocess Firefox: gBrowser.selectedBrowser.contentDocument.body.innerHTML = "replaced by chrome code"; It's still im
portant to keep in mind, though, that this is access through a CPOW and not direct access to content. Bidirectional CPOWs A common pattern is for chrome code to access content objects and add event listeners to them. To deal with this, CPOWs are bidirectional. This means that if content passes a CPOW to the chrome process, the chrome process can synchronously pass objects (such as event listener fun...
Limitations of frame scripts
Frame scripts run with system privileges and have access to the Components object, enabling them to use XPCOM objects and JSMs. Many privileged APIs will just work in a content process. Anything that just manipulates data structures will just work. XHR and Workers will work. However, some APIs that work in the chrome process will not work in a frame script. This article lists the most im
portant of these APIs. This is one of a pair of articles: the other one lists limitations of chrome scripts. Security Restrictions on File Access Processes that host remote content are isolated from the local system through a content security sandbox. One of the functions of the sandbox is to restrict access to the local file system by processes that host remote content. Since frame and process scri...
Limitations of frame scripts
Frame scripts run with system privileges and have access to the Components object, enabling them to use XPCOM objects and JSMs. Many privileged APIs will just work in a content process. Anything that just manipulates data structures will just work. XHR and Workers will work. However, some APIs that work in the chrome process will not work in a frame script. This article lists the most im
portant of these APIs. File I/O You should not write to or read from the disk from a frame script, in particular, the profile directory. Even if this is possible, you should not do it and may expect that it could stop working at any time. File I/O should all be done in the chrome process. For example: nsIFileInputStream nsIFileOutputStream Constructing a File from a string or nsIFile (but File ob...
Firefox
matrixThe following table lists the available library versions for the mozilla.org-distributed Firefox builds dependencies, and/or to build Firefox.Multiple Firefox profilesA profile in Firefox is the collection of settings, customizations, add-ons, and other personalizations that a user has made or installed into their copy of Firefox. You can find details about profiles on Mozilla's end-user sup
port site.Performance best practices for Firefox front-end engineersThis guide will help Firefox developers working on front-end code produce code which is as performant as possible--not just on its own, but in terms of its impact on other parts of Firefox. Always keep in mind the side effects your changes may have, from blocking other tasks, to interfering with other user interface elements.PrivacyTh...
mozbrowsercontextmenu
Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: clientX The X value of the coordinate that was clicked inside the browser <iframe>'s view
port. clientY The Y value of the coordinate that was clicked inside the browser <iframe>'s view
port. systemTargets An array containing one or more MenuSystem objects (see The MenuSystem object, below), containing details of the standard menu(s) that will be shown. For example, if the user clicked on an image nested in an <a> tag, two menus are available -- one with information related to the image...
mozbrowsererror
he following properties: type A DOMString representing the type of error that occurred. ...
mozbrowserscroll
ad only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: top A number representing the new vertical scroll position of the <iframe> view
port -- in CSS pixels -- from the top of the view
port. left A number representing the new horizontal scroll position of the <iframe> view
port -- in CSS pixels -- from the left of the view
port. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserscroll", function( event ) { console.log("The new scroll position is " + event.details.left + " a...
mozbrowserscrollareachanged
es Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: width A number representing the new scroll area width of the <iframe> view
port, in CSS pixels. height A number representing the new scroll area height of the <iframe> view
port, in CSS pixels. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserscrollareachanged", function( event ) { console.log("The new scroll area is " + event.details.width + " x " + event.details.height + "."); }); Related Events mozbrowser...
mozbrowserscrollviewchange
les Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: state A DOMString representing the current state of scrolling in the view
port -- available values are started and stopped. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserscrollviewchange", function( event ) { console.log("Scrolling has " + event.details.state + "."); }); Related Events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserload...
CSS <display-xul> component
Firefox sup
ports the following -moz- prefixed XUL display values: Syntax -moz-box Obsolete since Gecko 64 XUL box, mostly equivalent to flex -moz-inline-box Obsolete since Gecko 64 XUL inline box, mostly equivalent to inline-flex -moz-grid Obsolete since Gecko 62 XUL grid -moz-inline-grid Obsolete since Gecko 62 XUL inline grid -moz-grid-group Obsolete since Gecko 62 XUL grid group -moz-grid-line Obsolete since Gecko 62 XUL grid line -moz-stack Obsolete since Gecko 62 XUL stack -moz-inline-stack Obsolete since Gecko 62 XUL inline stack -moz-deck Obsolete since Gecko 62 XUL deck -moz-popup Obsolete since Gecko 62 XUL popup All XUL display values, with the exception of -moz-box and -moz-inline-box, have been removed in bug 1288572. See this Firefox Site Compatib...
Chrome-only CSS reference
r. ::-moz-tree-rowThe ::-moz-tree-row CSS pseudo-element is used to select rows and apply styles to tree rows.::-moz-tree-row(hover)The ::-moz-tree-row(hover) CSS pseudo-class will match an element if the mouse cursor is presently hovering over a tree row.::-moz-tree-separatorActivated by the properties attribute.::-moz-tree-twistyActivated by the properties attribute.CSS -moz-bool-pref() @sup
ports functionThe -moz-bool-pref() @sup
ports condition is available to Gecko chrome and UA stylesheets to check if a boolean preference is enabled.CSS <display-xul> component</display-xul>Firefox sup
ports the following -moz- prefixed XUL display values:overflow-clip-boxThe overflow-clip-box CSS property specifies relative to which box the clipping happens when there is an overflow. It is short hand fo...
How Mozilla determines MIME Types
PDF and Postscript. If the file starts with <?xml, asks the ExternalHelperAppService for a MIME type for the URI. This is done because the generic text/xml MIME type does not work for XUL files, and XHTML files get a different DOM when interpreted as text/xml. The Image Library will be asked for the MIME type given the content. This should allow reliable detection of all image types Mozilla sup
ports. Checks whether the data is HTML by looking for some common HTML tags. The URI is handed to the ExternalHelperAppService for MIME type guessing If all else fails, the buffer (i.e. the first few bytes of the file) is searched for embedded nulls; if none are found, text/plain will be used, otherwise application/octet-stream. ExternalHelperAppService (located at uriloader/exthandler/nsExterna...
How to investigate Disconnect failures
efox crashes. Usually disconnects happens when a modal dialog freezes and we cannot close it sp we close Firefox with the modal frozen. We cannot investigate failures via mozmill, because we do not catch the crashes, so the crashes' information is not logged; we have to go to ci machines and investigate directly. Check if Firefox crashed: Windows: [user]/AppData\Roaming\Mozilla\Firefox\Crash Re
ports Ubuntu: [user/home]/.mozilla/firefox/Crash Re
ports And there we can check by timestamp if Firefox crashed when we had the disconnect. Check the Event Viewer to check if an OS event interfered with the test run. The event viewer can be found on Windows: Computer Management > Event Viewer > Windows Logs > Application And here we look for errors that overlapped with the test run...
Addon
t the add-on was most recently updated. operationsRequiringRestart Read only integer A bitfield holding all of the operations that will require a restart to complete for this add-on. ...
Dict.jsm
Introduced in Firefox 5, this is now obsolete and has been removed in Firefox 40: use ES2015 Map. The Dict.jsm JavaScript code module offers routines for managing dictionaries of key/value pairs. To use it, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/Dict.jsm"); Creating a dictionary You can create a new, empty dictionary by simply calling the Dict() constructor: var newDict = new Dict(); If you wish, you may also pass in an object literal of key/value pairs with which to initialize the dictionary: var someObj = {}; var newDict = new Dict({key1: "foo", key2: someObj}); Note that values may be any JavaScript object type. Note: You can actually specify non-strings as keys; these are converted to string...
DownloadLastDir.jsm
The DownloadLastDir.jsm JavaScript code module lets you retrieve the path of the last directory into which a download occurred. To use this, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/DownloadLastDir.jsm"); If you are using Addon SDK, you can im
port the code module as: let { Cu } = require("chrome"); let DownloadLastDir = Cu.im
port("resource://gre/modules/DownloadLastDir.jsm").DownloadLastDir; Once you've im
ported the module, you can then use the DownloadLastDir object it ex
ports. Using the DownloadLastDir object To determine or set the path into which the last download occurred: // file is an nsIFile var file = DownloadLastDir.file; DownloadLastDir.file = file; You can also set and retrieve this information...
DownloadSummary
Stopped Read only boolean Indicates whether all the downloads are currently stopped. progressTotalBytes Read only number Indicates the total number of bytes to be transferred before completing all the downloads that are currently in progress. For downloads that do not have a known final size, the number of bytes currently transferred is re
ported as part of this property. This is zero if no downloads are currently in progress. progressCurrentBytes Read only number Number of bytes currently transferred as part of all the downloads that are currently in progress. This is zero if no downloads are currently in progress. Methods bindToList() This method may be calle...
FxAccountsProfileClient.jsm
token String Bearer token. Constructor FxAccountsProfileClient() Creates and returns a new FxAccountsProfileClient object. ...
Geometry.jsm
The Geometry.jsm JavaScript code module provides routines for performing common geometry operations on points and rectangles. It ex
ports two classes: Point and Rect. To use these routines, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/Geometry.jsm"); Once you've im
ported the module, you can then use the Point and Rect classes. Note: Although this module is usable from mobile, and is present in Firefox 4, it's currently not used in Firefox 4 and attempting to use it may produce unreliable results there. ...
Http.jsm
method GET, POST or PUT (this is automatically set if postData exists). ...
ISO8601DateUtils.jsm
The ISO8601DateUtils.jsm JavaScript code module provides methods that make it easy to convert JavaScript Date objects into ISO 8601 format date strings and back. To use this, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/ISO8601DateUtils.jsm"); Once you've im
ported the module, you can then use the ISO8601DateUtils object it ex
ports. Using the ISO 8601 date utilities To convert a date string into a Date object, simply use: dateObj = ISO8601DateUtils.parse(dateString); To convert a Date object into a date string: dateString = ISO8601DateUtils.create(dateObj); Method overview String create(aDate); Date parse(aDateString); Methods create Creates an ISO 8601 format date string, e.g. "2010-05-15T13:45:00Z", from a Jav...
JavaScript OS.Constants
many levels of symbolic links. EMFILE Too many open files in the process ENAMETOOLONG Name too long ENFILE Too many open files on the system ENOENT No such file or directory ENOMEM Cannot allocate memory ENOSPC No space on device ENOTDIR Is not a directory ENXIO Device no configured or does not sup
port operation EOPNOTSUPP (Not always available under Windows) Operation not sup
ported. EOVERFLOW (Not always available under Windows) Value too large to be stored in datatype. EPERM Operation not permitted ERANGE Result too large ETIMEDOUT (Not always available under Windows) Operation timed out. EWOULDBLOCK (Not always available...
PopupNotifications.jsm
The PopupNotifications.jsm JavaScript code module provides a popup notification box service. This service is used, for example, to display Geolocation related notifications. To use this, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource://gre/modules/PopupNotifications.jsm"); Once you've im
ported the module, you can then use the PopupNotifications object it ex
ports; this object provides methods for creating and displaying popup notification panels. Note: This code module is im
ported by Firefox chrome windows, so you don't have to do it yourself in most extensions. Method overview void locationChange(); Notification getNotification(id, browser); void remove(notification); Notification show(browser...
Deferred
ed promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason. Backwards and forwards compatible helper This Deferred function can be used for backwards and forwards compatibility, due to a change that took place in Firefox 30. function Deferred() { // update 062115 for typeof if (typeof(Promise) != 'undefined' && Promise.defer) { //need im
port of Promise.jsm for example: Cu.im
port('resource:/gree/modules/Promise.jsm'); return Promise.defer(); } else if (typeof(PromiseUtils) != 'undefined' && PromiseUtils.defer) { //need im
port of PromiseUtils.jsm for example: Cu.im
port('resource:/gree/modules/PromiseUtils.jsm'); return PromiseUtils.defer(); } else { /* A method to resolve the associated Promise with the value passed. * If...
PromiseUtils.jsm
This method was previously implemented as Promise.defer(), which is obsolete since Gecko 30. And PromiseUtils.defer uses DOM Promise instead of Promise.jsm's Promise. Deferred defer(); Parameters None. ...
Services.jsm
The Services.jsm JavaScript code module offers a wide assortment of lazy getters that simplify the process of obtaining references to commonly used services. To use it, you first need to im
port the code module into your JavaScript scope: const {Services} = ChromeUtils.im
port("resource://gre/modules/Services.jsm"); Then you can obtain references to services by simply accessing them from the Services object ex
ported by the code module. For example, to obtain a reference to the preferences service: var prefsService = Services.prefs; Provided service getters Service accessor Service interface Service name androidBridge nsIAndroidBridge 1 appinfo nsIXULAppInfo nsIXULRuntime Application information service appShell nsIAppShellServ...
SourceMap.jsm
new SourceMapConsumer(rawSourceMap) The only parameter is the raw source map (either as a string which can be JSON.parse'd, or an object). According to the spec, source maps have the following attributes: version: Which version of the source map spec this map is following. sources: An array of URLs to the original source files. ...
WebChannel.jsm
The WebChannel.jsm JavaScript code module provides an abstraction that uses the Message Manager and Custom Events APIs to create a two-way communication channel between chrome and content code for specific origins (using a specific origin passed to the constructor or a lookup with nsIPermissionManager while also ensuring the scheme is HTTPS). Components.utils.im
port("resource://gre/modules/WebChannel.jsm"); Constructor WebChannel(String webChannelId, nsIURI originOrPermission); 2nd argument is a valid origin that should be part of requests for this channel. WebChannel(String webChannelId, string originOrPermission); 2nd argument is a permission for which the permission manager will be checked to determine if the request is allowed. Note that in addition to the permission manager chec...
openLocationLastURL.jsm
This component has been removed from the platform in Firefox 29. (bug 953124) The openLocationLastURL.jsm JavaScript code module lets you set and retrieve the URL most recently opened using the "Open Location" option in the File menu. To use this, you first need to im
port the code module into your JavaScript scope: Components.utils.im
port("resource:///modules/openLocationLastURL.jsm"); Once you've im
ported the module, you can then use the OpenLocationLastURL object it ex
ports. This object lets you fetch and change the URL that is placed in the "Open Location" dialog box when it opens. If the user is not in private browsing mode, this automatically updates the value of the general.open_location.last_url preference. Note: This module automatically handles private browsing mode for you. Th...
Encodings for localization files
In general, files in the Mozilla repositories are UTF-8 encoded. There are a few exceptions, though. Installer The Windows installer can't handle UTF-8, but only the codepages provided by Windows. This is tricky to hook up in the build process, so here it goes: File Encoding Notes toolkit/installer/windows/charset.mk ASCII The WIN_INSTALLER_CHARSET variable must be set to an encoding which matches toolkit/installer/windows/install.it CHARSET= parameter. See the table below for appropriate values. toolkit/installer/windows/install.it A Windows codepage. ...
Mozilla Content Localized in Your Language
anguage? If so, what are they? Tone/Register What is the appropriate tone for your translations? Does it vary by product and target audience? If so, how? What are formality to avoid? List products and their tones if different. Capitalization What is the appropriate form of expressing capitalization in your language? Note: if this doens't apply, how is expressed in your language to indicate im
portance or name of a movie, book title, product UIs (Save, File...). Hyphens and compounds What is the appropriate form of expressing hyphens and compounds in your language? Note: if this doens't apply, indicate so with N/A. Prepositions and articles What is the appropriate form of expressing prepositions and articles in your language? Note: if this doens't apply, indicate so with N/A. Punctua...
L10n testing with xcode
Setting up your l10n testing environment Once you have your l10n testing environment set up in Xcode, testing your Firefox on iOS localization is a breeze. Follow the cloning and building instructions for Firefox on iOS. Open the Client.xcodeproj file in Xcode. Select the Client project in the left pane and choose Editor > Im
port Localizations from the toolbar and select your localized XLIFF file. A window will then appear showing the diff between the im
ported XLIFF file and the existing resources in the project folder. Click the Im
port button. Xcode will im
port your translated strings into the project by adding them to the project folder and replacing the existing strings. Next, you need to configure the iOS app simulator to run the app in your locale. Choose Produc...
Localizing with Mercurial
pe hg --version in the new shell window. If you see a message about the version of Mercurial (e.g. Mercurial Distributed SCM (version 1.3.1)), you have installed Mercurial successfully! More details For more details on installing Hg on Windows, refer to the instructions on Mercurial's Download page. Mercurial on Mac OSX Installing Hg on Mac OSX is super easy. You can install Mercurial via Mac
Ports through the Terminal, like so: $ sudo
port install mercurial You can also install it by downloading the dmg package from the Hg download page. It has an install dialog that will walk you through the process. If you prefer a graphical interface, you can download and install MercurialEclipse here. Did it work? Open a Terminal window and type hg --version. If you see a message about the versio...
Localizing with Pontoon
ces available for project. Locale selector (Slovenian) Switches between languages to localize. Go Opens project-resource-locale selection. Progress indicator Displays your progress on the resource being localized. More details are available in the popup. User menu Allows for user-specific tasks, like commiting to repository, downloading files and signing out. Info menu Gives im
portant information, like the anticipated project timeline and a list of keyboard shortcuts. Alright, how about we do some translating now? Translate strings When using Pontoon for localization, you have a couple of options to translate your strings. You can translate in-context, out-of-context, or a combination of the two. We'll start with looking at in-context translation. In-context Pon...
Release phase
followed the Koala or plain text approach, you probably already have a local clone of the repository. Otherwise, in order to be able to make any changes to the localization files, you will need to clone the repository on your local machine and work in the local clone. There are two different protocols you can use to connet with your Mercurial repository: HTTP and SSH. Be advised that there's an im
portant distinction between them. You can pull using both, but you can only push through SSH. Consequently, if you already have a local clone that you pulled using HTTP, you'll need to modify a config file to tell Mercurial to push through SSH. Let's go over configuring your connection protocols. Configuration Before you try pushing, you need to tell SSH which username you wish to use for connecting w...
Localization quick start guide
pping your localization work. These four stages make up tech side of the l10n program. To learn more about any of these, click on any of the links above. To get the big picture, we suggest you start with the green bubble and move from stage to stage. Note: This guide is written for two types of contributors: those starting a new localization and those joining an existing localization. It is im
portant to know which information applies to which type of contributor. To help you filter through to the most applicable information, note that all information that is unique to those starting a new localization will be in orange font. All information that is unique to those joining an existing localization will be in blue font. Next >> ...
Creating localizable web content
erences, positionning, mirroring for rtl, text in images...) and spot what sizes/margins can be tweaked by CSS or have to be fixed for all locales but English Don't use text in icons Images 1&2. Bad: Image 3. Good: Image 4. Good: This icon is recognized as the international symbol for information. It can stay this way. Use localized screenshots if possible Screenshots are im
portant informative graphics, often times explaining how to achieve something in a desktop or web application. As such, they should be perceived as an essential part of the content and should be localized. Image 1. Bad. If the screenshot shows the application that the website directly relates to (Firefox on mozilla.com/firefox, Personas on getpersonas.com), try to use screenshots from the local...
Localization formats
er can break everything.) Very hard to update automatically, if not impossible. Can be hard to tell what has changed .lang files Historically, Mozilla has used a gettext-like file to present content for localization. .lang files provide some features that differentiate it from Gettext: .lang is not dependent on PHP/.po library, so if our webdev team sets up a site without gettext sup
port, we still have .lang. (It should be noted that this is near impossibility since most sites will be set up with gettext sup
port.) .lang files can be easily edited in a text editor With this setup, a localizer is given a "[something].lang" file containing all the strings needing localization. That file will have the following structure: ;Getting Started Debuter avec Firefox The English cont...
Setting up the infrastructure
Create a new branch for l10n (optional if starting a new project). Create a locale directory in your website (usually something like DOCROOT/locale). ...
Web Localizability
n or content that enables localization. The following list contains links to pages that highlight steps that can be taken to make web content localizable. The documentation is divided into 4 parts: How to create localizable content. How to choose the right localization format. How to create localizable web applications. How to set up the infrastructure for localization. Why localizability is im
portant There are many reasons why you should start thinking about making your web app localizable as soon as possible. You will make localizer's life easier, for which they will be grateful. You will have quality content, localized and adapted to the needs of the local market. Extending you web app to sup
port new languages will be easy. The content will be easier to maintain and update. You will end...
Mozilla Framework Based on Templates (MFBT)
r provides size_t. CheckedInt.h implements checked integers. They behave like integers, but safely check for integer overflow and divide-by-zero. Useful for input validation. FloatingPoint.h provides various operations for examining and working upon double-precision floating point values, and for producing various special floating point values. Core Types.h further provides macros to define im
ported and ex
ported C symbols. Attributes.h implements various function and class attribute macros. The function macros control inlining, note whether a function returns, and enforce various C++-related restrictions on inheritance and use. The class macros permit controlling the inheritability of a class. Likely.h provides MOZ_LIKELY and MOZ_UNLIKELY macros to annotate conditions with their expected...
Basics
to other browser operations such as the zoom (try View -> Text Zoom), and you can do links a 2 + b 2 = c 2 , apply stylistic effects a 2 + b 2 = c 2 , or use color a 2 + b 2 = c 2 in very strange ways p(x) q(x) = a0 + a1x + a2 x2 + ... + an-1 xn-1 b0 + b1x + b2 x2 + ... + bn-1 xn-1 . You can also do other weird and risky things which are not
portable, bongo warns, such as mixing MathML with other markups lizard + bongo = ? a b d x + MathML and Javascript HTML Content <p> And you can turn to JavaScript and the DOM for dynamic operations. </p> <div style="text-align:center"> Fill the gaps in this matrix with resizable input fields. </div> <math class="inputmath" display="block"> <mrow> <mi>A</mi> <mo>=</mo> <mo>...
Extras
Other renderers are expected to ignore attributes that they don't understand while the behavior of undefined elements is well, undefined. ...
Fonts for Mozilla's MathML engine
> <dir>/your/path/to/texmf-dist/fonts/opentype</dir> </fontconfig> Finally, add this configuration file to the system font location list and regenerate the fontconfig cache: ln -sf /etc/fonts/conf.avail/09-texlive-fonts.conf /etc/fonts/conf.d/ fc-cache -sf Android You must use the MathML-fonts add-on. Note: There is an enhancement request opened on the Noto bug tracker to improve math sup
port. Firefox OS You must use the MathML-fonts add-on. Note: We plan to bundle a MATH font in the default installation. Other systems On other systems, consider installing a MATH font using your package manager. Note that these fonts are generally delivered with TeX distributions such as TeX Live, but you might need to follow specific instructions so that your system is aware of the fonts. As ...
MathML Torture Test
m Knuth's TeX book and equivalent MathML representations. It compares the rendering by the XeTeX engine using the default Latin Modern Math font against the MathML rendering by your browser using the default math font, or an alternative OpenType MATH fonts. To get the best rendering, be sure to have appropriate mathematical fonts installed on your system and to use a browser with OpenType MATH sup
port such as Gecko 31.0 (Firefox 31.0 / Thunderbird 31.0 / SeaMonkey 2.28) or higher. You may also try this test page for Mathematical OpenType Fonts which instead relies on Web fonts. Finally, you may want to check this table comparing how the tests are read by various screen readers for Mozilla browsers. Link to test: MathML Torture Test demo ...
Various MathML Tests
Testing MathML <msub>: a b ; a i ; A I k Testing MathML <msup>: d b 2 a x 2 2 x ( 1 2 ) y a x . ...
MathML Demo: <mo> - operator, fence, separator, or accent
2 2 ? ? k 1 2 2 ? | k 1 2 2 | || k 1 2 2 || and / k 1 2 2 / \ k 1 2 2 \ ? k 1 2 2 ? ? k 1 2 2 ? ? k 1 2 2 ? ? k 1 2 2 ? ? k 1 2 2 ? ? k 1 2 2 ? Generally, it is safest to script all attributes that configure an <mo> as a fence (fence, stretchy, symmetric, lspace, rspace). This is especially im
portant for vertical arrows used as fences. The default attributes given in the MathML Operator Dictionary don't configure vertical arrows as fences. In LaTeX, the lspace on a left side fence delimiter and the rspace on a right side fence delimiter is not 0. Here's an example to illustrate spacing around fences M [ M M M ] M ( M M ) M { M M } M < M M > M | M M | M ...
Mozilla Web Services Security Model
ervices directory: <webScriptAccess xmlns="http://www.mozilla.org/2002/soap/security"> <allow type="soapv"/> <allow type="soap"/> </webScriptAccess> Good examples (Needed.) References New Security Model for Web Services, the original proposal for the web-scripts-access.xml file format Web Services Roadmap, documenting when Web services features, including the security model, were first sup
ported Additional Reading Documentation of crossdomain.xml, a similar format used by Macromedia Flash Player ...
Mozilla Style System
e confused with the CSS structs (nsCSS*), which hold specified values. The grouping of properties into structs follows two rules: any properties in the same style struct must also be in the same CSS struct all of the properties in a style struct must be inherited or they must all be non-inherited (see inheritance for an explanation of the difference) The first of these rules is no longer im
portant (in fact, the separation of the specified values into nsCSS* structs is no longer im
portant). However, the second of these rules is the key to many of the performance and memory-use optimizations in the style system. Most callers who interact with the style system do so using the style structs. The style context has a getter for each struct, and nsIFrame, which represents the concept of a CSS...
Mozilla Style System Documentation
too much memory. Other nsIStyleSheet Implementations Problems: Some of the HTML style information is implemented in the content node classes. It should be consolidated so that the style system code can be moved back within the layout DLL and nsIStyleContext can be de-COM-ified. Original Document Information Author(s): L. David Baron Last Updated Date: June 6, 2003 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
mozilla::MonitorAutoEnter
Monitor. It is designed to make using mozilla::Monitor safer and easier. To use mozilla::MonitorAutoEnter, declare and initialize it with a reference to a mozilla::Monitor. The mozilla::MonitorAutoEnter constructor will Enter() the underlying mozilla::Monitor automatically. When the mozilla::MonitorAutoEnter goes out of scope, its destructor will Exit() the underlying mozilla::MonitorAutoEnter. Im
portant: When a mozilla::MonitorAutoEnter is live on the stack, your code is guaranteed to own the underlying mozilla::Monitor. Constructors MonitorAutoEnter( in mozilla::Monitor& monitor; ); This parameter is a reference so as to guarantee that your code has already properly constructed the mozilla::Monitor. Methods Wait() nsresult Wait( in PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT );...
mozilla::MutexAutoLock
When the mozilla::MutexAutoLock goes out of scope, its destructor will Unlock() the underlying mozilla::Mutex. Because of mozilla::MutexAutoUnlock, the rule for determining if your code owns the Mutex underlying the MutexAutoLock is slightly more complicated than that for MonitorAutoEnter. This is because MutexAutoUnlocks can be nested within MutexAutoLocks and vice versa, indefinitely deeply. Im
portant: When a mozilla::MutexAutoLock is the Mutex RAII wrapper most recently pushed on the stack, your code is guaranteed to own the underlying mozilla::Mutex. Constructors MutexAutoLock( in mozilla::Mutex& lock; ); This parameter is a reference so as to guarantee that your code has already properly constructed the mozilla::Mutex. Methods None. See also mozilla::Mutex mozilla::MutexAutoUnlock ...
mozilla::MutexAutoUnlock
e mozilla::MutexAutoUnlock goes out of scope, its destructor will Lock() the underlying mozilla::Mutex. Because of mozilla::MutexAutoLock, the rule for determining if your code does not own the Mutex underlying the MutexAutoUnlock is slightly more complicated than that for MonitorAutoEnter. This is because MutexAutoUnlocks can be nested within MutexAutoLocks and vice versa, indefinitely deeply. Im
portant: When a mozilla::MutexAutoUnlock is the Mutex RAII wrapper most recently pushed on the stack, your code is guaranteed not to own the underlying mozilla::Mutex. Constructors MutexAutoUnlock( in mozilla::Mutex& lock; ); This parameter is a reference so as to guarantee that your code has already properly constructed the mozilla::Mutex. Methods None. See also mozilla::Mutex mozilla::MutexAut...
Are We Slim Yet
efox transitioned to using multiple processes by default, we moved AWSY into the TaskCluster infrastructure. This allowed us to run measurements on all branches and platforms. The results are posted to perfherder where we can track regressions automatically. As new processes are added to Firefox we want to make sure their memory usage is also tracked by AWSY. To this end we request that memory re
porting be integrated into any new process before it is enabled on Nightly. ...
Activity Monitor, Battery Status Menu and top
ac OS X. Note: The power profiling overview is worth reading at this point if you haven't already. It may make parts of this document easier to understand. Activity Monitor This is a built-in OS X tool that shows real-time process measurements. It is well-known and its "Energy Impact" measure is likely to be consulted by users to compare the power consumption of different programs. (Apple sup
port documentation specifically recommends it for troubleshooting battery life problems.) Unfortunately "Energy Impact" is not a good measure for either users or software developers and it should be avoided. Activity Monitor can still be useful, however. Power-related measurements Activity Monitor has several tabs. They can all be customized to show any of the available measurements (by right-clicki...
Build Metrics
r is better. compiler warnings Number of compiler warnings detected during a build. Lower is better. Due to the way the build system works, compiler warnings are not consistently detected. So the value may fluctuate from build to build even if the number of compiler warnings didn't actually change. Since Perfherder alerts are calculated based on the mean value of a range, a regression may be re
ported as a fractional value. ...
Leak-hunting strategies and tips
(or allocations?) All tier 1 platforms Build with --enable-trace-malloc Leak tools for simple objects and summary statistics TraceMalloc All allocations All tier 1 platforms Build with --enable-trace-ma...
Memory Profiler
along the timeline. This gives some intuition of how and when a bulk of objects are allocated. However, it still relies on developers' wisdom, and sometimes chances, to dig out the problematical code snippet. This memory profiler is designed to solve the inconveniences and limitations. The goal is to identify the memory eager codes directly. The profiler is designed at the very beginning to sup
port not only JavaScript but also native codes. Naturally, not only JavaScript objects but also native allocations are tracked. The profile while recording is stored in memory in a very compact format. It's supposed to profile a very long time period without problem. Timeline view This view shows the allocation event across the period of time. It shows the overall memory usage history. Red is alloca...
Profiling with Xperf
data that you're looking for. Also experiment with turning columns on and off; removing a column will allow data to be aggregated without considering that column's contributions. Disabling all but one core will make the numbers add up to 100%. This can be done by running 'msconfig' and going to Advance Options from the "Boot" tab. Building Firefox To get good data from a Firefox build, it is im
portant to build with the following options in your mozconfig: ex
port CFLAGS="-Oy-" ex
port CXXFLAGS="-Oy-" This disables frame-pointer optimization which lets xperf do a much better job unwinding the stack. Traces can be captured fine without this option (for example, from nightlies), but the stack information will not be useful. ac_add_options --enable-debug-symbols This gives us symbols. For More I...
TimerFirings logging
65ec00]: [6775] obs timer (SLACK 1000 ms): 7f46a95a0200 Each line has the following information. The first two values identify the thread. This is not especially useful. The next value is the process ID (pid). This is useful in a multi-process scenario. Next is the timer kind, one of fn (function), iface (interface) or obs (observer), which are the three kinds of timers that Gecko sup
ports. Then comes the function kind, one of ONE_SHOT (a single-use timer), SLACK or PRECISE (repeating timers of differing precision). Then comes the timer period, measured in milliseconds. Finally there is the identifying information for the timer. Function timers have an informative label. Interface and observer timers only have an address, which is less useful, but they are uncommon enough that ...
powermetrics
sub-2ms deadline can also cause a package idle exit wakeup. Many of these measurements are also obtainable by passing the TASK_POWER_INFO flag and a task_power_info struct to the task_info function. By default, the coalitions/processes are sorted by a composite value computed from several factors, though this can be changed via command-line options. Other measurements powermetrics can also re
port measurements of backlight usage, network activity, disk activity, interrupt distribution, device power states, C-state residency, P-state residency, quality of service classes, and thermal pressure. These are less likely to be useful for profiling Firefox, however. Run with the --show-all to see all of these at once, but note that you'll need a very wide window to see all the data. Also note tha...
A brief guide to Mozilla preferences
he default values if he or she knows how. Another disadvantage is that existing profiles will not be affected. This method is considered user-hostile. Any use of this technique by software such as Firefox extension to override normal user preference will result in being added to the Firefox blocklist or the preferences being forcibly removed. Note: because of abuse of user.js preferences, sup
port for user.js may be removed in a future version of Firefox. See bug 1543752. Sticky Preferences Sticky preferences were introduced in Firefox 40 via bug 1098343. Sticky preferences are created when they are defined using sticky_pref(). These preferences act as default preferences but whenever a value is created for the preference, that value is always written even when it matches the default.
accessibility.tabfocus
The preference accessibility.tabfocus controls what elements receive focus when the user presses the Tab key. Note: On Mac OS X, if this preference is not set, the Full Keyboard Access setting in System Preferences > Keyboard is honored. Type:integer Default value: 7 (Windows and Linux); 2 (Mac OS X) Exists by default: no Application sup
port:Gecko 1.7 Status: Active Introduction: Bugs: bug 140612 Values 1 Give focus only to text fields (default on Mac OSX) 2 Give focus to all form elements except text fields. 4 Give focus only to links and linked images. Other You can add these values to combine their functionality. The value 7 (give focus to all elements) is the default on Windows and Linux. ...
browser.altClickSave
The preference browser.altClickSave controls whether clicking a link while holding the alt key starts the download of that link. Type:boolean Default value: false Exists by default: yes Application sup
port:Firefox 13.0 Status: Active; last updated 2012-03-19 Introduction: Pushed to Nightly on 2012-03-02 Bugs: bug 713052 Values true Clicking a link while holding the alt key starts the download of that link. false (default) No action triggered (see bug 736985). ...
browser.dom.window.dump.file
browser.dom.window.dump.file redirects the ouput of window.dump() calls to a file whose address is specified in this preference if browser.dom.window.dump.enabled is set to true. Changes require an application restart. Type:string Default value:none Exists by default: no Application sup
port: Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Status: Active; last updated 2012-03-18 Introduction: Pushed to Nightly on 2009-04-24 Bugs: bug 489938 Values The value holds the file system path for the file in which the content of the window.dump() calls get written, e.g. C:\dump.txt . It will be created if it doesn't exist yet. The line breaks have to be in the argument of the dump function, else successive dump calls will get logged into the same line. Related browser.
browser.download.lastDir.savePerSite
browser.download.lastDir.savePerSite controls whether the directory preselected in the file picker for saving a file download is being remembered on a per-website (host) base. If set to true, the data is stored as content preference. Type:boolean Default value:true Exists by default: no Application sup
port:Firefox 11.0 Status: Active; last updated 2012-02-15 Introduction: Pushed to Nightly on 2011-12-11 Bugs: bug 702748 Values true (default) The last used directory for the website (host) serving the file for download will be preselected in the file picker. If no download directory for the current website has been stored, browser.download.lastDir will be used. false The last used directory for any download (stored in browser.download.lastDir) will be the preselected di...
browser.pagethumbnails.capturing_disabled
The preference browser.pagethumbnails.capturing_disabled controls whether the application creates screenshots of visited pages which will be shown if the web page is shown in the grid of the "New Tab Page" (about:newtab) which offers the most often visited pages for fast navigation. Type:boolean Default value:true Exists by default: no Application sup
port: Firefox 14.0 Status: Active; last updated 2012-09-17 Introduction: Pushed to Nightly on 2012-04-13 Bugs: bug 726347 Values false The application creates screenshots of visited web pages. true (default) The application doesn't create screenshots of visited web pages. ...
browser.search.context.loadInBackground
browser.search.context.loadInBackground controls whether a search from the context menu with "Search <search engine> for <selected text>" opening a new tab will give focus to it and load it in the foreground or keep focus on the current tab and open it in the background. Type:boolean Default value:false Exists by default: yes Application sup
port: Firefox 13.0 Status: Active; last updated 2012-02-17 Introduction: Pushed to Nightly on 2012-02-15 Bugs: bug 727131 Values true New tab with search results will be opened in the background, focus stays on the current tab. false (default) New tab with search results will be opened in the foreground. ...
browser.urlbar.formatting.enabled
The preference browser.urlbar.formatting.enabled controls whether the domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts grey. Type:boolean Default value: true Exists by default: yes Application sup
port:Firefox 6.0 Status: Active; last updated 2012-04-03 Introduction: Pushed to Nightly on 2011-05-03 Bugs: bug 451833 Values true (default) The domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts grey. false All parts of the url are given the same color: black. ...
browser.urlbar.trimURLs
The preference browser.urlbar.trimURLs controls whether the protocol http and the trailing slash behind domain name (if the open page is exactly the domain name) are hidden. Type:boolean Default value: true Exists by default: yes Application sup
port:Firefox 7.0 Status: Active; last updated 2012-04-03 Introduction: Pushed to Nightly on 2011-06-23 Bugs: bug 665580 Values true (default) If the active url is exactly the domain name, the trailing slash (/) behind the top level domain will be hidden. If the address starts with http:// and neither starts with a ftp. subdomain nor contains @ (usually for ftp login information), the http:// prefix will be hidden. Examples: https://www.example.org/ becomes https://www.example.org, http://www.example.org/foobar becomes www.exa...
MailNews
s Extended Framework is one mechanism for testing the MailNews component of Thunderbird. See MailNews automated testing for a description of the other testing mechanisms. Leak And Bloat Tests This page describes how to perform tests that measure memory leaks and bloat for MailNews and its sub-components. MailNews automated testing Automated testing is an increasingly significant and im
portant part of MailNews development. It allows reviewers to quickly pick up regressions in patches and helps developers to think about different cases. See pages tagged MailNews for additional MailNews-specific information. ...
NSPR build instructions
uild, specify the --enable-64bit configure option. --target=x86_64-pc-mingw32 For 64-bit builds on Windows, when using the MozillaBuild environment. --enable-win32-target=WIN95 This option is only used on Windows. NSPR build generates a "WINNT" configuration by default on Windows for historical reasons. We recommend most applications use the "WIN95" configuration. The "WIN95" configuration sup
ports all versions of Windows. The "WIN95" name is historical; it should have been named "WIN32". To generate a "WIN95" configuration, specify the --enable-win32-target=WIN95 configure option. --enable-debug-rtl This option is only used on Windows. NSPR debug build uses the release C run-time library by default. To generate a debug build that uses the debug C run-time library, specify the --enable-...
Process Forking in NSPR
On some platforms, NSPR threads directly map one-to-one to the threads provided by the platform vendor, on other platforms NSPR threads are basically user-level threads within a single process (with no kernel threads) and on still others NSPR threads are user-level threads implemented on top of one or more kernel threads within single address space. NSPR does not override the fork function and so, when fork is called from the NSPR thread the results are different on the various platforms. ...
Atomic Operations
This chapter describes the global functions you use to perform atomic operations. The functions define a
portable API that may be reliably used in any environment. Since not all operating environments provide access to such functions, their performance may vary considerably. Atomic Operations Functions The API defined for the atomic functions is consistent across all sup
ported platforms. However, the implementation may vary greatly, and hence the performance. On systems that do not provide direct access to atomic operators, NSPR emulates the capabilities by using its own locking mechanisms. For such systems, NSPR performs atomic operations just as efficiently as the client could. Therefore, to preserve
portability, it is recommended that clients use the NSPR API for atomic operations. Thes...
Cached Monitors
monitor is associated with the address of a protected object, and the association is maintained only while the protection is needed. This arrangement allows a cached monitor to be associated with another object without preallocating a monitor for all objects. A hash table is used to quickly map addresses to their respective monitors. The system automatically enlarges the hash table as needed. Im
portant Cached monitors are slower to use than their uncached counterparts. See Monitors for information about uncached monitors. Cached Monitors Functions Cached monitors allow the client to associate monitoring protection and state change synchronization in a lazy fashion. The monitoring capability is associated with the protected object only during the time it is required, allowing the monitor ...
Date and Time
ve to the origin, called the epoch. NSPR defines the epoch to be midnight (00:00:00) 1 January 1970 UTC (Coordinated Universal Time). In this form, time is just a point on the time line. There is no notion of time zone. Clock/calendar time, used for human interfaces, represents time in the familiar year, month, day, hour, minute, second components. In this form, the time zone information is im
portant. For example, without specifying the time zone, the time 8:00AM 1 May 1998 is ambiguous. The NSPR data type for clock/calendar time, called an exploded time, has the time zone information in it, so that its corresponding point in absolute time is uniquely specified. Note that absolute and clock times are not normally used in timing operations. For functions that deal with the measurement of ...
Hash Tables
The hash table library functions are declared in the header file plhash.h. Warning: The NSPR hash table library functions are not thread safe. A hash table lookup may change the internal organization of the hash table (to speed up future lookups). ...
I/O Types
-oriented flavor. An I/O function on a PRFileDesc structure is carried out by invoking the corresponding "method" in the I/O methods table (a structure of type PRIOMethods) of the PRFileDesc structure (the "object"). Different kinds of I/O objects (such as files and sockets) have different I/O methods tables, thus implementing different behavior in response to the same I/O function call. NSPR sup
ports the implementation of layered I/O. Each layer is represented by a PRFileDesc structure, and the PRFileDesc structures for the layers are chained together. Each PRFileDesc structure has a field (of type PRDescIdentity) to identify itself in the layers. For example, the Netscape implementation of the Secure Sockets Layer (SSL) protocol is implemented as an I/O layer on top of NSPR's socket layer. ...
Logging
ation, compile using the NSPR debug build headers and runtime. Set one of the compile-time defines when you build your application. Execution-time control of NSPR's logging uses two environment variables. These variables control which modules and levels are logged as well as the file name of the log file. By default, no logging is enabled at execution time. ...
NSPR LOG MODULES
This environment variable specifies which log modules have logging enabled. Syntax moduleName:level[, moduleName:level]* moduleName is the name specified in a PR_NewLogModule call or one of the handy magic names listed below. level is a numeric value between 0 and 5, with the values having the following meanings: 0 = PR_LOG_NONE: nothing should be logged 1 = PR_LOG_ALWAYS: im
portant; intended to always be logged 2 = PR_LOG_ERROR: errors 3 = PR_LOG_WARNING: warnings 4 = PR_LOG_DEBUG: debug messages, notices 5: everything! Description Specify a moduleName that is associated with the name argument in a call to PR_NewLogModule and a non-zero level value to enable logging for the named moduleName. Special log module names are provided for controlling NSPR's log service at executi...
PRIOMethods
Connect to the specified network address. accept Accept a connection from a network peer. bind Associate a network address with the file descriptor. listen Prepare to listen for network connections. shutdown Shut down a network connection. recv Receive up to the specified number of bytes. send Send all the bytes specified. recvfrom Receive up to the specified number of bytes and re
port network source. sendto Send bytes to specified network address. poll Test the file descriptor to see if it is ready for I/O. acceptread Accept and read from a new network file descriptor. transmitfile Transmit an entire file to the specified socket. getsockname Get network address associated with a file descriptor. getpeername Get peer's network address. getsockopt Get current setti...
PRIPv6Addr
.ip field of the PRNetAddr structure. Syntax #include <prio.h> #if defined(_PR_INET6) typedef struct in6_addr PRIPv6Addr; #endif /* defined(_PR_INET6) */ Description PRIPv6Addr represents a 128-bit IPv6 address. It is equivalent to struct in6_addr in the Berkeley socket interface. PRIPv6Addr is always manipulated as a byte array. Unlike the IPv4 address (a 4-byte unsigned integer) or the
port number (a 2-byte unsigned integer), it has no network or host byte order. ...
PRIntervalTime
e. The constants PR_INTERVAL_MIN and PR_INTERVAL_MAX define a range in ticks per second. These constants bound both the period and the resolution of a PRIntervalTime object. The reserved constants PR_INTERVAL_NO_WAIT and PR_INTERVAL_NO_TIMEOUT have special meaning for NSPR. They indicate that the process should wait no time (return immediately) or wait forever (never time out), respectively. Im
portant Note The counters used for interval times are allowed to overflow. Since the sampling of the counter used to define an arbitrary epoch may have any 32-bit value, some care must be taken in the use of interval times. The proper coding style to test the expiration of an interval is as follows: if ((PRIntervalTime)(now - epoch) > interval) <... interval has expired ...> As long as the inter...
PRMcastRequest
request to join or leave a multicast group. Syntax #include <prio.h> struct PRMcastRequest { PRNetAddr mcaddr; PRNetAddr ifaddr; }; typedef struct PRMcastRequest PRMcastRequest; Fields The structure has the following fields: mcaddr IP multicast address of group. ifaddr Local IP address of interface. Description The mcaddr and ifaddr fields are of the type PRNetAddr, but their
port fields are ignored. Only the IP address (inet.ip) fields are used. ...
PR_ProcessAttrSetInheritableFileMap
Prepare filemap for ex
port to my children processes via PR_CreateProcess. Syntax #include <prshma.h> NSPR_API(PRStatus) PR_ProcessAttrSetInheritableFileMap( PRProcessAttr *attr, PRFileMap *fm, const char *shmname ); Parameters The function has the following parameters: attr Pointer to a PRProcessAttr structure used to pass data to PR_CreateProcess. fm Pointer to a PRFileMap structure to be passed to the child process. shmname Pointer to the name for the PRFileMap; used by child. Returns PRStatus Description PR_ProcessAttrSetInheritableFileMap connects the PRFileMap to PRProcessAttr with shmname. A subsequent call to PR_CreateProcess makes the PRFileMap im
portable by the child process. Note: This function is not implemented. ...
PR_StringToNetAddr
. If unsuccessful, PR_FAILURE. You can retrieve the reason for the failure by calling PR_GetError. Description For IPv4 addresses, the input string represents numbers in the Internet standard "." notation. IPv6 addresses are indicated as strings using ":" characters separating octets, with numerous caveats for shortcutting (see RFC #1884). If the NSPR library and the host are configured to sup
port IPv6, both formats are sup
ported. Otherwise, use of anything other than IPv4 dotted notation results in an error. ...
PR_VersionCheck
Compares the version of NSPR assumed by the caller (the im
ported version) with the version being offered by the runtime (the ex
ported version). Syntax #include <prinit.h> PRBool PR_VersionCheck(const char *im
portedVersion); Parameter PR_VersionCheck has one parameter: im
portedVersion The version of the shared library being im
ported. Returns The function returns one of the following values: If the version of the shared library is compatible with that expected by the caller, PR_TRUE. If the versions are not compatible, PR_FALSE. Description PR_VersionCheck tests whether the version of the library being im
ported (im
portedVersion) is compatible with the running version of the shared library. This is a string comparison of sorts, though the details of the comparison will vary o...
PR_Wait
(&ml); A thread can be resumed from a wait for a variety of reasons. The most obvious is that it was notified by another thread. If the value of timeout is not PR_INTERVAL_NO_TIMEOUT, PR_Wait resumes execution after the specified interval has expired. If a timeout value is used, the Boolean expression must include elapsed time as part of the monitored data. Resuming from the wait is merely an op
portunity to evaluate the expression, not an assertion that the expression is true. ...
Thread Pools
NSPR's thread pool is modeled on the thread pools described by David R. Butenhof inProgramming with POSIX Threads (Addison-Wesley, 1997). ...
NSPR API Reference
Library Linking Library Linking Types PRLibrary PRStaticLinkTable Library Linking Functions PR_SetLibraryPath PR_GetLibraryPath PR_GetLibraryName PR_FreeLibraryName PR_LoadLibrary PR_UnloadLibrary PR_FindSymbol PR_FindSymbolAndLibrary Finding Symbols Defined in the Main Executable Program Platform Notes Dynamic Library Search Path Ex
porting Symbols from the Main Executable Program Process Management and Interprocess Communication Process Management Types and Constants PRProcess PRProcessAttr Process Management Functions Setting the Attributes of a New Process Creating and Managing Processes Multiwait Receive System Information and Environment Variables Logging Conditional Compilatio...
Running NSPR tests
ILED ... timetest Passed tpd Passed udpsrv Passed vercheck Passed version Passed writev Passed xnotify Passed zerolen Passed END Mon Mar 12 11:55:47 PDT 2007 How to determine if the test suite passed If all the tests re
ported Passed as the results, the test suite passed. What if some of the tests crashed or re
ported FAILED as the results? It doesn't necessarily mean the test suite failed because some of the test programs are known to fail. Until the test failures are fixed, you should run NSPR tests against a known good version of NSPR on the same platform, and save the test results as the benchmark. Then you can d...
Building NSS
the following commands: hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss To get the source of a specific release, see NSS Releases. Build Build NSS using our build script: nss/build.sh This builds both NSPR and NSS. Build with make Alternatively, there is a make target called "nss_build_all", which produces a similar result. This sup
ports some alternative options, but can be a lot slower. make -C nss nss_build_all USE_64=1 The make-based build system for NSS uses a variety of variables to control the build. Below are some of the variables, along with possible values they may be set to. BUILD_OPT 0 Build a debug (non-optimized) version of NSS. This is the default. 1 Build an optimized (non-debug) version of NSS. ...
CERT_FindCertByIssuerAndSN
ference count on the certificate instance. Example CERTIssuerAndSN issuerSN; issuerSN.derIssuer.data = caName->data; issuerSN.derIssuer.len = caName->len; issuerSN.serialNumber.data = authorityKeyID->authCertSerialNumber.data; issuerSN.serialNumber.len = authorityKeyID->authCertSerialNumber.len; issuerCert = CERT_FindCertByIssuerAndSN(cert->dbhandle, &issuerSN); if ( issuerCert == NULL ) {
PORT_SetError (SEC_ERROR_UNKNOWN_ISSUER); } See Also Occurrences of CERT_FindCertByIssuerAndSN in the current NSS source code (generated by LXR). ...
NSS Code Coverage
574/1351). 42% - ratio of tested blocks and total blocks in file. 165 - tested blocks in all files in directory (sum of numbers generated by TCOV). 227 - total blocks in all files in directory (sum of numbers generated by TCOV). These numbers doesn't count blocks in files which are not tested (marked with red color), because we don't know number of blocks there. Total count at the end of re
port counts blocks in all tested files in all directories. ...
Deprecated SSL functions
Applications that want to use the SSL shared libraries must convert to calling the new replacement functions listed below. Each function name is linked to its entry in the old SSL Reference. The Mozilla Cross Reference (MXR) link for each function provides access to the function definition, prototype definition, and source code references. ...
Using JSS
la.org/security/nss/releases ssl3 NSS SSL library smime3 NSS S/MIME functions and types nssckbi PKCS #11 module containing built-in root CA certificates. Optional. freebl_* Processor-specific optimized big-number arithmetic library. Not present on all platforms. More information... fort FORTEZZA sup
port. Optional swft PKCS #11 module implementing FORTEZZA in software. Optional. If you built JSS from source, you have these libraries in the mozilla/dist/<platform>/lib directory of your build tree. If you are downloading binaries, get them from the binary release locations in the above table. You need to select the right version of the components, based on the ver...
NSS Memory allocation
n the free list. See the prototype at http://mxr.mozilla.org/nspr/source/n.../ds/plarenas.h A program should call that function at the very end, after having shutdown NSS and NSPR, to really free the contents of the free list. After that function returns, any arenas that still appear to be leaked have truly been leaked, and are not merely on the free list. 2. Leak analysis tools will frequently re
port the wrong call stack for the allocation of leaked arenas. When the arena free list is in use, the first user of an arena will allocate it from the heap, but will then free it to the free list. The second user will allocated it from the free list and return it to the free list. If and when an arena is leaked, the developer wants to see the call stack of the most recent allocation of the arena, not...
NSS 3.12.9 release notes
le with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.12.9 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with mozilla.org Bugzilla (product NSS). ...
NSS 3.14.3 release notes
mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.14.3 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
NSS Sample Code sample5
keynickname"); rv = ATOB_ConvertAsciiToItem(&der, pvtkstr); if (rv!= SECSuccess) { fprintf(stderr, "ATOB_ConvertAsciiToItem failed %d\n", PR_GetError()); goto cleanup; } /* KU_ALL includes a lot of different key usages, KU_DATA_ENCIPHERMENT * is enough for just RSA encryption. ...
NSS Sample Code
NSS Sample Code The collection of sample code here demonstrates how NSS can be used for cryptographic operations, certificate handling, SSL, etc. It also demonstrates some best practices in the application of cryptography. Old samples in the process of being replaced. Sample Code 1: Key Generation and Trans
port Between Servers Sample Code 2: Symmetric Encryption Sample Code 3: Hashing, MAC Sample Code 4: PKI Encryption Sample Code 5: PKI Encryption with a raw public & private key in DER format Sample Code 6: Persistent Symmetric Keys in NSS database These are very old examples in need of replacement. See https://bugzilla.mozilla.org/show_bug.cgi?id=490238 You are welcome to download the new samples via: hg clone https://hg.mozilla.org/projects/nss; cd nss; hg update SAM...
nss tech note3
ify the validity of a certificate chain, it verifies the validity of that cert chain for a particular purpose, known as a SECCertUsage, as of a specific date and time. The list of known SECCertUsages is short: certUsageSSLClient ........... An SSL client authentication cert certUsageSSLServer ........... An ordinary SSL server cert certUsageSSLServerWithStepUp.. An SSL server cert that allows ex
port clients to use strong crypto. certUsageSSLCA ............... An intermediate or root CA cert allowed to issue SSL client or SSL server certs or other intermediate SSL CA certs. certUsageEmailSigner ......... Used to verify S/MIME email signatures certUsageEmailRecipient ...... Used to encrypt S/MIME emails. certUsageObjectSigner ........ Used to verify signatures on files of execu...
nss tech note6
chk files will no longer match the softoken and freebl shared libraries . The softoken and freebl binaries won't match any NSS binaries that may have been submitted to NIST for validation, and thus may not be verified as being the actual FIPS 140 validated cryptographic module . The only way to meet this requirement is for your application never to modify the NSS binaries. Any offer of binary sup
port that may have been previously made to you by NSS developers is null and void. If your build process modifies NSS libraries in any way (for example, to strip the symbols), it should consider not doing so for the reasons cited above. If you still decide to make unsup
ported changes, you can allow the softoken to come up in FIPS 140 mode of operation by regenerating the .chk files yourself. The to...
NSS release notes template
mpatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS 3.XX.y shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in NSS Public Functions will remain compatible with future versions of the NSS shared libraries. Feedback Bugs discovered should be re
ported by filing a bug re
port with bugzilla.mozilla.org (product NSS). ...
PKCS11 module installation
PKCS #11 modules are external modules which add to Firefox sup
port for smartcard readers, biometric security devices, and external certificate stores. This article covers the two methods for installing PKCS #11 modules into Firefox. Users can use the preferences dialog to install or remove PKCS #11 module. Extensions can programmatically manage PKCS #11 modules using the nsIPKCS11 programming interface. Note: The information in this article is specific to Firefox 3.5 and newer. Older versions of Firefox may sup
port the window.pkcs11 property for installing PKCS #11 modules. Using the Firefox preferences to install PKCS #11 modules Save the PKCS #11 module to a permanent location on your local computer Open the Firefox preferences dialog. Choose "Advanced" > "Encryption" > "Securi...
PKCS 7 functions
The public functions listed here perform PKCS #7 operations required by mail and news applications and by some of the NSS tools. The Mozilla Cross Reference (MXR) link for each function provides access to the function definition, prototype definition, and source code references. The NSS version column indicates which versions of NSS sup
port the function. Function name/documentation Source code NSS versions SEC_PKCS7AddCertificate MXR 3.3 and later SEC_PKCS7AddRecipient MXR 3.2 and later SEC_PKCS7AddSigningTime MXR 3.2 and later SEC_PKCS7ContainsCertsOrCrls MXR 3.4 and later SEC_PKCS7ContentIsEncrypted MXR 3.4 and later ...
Migration to HG
and related projects have stopped using Mozilla'a CVS server, but have migrated to Mozilla's HG (Mercurial) server. Each project now lives in its own separate space, they can be found at: https://hg.mozilla.org/projects/nspr/ https://hg.mozilla.org/projects/nss/ https://hg.mozilla.org/projects/jss/ https://hg.mozilla.org/projects/python-nss/ This migration has been used as an op
portunity to change the layout of the source directories. For NSPR, "mozilla/nsprpub" has been removed from the directory hierarchy, all files now live in the top directory of the NSPR repository. Likewise for NSS and JSS, "mozilla/security" has been removed and files now live at the top level. In addition for NSS, we have merged the contents of directories mozilla/dbm and mozilla/se...
FC_GetMechanismInfo
Name FC_GetMechanismInfo - get information on a particular mechanism. Syntax CK_RV FC_GetMechanismInfo( CK_SLOT_ID slotID, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR pInfo ); Parameters FC_GetMechanismInfo takes three parameters: slotID [Input] type [Input] . pInfo [Output] . Description FC_GetMechanismInfo obtains information about a particular mechanism possibly sup
ported by a token. A user may call FC_GetMechanismInfo without logging into the token (to assume the NSS User role). Return value CKR_OK Examples See also NSC_GetMechanismInfo ...
FC_OpenSession
a session between an application and a token. Syntax CK_RV FC_OpenSession( CK_SLOT_ID slotID, CK_FLAGS flags, CK_VOID_PTR pApplication, CK_NOTIFY Notify, CK_SESSION_HANDLE_PTR phSession ); Parameters FC_OpenSession has the following parameters: slotID [in] the ID of the token's slot. flags [in] pApplication Notify [in] pointer to a notification callback function. Not currently sup
ported. phSession [out] pointer to a session handle. Description FC_OpenSession opens a session between an application and the token in the slot with the ID slotID. The NSS cryptographic module currently doesn't call the surrender callback function Notify. (See PKCS #11 v2.20 section 11.17.1.) A user may call FC_OpenSession without logging into the token (to assume the NSS User role). Return valu...
FC_WaitForSlotEvent
Name FC_WaitForSlotEvent - waits for a slot event, such as token insertion or token removal, to occur. Syntax CK_RV FC_WaitForSlotEvent(CK_FLAGS flags, CK_SLOT_ID_PTR pSlot CK_VOID_PTR pReserved); Parameters FC_WaitForSlotEvent takes three parameters: [Input] flags [Input] pSlot. pReserved. Description This function is not sup
ported by the NSS cryptographic module. Return value FC_WaitForSlotEvent always returns CKR_FUNCTION_NOT_SUP
PORTED. Examples See also FC_WaitForSlotEvent ...
NSS_Initialize
DB, just initialize the PKCS #11 module. NSS_INIT_FORCEOPEN - Continue to force initializations even if the databases cannot be opened. NSS_INIT_NOROOTINIT - Don't try to look for the root certs module automatically. NSS_INIT_OPTIMIZESPACE - Optimize for space instead of speed. Use smaller tables and caches. NSS_INIT_PK11THREADSAFE - only load PKCS#11 modules that are thread-safe, i.e., that sup
port locking - either OS locking or NSS-provided locks . If a PKCS#11 module isn't thread-safe, don't serialize its calls; just don't load it instead. This is necessary if another piece of code is using the same PKCS#11 modules that NSS is accessing without going through NSS, for example, the Java SunPKCS11 provider. NSS_INIT_PK11RELOAD - ignore the CKR_CRYPTOKI_ALREADY_INITIALIZED error when loading ...
sslcrt.html
tificate signatures will not be checked. certUsage One of these values: certUsageSSLClient certUsageSSLServer certUsageSSLServerWithStepUp certUsageSSLCA certUsageEmailSigner certUsageEmailRecipient certUsageObjectSigner certUsageUserCertIm
port certUsageVerifyCA certUsageProtectedObjectSigner wincx The PIN argument value to pass to PK11 functions. See description below for more information. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailure. Use PR_GetError to obtain t...
NSS Tools
ocumentation, dbck 1.0 Analyze and repair certificate databases (not working in NSS 3.2) Source, Tasks/Plans modutil 1.1 Manage the database of PKCS11 modules (secmod.db). Add modules and modify the properties of existing modules (such as whether a module is the default provider of some crypto service). Source, Documentation, Tasks/Plans pk12util 1.0 Im
port and ex
port keys and certificates between the cert/key databases and files in PKCS12 format. Source, Documentation, Tasks/Plans signtool 1.3 Create digitally-signed jar archives containing files and/or code. Source, Documentation, signver 1.1 Verify signatures on digitally-signed objects. Source, Documentation, Tasks/Plans sslstrength SSL Str...
NSS Tools certutil-tasks
NSS Security Tools: certutil Tasks Newsgroup: mozilla.dev.tech.crypto Task List Better error re
porting. Most certutil errors provide no detail. Mistakes with command-line options just print a usage message. Improve certificate listings. Allow for sorting by name and trust. Sorting by trust will return CA certs first. Allow listing and lookup of keys by index and nickname. Improve coherence of key and certificate nicknames. Remove keys "stranded" without a certificate (except for the imminent (????) encryption key for password files). Sup
port im
porting keys from a file. Improve hardware token sup
port. (bugfix) Some certificate extensions cause certutil to crash. (bugfix) Certificate entries require a serial number; one s...
Invariants
locking is going away regardless.) Compartments Suppose obj = JS_GetScopeChain(cx) is not null. Then cx->compartment == obj->compartment(). When a new object is created, it is automatically created in cx->compartment, but its parent and prototype are often determined by examining the scope chain. The object and its proto and parent must be in the same compartment. So it is utterly crucially im
portant that this invariant always be true if objects are being created. The public API for compartment-hopping, JSAutoEnterCompartment, and the internal API, js::AutoCompartment, both make sure the invariant is maintained. However, there is another internal API, js::SwitchToCompartment, that lets you break this invariant, and of course in XPConnect we use that from time to time when we know we aren'...
Self-hosted builtins in SpiderMonkey
ey has the ability to self-host built-in functions in JavaScript. These docs describe the current state as of Nightly 45. Differences from normal JavaScript All self-hosted code is strict, so self-hosted functions invoked in a null or undefined scope won't be run in the scope of the global object. Self-hosted code has access to some functionality that's not available to normal JS code. Most im
portantly, it's possible to invoke any function within the scope of any object using the syntax callFunction(fun, receiver, ...args) (or callContentFunction, see below), which causes fun to be called within the scope of receiver with ...args as its arguments. In contrast to Function.prototype.call, this syntax makes it impossible for other code to interfere and gets compiled to bytecode that doesn't h...
Introduction to the JavaScript shell
flect.parse() See Parser API. Note: This function is intended only for use when testing the JavaScript engine. seal(object[, deep]) Seals the specified object, or an object graph if deep is true. By sealing an object or object graph, you disable modification of those objects. sleep(dt) Added in SpiderMonkey 1.8 Only in JS_THREADSAFE builds. Sleep for dt seconds. Fractions of a second are sup
ported. Returns true on success, false if the sleep was interrupted. stackQuota([number]) Get or set the script stack quota. throwError() Throws an error from the JS_Re
portError() function. Note: This function is intended only for use when testing the JavaScript engine. trap([function, [pc,]] expression) Sets a trap at the specific point in the JavaScript code. When the bytecode at the offset...
JS::Add*Root
t, identifying the source location of the call to JS::AddNamed*Root for debugging purposes. Needs the Example for typical usage of the name parameter. All the JS::Add*Root methods are idempotent: multiple calls for the same address will add only one root. Correspondingly, only a single JS::Remove*Root is required to unroot the location. On success, these functions return true. Otherwise they re
port an out of memory error and return false. See Also MXR ID Search for JS::AddValueRoot MXR ID Search for JS::AddStringRoot MXR ID Search for JS::AddObjectRoot MXR ID Search for JS::AddNamedValueRoot MXR ID Search for JS::AddNamedValueRootRT MXR ID Search for JS::AddNamedStringRoot MXR ID Search for JS::AddNamedObjectRoot MXR ID Search for JS::AddNamedScriptRoot bug 912581 bug 1107639 ...
JS::Compile
ipt to compile. chars const char16_t * String containing the script to compile. bytes const char * String containing the script to compile. length size_t The length of chars or bytes, in characters. file FILE * File handle containing the function. filename const char * Name of file or URL containing the function. Used to re
port filename or URL in error messages. script JS::MutableHandleScript Out parameter. On success, script receives the result script. Description JS::Compile compiles a script, srcBuf, chars, bytes, or file, for execution. The script is associated with a JS object. srcBuf, chars, bytes is the string containing the text of the script. length indicates the size of the text version...
JS::Evaluate
urce buffer containing the script to compile and execute. chars const char16_t * String containing the script to compile and execute. bytes const char * String containing the script to compile and execute. length size_t The length of chars or bytes, in characters. filename const char * Name of file or URL containing the script. Used to re
port filename or URL in error messages. rval JS::MutableHandleValue Out parameter. On success, if rval is not NULL, *rval receives the result value. Description JS::Evaluate compiles and executes a script in the specified scope, obj or scopeChain. srcBuf, chars and bytes are the string containing the text of the script. length indicates the size of the text version of the scrip...
JS::GetSelfHostedFunction
t. id JS::Handle<jsid> A pointer to jsid of the name to assign to the new function. nargs unsigned Number of arguments the function expects. Description JS::GetSelfHostedFunction creates a new JavaScript function implemented in self-hosted JavaScript. On success, JS::GetSelfHostedFunction returns a pointer to the newly created function. Otherwise, it re
ports an out-of-memory error and returns NULL. See Also MXR ID Search for JS::GetSelfHostedFunction bug 1140573 ...
JS::SetOutOfMemoryCallback
ion to use. data void * data parameter which will be passed to JS::OutOfMemoryCallback. Added in SpiderMonkey 38 Callback syntax typedef void (* OutOfMemoryCallback)(JSContext *cx, void *data); Name Type Description data void * data parameter passed to JS::SetOutOfMemoryCallback. Added in SpiderMonkey 38 Description Unlike the error re
porter, which is only called if the exception for an OOM bubbles up and is not caught, the JS::OutOfMemoryCallback is called immediately at the OOM site to allow the embedding to capture the current state of heap allocation before anything is freed. If the large-allocation-failure callback is called at all (not all allocation sites call the large-allocation-failure callback on failure), it is called b...
JSClass.flags
value is the logical OR of zero or more of the following constants: Flag Meaning JSCLASS_HAS_PRIVATE This class uses private data. If this flag is set, each instance of the class has a field for private data. The field can be accessed using JS_GetPrivate and JS_SetPrivate. MXR ID Search for JSCLASS_HAS_PRIVATE JSCLASS_PRIVATE_IS_NSISUP
PORTS Mozilla extension. The private field of each object of this class points to an XPCOM object (see nsISup
ports). This is only meaningful if SpiderMonkey is built with XPConnect and the JSCLASS_HAS_PRIVATE flag is also set. MXR ID Search for JSCLASS_PRIVATE_IS_NSISUP
PORTS JSCLASS_IS_DOMJSCLASS Added in SpiderMonkey 17 Objects are DOM. MXR ID Searc...
JSClass
onstruct(JSContext *cx, unsigned argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JSObject *obj = JS_NewObjectForConstructor(cx, &printer_class, args); /* SpiderMonkey 31 or older * JSObject *obj = JS_NewObjectForConstructor(cx, &printer_class, vp); */ if (!obj) return false; MyPrinter *p = new MyPrinter; if (p == NULL) { JS_Re
portOutOfMemory(cx); return false; } JS_SetPrivate(cx, obj, p); args.rval().setObject(*obj); /* SpiderMonkey 31 or older * JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); */ return true; } { JS_InitClass(cx, global, JS::NULL(), &printer_class, printer_construct, 1, NULL, NULL, NULL, NULL); } See also MXR ID Search for JSClass JSClass.flags JS_...
JSConstDoubleSpec
ble or integer. name const char * Name to assign the double. flags uint8_t Property attributes for the double. Obsolete since JSAPI 35 Currently these can be 0 or more of the following values OR'd: JSPROP_ENUMERATE: property is visible in for loops. JSPROP_READONLY: property is read-only. JSPROP_PERMANENT: property cannot be deleted. JSPROP_EX
PORTED: property can be ex
ported outside its object. JSPROP_INDEX: property is actually an array element. If this field is 0, JS_DefineConstDoubles uses the default attributes JSPROP_READONLY | JSPROP_PERMANENT instead. spare uint8_t [3] Reserved for future use. Obsolete since JSAPI 35 Description JSConstDoubleSpecs is used to define a set of double values that a...
JSConvertOp
arameter. On success, *vp receives the converted value. Description JSConvertOp callback specifies conversion behavior for objects having this class, implementing the ECMAScript [[DefaultValue]] behavior for them. On success it must return a primitive value in *vp. Implementations of this hook have historically been required to accept any type. However, the engine itself only requires sup
port for JSTYPE_STRING, JSTYPE_NUMBER, and JSTYPE_VOID, if JS_ConvertValue is not used. If you do not use the JS_ConvertValue method, you may omit sup
port for other types. (Sup
port for the other types may eventually be removed.) The callback returns true to indicate success or false to indicate failure. JSClass hooks JSClass offers the following hook: The JSClass.convert callback implements t...
JSDeletePropertyOp
Description JSDeletePropertyOp callback is a hook that applications may install to be called at some point during property access. A JSDeletePropertyOp may be installed on a JSClass to hook property deletes. If a JSDeletePropertyOp does nothing and returns true, then property delete is unaffected. It proceeds as normal. This callback may veto the ongoing property operation by optionally re
porting an error or raising an exception and then returning false. The operation then fails, and the error is propagated to the caller. Otherwise the callback must return true, and the property operation proceeds. JSClass hooks JSClass offers the following hook: JSClass.delProperty is called during most property deletions, even when obj has no property named id. If an error occurred, return...
JSFUN_BOUND_METHOD
browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Flag that indicates a function nominally associated with an object is bound, instead, to that object's parent. Syntax JSFUN_BOUND_METHOD Description This macro exists only for backward compatibility with existing applications. Its use is deprecated. Future versions of the JavaScript engine may not sup
port or recognize this macro. JSFUN_BOUND_METHOD is a flag that indicates a method associated with an object is bound to the method's parent, the object on which the method is called. See Also JSFUN_GLOBAL_PARENT bug 429507 ...
JSVAL_LOCK
To lock a value, use local roots with JS_AddRoot. ...
JSVAL_UNLOCK
To unlock a value, use local roots with JS_RemoveRoot. ...
JS_AddArgumentFormatter
es; JS_FALSE if the conversion function should convert from C values to jsval values. vpp jsval ** In-out parameter. A pointer into an array of jsval values. app va_list * In-out parameter. A pointer to an argument pointer, used to retrieve pointers to C values. Callback Description The conversion function should return true on success, and return false after re
porting an error or detecting an already-re
ported error. For a given format string, for example "AA", the formatter is called from JS_ConvertArgumentsVA like so: formatter(cx, "AA...", JS_TRUE, &sp, &ap); sp points into the arguments array on the JS stack, while ap points into the stdarg.h va_list on the C stack. The JS_TRUE passed for fromJS tells the formatter to convert zero or more jsvals at sp t...
JS_Add*Root
g the source location of the call to JS_AddNamedRoot for debugging purposes. JS_DumpNamedRoots can be used to access this information from a debugger. All the JS_Add*Root methods are idempotent: multiple calls for the same address will add only one root. Correspondingly, only a single JS_RemoveRoot is required to unroot the location. On success, these functions return JS_TRUE. Otherwise they re
port an out of memory error and return JS_FALSE. See Also MXR ID Search for JS_AddValueRoot MXR ID Search for JS_AddStringRoot MXR ID Search for JS_AddObjectRoot MXR ID Search for JS_AddNamedValueRoot MXR ID Search for JS_AddNamedStringRoot MXR ID Search for JS_AddNamedObjectRoot bug 912581 ...
JS_AliasProperty
property. Notes This feature has been removed. An alias does not replace a property's name; it supplements it, providing a second way to reference a property. If the alias is successfully created and associated with the property, JS_AliasProperty returns JS_TRUE. Creating an alias does not change the length of the property array. If the property name you specify does not exist, JS_AliasProperty re
ports an error, and returns JS_FALSE. If the property is currently out of scope, already exists, or the alias itself cannot be assigned to the property, JS_AliasProperty does not re
port an error, but returns JS_FALSE. Once you create an alias, you can reassign it to other properties as needed. Aliases can also be deleted. Deleting an alias does not delete the property to which it refers. See Also JS...
JS_AlreadyHasOwnProperty
t yet been resolved.) Shared, permanent, delegated properties are not found. (Such properties are an implementation detail of SpiderMonkey. They are meant to be a transparent optimization; this is the only API that breaks the abstraction.) For non-native objects, this falls back on a complete search. This calls the JSObjectOps.lookupProperty hook. *foundp is set to true only if lookupProperty re
ports that the property was found on obj itself and not on some other object (even the corresponding outer object, if any). If the property is found on obj, this sets *foundp to true and returns true. If the property is not found on obj, this sets *foundp to false and returns true (to indicate that no error occurred). If the search fails with an error or exception, this returns false. See Also MXR ID...
JS_BufferIsCompilableUnit
on this JSContext. obj JS::HandleObject The global object, or NULL. utf8 const char * String containing the script to compile. length size_t The length of utf8 in characters. Description Given a buffer, return false if the buffer might become a valid JavaScript statement with the addition of more lines. Otherwise return true. The intent is to sup
port interactive compilation - accumulate lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to the compiler. See Also MXR ID Search for JS_BufferIsCompilableUnit JS::Evaluate JS::Compile JS::CompileOffThread JS::CompileFunction JS_DecompileScript ...
JS_CheckAccess
pecifies what kind of access to check for. It is one of the following values: Value Description JSACC_PROTO Check for permission to read to obj's prototype. (This is redundant with passing the string id "__proto__" as id.) JSACC_PARENT Check for permission to read obj's parent. (This is redundant with passing the string id "__parent__" as id.) JSACC_IM
PORT Check for permission to im
port the property. JSACC_WATCH Check for permission to place a watchpoint on the property. JSACC_READ Check for permission to get the property's value. JSACC_WRITE When bitwise-ORed with one of the above values, check for permission to write the property, not read it. The access check proceeds as follows. If obj has custom JS...
JS_CompileScript
source, for execution. JS_CompileUCScript is the Unicode version of the function. The script is associated with a JS object. ascii and chars are the string containing the text of the script. length indicates the size of the text version of the script in characters. On success, JS_CompileScript and JS_CompileUCScript stores the newly compiled script to *script and returns true. Otherwise, they re
port an error, stores NULL to *script, and return false. See Also The JSAPI User Guide contains example code using compiled scripts. MXR ID Search for JS_CompileScript MXR ID Search for JS_CompileUCScript JS::Evaluate JS::CompileOffThread JS::CompileFunction JS_ExecuteScript JS_DecompileScript bug 1143793 -- removed obj parameter ...
JS_ConvertValue
which to perform the conversion. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. v JS::HandleValue The value to convert. type JSType The type to which the value is to be converted. type must be one of JSTYPE_VOID, JSTYPE_OBJECT, JSTYPE_FUNCTION, JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_BOOLEAN. Otherwise JS_ConvertValue re
ports an error. vp JS::MutableHandleValue Out parameter. On success, *vp receives the converted value. Description JS_ConvertValue converts a JavaScript value, v, to the specified type. On success, the converted value is stored in *vp. Typically users of this function set vp to point to v, so that if conversion is successful, v now contains the converted value. JS_ConvertValue ...
JS_DeleteElement
ex, from an object, obj. If an object references an element belonging to a prototype, the element reference is removed from the object, but the prototype's element is not deleted. If deletion is successful, JS_DeleteElement returns true. Otherwise it returns false. For JavaScript 1.2 and earlier, if failure occurs because you attempt to delete a permanent or read-only element, JS_DeleteElement re
ports the error before returning false. For JavaScript 1.3 and later, the attempt is silently ignored. To truncate an array, use JS_SetArrayLength. To remove all elements and properties from an object, call JS_ClearScope. See Also MXR ID Search for JS_DeleteElement bug 1113369 -- added result parameter ...
JS_DeleteElement2
d. If deletion is successful, JS_DeleteElement2 stores true to *succeeded and returns true. Otherwise it returns false and the value of *succeeded is undefined. Notes Per the ECMA standard, JS_DeleteElement2 removes read-only properties from objects as long as they are not also permanent. For JavaScript 1.2 and earlier, if deletion fails because the property is permanent, JS_DeleteElement2 re
ports the error and returns false. For JavaScript 1.3, the attempt is silently ignored. In both these cases, *succeeded will receive the stored value of the property that was not deleted. To remove all properties from an object, call JS_ClearScope. See Also MXR ID Search for JS_DeleteElement2 bug 1113369 -- added result parameter ...
JS_EncodeCharacters
if (dst == NULL) return JS_FALSE; /* Convert characters to bytes. */ JS_EncodeCharacters(cx, src, srclen, dst, &dstlen); /* Use the converted bytes for something. */ ... /* Remember to free the bytes afterwards. */ JS_free(cx, dst); return JS_TRUE; On success, JS_EncodeCharacters sets *dstlenp to the real result length and returns JS_TRUE. Otherwise it re
ports an error and returns JS_FALSE. This happens if the destination is too small for the resulting string or if the source buffer isn't proper UTF-16 because it contains unpaired surrogate values. The user is responsible for allocating and freeing the memory of the destination string. JS_EncodeCharacters never adds a trailing null character. To obtain a null-terminated string, allocate an extra byte...
JS_GetArrayLength
on JS_GetArrayLength gets the .length property of obj as though by calling JS_GetProperty and converts it to a 32-bit unsigned integer. If obj is an array (see JS_IsArrayObject), this is guaranteed to succeed, because the .length property of an array is always a number and can't be deleted or redefined. On success, JS_GetArrayLength stores the length in *lengthp and returns true. On failure, it re
ports an error and returns false, and the value left in *lengthp is undefined. See Also MXR ID Search for JS_GetArrayLength JS_GetElement JS_SetArrayLength ...
JS_GetConstructor
A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::Handle<JSObject*> The object whose constructor is to be returned. Description JS_GetConstructor retrieves the constructor property of a given object, obj. If the result is a Function object, JS_GetConstructor returns a pointer to that object. Otherwise, it re
ports an error and returns NULL. To get an object's prototype, use JS_GetPrototype. To get an object's parent, use JS_GetParent. See Also MXR ID Search for JS_GetConstructor ...
JS_GetErrorPrototype
This article covers features introduced in SpiderMonkey 38 Return the original value of Error.prototype. Syntax JSObject * JS_GetErrorPrototype(JSContext *cx); Name Type Description cx JSContext * Pointer to a JS context whose errors should be re
ported via your function. Other contexts in the same runtime can have their own error re
porting functions. Description JS_GetErrorPrototype returns the original value of Error.prototype from the global object of the current compartment of cx. See Also MXR ID Search for JS_GetErrorPrototype bug 997285 ...
JS_GetGlobalObject
h to retrieve the global object. Description This function is obsolete: use JS_GetGlobalForObject or JS_GetGlobalForScopeChain instead. The concept of a global object belonging to a context will likely be phased out in future versions of SpiderMonkey. JS_GetGlobalObject retrieves the global object for a specified JSContext *, cx. This returns NULL if cx has no global object. SpiderMonkey sup
ports applications that have multiple global objects, such as the various window objects in a Web browser. The object returned by JS_GetGlobalObject is not necessarily the same thing as the global object seen by any JavaScript code that runs in cx! If a function is executing, the global object used by that function is determined when the function is created. Furthermore, some JSAPI functions, such as ...
JS_GetPrivate
ax void * JS_GetPrivate(JSObject *obj); Name Type Description obj JSObject * An object whose JSClass has the JSCLASS_HAS_PRIVATE flag. Description JS_GetPrivate accesses an object's private data field. obj must be an instance of a class that has the JSCLASS_HAS_PRIVATE flag. New objects' private data fields are initially NULL. If obj is a Function object, as re
ported by JS_ObjectIsFunction, the private data is a pointer to a JSFunction. (But consider using JS_ValueToFunction instead to access it.) Warning: It is dangerous to call JS_GetPrivate on a JSObject * unless the object's JSClass is known. If the object is not of the expected JSClass, the result of JS_GetPrivate would probably be NULL or a pointer to some unexpected type of data. Casting that p...
JS_GetScopeChain
nction, it's running in a scope that was passed to JS_ExecuteScript or a similar function by the application. This scope chain may or may not contain cx's current global object. If any code is currently executing in cx, JS_GetScopeChain returns a pointer to the first JSObject on the current scope chain. Otherwise, if cx has a global object, JS_GetScopeChain returns that. Otherwise, an error is re
ported and JS_GetScopeChain returns NULL. To walk the scope chain, use JS_GetParent. See Also MXR ID Search for JS_GetScopeChain JS_GetGlobalForScopeChain bug 632064 ...
JS_GetStringLength
This is the same as the length property of the string. This is the same as the length of the array returned by JS_GetStringChars, in char16_ts (not bytes). ...
JS_GetTypeName
cx JSContext * Pointer to a JS context from which to derive runtime information. type JSType One of JSTYPE_VOID, JSTYPE_OBJECT, JSTYPE_FUNCTION, JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_BOOLEAN. Description JS_GetTypeName returns a pointer to a string literal description of a specified JS data type, type. ...
JS_HasArrayLength
uccess, JS_HasArrayLength returns JS_TRUE, and *lengthp receives the current value of the length property. On failure, JS_HasArrayLength returns JS_FALSE, and the value left in *lengthp is undefined. This function differs from JS_GetArrayLength in the treatment of errors and unusual cases, like when an object's length is negative or not a number. This function may return JS_FALSE without having re
ported any error or exception. See Also JS_DefineElement JS_DeleteElement JS_GetArrayLength JS_GetElement JS_IsArrayObject JS_LookupElement JS_NewArrayObject JS_SetArrayLength JS_SetElement bug 657298 ...
JS_InitClass
e functions, if any, are added to the new class's constructor. (This is the JavaScript equivalent of public static methods in C++ or Java.) Description JS_InitClass initializes a JSClass and (optionally) makes it visible to JavaScript code. This is one way to create JSObjects whose properties and methods are implemented in native C/C++. If you need a native function but you don't need to sup
port instances or inheritance, JS_InitClass might be overkill. JS_DefineFunction is simpler. A JSAPI class consists of a JSClass structure, a constructor, a prototype object, and properties and functions. The JSClass is an internal data structure that is not exposed outside the JavaScript engine. It specifies the name of the class, its flags, and its property access functions. These include native C f...
JS_InternString
table of all existing interned strings. If an interned string already exists with the desired value, these functions return the existing string. Otherwise a new string is created and added to the table. Strings created with these functions are protected from garbage collection for the lifetime of the JSRuntime. On success, these functions return a pointer to the interned string. Otherwise they re
port an error and return NULL. See Also MXR ID Search for JS_InternString MXR ID Search for JS_InternStringN MXR ID Search for JS_InternUCString MXR ID Search for JS_InternUCStringN JS_GetEmptyStringValue JS_NewStringCopyN JS_NewStringCopyZ JS_NewUCString JS_NewUCStringCopyN JS_NewUCStringCopyZ JS_ValueToString ...
JS_MaybeGC
Syntax void JS_MaybeGC(JSContext *cx); Name Type Description cx JSContext * The context in which to perform garbage collection, if needed. Description JS_MaybeGC tries to determine whether garbage collection in cx's runtime would free up enough memory to be worth the amount of time it would take. If so, it performs some garbage collection. Calling JS_MaybeGC when the application is idle can help prevent garbage collection from happening at less convenient times. ...
JS_NewArrayObject
rayObject defines an enumerable array element with the value contents[i] on the new array. JS_NewArrayObject with length parameter creates a new array object with the specified length; the result is like the JavaScript expression new Array(length). The new array has the specified length, but it doesn't have any elements. On success, JS_NewArrayObject returns the new array object. Otherwise it re
ports an error as though by calling JS_Re
portOutOfMemory and returns NULL. Obsolete since JSAPI 30. JS_NewArrayObject with length parameter creates a new array object with the specified length. If vector is non-null, then for each index i from 0 to length - 1, JS_NewArrayObject defines an enumerable array element with the value vector[i] on the new array. (This means that if length is nonzero and v...
JS_NewFunction
RUCTOR, a created function can be called as a constructor. parent may be used to specify the new function's parent; NULL is usually the right thing here. name is the name to assign to the function. If name is NULL, the new function has no name. (JS_GetFunctionId, passed the new function, will return NULL.) On success, JS_NewFunction returns a pointer to the newly created function. Otherwise it re
ports an out-of-memory error and returns NULL. See Also MXR ID Search for JS_NewFunction MXR ID Search for JS_NewFunctionById JS_CallFunction JS_CallFunctionName JS_CallFunctionValue JS_CompileFunction JS_CompileUCFunction JS_DefineFunction JS_DefineFunctions JS_GetFunctionName JS_GetFunctionObject bug 607695 - added JS_NewFunctionById bug 1140573 - removed parent parameter bug 105475...
JS_NewStringCopyN
s create ordinary JavaScript strings, and all JavaScript strings are made up of 16-bit characters. If the array s contains more than n characters, the new string contains a truncated version of the original string. The string may contain null characters ('\0'). They are copied into the new string like any other character. You can use JS_NewStringCopyN to copy binary data or to copy only a certain
portion of a C string into a JavaScript string. On success, JS_NewStringCopyN and JS_NewUCStringCopyN return a pointer to the new JS string. Otherwise they return NULL. See Also MXR ID Search for JS_NewStringCopyN MXR ID Search for JS_NewUCStringCopyN JS_GetEmptyStringValue JS_NewStringCopyZ JS_NewUCStringCopyZ JS_ValueToString ...
JS_ParseJSON
parsing (and optionally, processing by the reviver). If an error occurs, the value left in *vp is undefined. Description Use these functions to parse a sequence of characters as JSON. The parsing rules applied by these methods are exactly those specified by ECMAScript 5. Various JSON extensions like trailing commas, unquoted property names, more generous number parsing, and so on are not sup
ported. MXR ID Search for JS_ParseJSON MXR ID Search for JS_ParseJSONWithReviver ...
JS_PreventExtensions
r if the object couldn't be made non-extensible. There are instead two modes of failure: through internal error, and because the object denied the attempt. The first case occurs when something went wrong internally, not necessarily because the object chose not to become non-extensible. For example, if making the object requires an allocation, and that allocation fails, out-of-memory might be re
ported, and JS_PreventExtensions would return false. This might also occur if the object is a proxy, and some internal state of the proxy means that no coherent behavior is possible. For example, if the object is a revocable proxy that has been revoked, it makes no sense to say that an attempt to prevent extensions either succeeded or failed: it's a category error. Thus in this case JS_PreventExten...
JS_SaveExceptionState
ect may then be used to restore again the context using JS_RestoreExceptionState, or discarded using JS_DropExceptionState. Either of those two functions frees any memory used by the JSExceptionState. The JSExceptionState created by this function automatically roots any pending exception object which needs to be protected from the GC. This function returns NULL if the engine was not built with sup
port for exceptions. See Also MXR ID Search for JS_SaveExceptionState JSExceptionState JS_RestoreExceptionState JS_DropExceptionState ...
JS_SetInterruptCallback
)). Description These functions allow setting an interrupt callback that will be called from the JS thread some time after any thread triggered the callback using JS_RequestInterruptCallback. To schedule the GC and for other activities the engine internally triggers interrupt callbacks. The embedding should thus not rely on callbacks being triggered through the external API only. Im
portant note: Additional callbacks can occur inside the callback handler if it re-enters the JS engine. The embedding must ensure that the callback is disconnected before attempting such re-entry. JS_SetInterruptCallback sets a callback that can be called asynchronously. Some common uses for an interrupt callback are: To run garbage collection periodically, by calling JS_MaybeGC; To periodically...
JS_SetOperationCallback
allback API. Description These functions allow setting an operation callback that will be called from the JS thread some time after any thread triggered the callback using JS_TriggerOperationCallback. To schedule the GC and for other activities the engine internally triggers operation callbacks. The embedding should thus not rely on callbacks being triggered through the external API only. Im
portant note: Additional callbacks can occur inside the callback handler if it re-enters the JS engine. The embedding must ensure that the callback is disconnected before attempting such re-entry. JS_SetOperationCallback sets a callback that can be called asynchronously. Some common uses for an operation callback are: To run garbage collection periodically, by calling JS_MaybeGC; To periodically...
JS_SetParent
object is exposed to a script, the object's parent must not change. The JavaScript engine relies on this invariant. JS_SetParent has no way to check that this is the case, but nonetheless, applications must not call JS_SetParent on an object that has already been exposed to a script. If an application does this, the behavior is undefined. On success, JS_SetParent returns JS_TRUE. Otherwise, it re
ports an error or sets an exception and returns JS_FALSE. See Also MXR ID Search for JS_SetParent bug 1136980 - removed ...
JS_SetPendingException
native function or hook using this to throw an exception must also return false to ensure the exception is thrown. Each JSContext's pending-exception field is a GC root. That is, garbage collection never collects a pending exception. See examples in the JSAPI Phrasebook. See Also MXR ID Search for JS_SetPendingException JS_IsExceptionPending JS_GetPendingException JS_ClearPendingException JS_Re
portPendingException ...
JS_SetProperty
the hook succeeds and the property has a stored value, then the value left in v by the addProperty hook becomes the stored value of the property. Setting the value. Two of the cases above can involve setting the value of a new or existing property of obj. This is done as follows. If the property has a JavaScript setter, it is called; otherwise, if it has a JavaScript getter, then an error is re
ported; otherwise the property's setter is called, passing the arguments (cx, obj, id, &v). If the setter succeeds and the property has a stored value, then the value left in v becomes the stored value of the property. On success, JS_SetProperty returns true, and the value in v is left unchanged unless a hook or setter modified it. On error or exception, it returns false, and the value left in v is u...
JS_SetPropertyAttributes
ibutes is the Unicode version of the function. attrs is an unsigned integer containing the attribute value to set. It is the bitwise OR of zero or more of the following values: Flag Purpose JSPROP_ENUMERATE Property is visible in for and in loops. JSPROP_READONLY Property is read only. JSPROP_PERMANENT Property cannot be deleted. JSPROP_EX
PORTED Property can be im
ported by other objects. JSPROP_INDEX Property is actually an index into an array of properties, and is cast to a const char *. If JS_SetPropertyAttributes cannot locate an object with the specified property, it returns JS_FALSE, and the value left in *foundp is undefined. If the specified property or the specified object does not exist, foundp is set to...
JS_THREADSAFE
We have recently made major changes to this feature. Until recently, sharing objects among threads would mostly work, although scripts could easily make it crash. We have now completely removed that feature. Each thread that uses the JavaScript engine must essentially operate in a totally separate region of memory. ...
JS_ValueToFunction
l or enclosing scope, and therefore must not be treated like a real function. Instead, use JSVAL_IS_OBJECT and JS_ObjectIsFunction() to check whether a value is already a function, or use JS_ConvertValue() to convert a value to JSTYPE_FUNCTION safely. If v is a Function object, this returns the associated JSFunction. If v is null, undefined, a boolean, a number, or a string, a TypeError is re
ported and JS_ValueToFunction returns NULL. Otherwise, v is an object. The JavaScript engine attempts to convert it to a function. (Implementation note: The actual conversion is performed by the object itself. The object's JSObjectOps.defaultValue method is called with hint=JSTYPE_FUNCTION.) JS_ValueToFunction returns a pointer to the converted function. If conversion fails with an error or exceptio...
JS_ValueToId
index of array to convert. chars JS::TwoByteChars The string to convert. key JSProtoKey The prototype key to convert. idp JS::MutableHandleId Out parameter. On success, *idp receives the converted jsid. Description JS_ValueToId converts a specified JS::Value, v, to a jsid. If v is an integer, *idp receives an integer jsid. Otherwise, if E4X sup
port is enabled and v is an object, *idp receives an object jsid. Otherwise, *idp receives an interned string jsid based on the value of v. If v is not a string, it is converted to a string as if by calling JS_ValueToString. JS_StringToId and JS_CharsToId convert a specified string to a jsid. JS_IndexToId converts a specified integer index to an integer jsid. JS::ProtoKeyToId converts a specified p...
Profiling SpiderMonkey
s to work from: media:Profiling-ammo.zip 3.) Once you have some changes you'd like to try, you can just rebuild the js/src directory, since it produces its own shared library, even in libxul and static builds. make -C my-obj-dir/js/src Other Ways To Profile For Linux, there are global jprof functions available. See the documentation on the --enable-jprof mozconfig option. We're working to add sup
port for other profilers, such as OProfile, Intel VTune, and Callgrind. When we have JS scriptable profiling options available for all tier 1 platforms, we'll look at adding global start/stop profiling functions. If you'd like to profile something at a higher level of detail than the JS Shark functions allow, there are corresponding C functions available at the bottom of jsdbgapi.h. Costs Of Thread Sa...
SpiderMonkey 52
evious SpiderMonkey releases. It also contains new language and API features described in detail below. ...
SpiderMonkey releases
ll that is built into a binary that runs our smoke tests, but we do not maintain it nor actively test its suitability for general embedding. We have periodically created "releases", but they are best-effort and incomplete. We do happily accept patches, and make some effort to keep the tip of the Gecko tree minimally working as an embeddable source package. We are very limited in our ability to sup
port older versions, including those labeled as "releases" on this page. The easiest way to fetch the version corresponding to the current Firefox release is to visit the treeherder page for the release repository and click on the first SM(pkg) link you see. That will open a small window in the bottom left with a line like "artifact uploaded: mozjs-57.0.1.tar.bz2". Past releases SpiderMonkey 52 ...
Running Automated JavaScript Tests
. Most of the Spidermonkey shell jobs, labeled SM(...), will include JS shell runs of both jstests and jit-tests. Running jit-tests The jit-test suite uses a Python harness that is similar to the jstests shell harness, but with some minor differences. Basic usage is the same: jit_test.py PATH_TO_JS_SHELL Developers will usually want to run like this to skip the slow tests and cover the most im
portant options: jit_test.py --no-slow PATH_TO_JS_SHELL You can select specific tests to run in the same way as the jstests shell harness. Most of the options in the jstests harness are also available for this one, but a few have different names. Use -h to see all the options. The --jitflags option allows you to test the JS executable with different flags. The flags are used to control which featur...
Split object
SpiderMonkey returns the inner object instead. Inner and outer objects are in certain other respects the same object: If Object.hasOwnProperty is called on an inner object, and the named property is found on an outer object, that's considered close enough and hasOwnProperty returns true. Note that none of the rules listed here affects ordinary property accesses. SpiderMonkey's split object sup
port, by itself, does not cause inner object properties to appear on the outer object or vice versa. Split objects that need this behavior must implement it in custom JSClass hooks. In the case of window, each half has custom hooks. ...
SpiderMonkey: The Mozilla JavaScript runtime
nkey Internals: GC Separate internals article on the GC SpiderMonkey Internals: Hacking Tips Collection of helpful tips & tools for hacking on the engine Related Topics JavaScript FOSS projects using or based on SpiderMonkey Releases SpiderMonkey release notes Current and past versions: 52, 45, 38, 31, 24, 17 Community Mailing list SpiderMonkey questions on Stack Overflow Re
port a bug ...
TPS Bookmark Lists
aths must begin with one of the following: "menu": the normal bookmarks menu "toolbar": the bookmarks toolbar "tags": the tags folder "unfiled": the unfiled bookmarks folder "places": the places root folder ("menu", "toolbar", and "unfiled" are all children of this) Sub-folders are preceded with forward slashes, so "menu/folder1" denotes that "folder1" is a sub-folder of "menu". TPS does not sup
port forward slashes as part of a folder name. Folder contents The contents for a folder are given as an array of objects, representing various bookmark types, described below. Bookmark objects Valid properties are: uri: the bookmark uri. Required. title: the bookmark title. Optional. Defaults to the bookmark uri. loadInSidebar: true or false. Optional. Toggles the "load in sidebar" property. descrip...
TPS Formdata Lists
Note 2, Sync currently does not sync Formdata dates, so the date field is ignored when performing verify and verify-not actions. See bug 552531. ...
TPS Pref Lists
A prefs asset list is an array of objects with name and value keys, representing browser preferences. For example: var prefs1 = [ { name: "browser.startup.homepage", value: "http://www.getfirefox.com" }, { name: "browser.urlbar.maxRichResults", value: 20 }, { name: "browser.tabs.autoHide", value: true } ]; Pref lists and phase actions The only actions sup
ported for preference asset lists are modify and verify: Prefs.modify Prefs.verify Sync only syncs certain preferences. To find the list of valid preferences, go to about:config on a browser that has Weave installed, and search for services.sync.prefs.sync. For a more detailed test example, see the TPS prefs unit test. ...
Zest tools
It is being developed alongside Zest and can be expected to showcase the latest Zest features. ...
compare-locales
locales shows the missing and obsolete strings in a pseudo-diff format. ab-CD browser chrome/browser browser.dtd +backForwardMenu.tooltip +fullZoomEnlargeCmd.commandkey3 +fullZoomReduceCmd.commandkey2 +fullZoomResetCmd.commandkey2 +organizeBookmarks.label -showAllBookmarksCmd2.label migration/migration.dtd -im
portFromFile.accesskey -im
portFromFile.label +im
portFromHTMLFile.accesskey +im
portFromHTMLFile.label You can assume changed strings when you see entities removed and added with a similar name. The file names will be shown in a hierarchical form, so in the example above, your files are browser.dtd in ab-CD/browser/chrome/browser and migration.dtd in another directory lev...
Security and the jar protocol
iNotes has since been updated so that it no longer needs remote jars, so they have been disabled again in Firefox 55. You may re-enable the feature if necessary by setting the network.jar.block-remote-files preference to false. Java Archive (JAR) files are simply Zip compressed bundles of files. ...
Signing Mozilla apps for Mac OS X
eate your ID: Open the Developer Certificate Utility. Click "Certificates" from the left hand menu. Click "Create a Certificate" at the top right corner Select the "Developer ID" radio button and uncheck the "Developer ID Installer Certificate" box. Click "Create" and follow the instructions in the wizard. It will guide you through creating a private key, certificate signing request, and im
porting your new Developer ID into the Keychain Access application on your Mac. If the "Developer ID" radio button is greyed out you probably have a group account. These types of accounts only allow for the "Agent" role to create Developer IDs. Contact the person who created your group Apple Developer Account if you get stuck here. The codesign tool Apple provides a tool called codesign; this comma...
ROLE_CELL
<< Gecko Roles Page Represents a cell within a table. Also, see ROLE_TABLE. ...
ROLE_ROW
<< Gecko Roles Page Represents a row of cells within a table. Also, see ROLE_TABLE. ...
AT Development
Introduction Software Accessibility: Where are we today? The accessibility of computer software has seen drastic improvements over the past two decades. This article (from 2007) reviews the progress and technology as it has developed. Guidelines AT APIs Implementation by Gecko AT vendors guide to sup
port Gecko-based applications like Firefox, Thunderbird and so on. Accessibility Architecture How the accessibility hierarchy is implemented in Mozilla (some issues aren't addressed by previous guide). Building XULRunner with Python How to build XULRunner with Python on Windows. Then comtypes gives access to MSAA and IAccessible2. References AT APIs Implementation References Shows how Gecko handles ATK, IAccessible2, MSAA and Universal Access API Accessible We...
Embedded Dialog API
to create additional windows at times perhaps unexpected by the containing appliction. These new windows can be entire new browser windows opened in response to web page script, or dialogs or alerts which may arise from script or merely during normal operation of the browser. Part of Gecko's embedding API is callbacks into the embedding application for creating new windows. The complete windowing
portion of the API is large and complex, but it need not be entirely implemented. Its simplest requirements are that the app must allow Gecko to create new browser windows and new simple, empty windows. Gecko can use the latter to pose dialogs built from XUL. XUL dialogs are part of the Gecko package; they are the default dialog posing mechanism. Many embedding applications will find them entirely suf...
Manipulating bookmarks using Places
r parentFolderId = bmsvc.getFolderIdForItem(newBkmkId); Observing changes to bookmarks and tags To set up an observer to listen for changes related to bookmarks, you will need to create an nsINavBookmarkObserver object and use the nsINavBookmarksService.addObserver() and nsINavBookmarksService.removeObserver() methods. Note that this example takes advantage of XPCOMUtils to generate the nsISup
ports.QueryInterface() method. // An nsINavBookmarkObserver var myExt_bookmarkListener = { onBeginUpdateBatch: function() {}, onEndUpdateBatch: function() {}, onItemAdded: function(aItemId, aFolder, aIndex) {}, onItemRemoved: function(aItemId, aFolder, aIndex) {}, onItemChanged: function(aBookmarkId, aProperty, aIsAnnotationProperty, aValue) { MyExtension.doSomething(); }, onItemVis...
Retrieving part of the bookmarks tree
Bookmarks are retrieved using the Places query system. For more basic bookmarks examples, see Manipulating bookmarks using Places. Get the query and options objects All querying is done through the history service. ...
Using the Places annotation service
ervice also provides special-case handling of favicons. When the annotation name is "favicon," the annotation protocol handler will pass the request through to the favicon service for handling. To get a favicon annotation URI for a given favicon, use nsIFaviconService.getFaviconLinkForIcon and to get the favicon annotation URI for a given page, use nsIFaviconService.getFaviconLinkForPage. It is im
portant that you use these functions and not make up your own URIs, because these functions will efficiently default to the default page favicon when it does not exist. See Using the Places favicon service for more information. Lifetime of annotations Annotation expiration can be explicitly stated when the annotation is created. If no expiration is specified, the annotation is expired when the numbe...
Using the Places keywords API
are currently created through the Add Keyword For this search contextual menu option in form text fields. Note this is the same feature previously known as Bookmark keywords, the key difference is that keywords are not bound to a specific bookmark, but to a specific URL. Using the keywords API The keywords API is a promise-based API available through the PlacesUtils module: Components.utils.im
port("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); Setting a keyword for an URL The insert() method accepts a keyword entry object describing the keyword to insert. It has the following properties: keyword: string representing the keyword url: either a URL or spec represeting the URL to associate to p...
Preferences API
You can also create a XUL-based options window easily to allow user modify some preferences. Many applications including Firefox and Thunderbird have an additional tool for power users, about:config, which can be used to tweak the preferences without UI. ...
extIApplication
e [1]), use getExtensions() instead Obsolete since Gecko 2.0 prefs readonly attribute extIPreferenceBranch The preferences object for the application. Defaults to an empty root branch. storage readonly attribute extISessionStorage The storage object for the application. events readonly attribute extIEvents The events object for the application. sup
ports: "load", "ready", "quit", "unload" The following interfaces are only available to Firefox: Attribute Type Description bookmarks readonly attribute fuelIBookmarkRoots The root bookmarks object for the application. windows readonly attribute nsIVariant An array of browser windows within the application. activeWindow readonly attr...
extIExtension
after install prefs readonly attribute extIPreferenceBranch The preferences object for the extension. Defaults to the "extensions.<extensionid>." branch. storage readonly attribute extISessionStorage The storage object for the extension. events readonly attribute extIEvents The events object for the extension. sup
ports: "uninstall" Methods FIXME: See also See extApplication.js line:395 for the implementation of firstRun. A preference "install-event-fired" under your extensions preferences branch (e.g. extensions.YOUR_EXTENSION_ID.install-event-fired) will be set to false after your extension has been installed. You may need to reset this preference in about:config during testing. Also, see the FUEL...
extISessionStorage
sually accessed via Application.storage. Return Type Method boolean has(in AString aName) void set(in AString aName, in nsIVariant aValue) nsIVariant get(in AString aName, in nsIVariant aDefaultValue) Attributes Attribute Type Description events readonly attribute extIEvents The events object for the storage sup
ports: "change" Methods has() Determines if a storage item exists with the given name. boolean has(in AString aName) Parameters aName The name of an item Return value true if an item exists with the given name, false otherwise. set() Sets the value of a storage item with the given name. void set(in AString aName, in nsIVariant aValue) Parameters aName The name of an item ...
Fun With XBL and XPConnect
]]> </property> So we've defined a property on the widget called autoCompleteSession. The initial value of this property evaluates to an xp-connect object. Now accesses to autoCompleteSession will return the xp-connect object. Exposing the XPCOM Interfaces One somewhat nasty trick you need to do is to manually expose the interfaces of the XPCOM object that you want your widget to sup
port. All you have to do is specifically defining a method on the XBL widget which forwards the method call to the XPCOM object. <method name="autoComplete"> <argument name="aSearchString"/> <argument name="resultListener"/> <body> <![CDATA[ return this.autoCompleteSession.autoComplete(null, anonymousContent[0], aSearchString, this.autoCompleteListe...
Avoiding leaks in JavaScript XPCOM components
properties roots, but simpler.) Once this happens, it remains a root until the document stops being displayed. This means that neither the element nor any of the properties nor any of the objects reachable from those properties can be freed until the document is no longer displayed. You might think that it's unusual to set arbitrary properties on DOM nodes. And in many cases it is. But in one im
portant case it's not: XBL. XBL fields are implemented as JavaScript properties on the bound element's wrapper, so they have all the hazards of JavaScript properties. (On wrapped objects other that DOM nodes, we allow JavaScript programmers to set properties, but we don't do anything to protect them from garbage collection. This makes program behavior depend on when garbage collection happens, which ...
Resources
ock installer and information The SDK download Linux: http://ftp.mozilla.org/pub/mozilla/releases/mozilla1.4a/gecko-sdk-i686-pc-linux-gnu-1.4a.tar.gz Windows: http://ftp.mozilla.org/pub/mozilla/releases/mozilla1.4a/gecko-sdk-win32-1.4a.zip Other Mozilla downloads Gecko Resources Internal string guide External string guide The Gecko networking library ("necko") The Netscape
Portable Runtime Environment Embedding Mozilla Current module owners XPInstall XUL XPCOM Resources The XPCOM project page XULPlanet's online XPCOM reference Information on XPConnect and scriptable components The Smart Pointer Guide XPIDL xpidl Compiler Reference General Development Resources The World Wide Web Consortium URL specification at the W3 GNU Make << Previous Co...
XPCOM guide
ct XPCOM component compatibility are taking place in Gecko 2. This article details those changes, and provides suggestions for how to update your code.XPCOM hashtable guideA hashtable is a data construct that stores a set of items. Each item has a key that identifies the item. Items are found, added, and removed from the hashtable by using the key. Hashtables may seem like arrays, but there are im
portant differences:XPCOM Stream GuideIn Mozilla code, a stream is an object which represents access to a sequence of characters. It is not that sequence of characters, though: the characters may not all be available when you read from the stream. ...
Components.isSuccessCode
xt) { copyInProgress = true; }, onStopRequest: function(request, context, statusCode) { copyInProgress = false; // did the copy fail? ...
Components.results
sult codes, with each value being that of the corresponding result code. Elements in this array can be used to test against unknown nsresult variables or they can be 'thrown' to indicate failure... if(something_unexpected_happened) throw Components.results.NS_ERROR_UNEXPECTED; The elements of the Components.results object can be enumerated using a for-in loop. Usage Implementing nsISup
ports The standard nsISup
ports is usually implemented in JavaScript by using Components.results to get a failure return value if does not implement the given interface. Note the common use of an abbreviation for Components.results, Cr: const Ci = Components.interfaces, Cr = Components.results; function Class() { /* ... */ } Class.prototype = { /* ... */ QueryInterface: function(id) { if...
Components.utils.createObjectIn
Note that this function is now mostly obsolete when you are using Sandbox, because you can create an object in a different compartment using new. ...
Components.utils.evalInSandbox
in Firefox. Use To use evalInSandbox(), you must first create a sandbox object using its constructor, Components.utils.Sandbox. In the constructor you define the security principal for code running in the sandbox, and can make various properties available to code running in the sandbox. The sandbox will become the global scope object when you pass it to evalInSandbox(text, sandbox). You can im
port functions or objects into the sandbox simply by assigning them to the sandbox object. For example: function double(n) { return n * 2; } // create new sandbox instance var mySandbox = new Components.utils.Sandbox("http://www.example.com/"); mySandbox.y = 5; // insert property 'y' with value 5 into global scope. mySandbox.double = double; var result = Components.utils.evalInSandbox("x = y + ...
Components.utils.evalInWindow
de, to access variables and APIs defined in web content. Even so, while the code is being evaluated it is in the content's context, so the caller has to be prepared for the possibility that the content could have redefined behavior (for example, a setter in the script may have been redefined to do something unexpected). This function is made available as a global in sandboxes which have the wantEx
portHelpers option set in the Sandbox() constructor. Syntax var result = Components.utils.evalInWindow(script, window); Parameters script : string The script to evaluate in the other window. window : object The window in which to evaluate the script. Returns The result of evaluating the script. If this is just native (for example, a DOM node), then the function relies on XrayWrapper...
Components.utils.unload
Components.utils.unload was introduced in Firefox 7 and is used to unload JavaScript code modules. This can be particularly handy with restartless (boostrapped) extensions, so that you can unload an old version of a code module when a new version of your add-on is installed. Once this method has been called, references to the module will continue to work but any subsequent im
port of the module will reload it and give a new reference. If the JavaScript code module has not yet been im
ported then this method will do nothing. You should not unload modules that are part of the application (anything under resource://gre/ or resource:/// or resource://app/) as these may be in use by other extensions and the application. Only unload modules you include as part of your extension. Syntax Components.uti...
Other Resources
Other Resources Embedding Mozilla XPConnect - Javascript-XPCOM bridge BlackConnect - Java-XPCOM bridge (no longer sup
ported) XPIDL to Java types - from Blackconnect ...
JavaXPCOM
r embed Gecko from a Java application. JavaXPCOM is very similar to XPConnect (JavaScript-XPCOM bridge), and uses XPIDL. Note: JavaXPCOM was included in XULRunner up through version 1.9.2. It has been removed in XULRunner 2, and is not actively maintained. Documentation JavaXPCOM Development How to get and build the source, as well as how to view and re
port bugs. Sample code There are several Java test applications checked in to the tree that give examples on how to embed Gecko or init XPCOM from within Java. Embedding Mozilla in a Java Application using JavaXPCOM XULRunner ships with the JavaXPCOM component, which allows Java code to interact with XPCOM objects. As you will see in this article, workin...
Using components
ive code] } Constructor=[object nsXPCComponents_Constructor] QueryInterface=function QueryInterface() { [native code] } interfacesByID=[object nsXPCComponents_InterfacesByID] classesByID=[object nsXPCComponents_ClassesByID] stack=JS frame :: Scratchpad/4 :: cDump :: line 8 manager=[xpconnect wrapped nsIComponentManager] ID=[object nsXPCComponents_ID] Exception=[object nsXPCComponents_Exception] re
portError=function re
portError() { [native code] } canCreateWrapper=function canCreateWrapper() { [native code] } canCallMethod=function canCallMethod() { [native code] } canGetProperty=function canGetProperty() { [native code] } canSetProperty=function canSetProperty() { [native code] } ...
nsIRegistry
Components.classes; var Ci = Components.interfaces; var rc = Cc["@mozilla.org/registry;1"]; var rs = rc.getService(Ci.nsIRegistry); Now you have the registry service. rs.openWellKnownRegistry(2); // 2 signifies the ApplicationRegistry, if I understand right var st = rs.enumerateAllSubtrees(2); // 2 signifies "common", see libreg source (reg.h) for info Now you have an nsIEnumerator that can re
port the subtrees. try { st.first(); do { var data = st.currentItem(); if( data instanceof Ci.nsIRegistryNode ) print("nsIRegistryNode: " + data.nameUTF8 + " (" + data.key + ")"); st.next(); } while( Components.lastResult == 0 ); } catch(e) {} Now, the output is something like: Profiles (344) Profiles/default (530) Profiles/foo (1046) Profiles/bar (1518) The number inside the...
Profiling XPCShell
. But then, you can't use the Venkman UI. XPCTools There is profiler in the tree that can profile xpcshell scripts. To use it, you need to enable it in your mozconfig: ac_add_options --enable-xpctools Now you can profile an entire script by setting the environment variable <tt>MOZILLA_JS_PROFILER_OUTPUT</tt> to a filename where you want the output file. For example, on Linux or MacOSX you do: ex
port MOZILLA_JS_PROFILER_OUTPUT=/tmp/profile.txt Now, run the script using xpcshell. After running has finished, the output file will contain a profile. A profile will look like this: file:///Users/michiel/Mozilla/tree1/...js/calUtils.js [2,25420] createDateTime() {60-62} 579 {min 0, max 3, avg 0, sum 427, self 427} [2,56810] cp_QI() {860-866} 835 {min 0, max 1, avg 0, sum 950, self 950} ...
XPCShell Reference
sion number). See the above documentation on the -v command-line argument for more information. quit(exitCode) quit() exits the shell. You can specify arguments that will get translated to an exit code. quit(5) will exit XPCShell with a result code of 5. Original Document Information Author: David Bradley <dbradley@netscape.com> Last Updated Date: 17 March 2003 Copyright Information:
Portions of this content are (C) 1998-2008 by individual mozilla.org contributors; content available under a Creative Commons license. ...
Monitoring HTTP activity
g/network/http-activity-distributor;1"] .getService(Components.interfaces.nsIHttpActivityDistributor); activityDistributor.addObserver(httpObserver); Observable activities There are two classes of observable activities: those that occur at the socket level and those that occur at the HTTP transaction level. Observable socket activities When the activity type re
ported to your nsIHttpActivityObserver.observeActivity() method is ACTIVITY_TYPE_SOCKET_TRANS
PORT, the activity subtype, which indicates the specific type of activity that occurred, will be a socket trans
port status code. Observable HTTP activities When the activity type is ACTIVITY_TYPE_HTTP_TRANSACTION, the activity subtype will be one of the activity subtype constants. These include the ability to ...
nsCategoryManager
<< XPCOM API Reference Summary The XPCOM Category Manager. Class ID 16d222a6-1dd2-11b2-b693-f38b02c021b2 ContractID @mozilla.org/categorymanager;1 Sup
ported Interfaces nsICategoryManager Remarks This component is a singleton and should therefore be accessed via the XPCOM Service Manager. ...
nsDirectoryService
<< XPCOM API Reference Summary The XPCOM Directory Service. This service returns the locations of "well known" directories in an OS-independent manner. For instance, it can give you the path of the system's temporary directory, desktop directory, current working directory, and so on. Class ID f00152d0-b40b-11d3-8c9c-000064657374 ContractID @mozilla.org/file/directory_service;1 Sup
ported Interfaces nsIProperties nsIDirectoryService Remarks This component is a singleton and should therefore be accessed via the XPCOM Service Manager. Example Code #include "nsXPCOM.h" #include "nsCOMPtr.h" #include "nsDirectoryServiceDefs.h" #include "nsIServiceManager.h" #include "nsIProperties.h" /** * Get the location of the system's "temp" directory. */ nsresult GetTempDir(...
nsLocalFile
Example Code function getFileSize(path) { var file = Components.classes["@mozilla.org/file/local;1"]. ...
nsObserverService
<< XPCOM API Reference The XPCOM Observer Service. Class ID D07F5195-E3D1-11d2-8ACD-00105A1B8860 ContractID @mozilla.org/observer-service;1 Sup
ported interfaces nsIObserverService Remarks This component is a singleton and should therefore be accessed via the XPCOM Service Manager. It should be used from the main thread only. ...
NS_InitXPCOM3
#include "nsXPCOM.h" nsresult NS_InitXPCOM3( nsIServiceManager** aResult, nsIFile* aBinDirectory, nsIDirectoryServiceProvider* aAppFileLocationProvider, nsStaticModuleInfo const* aStaticModules, PRUint32 aStaticModuleCount ); Parameters aResult [out] The resulting XPCOM service manager. You may pass null if you are not interested in this return value. The service manager may alternatively be accessed by calling NS_GetServiceManager. ...
NS_NewLocalFile
olved. aResult [out] A reference to the newly created nsILocalFile instance. Return Values The NS_NewLocalFile function returns NS_OK if successful. Otherwise, it returns an error code. NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that the specified path is invalid. This error is returned if a relative file path is passed to NS_NewLocalFile. Remarks On UNIX systems, the prefix "~/" is sup
ported as a shorthand for the user's home directory. Example Code // Create a local file that references c:\foo.txt nsresult rv; nsCOMPtr<nsILocalFile> file; rv = NS_NewLocalFile(nsEmbedString(L"c:\\foo.txt"), PR_FALSE, getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; Note: GCC requires the -fshort-wchar option to compile this example since PRUnichar is an unsigned short...
NS_NewNativeLocalFile
sult [out] A reference to the newly created nsILocalFile instance. Return Values The NS_NewNativeLocalFile function returns NS_OK if successful. Otherwise, it returns an error code. NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that the specified path is invalid. This error is returned if a relative file path is passed to NS_NewNativeLocalFile. Remarks On UNIX systems, the prefix "~/" is sup
ported as a shorthand for the user's home directory. If you use this function on Windows 2000 or later, you would not be able to handle file names containing characters outside the default code page even though the OS has no problem dealing with them. Do not use this function (on Windows) unless it is guaranteed that the full path involved is always ASCII. Example Code // Create a local file that r...
nsresult
<< XPCOM API Reference The nsresult data type is a strongly-typed enum used to represent a value returned by an XPCOM function; these are typically error or status codes. For a list of defined result values, see Error codes returned by Mozilla APIs. Note: On compilers that do not sup
port strongly-typed enums (that is, compilers that don't sup
port this feature of C++11), it falls back to being an unsigned 32-bit integer, as in past versions of Gecko. Note: Prior to Gecko 19.0, nsresult was not strongly typed. As a result, it was possible for code to misuse it, such as returning an nsresult value from a function whose signature indicates it returns a boolean. Because nsresult is strongly typed, code like the following will result in an error at compile time: bool foo() { ... ...
Core XPCOM functions
NS_NewLocalFileThe NS_NewLocalFile function creates an instance of nsILocalFile that provides a platform independent representation of a file path.NS_NewNativeLocalFileThe NS_NewNativeLocalFile function creates an instance of nsILocalFile that provides a platform independent representation of a file path.NS_ReallocReallocates a block of memory using the X...
nsACString_internal
Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const char AppendLiteral(char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Data Members No public members. Methods Constructors void nsACString_internal(const nsCSubstringTuple&) - source this is public to sup
port automatic conversion of tuple to string base type, which helps avoid converting to nsTAString. Parameters nsCSubstringTuple& tuple void nsACString_internal(char*, PRUint32, PRUint32) - source Parameters char* data PRUint32 length PRUint32 flags BeginReading char* BeginReading() const - source reading iterators nsReadingIterator<char>& BeginReading(nsReadingIterator<char>&) const...
nsAString_internal
= Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const char AppendLiteral(char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Data Members No public members. Methods Constructors void nsAString_internal(const nsSubstringTuple&) - source this is public to sup
port automatic conversion of tuple to string base type, which helps avoid converting to nsTAString. Parameters nsSubstringTuple& tuple void nsAString_internal(PRUnichar*, PRUint32, PRUint32) - source Parameters PRUnichar* data PRUint32 length PRUint32 flags BeginReading PRUnichar* BeginReading() const - source reading iterators nsReadingIterator<short unsigned int>& BeginReading(nsRe...
nsAutoString
It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64 characters. ...
nsCAutoString
It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64 characters. ...
nsCOMPtr
<< XPCOM API Reference Summary This utility class simplifies managing XPCOM interface references from C++ code. #include "nsCOMPtr.h" Remarks Consult Using nsCOMPtr for more info. To use this class, you must link your component or application against the XPCOM glue library. The class itself and the sup
porting functions that are used with it are not frozen, but they are available as part of the XPCOM glue library for easy reuse. ...
nsXPIDLCString
Class Declaration nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const CharT*| (3) getter_Copies method is sup
ported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. NAMES: nsXPIDLString for wide characters nsXPIDLCString for narrow characters Method Overview Constructors operator const char* operator[] operator= get Find RFind RFindChar FindCharInSet RFindCharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt Appen...
nsXPIDLString
Class Declaration nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const CharT*| (3) getter_Copies method is sup
ported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. NAMES: nsXPIDLString for wide characters nsXPIDLCString for narrow characters Method Overview Constructors operator const PRUnichar* operator[] operator= get Find RFind RFindChar FindCharInSet RFindCharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right SetCharAt StripChars StripWhitespace ReplaceChar ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat ...
IAccessible2
ccessible2 use QueryService as follows: // pAcc is a reference to the accessible object's IAccessible interface. IServiceProvider *pService = NULL; hr = pAcc->QueryInterface(IID_IServiceProvider, (void **)&pService); if(SUCCEEDED(hr)) { IAccessible2 *pIA2 = NULL; hr = pService->QueryService(IID_IAccessible, IID_IAccessible2, (void**)&pIA2); if (SUCCEEDED(hr) && pIA2) { // The control sup
ports IAccessible2. // pIA2 is the reference to the accessible object's IAccessible2 interface. } } See also IAccessible ...
IAccessibleAction
actions that can be executed for accessible objects. 1.0 66 Introduced Gecko 1.9 Inherits from: IUnknown Last changed in Gecko 1.9 (Firefox 3) Every accessible object that can be manipulated via the native GUI beyond the methods available either in the MSAA IAccessible interface or in the set of IAccessible2 interfaces (other than this IAccessibleAction interface) should sup
port the IAccessibleAction interface in order to provide Assistive Technology access to all the actions that can be performed by the object. Each action can be performed or queried for a name, description or associated key bindings. Actions are needed more for ATs that assist the mobility impaired, such as on-screen keyboards and voice command software. By providing actions directly, the AT can presen...
nsIDOMHTMLSourceElement
s encoded. media Unimplemented DOMString The media attribute gives the intended media type of the media resource, to help the user agent determine if this media resource is useful to the user before fetching it. Its value must be a valid media query. Example <video controls> <source src="foo.webm" type="video/webm; codecs="vp9, opus""> Your browser does not sup
port the <code>video</code> element. </video> This example specifies that a video object with playback controls should be drawn, playing the file "foo.ogg". The type is specified as "video/ogg", and the source element also specifies that the video file uses the Dirac and Speex codecs. ...
nsIDOMHTMLTimeRanges
resented by an nsIDOMHTMLTimeRanges object has an index number; you call the start() and end() methods to obtain the start and end times of each range, specifying the index number of the range to look up. dom/interfaces/html/nsIDOMHTMLTimeRanges.idlScriptable Please add a summary to this article. Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Inherits from: nsISup
ports Method overview float start(in unsigned long index); float end(in unsigned long index); Attributes Attribute Type Description length unsigned long The number of ranges represented by the nsIDOMHTMLTimeRanges object. Read only. Methods end() Returns the time offset to the end of the specified time range. float end( in unsigned long index ); Parameters index The index to th...
nsIDOMMouseScrollEvent
dom/interfaces/events/nsIDOMMouseScrollEvent.idlScriptable This interface represents a mouse scroll wheel event. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsIDOMMouseEvent Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Gecko 1.9.2 note Prior to Gecko 1.9.2, this inherited from nsISup
ports instead of from nsIDOMMouseEvent. Method overview void initMouseScrollEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in nsIDOMAbstractView viewArg, in long detailArg, in long screenXArg, in long screenYArg, in long clientXArg, in long clientYArg, in boolean ctrlKeyArg, in boolean altKeyArg, in boolean shiftKeyArg, in boolean metaKeyArg, in unsigned short buttonArg, in nsIDOMEventTarget relate...
nsIDOMMozNetworkStats
To create an instance, use: var networkStatsManager = Components.classes["@mozilla.org/networkStats;1"] .createInstance(Components.interfaces.nsIDOMNetworkStats); Attributes Attribute Type Description connectionType DOMString Connection type of the stats. Read only. data nsIDOMMozNetworkStatsData array Stats samples. Read only. ...
nsIDOMNavigatorDesktopNotification
dom/interfaces/notification/nsIDOMNavigatorDesktopNotification.idlScriptable Property that extends the navigator object. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Property that extends the navigator object. Attributes Attribute Type Description mozNotification nsIDOMDesktopNotificationCenter Read only. See also nsIDOMDesktopNotificationCenter ...
nsIDOMSerializer
content/base/public/nsIDOMSerializer.idlScriptable This interface is really a placeholder till the W3C DOM Working Group defines a mechanism for serializing DOM nodes. An instance of this interface can be used to serialize a DOM document or any DOM subtree. Inherits from: nsISup
ports Last changed in Gecko 1.7 Implemented by: @mozilla.org/xmlextras/xmlserializer;1. To create an instance, use: var domSerializer = Components.classes["@mozilla.org/xmlextras/xmlserializer;1"] .createInstance(Components.interfaces.nsIDOMSerializer); Method overview void serializeToStream(in nsIDOMNode root, in nsIOutputStream stream, in AUTF8String charset); AString serializeToString(in nsIDOMNode root); Methods serializeToStream() The subtree rooted by the specified elem...
nsIDOMSimpleGestureEvent
dinates contain the center point of the tap. (XXX Not implemented on Mac) MozPressTapGesture - Generated when the user executes a press and tap two finger gesture (first finger down, second finger down, second finger up, first finger up) on the input device. Client coordinates contain the center pivot point of the action. (XXX Not implemented on Mac) Default behavior: Some operating systems sup
port default behaviors for gesture events when they are not handled by the application. Consumers should use event.preventDefault() to prevent default behavior when consuming events. Method overview void initSimpleGestureEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in nsIDOMAbstractView viewArg, in long detailArg, in long screenXArg, in long screenYArg, in ...
nsIDOMStorage
dom/interfaces/storage/nsIDOMStorage.idlScriptable This interface represents the storage space used for session storage in the DOM. Items stored in session storage may be accessed by any interested party in the same browsing context. 1.0 66 Introduced Gecko 1.8.1 Inherits from: nsISup
ports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) A DOM window's session storage object can be retrieved from the window's sessionStorage attribute. A storage object stores an arbitrary set of key-value pairs, which may be retrieved, modified and removed as needed. A key may only exist once within a storage object, and only one value may be associated with a particular key. Keys are stored in a particular order with the condition that this order ...
nsIDOMStorage2
s stored in local storage may only be accessed by the same origin that created the items in the first place. A DOM window's local storage object can be retrieved from the window's localStorage attribute. dom/public/idl/storage/nsIDOMStorage2.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Inherits from: nsISup
ports Method overview void clear(); DOMString getItem(in DOMString key); DOMString key(in unsigned long index); void removeItem(in DOMString key); void setItem(in DOMString key, in DOMString data); Attributes Attribute Type Description length unsigned long The number of keys stored in local storage. Methods clear() Clears the contents of this storage context; this removes all v...
nsIDOMStorageItem
Attributes Attribute Type Description secure boolean If true, the item was stored for an HTTPS page. ...
nsIDOMStorageList
dom/interfaces/storage/nsIDOMStorageList.idlScriptable This interface is used to access the contextual storage areas used by globalStorage by domain. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview nsIDOMStorage namedItem(in DOMString domain); Methods namedItem() Called when the list of available access points changes. nsIDOMStorage namedItem( in DOMString domain ); Parameters domain The name of the domain for whom to return the storage object. Return value The nsIDOMStorage object representing the data store for the specified domain.See also DOM Storage Structured client-side storage (HTML 5 specification) nsIDOMWindow ...
nsIDOMStorageManager
dom/interfaces/storage/nsIDOMStorageManager.idlScriptable This interface provides methods for managing data stored in the offline apps cache. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Implemented by @mozilla.org/dom/storagemanager;1 as a service: var domStorageManager = Components.classes["@mozilla.org/dom/storagemanager;1"] .getService(Components.interfaces.nsIDOMStorageManager); Method overview void clearOfflineApps(); nsIDOMStorage getLocalStorageForPrincipal(in nsIPrincipal aPrincipal, in DOMString aDocumentURI); long getUsage(in AString aOwnerDomain); Methods clearOfflineApps() Clears keys owned by offline applications. All data o...
nsIDOMStorageWindow
dom/interfaces/storage/nsIDOMStorageWindow.idlScriptable This interface provides access to a DOM window's client side storage objects. All DOM windows inherit from this interface. 1.0 66 Introduced Gecko 1.8.1 Obsolete Gecko 8.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) In Gecko 8.0 this interface has been merged into nsIDOMWindow, and this interface has been removed. Attributes Attribute Type Description globalStorage nsIDOMStorageList Global storage, accessible by domain. Read only. localStorage nsIDOMStorage Local storage for the current browsing context. Data stored in local storage may only be accessed from the same origin that insert...
nsIDOMXPathException
Constants Error codes Constant Value Description INVALID_EXPRESSION_ERR 51 An invalid XPath expression was used. TYPE_ERR 52 An attempt was made to reference an unavailable type. ...
nsIDOMXPathExpression
dom/interfaces/xpath/nsIDOMXPathExpression.idlScriptable Represents a compiled XPath query returned from nsIDOMXPathEvaluator.createExpression or document.createExpression Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview nsISup
ports evaluate(in nsIDOMNode contextNode, in unsigned short type, in nsISup
ports result) Methods evaluate() Evaluate the XPath expression. nsISup
ports evaluate( in nsIDOMNode contextNode, in unsigned short type, in nsISup
ports result ); Parameters contextNode A DOM node to evaluate the XPath expression against. To evaluate against a whole document, use the document.documentElement method to get the node to evaluate against. type A number that corresponds to one of the type constants of nsIDOMXPath...
nsIDOMXPathResult
Read only. invalidIteratorState boolean true if the iterator state has become invalid. ...
nsIDataSignatureVerifier
security/manager/ssl/public/nsIDataSignatureVerifier.idlScriptable An interface for verifying that a given string of data was signed by the private key matching the given public key. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Method overview boolean verifyData(in ACString aData, in ACString aSignature, in ACString aPublicKey); Methods verifyData() Verifies that the data matches the data that was used to generate the signature. boolean verifyData( in ACString aData, in ACString aSignature, in ACString aPublicKey ); Parameters aData The data to be tested. aSignature The signature of the data, base64 encoded. aPublicKey The public part of the key used for signing, DER encoded then base64 encoded. Re...
nsIDebug
xpcom/base/nsIDebug.idlScriptable Provides debugging sup
port for scripted languages, such as JavaScript, Java, Python, Perl, and so forth. Inherits from: nsISup
ports Last changed in Gecko 1.7 Note: C/C++ consumers who are planning to use the nsIDebug interface with the @mozilla.org/xpcom;1 contract should use NS_DebugBreak() from XPCOM glue instead, or alternatively the NS_ABORT, NS_ASSERTION, NS_BREAK, and NS_WARNING macros, which also call NS_DebugBreak() if used in a debugging build. Method overview void abort(in string aFile, in long aLine); void assertion(in string aStr, in string aExpr, in string aFile, in long aLine); void break(in string aFile, in long aLine); void warning(in string aStr, in string aFile, in long aLine); Methods abort() Requests the process ...
nsIDeviceMotionListener
xpcom/system/nsIDeviceMotion.idlScriptable This interface can be implemented by clients that want to be notified orientation or acceleration changes on sup
ported devices. 1.0 66 Introduced Gecko 1.9.2 Inherits from: nsISup
ports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Method overview void onMotionChange(in nsIDeviceMotionData aMotionData); Methods onMotionChange() Called when new orientation or acceleration data is available. void onMotionChange( in nsIDeviceMotionData aMotionData ); Parameters aAcceleration The nsIDeviceMotionData object describing updated motion information. See also MozOrientation nsIDOMOrientationEvent nsIDeviceMotion nsIDeviceMotionData ...
nsIDialogCreator
embedding/base/nsIDialogCreator.idlScriptable Please add a summary to this article. ...
nsIDialogParamBlock
embedding/components/windowwatcher/public/nsIDialogParamBlock.idlScriptable An interface to pass strings, integers and nsISup
ports to a dialog. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview PRInt32 GetInt( in PRInt32 inIndex ); wstring GetString( in PRInt32 inIndex ); void SetInt( in PRInt32 inIndex, in PRInt32 inInt ); void SetNumberStrings( in PRInt32 inNumStrings ); void SetString( in PRInt32 inIndex, in wstring inString); Attributes Attribute Type Description objects nsIMutableArray A place where you can store an nsIMutableArray to pass nsISup
ports. Methods GetInt() Get a previously set integer. PRInt32 GetInt( in PRInt32 inIndex ); Parameters inIndex Th...
nsIDirIndex
Unspecified for directories. description wstring A description for the filename, which should be displayed by a viewer. ...
nsIDirectoryEnumerator
xpcom/io/nsIDirectoryEnumerator.idlScriptable This interface provides a means for enumerating the contents of a directory. It is similar to nsISimpleEnumerator except the retrieved entries are QI'ed to nsIFile, and there is a mechanism for closing the directory when the enumeration is complete. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void close(); Attributes Attribute Type Description nextFile nsIFile The next file in the sequence. The nextFile attribute is the first element upon the first call. This attribute is null if there is no next element. Read only. Methods close() Closes the directory being enumera...
nsIDirectoryIterator
The nsIDirectoryIterator interface provides a way to iterate over the entries in a directory. xpcom/obsolete/nsIFileSpec.idlScriptable Please add a summary to this article. ...
nsIDirectoryService
xpcom/io/nsIDirectoryService.idlScriptable This interface provides methods to initialize and configure a directory service instance. The XPCOM Directory Service implements this interface to provide sup
port for a variety of well-known file and directory locations. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview void init(); void registerProvider(in nsIDirectoryServiceProvider prov); void unregisterProvider(in nsIDirectoryServiceProvider prov); init() Initializes the nsIDirectoryService instance. This method must be called before an nsIDirectoryService instance can be used. In the case of the XPCOM Directory Service, this method is called as part of XPCOM initialization. Must not be called by external code; called internally by XPCOM initialization.
nsIDirectoryServiceProvider
Method overview nsIFile getFile(in string prop, out PRBool persistent); Methods getFile() The Directory Service calls this method when it gets the first request for a prop or on every request if the prop is not persistent. nsIFile getFile( in string prop, out PRBool persistent ); Parameters prop The symbolic name of the file. persistent true if the returned file will be cached by Directory Service. ...
nsIDiskCacheStreamInternal
netwerk/cache/nsIDiskCacheStreamInternal.idlScriptable Please add a summary to this article. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview void closeInternal(); Methods closeInternal() We use this method internally to close nsDiskCacheOutputStream under the cache service lock. void closeInternal(); Parameters None. ...
nsIDownload
transfer that has been completed, or -1 if the file's size is unknown. Read only. referrer nsIURI The referrer URI of the download. This is only valid for HTTP downloads, and can be null. Read only. resumable boolean Indicates if the download can be resumed after being paused or not. This is only the case if the download is over HTTP/1.1 or FTP and if the server sup
ports it. Read only. size long long The total size of the file in bytes, or LL_MAXUINT if the file's size is unknown. Read only. source nsIURI The source URI of the download. Read only. speed double The downloads transfer speed in bytes per second. Read only. startTime long long The time at which the transfer was started. Read only. ...
nsIDownloadHistory
docshell/base/nsIDownloadHistory.idlScriptable This interface can be used to add a download to history. There is a separate interface specifically for downloads in case embedders choose to track downloads differently from other types of history. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Method overview void addDownload(in nsIURI aSource, [optional] in nsIURI aReferrer, [optional] in PRTime aStartTime); Methods addDownload() Adds a download to history. This will also notify observers that the URI aSource is visited with the topic NS_LINK_VISITED_EVENT_TOPIC if aSource has not yet been visited. void addDownload( in nsIURI aSource, in nsIURI aReferrer, Optional in PRTime aStartTime Optional ); Parame...
nsIDownloadManager
This interface is deprecated as of Firefox 26. Please use Downloads.jsm instead. toolkit/components/downloads/public/nsIDownloadManager.idlScriptable This interface lets applications and extensions communicate with the Download Manager, adding and removing files to be downloaded, fetching information about downloads, and being notified when downloads are completed. Inherits from: nsISup
ports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Implemented by: @mozilla.org/download-manager;1. To get the service, use: var downloadManager = Components.classes["@mozilla.org/download-manager;1"] .getService(Components.interfaces.nsIDownloadManager); Method overview nsIDownload addDownload(in short aDownloadType, in nsIURI aSource,...
nsIExternalURLHandlerService
uriloader/exthandler/nsIExternalURLHandlerService.idlScriptable The external URL handler service is used for finding platform-specific applications for handling particular URLs. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview nsIHandlerInfo getURLHandlerInfoFromOS(in nsIURI aURL, out boolean aFound); Methods getURLHandlerInfoFromOS() Given a URL, looks up the handler info from the operating system. This should be overridden by each operating systems implementation. nsIHandlerInfo getURLHandlerInfoFromOS( in nsIURI aURL, out boolean aFound ); Parameters aURL The URL we are looking for. aFound Was an operating system default handler for this URL found? Ret...
nsIFTPChannel
The nsIFTPChannel is an extension of nsISup
ports used to determine if a channel is an FTP channel, and offering additional information about the FTP channel. You can determine if a channel is an FTP channel by checking to see if it implements this interface, by calling nsISup
ports.queryInterface() on it. netwerk/protocol/ftp/nsIFTPChannel.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9 (Firefox 3) Inherits from: nsISup
ports Attributes Attribute Type Description lastModifiedTime PRTime The time at which the FTP channel was last updated. ...
nsIFaviconDataCallback
toolkit/components/places/public/nsIFaviconService.idlScriptable Please add a summary to this article. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview void onComplete(in nsIURI aURI, in unsigned long aDataLen, [const,array,size_is(aDataLen)] in octet aData, in AUTF8String aMimeType); Methods onComplete() Called when the required favicon's information is available. It's up to the invoking method to state if the callback is always invoked, or called on success only. Check the method documentation to ensure that. The caller will receive the most information we can gather on the icon, but it's not guaranteed that all of them will be set. For some...
nsIFeed
night) to 23 (11:00 PM), and are always indicated using UTC. Note: This field is rarely implemented. subtitle nsIFeedTextConstruct Returns a subtitle for the feed, based on its description, subtitle, and appropriate extensions. textInput nsIWritablePropertyBag2 Information about a text box that can be displayed along with the feed by aggregators that sup
port it, to allow the reader to send a response back to the source of the feed. Note: This field is almost never used, and is incompatible with many aggregators. type unsigned long Indicates the type of content presented by a feed. See Constants. Note: You should consider this a bit mask of values; at some point, the type may include more than one of these values ORed together.
nsIFeedElementBase
toolkit/components/feeds/public/nsIFeedElementBase.idlScriptable This interface is a base interface from which several of the other feed access interfaces derive. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Attributes Attribute Type Description attributes nsISAXAttributes All the attributes found on the element. Most derived interfaces provide convenience accessors for their standard fields, so this is only useful when looking for nonstandard fields. baseURI nsIURI The base URI for the entry or feed. Interwiki link ...
nsIFeedTextConstruct
toolkit/components/feeds/public/nsIFeedTextConstruct.idlScriptable This interface represents RSS or Atom feed text fields that may contain plain text, HTML, or XHTML. Some extension elements also include "type" parameters, and this interface could be used to represent those as well. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8.1 (Firefox 2 / Thunderbird 2 / SeaMonkey 1.1) Implemented by: @mozilla.org/feed-textconstruct;1, but users usually don't need to create instances of this directly. Various other feed-related interfaces, such as nsIFeed, nsIFeedEntry, and nsIFeedContainer have attributes that return objects implementing nsIFeedTextConstruct. Method overview nsIDOMDocumentFragment createDocumentFragment(in ns...
nsIFilePicker
widget/nsIFilePicker.idlScriptable The file picker component is used to display standard user interface for selecting files and directories, as well as for selecting destinations for, and naming, new files. Inherits from: nsISup
ports Last changed in Gecko 17.0 (Firefox 17.0 / Thunderbird 17.0 / SeaMonkey 2.14) Implemented by: @mozilla.org/filepicker;1. To create an instance, use: var filePicker = Components.classes["@mozilla.org/filepicker;1"] .createInstance(Components.interfaces.nsIFilePicker); Method overview void appendFilter(in AString title, in AString filter); void appendFilters(in long filterMask); void init(in nsIDOMWindow parent, in AString title, in short mode); void open(in nsIFilePickerShownCallback aFilePick...
nsIFileProtocolHandler
The nsIFile to convert. Return value A reference to a new nsIURI object. readURLFile() Takes a local file and tries to interpret it as an Internet shortcut (for example .url files on windows). nsIURI readURLFile( in nsIFile file ); Parameters file The nsIFile to read. Return value The nsIURI the file refers to. Exceptions thrown NS_ERROR_NOT_AVAILABLE The OS does not sup
port such files. NS_ERROR_NOT_AVAILABLE The file is not an Internet shortcut. See also Code_snippets:File_I/O ...
nsIFileStreams
The nsIFileStreams interface is an input stream that allows you to read from a file. netwerk/base/public/nsIFileStreams.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9 (Firefox 3) Inherits from: nsISup
ports Method overview void init(in nsIFile file, in long ioFlags, in long perm, in long behaviorFlags); Constants Constants Value Description DELETE_ON_CLOSE 1<<1 If this is set, the file will be deleted by the time the stream is closed. It may be removed before the stream is closed if it is possible to delete it and still read from it. If OPEN_ON_READ is defined, and the file was recreated after the first delete, the file will be deleted again when it is closed again. CLOSE_ON_EOF 1<<2 If this is set, the file will close automatically when the...
nsIFileURL
The getter returns a reference to an immutable object. ...
nsIFileView
It's not included in Windows or Mac builds. Note: A quirk of the nsIFileView is that it requires an appropriate treecols section in the tree tag, by default fileview will return the file size in the column. If the treecol id is "FilenameColumn" fileview will return the file name, if the id is "LastModifiedColumn" it will return the date of last modification. Currently no other file stats are implemented. ...
nsIFocusManager
dom/interfaces/base/nsIFocusManager.idlScriptable Please add a summary to this article. ...
nsIFormHistory2
toolkit/components/satchel/public/nsIFormHistory.idlScriptable A service which holds a set of name/value pairs. The names correspond to form field names, and the values correspond to values the user has submitted. So, several values may exist for a single name. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Note: This interface provides no means to access stored values. Stored values are used by the FormFillController to generate autocomplete matches. Method overview void addEntry(in AString name, in AString value); boolean entryExists(in AString name, in AString value); boolean nameExists(in AString name); void removeAllEntries(); void removeEntriesByTimeframe...
nsIFrameMessageListener
content/base/public/nsIMessageManager.idlScriptable Implement this interface in a remote frame handling process to receive messages from the browser process. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) This interface is used when implementing out-of-process handling of frames; the process handling a frame should implement this interface in order to receive messages. Method overview void receiveMessage(); Methods receiveMessage() Note: This method is for JavaScript only. Called to deliver a message to the frame handling process; called with one parameter, which has the following properties: name The name of the message. sync ...
nsIMicrosummarySet
toolkit/components/places/public/nsIMicrosummaryService.idlScriptable This interface provides access to sets of microsummaries returned from the nsIMicrosummaryService. 1.0 66 Introduced Gecko 1.8 Obsolete Gecko 6.0 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Warning: Microsummary sup
port was removed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Method overview void addObserver(in nsIMicrosummaryObserver observer); nsISimpleEnumerator Enumerate(); void removeObserver(in nsIMicrosummaryObserver observer); Methods addObserver() Add a microsummary observer to this microsummary set. Adding an observer to a set is the equiva...
nsIMimeConverter
The nsIMimeConverter service allows you to convert headers into and out of MIME format. Inherits from: nsISup
ports Implemented by: @mozilla.org/messenger/mimeconverter;1. Method overview string encodeMIMEPartIIStr(in string header, in boolean structured, in string mailCharset, in long fieldnamelen, in long encodedwordsize); string encodeMIMEPartIIStr_UTF8(in AUTF8String header, in boolean structured, in string mailCharset, in long fieldnamelen, in long encodedwordsize); string decodeMimeHeaderToCharPtr(in string header, in string default_charset, in boolean override_charset, in boolean eatContinuations); AString decodeMimeHeader(in string header, in string default_charset, in boolean override_charset, in boolean eatContinuations); Mime...
nsIMimeHeaders
nsIMimeHeaders mailnews/mime/public/nsIMimeHeaders.idlScriptable ??? Add brief description of Interface ??? Inherits from: nsISup
ports Last changed in Gecko 1.7 Implemented by: ?????????????????????????????????????. To create an instance, use: Implemented by: ????????????????????????????????????? as a service: var mimeHeaders = Components.classes["@mozilla.org/????????????????????????????"] .createInstance(Components.interfaces.nsIMimeHeaders); Method overview string extractHeader([const] in string headerName, in boolean getAllOfThem); void initialize([const] in string allHeaders, in long allHeadersSize); Attributes Attribute Type Description allHeaders string Read ...
nsIMsgAccount
nsIMsgAccount mailnews/base/public/nsIMsgAccount.idlScriptable An account consists of an incoming server and one or more outgoing identities. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview void addIdentity(in nsIMsgIdentity identity); void clearAllValues(); void init(); void removeIdentity(in nsIMsgIdentity identity); AString toString(); Attributes Attribute Type Description defaultIdentity nsIMsgIdentity identities nsISup
portsArray Read only. Outgoing identity list (array of nsIMsgIdentity's) incomingServer nsIMsgIncomingServer Incoming server stuff key ACString Internal key identifying itself Methods addIdentity() Adds a new identity to this account. void addIdentity( in nsIMsgIdentity identity ); Parameters identity The...
Building an Account Manager Extension
Step 1: Implementing nsIAccountManagerExtension As first step we have to implement the nsIAccountManagerExtension. We name the Extension "devmo-account" and state that it is located in the Chrome Package "example@mozilla.org". Furthermore we show the new panel only for IMAP accounts... Components.utils.im
port("resource://gre/modules/XPCOMUtils.jsm"); //class constructor function DevmoAccountManagerExtension() {}; // class definition DevmoAccountManagerExtension.prototype = { name : "devmo-account", chromePackageName : "example@mozilla.org", showPanel: function(server) { //this panel is only shown for imap accounts... if (server.type == \"imap\") return true; return false; }, QueryInterface: XPCOMUtils.generateQI([ ...
nsIMsgAccountManagerExtension
e to register any new Account Manager Extensions via the the category manager at start up. Simply add a new Entry with the Contact ID of the component to the "mailnews-accountmanager-extensions" category. //github.com/RealityRipple/UXP/blob/master/mailnews/base/public/nsIMsgAccountManager.idlScriptable Please add a summary to this article. Last changed in Gecko ??? Inherits from: nsISup
ports Method overview boolean showPanel(in nsIMsgIncomingServer server); Attributes Attribute Type Description name ACString name of the account manager extension. It has to be unique and defines the file name of the property file and the XUL Page as well as the name of the localized string contained in the property file. This attribute is readonly! chromePackageName ACString chrome packa...
nsIMsgDBHdr
There are utility functions that also return it though. For instance, msgHdrForCurrentMessage() will return the currently selected message's header. Headers are backed by the database: a call to these functions directly modifies the state of the database, although it is not saved until the database is committed. ...
nsIMsgDBViewCommandUpdater
The nsIMsgDBViewCommandUpdater interface controls changes that occur as the selection changes. mailnews/base/public/nsIMsgDBView.idl#349Scriptable Please add a summary to this article. Last changed in Gecko 1.9 (Firefox 3) Inherits from: nsISup
ports In Thunderbird this is implemented for different windows in several different places: nsMsgDBViewCommandUpdater (for the standalone message window) nsMsgDBViewCommandUpdater (for the threadpane message window) nsMsgSearchCommandUpdater (for search dialogs) Method overview void updateCommandStatus(); void displayMessageChanged(in nsIMsgFolder aFolder, in AString aSubject, in ACString aKeywords); void updateNextMessageAfterDelete(); Methods updateCommandStatus() Called when the number of selected items changes. void ...
nsIMsgDatabase
hangeListener instigator); MarkHdrReplied() void MarkHdrReplied(in nsIMsgDBHdr msgHdr, in boolean bReplied, in nsIDBChangeListener instigator); MarkHdrMarked() void MarkHdrMarked(in nsIMsgDBHdr msgHdr, in boolean mark, in nsIDBChangeListener instigator); MarkMDNNeeded() MDN (Message Disposition Notification) sup
port. void MarkMDNNeeded(in nsMsgKey key, in boolean bNeeded, in nsIDBChangeListener instigator); IsMDNNeeded() MarkMDNneeded only used when mail server is a POP3 server, or when the IMAP server does not sup
port user defined PERMANENTFLAGS. boolean IsMDNNeeded(in nsMsgKey key); MarkMDNSent() void MarkMDNSent(in nsMsgKey key, in boolean bNe...
nsIMsgFilter
ion, in nsIMsgDBHdr aHeader ) createAction() nsIMsgRuleAction nsIMsgFilter::createAction ( ) getActionAt() nsIMsgRuleAction nsIMsgFilter::getActionAt (in long aIndex) appendAction() void nsIMsgFilter::appendAction (in nsIMsgRuleAction action ) clearActionList() void nsIMsgFilter::clearActionList() getSortedActionList() void nsIMsgFilter::getSortedActionList (in nsISup
portsArray actionList) ...
nsIMsgFilterCustomAction
* recommended form: ExtensionName@example.com#ActionName */ readonly attribute ACString id; /* action name to display in action list. This should be localized. ...
nsIMsgIdentity
The nsIMsgIdentity interface contains all the personal outgoing mail information for a given person. Each identity is identified by a key, which is the id string in the identity preferences, such as in mail.identity.<id>.replyTo. ...
nsIMsgRuleAction
throws an exception if the action is not priority attribute nsMsgPriorityValue priority; // target folder.. throws an exception if the action is not move to folder attribute ACString targetFolderUri; // target label. ...
nsIMsgSearchNotify
Defined in comm-central/ mailnews/ base/ search/ public/ nsIMsgSearchNotify.idl [scriptable, uuid(ca37784d-352b-4c39-8ccb-0abc1a93f681)] interface nsIMsgSearchNotify : nsISup
ports { void onSearchHit(in nsIMsgDBHdr header, in nsIMsgFolder folder); // notification that a search has finished. void onSearchDone(in nsresult status); /* * until we can encode searches with a URI, this will be an * out-of-bound way to connect a set of search terms to a datasource */ /* * called when a new search begins */ void onNewSearch(); }; ...
nsIMsgSearchScopeTerm
Defined in comm-central/ mailnews/ base/ search/ public/ nsIMsgSearchScopeTerm.idl [scriptable, uuid(934672c3-9b8f-488a-935d-87b4023fa0be)] interface nsIMsgSearchScopeTerm : nsISup
ports { nsIInputStream getInputStream(in nsIMsgDBHdr aHdr); void closeInputStream(); readonly attribute nsIMsgFolder folder; readonly attribute nsIMsgSearchSession searchSession; }; ...
nsIMsgThread
The nsIMsgFolder interface is used to interact with threads in Thunderbird. ...
nsIMsgWindow
To create an instance, use: msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"] .createInstance(Components.interfaces.nsIMsgWindow); In Thunderbird the default message window is stored in the global variable msgWindow. ...
nsIMsgWindowCommands
Method overview void selectFolder(in ACString folderUri); void selectMessage(in ACString messageUri); void clearMsgPane(); Methods selectFolder() This method is called by the backend to change the folder displayed in the message window. ...
nsINavHistoryQueryResultNode
ponents/places/nsINavHistoryService.idlScriptable Used for Places queries and as a base class for bookmark folders. 1.0 66 Introduced Gecko 1.8 Inherits from: nsINavHistoryContainerResultNode Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Note: If you request that places not be expanded in the options that generated the node, the node will re
port that it has no children and will never try to populate itself. Method overview void getQueries([optional] out unsigned long queryCount, [retval,array,size_is(queryCount)] out nsINavHistoryQuery queries); Attributes Attribute Type Description folderItemId long long For both simple folder nodes and simple-folder-query nodes, this is set to the concrete itemId of the folder. Otherwise, th...
nsINavHistoryResultNode
toolkit/components/places/public/nsINavHistoryService.idlScriptable This is the base class for all Places history result nodes, containing the URI, title, and other general information. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Attributes Attribute Type Description accessCount unsigned long Total number of times the URI has been accessed. For hosts, this is the total number of the children under it, rather than the total number of times the host has been accessed (getting that information would require an additional query, so for performance reasons that information isn't given by default). Read only. bookmarkIndex long When this item is in a bookmark folder (its ...
nsINavHistoryResultObserver
toolkit/components/places/nsINavHistoryService.idlScriptable Lets clients observe changes to a result as the result updates itself according to bookmark and history system events. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 11.0 (Firefox 11.0 / Thunderbird 11.0 / SeaMonkey 2.8) Note: In Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), this interface replaced the older nsINavHistoryResultViewer interface, which only allowed one client at a time. Method overview void batching(in boolean aToggleMode); void containerClosed(in nsINavHistoryContainerResultNode aContainerNode); Deprecated since Gecko 2.0 Obsolete since Gecko 11.0 void containerOpened(in nsINavHistoryContainerResultNode aContainerNode); Deprecated ...
nsINavHistoryResultTreeViewer
c/nsINavHistoryService.idlScriptable This interface provides a predefined view adaptor for interfacing Places query results with a tree. 1.0 66 Introduced Gecko 1.8 Inherits from: nsINavHistoryResultObserver Last changed in Gecko 1.9 (Firefox 3) This object removes itself from the associated result when the tree is detached; this prevents circular references. It's im
portant to be aware of this--if you want to reuse the same viewer, you need to keep your own reference to it, then reinitialize it when the tree changes. If you use this object and attach it to a result without attaching it to a tree, then forget about it, it will leak. Method overview nsINavHistoryResultNode nodeForTreeIndex(in unsigned long aIndex); unsigned long treeIndexForNode(in nsINavHisto...
nsINavHistoryResultViewer
/places/public/nsINavHistoryService.idlScriptable Lets nsINavHistoryResult instances notify Places views of changes in the results. Removed in Gecko 2.0 and replaced with the nsINavHistoryResultObserver interface, which is similar but allows multiple clients to observe the result at once. 1.0 66 Introduced Gecko 1.9 Obsolete Gecko 2.0 Inherits from: nsISup
ports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Note: Most methods in this interface were renamed in Gecko 1.9.2, and others have slightly di...
nsIOutputStreamCallback
xpcom/io/nsIAsyncOutputStream.idlScriptable This is a companion interface for nsIAsyncOutputStream.asyncWait. Inherits from: nsISup
ports Last changed in Gecko 1.7 Method overview void onOutputStreamReady(in nsIAsyncOutputStream aStream); Methods onOutputStreamReady() Called to indicate that the stream is either writable or closed. void onOutputStreamReady( in nsIAsyncOutputStream aStream ); Parameters aStream The stream whose nsIAsyncOutputStream.asyncWait() method was called. ...
nsIParentalControlsService
toolkit/components/parentalcontrols/public/nsIParentalControlsService.idlScriptable This interface provides access to the operating system's parental controls feature, allowing code to detect whether such a service is enabled and to request overrides to bypass the feature. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Note: Currently, this interface is only sup
ported on Microsoft Windows Vista and newer as well as Android 4.3 and newer. Implemented by: @mozilla.org/parental-controls-service;1. To create an instance, use: var parentalControlsService = Components.classes["@mozilla.org/parental-controls-service;1"] .createInstance(Components.interfaces.nsIParentalControlsService); M...
nsIPermission
The nsIPermission interface defines a "permission" object, which is used to allow or block objects (for example cookies, images) from certain sites based on user preferences. netwerk/base/public/nsIPermission.idlScriptable Please add a summary to this article. Last changed in Gecko 2 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Inherits from: nsISup
ports Attributes Attribute Type Description capability PRUint32 The permission to set: allow, deny, or unknown (which is the default). See nsIPermissionManager.Permission_type_constants for allowed values. Read only. expireTime PRInt64 The expiration time of the permission measured in milliseconds since 1970 Jan 1 0:00:00. Read only. ...
nsIPermissionManager
The nsIPermissionManager interface is used to persistently store permissions for different object types (cookies, images, and so on) on a site-by-site basis. netwerk/base/nsIPermissionManager.idlScriptable Please add a summary to this article. ...
nsIPrefLocalizedString
modules/libpref/public/nsIPrefLocalizedString.idlScriptable This interface is simply a wrapper interface for nsISup
portsString so the preferences service can have a unique identifier to distinguish between requests for normal wide strings nsISup
portsString) and 'localized' wide strings, which get their default values from properites files. Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void setDataWithLength(in unsigned long length, [size_is(length)] in wstring data); wstring toString(); Attributes Attribute Type Description data wstring Provides access to string data stored in this property. Methods setDataWithLength() Used to set the contents of thi...
nsIPrefService
modules/libpref/public/nsIPrefService.idlScriptable This interface is the main entry point into the back end preferences management library. The preference service is directly responsible for the management of the preferences files and also facilitates access to the preference branch object which allows the direct manipulation of the preferences themselves. ...
nsIPrinterEnumerator
widget/nsIPrintOptions.idlScriptable Please add a summary to this article. Inherits from: nsISup
ports Last changed in Gecko 1.9 (Firefox 3) Method overview void displayPropertiesDlg(in wstring aPrinter, in nsIPrintSettings aPrintSettings); void enumeratePrinters(out PRUint32 aCount,[retval, array, size_is(aCount)] out wstring aResult); Obsolete since Gecko 1.9 void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings); Attributes Attribute Type Description defaultPrinterName wstring The name of the system default printer. This name should also be present in printerNameList. This is not necessarily gecko's default printer; see nsIPrint...
nsIXFormsNSInstanceElement
FormsNSInstanceElement is implemented by all XForms <instance/> elements, defining Mozilla extensions. extensions/xforms/nsIXFormsNSInstanceElement.idlScriptable Please add a summary to this article. Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Interface Code [scriptable, uuid(80669b92-8331-4f92-aaf8-06e80e6827b3)] interface nsIXFormsNSInstanceElement : nsISup
ports { nsIDOMDocument getInstanceDocument(); }; Methods getInstanceDocument nsIDOMDocument getInstanceDocument(); getInstanceDocument returns a DOM Document that corresponds to the instance data associated with the instance element. Essentially it is just a shortcut to nsIXFormsModelElement::getInstanceDocument() for the given instance element. Related Interfaces nsIXFormsModelElement Example ...
nsIXFormsNSModelElement
ented by all XForms <model/> elements. It defines Mozilla extensions to the nsIXFormsModelElement interface. extensions/xforms/nsIXFormsNSModelElement.idlScriptable Please add a summary to this article. Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Interface Code [scriptable, uuid(85fd60c7-1db7-40c0-ae8d-f723fdd1eea8)] interface nsIXFormsNSModelElement : nsISup
ports { nsIDOMNodeList getInstanceDocuments(); }; Methods getInstanceDocuments nsIDOMNodeList getInstanceDocuments(); getInstanceDocuments returns a nsIDOMNodeList containing all the instance documents for the model, making it possible to enumerate over instances in the model without knowing their names. Related Interfaces nsIXFormsModelElement Example Code None. ...
nsIXULAppInfo
xpcom/system/nsIXULAppInfo.idlScriptable This interface provides information about the host application. It can be used to distinguish between different Mozilla-based applications. It provides application name, application version, Gecko version and more. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) In XULRunner applications nsIXULAppInfo obtains app-specific information from application.ini. Implemented by: @mozilla.org/xre/app-info;1. To create an instance, use: var xulAppInfo = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULAppInfo); The nsIXULRuntime interface is also implemented by "xre/app-info". It contains adv...
nsIXULBrowserWindow
xpfe/appshell/public/nsIXULBrowserWindow.idlScriptable Provides methods that may be called from the internals of the browser area to tell the containing XUL window to update its user interface. Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) The XULBrowserWindow attribute exists on the nsIXULWindow interface although both Firefox and SeaMonkey also store their nsIXULBrowserWindow reference in the global XULBrowserWindow object accessible from JavaScript code. Note: The XULBrowserWindow object offered to JavaScript code provides a great many more methods and attributes than those listed here, which are only the ones available to C++ code. See the documentation for XULBrowserWindow for details. Method overview AString onBeforeL...
nsIXULRuntime
xpcom/system/nsIXULRuntime.idlScriptable Provides information about the XUL runtime to allow extensions and XUL applications to determine information about the XUL runtime. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Implemented by: @mozilla.org/xre/app-info;1. To get an instance, use: var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULRuntime); Method overview void invalidateCachesOnRestart(); Attributes Attribute Type Description accessibilityEnabled boolean If true, the accessibility service is running. Read only. browserTabsRemoteAutost...
nsIXULSortService
content/xul/templates/public/nsIXULSortService.idlScriptable A service used to sort the contents of a XUL widget. Inherits from: nsISup
ports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview void insertContainerNode(in nsIRDFCompositeDataSource db, in nsRDFSortState sortStatePtr, in nsIContent root, in nsIContent trueParent, in nsIContent container, in nsIContent node, in boolean aNotify); Native code only! Obsolete since Gecko 1.9 void sort(in nsIDOMNode aNode, in AString aSortKey, in AString aSortHints); Constants Constant Value Description SORT_COMPARECASE 0x0001 SORT_INTEGER 0x0100 Methods Native code only!insertContainerNode Obsolete since Gecko 1.9 (Firefox 3)This feature is obsolete. Although it may still work in...
nsIXmlRpcFault
e since Gecko 1.9 (Firefox 3)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. extensions/xml-rpc/idl/nsIXmlRpcClient.idlScriptable An XML-RPC exception. XML-RPC server fault codes are returned wrapped in this; access it using nsIXPConnect.GetPendingException->data. Inherits from: nsISup
ports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void init(in PRInt32 faultCode, in string faultSring); string toString(); Attributes Attribute Type Description faultCode PRInt32 Read only. faultString string Read only. Methods init() void getData( in PRInt32 faultCode, in str...
nsIZipReaderCache
modules/libjar/nsIZipReader.idlScriptable Please add a summary to this article. Inherits from: nsISup
ports Last changed in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) Implemented by: @mozilla.org/libjar/zip-reader-cache;1. To create an instance, use: var zipReaderCache = Components.classes["@mozilla.org/libjar/zip-reader-cache;1"] .createInstance(Components.interfaces.nsIZipReaderCache); Method overview nsIZipReader getInnerZip(in nsIFile zipFile, in AUTF8String zipEntry); nsIZipReader getInnerZip(in nsIFile zipFile, in string zipEntry); Obsolete since Gecko 10 nsIZipReader getZip(in nsIFile zipFile); void init(in unsigned long cacheSize); Methods getInnerZip() Returns a (possibly shared) cached nsIZip...
nsPIPromptService
This interface defines the meaning of each indexes of GetInt(), SetInt(), GetString() and SetString() of the nsIDialogParamBlock interface but they are defined on in C++. The indexes for GetString() and SetString() are: eMsg The value is 0. This is the message text of the dialog. eCheckboxMsg The value is 1. ...
NS_IF_RELEASE
page still needs some work, help to improve it! Summary Macro Decrements the reference count of a pointer by one. ...
NS_CStringCutData
AX to specify the length from aCutStart to the end of the string. Return Values The NS_CStringCutData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_CStringSetDataRange . Example Code nsCStringContainer str; NS_CStringContainerInit(str); NS_CStringSetData(str, "hello world"); // remove " world"
portion of string NS_CStringCutData(str, 5, PR_UINT32_MAX); const char* data; NS_CStringGetData(str, &data); printf("%s\n", data); // prints out "hello" NS_CStringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_CStringSetDataRange , nsACString ...
NS_StringCutData
eturns an error code. Remarks This function is defined inline as a wrapper around NS_StringSetDataRange. Note: GCC requires the -fshort-wchar option to compile this example since PRUnichar is an unsigned short. This example should compile by default under MSVC. Example Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello world"); // remove " world"
portion of string NS_StringCutData(str, 5, PR_UINT32_MAX); const PRUnichar* data; NS_StringGetData(str, &data); // data now ponts to the string: L"hello" NS_StringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_StringSetDataRange, nsAString ...
nsMsgMessageFlags
es 0x0000E000 The set of bits that indicate the priority. New 0x00010000 Indicates whether or not the message is new since the last time the folder was opened. Ignored 0x00040000 Indicates whether or not the (sub-)thread has been ignored. ImapDeleted 0x00200000 Indicates whether or not the message has been deleted on the IMAP server MDNRe
portNeeded 0x00400000 Indicates whether or not a delivery receipt was requested. MDNRe
portSent 0x00800000 Indicates whether or not a delivery receipt was sent. Template 0x01000000 Indicates whether or not the message is a template. Attachment 0x10000000 Indicates whether or not the message has an attachment. Labels 0x0E000000 The set of...
XPCOM Thread Synchronization
mozilla::CondVar mozilla::Monitor mozilla::MonitorAutoEnter mozilla::Mutex mozilla::MutexAutoLock mozilla::MutexAutoUnlock ...
Using IndexedDB in chrome
The indexedDB API is typically used to store data in the user's browser from content JavaScript. (See Using IndexedDB for an overview.) However, the APIs can also be accessed from system-privileged JavaScript using the Components.utils.im
portGlobalProperties() function: Components.utils.im
portGlobalProperties(["indexedDB"]); // From here on, it's like using IndexedDB from content var req = indexedDB.open("my-database"); // ... If you are creating a sandbox, and want indexedDB to be available in it, use the wantGlobalProperties option in the Sandbox constructor: var options = { "wantGlobalProperties": ["indexedDB"] } var principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal); var sandbox = Components.utils.Sandbox(principal, options); // The sandbox will have...
Getting Started Guide
Never cast an nsCOMPtr, it's almost guaranteed to leak. nsCOMPtrs for non-interface classes Appropriately formatted answer to come, in the meanwhile, the full details are available in this news posting (via Google Groups). nsCOMPtrs in function signatures In general, you won't want to use nsCOMPtr in the signature of XPCOM (i.e., `scriptable') functions. nsCOMPtr is not currently directly sup
ported by IDL. However, you may sometime be tempted to use an nsCOMPtr in a non-scriptable function. nsCOMPtr<T> f() don't return an nsCOMPtr This practice is dangerous. Returning an AddRefed pointer in almost any form as a function result leads to several potential errors, some of which are leaks, some of which are dangling pointers. Returning an nsCOMPtr may seem like a good idea (since it tells c...
Status, Recent Changes, and Plans
ll be easy. Recent changes to nsCOMPtr Most recent first Made == and != between an nsCOMPtr and a raw pointer (or a literal 0 or nsnull) work correctly on all compilers. See bug 65664. Made getter_AddRefs( nsCOMPtr& ) apply the same type-safety check that the simple assignment forms do. Added do_CreateInstance. Added do_GetService. Eliminated the need to cast getter_AddRefs when an nsISup
ports** is needed. Relaxed the invariant for nsCOMPtr<nsISup
ports>, so that it is now a pointer to any XPCOM interface. Added do_QueryReferent to make using nsIWeakReferences easier. Plans for nsCOMPtr bug 59212: as soon as we test on more compilers, start recommending already_AddRefed as a function result. bug 59414: making operator& private may help prevent some leaks caused by casting Move...
Using nsCOMPtr
n nsCOMPtr<T> as a T* Efficiency and Correctness Compiler Annoyances Frequently Asked Questions Buildtime Errors Runtime Errors How do I... General Bibliography Original Document Information Author(s): Scott Collins Last Updated Date: December 11, 2001 Copyright Information: Copyright (C) 1999, 2000 by the Mozilla organization; use is subject to the MPL.
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Using nsIClassInfo
to activate the auto-interface magic which makes calling QueryInterface unnecessary. It just happens. How do I make my C++ class implement nsIClassInfo? See nsIClassInfoImpl.h for instructions. How does nsIClassInfo work? That's also detailed in nsIClassInfoImpl.h. Original Document Information Authors: Mike Shaver, Justin Lebar Last Updated Date: July 25, 2011 Copyright Information:
Portions of this content are (C) 1998-2011 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Working with Multiple Versions of Interfaces
worked, as is, for versions as early as Firefox 1.5. The problem arises when one tries to run an extension built with the latest SDK in an older version of Firefox, say Firefox 2. What happens is that the call to do_CreateInstance fails with nsresult NS_ERROR_NO_INTERFACE. This is because the call to do_CreateInstance(aCID, aOuter, error); will eventually evolve into a request for an object sup
porting the interface with IID NS_GET_IID(nsIAccessibleRetrieval). Unfortunately we compiled this in the latest SDK, and so this magic number happens to be: "244e4c67-a1d3-44f2-9cab-cdaa31b68046" whereas, inside Firefox 2, the IID it happens to know about is: "663ca4a8-d219-4000-925d-d8f66406b626". and this explains our NS_ERROR_NO_INTERFACE. Fortunately there is a plan of action that we can foll...
Working with out parameters
} The getTransferData method takes three parameters, aFlavor, aData, and aDataLen, and returns nothing. aData and aDataLen are marked as out, meaning that they act as "return values" for this method, and are changed during the method call. These are so-called out parameters. ...
XPCOM ownership guidelines
contain (and not the reverse). Use nsCOMPtrs to implement owning-pointers. It's explicit, efficient, and fairly bullet-proof. It's easier to write `getter's and `setter's; and you don't need to put anything in your destructor. Original Document Information Author: Scott Collins Last Updated Date: May 8, 2003 Copyright Information: Copyright(C) 1999 by Netscape; use is subject to the NPL.
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
XTF
Documentation XTF Readme The XTF readme. XTF Home The XTF home (outdated). XTF: When XBL Just Won't Cut It More recent primer to XTF by Alex Vincent. Extending Gecko with XBL and XTF A presentation given at XTech 2005 comparing XBL and XTF, as well as discussing XTF basics. View All... ...
Xray vision
ring or a primitive the return value of evalInSandbox() and any properties attached to the Sandbox object may be pure JavaScript objects Also, the WebIDL specifications are starting to use JavaScript types such as Date and Promise: since WebIDL definition is the basis of DOM Xrays, not having Xrays for these JavaScript types starts to seem arbitrary. So, in Gecko 31 and 32 we've added Xray sup
port for most JavaScript built-in objects. Like DOM objects, most JavaScript built-in objects have an underlying C++ state that is separate from their JavaScript representation, so the Xray implementation can go straight to the C++ state and guarantee that the object will behave as its specification defines: // chrome code var sandboxScript = 'Date.prototype.getFullYear = function() {return 1000};'...
Test-Info
central. Each task generates one or more json-formatted data files providing detailed information on tests run in continuous integration, typically broken down by bugzilla component. Data files are typically consumed by dashboards, like www.arewefissionyet.com. Running test-info locally "test-info" is a mach command and can be run from any source tree. test-info has several sub-commands; the "re
port" sub-command is used by the test-info tasks mozilla-central$ mach help test-info re
port To reproduce test-info(all): mozilla-central$ mach test-info re
port --show-tests --show-summary --show-activedata Running test-info on try To run these tasks on try, use something like: mach try fuzzy -q test-info Contact information test-info is maintained by :gbrown. Bugs should be filed in Testi...
The Valgrind Test Job
mory leaks in the codebase that have corresponding suppressions. But generally errors should be fixed rather than suppressed. When running locally, you may see errors that do not occur on the test machines. Errors in system libraries can generally be ignored, because they are out of our control and the kind of thing we suppress on the test machines. Errors in Mozilla code should probably be re
ported in bugs! If you need help or experience problems If you need help with the Valgrind test job, please contact Nicholas Nethercote or Gary Kwong. Julian Seward can also help with Valgrind issues. Alternatively, bugs relating to the test job can be filed in the "Testing" product, under the "General" component. Please CC :njn and :gkw on any such bugs. ...
Testing Mozilla code
Testing your code is im
portant! Before you can even get your code committed into the source tree, you have to test it, and larger patches have to have automated tests. These articles will help you master (and continue to excel at) testing Mozilla code. ASan Nightly ProjectThe ASan Nightly Project involves building a Firefox Nightly browser with the popular AddressSanitizer tool and enhancing it with remote crash re
porting capabilities for any errors detected.Clang static analysisThis document is split in two parts. The first part will focus on the modern and robust way of static-analysis and the second part will present the build-time static-analysis.Debugging Mozilla with ValgrindThis page describes how to use Valgrind (specifically, its Memcheck tool) to find memory errors.Fire...
Buddy icons in mail
Seth Spitzer Mozilla is now able to show icons in the message header area and the addressbook card pane. For the message pane, the icon we will show is on disk at: <profile home>/NIM/<value of pref aim.session.screenname>/picture/<screenname for sender email address>.gif When trying to determine the screenname for the sender, we search the addressbook that we are using for collection. ...
Cached compose window FAQ
Seth Spitzer (sspitzer@mozilla.org) What is the "cached" compose window? Instead of destroying the mail compose window on send (or close) just to create a new one the next time, Mozilla Mail will "cache" the compose window on send (or close), and use that instead. The downsides are that we have had some bugs, it complicates and bloats the code, and it requires more testing. The upside is that is has been a major performance win Why did you do this? Back 0.9.7, we hit a wall with the compose window. ...
Thunderbird extensions
g, Gloda indexing More Thunderbird-specific links Some links may be out of date, but they still provide valuable information on the codebase. ...
Using Mozilla code in other projects
lications with ease. Mozilla Toolkit Information about the Mozilla Toolkit API. Signing Mozilla apps for Mac OS X How to code-sign applications based on Mozilla code for Mac OS X's application security model. Using Mozilla components SpiderMonkey SpiderMonkey is the JavaScript runtime engine used by Mozilla projects. NSPR The Netscape
Portable Runtime provides a platform-neutral API for system level and libc-type functions. Necko The Mozilla networking library provides cross-platform networking functionality. Embedding Mozilla For information on embedding a web browser into your own application see Embedding Mozilla. ...
Using tab-modal prompts
Then apply it, like in the example below, here we apply the prompt with a checkbox: var window = gBrowser.contentWindow; var promptfact = Components.classes['@mozilla.org/prompter;1'].getService(Components.interfaces.nsIPromptFactory); var prompt = p...
XPI
emes, and Thunderbird dictionaries. An XPI contains installation instructions (install.js or install.rdf) as well as the actual software to install, which is often itself packaged as a JAR file. When downloaded or dropped into an extension manager, XPInstall automatically interacts with the installation instructions contained in the XPI, and installs the contained software. XPI archives only sup
port files stored uncompressed or compressed using the "deflate" method. Note: Starting in Gecko 2.0, XPI files are no longer unpacked when extensions are installed. Instead, the XPI itself is placed in the extensions directory, and files are loaded directly out of the package. See Updating extensions for Firefox 4 for details. When XPI files are served via HTTP, the application/x-xpinstall MIME t...
Examples
rates JavaScript-Cocoa Bridge for Mac OS X. Lightweight bridge for calling Cocoa frameworks from JavaScript, js-macosx transparently handles definition of Cocoa API, both C and Objective-C, and provides automatic declarations for framework functions, structures, constants and enumerations, as well as allows creating and subclassing Cocoa classes. The js-macosx bridge has dependency on BridgeSup
port metadata: whenever a Cocoa class, function, struct or const is encountered in the JavaScript code, js-macosx will replace it with the corresponding js-ctypes declaration based on the BridgeSup
port file from the framework that object belongs to. ...
Declaring types
't a way to specify that an array's C equivalent was declared as a packed structure; that is, using #pragma pack. Field descriptors Each field descriptor is comprised of a field name and its data type, represented as a string and a CType object, respectively. The format, then, looks like this: [ { field1: type1 }, { field2: type2 }, ... ...
CType
out them, and so forth. The specific properties and methods on each object vary depending on the data type represented. There are several kinds of types: Primitive types These are typical unstructured data, such as the predefined types listed in Predefined data types. Big integer types The Int64 and UInt64 types provide access to 64-bit integer values, which JavaScript doesn't currently sup
port. PointerType These represent pointers to data in memory. FunctionType These represent callable C functions. StructType These represent C structures. ArrayType These represent C arrays. Method overview Methods available on all CType objects CType array([n]) String toSource() String toString() Properties Properties of all CType objects These propertie...
js-ctypes
Other work made possible by js-ctypes is JNI, this is elaborated on in the JNI.jsm section and not the js-ctypes section due to the JSM abstracting away all of the js-ctypes. Unlike binary XPCOM components, it allows developers to ship a single binary for use with multiple versions of Firefox. Note: js-ctypes is only available from chrome code; that is, ctypes is not available to websites, only application and extension code. ...
Blocking By Domain - Plugins
Rather than block plugins entirely, Firefox is limiting the impact of plugins by blocking certain domains from using plugins. These blocks improve Firefox security and performance and also make the click-to-activate feature more valuable to users by reducing unnecessary prompts. According to the Firefox plugin roadmap, the plugin block list is planned for Firefox 55. ...
Flash Activation: Browser Comparison - Plugins
lemented this feature and the user interface in slightly different ways. This guide will help outline the similarities and differences between the browsers so web developers can provide the best user experience. In each browser, the decision to enable Flash is made by users on a per-site basis. When a site attempts to use Flash, the browser will prompt the user in some way and give the user an op
portunity to enable Flash for that site. Flash-blocking extensions are no longer necessary because this functionality is now built into the browser. Mozilla Firefox Google Chrome Microsoft Edge Setting Name Ask to activate HTML5 by default Click-to-run 'application/x-shockwave-flash' in navigator.mimeTypes by default when Flash is inactive yes ...
Browser Side Plug-in API - Plugins
the browser. The names of all of these methods begin with NPN_ to indicate that they are implemented by the browser and called by the plug-in. For an overview of how these two sides of the plug-in API interact, see the How Plug-ins Work and Overview of Plug-in Structure sections in the introduction. Warning: You must only call these from the main thread; calling them from other threads is not sup
ported and may have unpredictable results. Netscape Plug-in Method Summary << PreviousNext >> NPN_DestroyStream Closes and deletes a stream. NPN_ForceRedraw Forces a paint message for a windowless plug-in. NPN_GetAuthenticationInfo This function is called by plug-ins to get HTTP authentication information from the browser. NPN_GetURL Asks the browser to create a stream for the ...
Constants - Plugins
LiveConnect (Win16). NPVERS_68K_HAS_LIVECONNECT 11 LiveConnect (68K). NPVERS_HAS_WINDOWLESS 11 Windowless plug-in. NPVERS_HAS_XPCONNECT_SCRIPTING 13 Plug-in is scriptable using XPConnect. NPVERS_HAS_NPRUNTIME_SCRIPTING 14 Plug-in is scriptable using NPRuntime. NPVERS_HAS_FORM_VALUES 15 NPPVformValue NPPVariables are sup
ported. NPVERS_HAS_POPUPS_ENABLED_STATE 16 The NPN_PushPopupsEnabledState() and NPN_PopPopupsEnabledState() functions are sup
ported. NPVERS_HAS_RESPONSE_HEADERS 17 NPStreams have response headers for HTTP streams. NPVERS_HAS_NPOBJECT_ENUM 18 The NPClass in question has an enumerate field, which lets you enumerate the properties of an NPObject of that class.
Initialization and Destruction - Plugins
yLength; (*save)->buf = (void*) NPN_MemAlloc(myLength); strcpy((*save)->buf, myData); If you allocate saved instance data in NPP_Destroy, be sure to allocate memory with this function, since the browser can delete the saved data with the equivalent of NPN_MemAlloc at any time. Shutdown When the application no longer needs the plug-in, it is shut down and released. NP_Shutdown gives you an op
portunity to delete data allocated in NP_Initialize to be shared by all instances of a plug-in. The browser calls the plug-in's NP_Shutdown function, which informs the plug-in that its library is about to be unloaded, and gives it a chance to cancel any outstanding I/O requests, delete threads it created, free any memory it allocated, and perform any other closing tasks. The NP_Shutdown function rele...
Memory - Plugins
ctly. If NPN_MemAlloc is called, calls to NPN_MemFlush have no effect. For example, suppose that the plug-in calls NewGWorld, and that the call fails because of insufficient memory. The plug-in should try calling NPN_MemFlush to free enough memory. If NPN_MemFlush returns a value indicating that enough memory was freed, the plug-in can call NewGWorld again. Calling NPN_MemFlush is particularly im
portant to systems with small amounts of RAM and with virtual memory turned off. To request that the browser free as much memory as possible, call NPN_MemFlush repeatedly until it returns 0. uint32 NPN_MemFlush (uint32 size); The size parameter is an unsigned long integer that represents the amount of memory, in bytes, to free in the browser's memory space. This function returns the amount of free...
Plug-in Side Plug-in API - Plugins
ew of how these two sides of the plug-in API interact, see the How Plug-ins Work and Overview of Plug-in Structure sections in the introduction. Plugin method summary NPP_Destroy Deletes a specific instance of a plug-in. NPP_DestroyStream Tells the plug-in that a stream is about to be closed or destroyed. NP_GetEntryPoints Undocumented. NP_GetMIMEDescription Registers the mime types sup
ported by the plug-in (Unix, Mac OS). NPP_GetValue Allows the browser to query the plug-in for information. NP_GetValue Allows the browser to query the plug-in for information. NPP_HandleEvent Delivers a platform-specific window event to the instance. NP_Initialize Provides global initialization for a plug-in. NPP_New Creates a new instance of a plug-in. NPP_NewStream Notifies a plug-in in...
Scripting plugins - Plugins
ion to the API has been developed that lets plugins be scriptable again, independent of Java. This extension will also let plugins access the script objects in the browser, and is thus a much stronger and more flexible API.) The information in this section applies to Firefox 1.0 and Mozilla 1.7.5 and newer versions. How the DOM handles scripting The Mozilla DOM code now checks if a plugin sup
ports this new scriptability API and if it exposes a scriptable object through this new mechanism. Mozilla does this by calling the old plugin API call NPP_GetValue with the new enumeration value that has been added to the NPPVariable enumeration. The new NPPVariable enumeration is defined in npapi.h as: NPPVpluginScriptableNPObject = 15 Threading model This API is not designed to be thread safe.
Structures - Plugins
t Substructure of NPPrint that contains platform-specific information used during embedded mode printing. NPEvent Represents an event passed by NPP_HandleEvent to a windowless plug-in. NPFullPrint Substructure of NPPrint that contains platform-specific information used during full-page mode printing. NPP Represents a single instance of a plug-in. NP_
Port Contains information required by the window field of an NPWindow structure. NPPrint Contains information the plug-in needs to print itself in full-page or embedded mode. NPPrintCallbackStruct Contains information required by the platformPrint field of the NPEmbedPrint during embedded mode printing. NPRect Represents a rectangular area of a page. NPR...
Accessibility Inspector - Firefox Developer Tools
This article takes you through the main features of the Accessibility Inspector and how to use it. A (very) brief guide to accessibility Accessibility is the practice of making your websites usable by as many people as possible. This means trying your best to not lock anyone out of accessing information because of any disability they may have, or any other personal circumstances such as the device they are using, the speed of their network connection, or their geographic location or locale. ...
DOM Inspector FAQ - Firefox Developer Tools
les for other pseudo-classes or any pseudo-elements from the DOM Inspector UI. You can, however, find any rule in its parent style sheet (e.g., to modify it) by using the Style Sheets viewer in the document pane, and locating it in the CSS Rules viewer in the object pane. Original Document Information Author(s): Christopher Aillon Last Updated Date: November 11, 2003 Copyright Information:
Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
DOM Inspector - Firefox Developer Tools
bird Add-ons. Or, build Thunderbird yourself with the following options: ac_add_options --enable-extensions="default inspector" ac_add_options --enable-inspector-apis Mozilla Suite and SeaMonkey Select Tools > Web Development > DOM Inspector. You can install the Sidebar panel via Edit > Preferences > Advanced > DOM Inspector, then simply open up the inspector panel and visit a website. Re
port a bug in DOM Inspector Use the conveniently named "DOM Inspector" component in Bugzilla. To find out who knows DOM Inspector code and where it lives, see the DOM Inspector module listing. ...
Inspecting web app manifests - Firefox Developer Tools
You also need to make sure the JSON inside the file is of the correct format. You can test this using the Web Manifest Validator. Inspecting your manifest If your manifest is deployed successfully, you should end up with a display like the following on the Manifest view: From here, you can inspect all the ...
Debugging service workers - Firefox Developer Tools
service worker has previously been installed, but then a new version of the worker is available on refresh or page load, the new version is installed in the background, but not yet activated. It is only activated when there are no longer any pages loaded that are still using the old service worker. As soon as there are no more such pages still loaded, the new service worker activates. Debug Im
portant: The Debug button is currently enabled only in Firefox Nightly. When your service worker is running, a Debug button is available next to the Source information (it is disabled when the service worker is stopped). When pressed, this takes you straight to the JavaScript debugger view of your service worker code, and you can use the full power of the debugger to debug it -- stepping through cod...
Examine, modify, and watch variables - Firefox Developer Tools
If you need to use it, you can, for now, switch back to the old debugger by visiting about:config and setting the "devtools.debugger.new-debugger-frontend" preference to false. To see the docs for the old debugger, please visit Debugger (before Firefox 52). Examine variables When the code has stopped at a breakpoint, you can examine its state in the variables pane of the debugger: Variables are grouped by scope: in Function scope you'll see the built-in arguments and this variables as well as local variables defined by the function like user and greeting. ...
Step through code - Firefox Developer Tools
This lets you know what kind of breakpoint the code is paused on (breakpoint, event breakpoint, etc.), and also provides a step button and a play button. The thinking here is that if you've got your DevTools open in a separate window, as many people do, it can be easier to have the buttons available right there to move the code forward while you are looking at the...
Debugger.Object - Firefox Developer Tools
g invocation functions. This method pierces the membrane of Debugger.Object instances meant to protect debugger code from debuggee code, and allows debugger code to access debuggee objects through the standard cross-compartment wrappers, rather than via Debugger.Object's reflection-oriented interfaces. This method makes it easier to gradually adapt large code bases to this Debugger API: adapted
portions of the code can use Debugger.Object instances, but use this method to pass direct object references to code that has not yet been updated. forceLexicalInitializationByName(binding) Ifbinding is in an uninitialized state initialize it to undefined and return true, otherwise do nothing and return false. Source Metadata Generated from file: js/src/doc/Debugger/Debugger.Object.md Wa...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
tchpad), and select "Browser" from the "Environment" menu. (This menu will not be present unless you have changed the preference as explained above.) Selecting the 'browser' context in the Scratchpad Enter the following code in the Scratchpad: // This simply defines the 'Debugger' constructor in this // Scratchpad; it doesn't actually start debugging anything. Components.utils.im
port('resource://gre/modules/jsdebugger.jsm'); addDebuggerToGlobal(window); (function () { // The debugger we'll use to observe a tab's allocation. var dbg; // Start measuring the selected tab's main window's memory // consumption. This function is available in the browser // console. window.demoTrackAllocations = function() { dbg = new Debugger; // This makes hacking on the dem...
Debugger-API - Firefox Developer Tools
es: Setting a breakpoint in a page, running a handler function when it is hit that evaluates an expression in the page's context. Showing how many objects different call paths allocate. Gecko-specific features While the Debugger core API deals only with concepts common to any JavaScript implementation, it also includes some Gecko-specific features: [Global tracking][global] sup
ports debugging all the code running in a Gecko instance at once--the 'chrome debugging' model. [Object wrapper][wrapper] functions help manipulate object references that cross privilege boundaries. Source Metadata Generated from file: js/src/doc/Debugger/Debugger-API.md Watermark: sha256:6ee2381145a0d2e53d2f798f3f682e82dd7ab0caa0ac4dd5e56601c2e49913a7 Changeset: ffa775dd5bd4 ...
Basic operations - Firefox Developer Tools
or clear this snapshot: Clearing a snapshot To remove a snapshot, click the "X" icon: Saving and loading snapshots If you close the Memory tool, all unsaved snapshots will be discarded. To save a snapshot click "Save": You'll be prompted for a name and location, and the file will be saved with an .fxsnapshot extension. To load a snapshot from an existing .fxsnapshot file, click the im
port button, which looks like a rectangle with an arrow rising from it (before Firefox 49, this button was labeled with the text "Im
port..."): You'll be prompted to find a snapshot file on disk. Comparing snapshots Starting in Firefox 45, you can diff two heap snapshots. The diff shows you where memory was allocated or freed between the two snapshots. To create a diff, click the button that look...
Dominators - Firefox Developer Tools
his gives rise to a distinction between two ways to look at the size of an object: shallow size: the size of the object itself retained size: the size of the object itself, plus the size of other objects that are kept alive by this object Often, objects will have a small shallow size but a much larger retained size, through the references they contain to other objects. Retained size is an im
portant concept in analyzing memory usage, because it answers the question "if this object ceases to exist, what's the total amount of memory freed?". Dominators A related concept is that of the dominator. Node B is said to dominate node A if every path from the root to A passes through B: If any of node A's dominators are freed, then node A itself becomes eligible for garbage collection. If nod...
Inspecting web sockets - Firefox Developer Tools
me OpCode MaskBit FinBit The Data and Time columns are visible by default, but you can customize the interface to see more columns by choosing which ones to show from the context menu that is opened by right-clicking in the table header. Expanding each message Selecting a message in the list shows a preview of the data being sent in that message, at the bottom of the Response pane. Sup
ported WS protocols The inspector currently sup
ports the following web socket protocols: Plain JSON Socket.IO SockJS SignalR WAMP The payload based on those protocols is parsed and displayed as an expandable tree for easy inspection, although you can of course still see the raw data (as sent over the wire) as well. ...
Network monitor toolbar - Firefox Developer Tools
WebSocket upgrades and messages (labeled WS) Other requests A checkbox that allows you to disable caching. Throttling menu, to simulate various connection types A menu of other actions: Persist Logs: By default, the Network Monitor is cleared each time you navigate to a new page or reload the current page. When you select Persist Logs, the log is not cleared on page load. Im
port HAR im
ports a HAR (HTTP Archive) file. Save All as HAR opens a file dialog box so you can save the current contents of the Network log as a HAR file with the extension .har. Copy All as HAR copies the current contents of the Network log to the clipboard in HAR format. A second toolbar area at the bottom of the network monitor provides: An icon to launch performance analysis. A ...
Work with animations - Firefox Developer Tools
esenting ease-in, and the second is convex, representing ease-out. If the animation used CSS transitions, there is one bar for each property transitioned, and it is labeled with the name of the property being transitioned. If the animation used CSS @keyframes, there is one bar for each animation, labeled with its name. If the animation or transition had a delay, this is shown as a cross-hatched
portion of the bar. delay and endDelay are both represented. If you hover over the bar, a tooltip appears, giving you more detailed information about the animation or transition, including: the type of animation: CSS transition, CSS animation, or Web Animations API the duration of the animation the animation's start and end delay the animation's easing (or timing function). the animation's fil...
UI Tour - Firefox Developer Tools
shows you the complete computed CSS for the selected element (The computed values are the same as what getComputedStyle would return.): Compatibility view Starting with Firefox Developer Edition version 77, the Compatibility view shows CSS compability issues, if any, for properties applied to the selected element, and for the current page as a whole. It shows icons for the browsers that do sup
port the properties, and notes properties that are experimental or deprecated. Click the name of the property to open the reference article for that property on MDN Web Docs. The "Browser compatibility" section of the article gives details of browser sup
port for the property. In the All Issues section, click the name of the element that uses the property to select that element in the inspector. ...
Paint Flashing Tool - Firefox Developer Tools
e-intensive operations, eliminating unnecessary repaints can improve your website's responsiveness. Repaints and responsiveness When the browser renders a web page it parses the HTML and CSS, determines how to lay it out, and then paints it to actually display the content on the screen. Whenever an event happens that might change a visible part of the web page then the browser must repaint some
portion of the page. For example, a repaint will be needed if the user scrolls the page or moves the mouse pointer over an element with a :hover pseudo-class that changes the element's style. Repainting can be an expensive operation, so the browser tries to minimise the amount of repainting that it needs to do. It tries to work out which parts of the screen are "damaged" and repaint only those. The b...
Allocations - Firefox Developer Tools
This in turn can hurt the responsiveness of a page. The Allocations view is new in Firefox 46. To enable the Allocations view, you must check "Record Allocations" in the Performance tool settings, before recording a profile. ...
Flame Chart - Firefox Developer Tools
them easier to distinguish. This gives you a way to know exactly which function was executing at any point during the recording, how long it ran for, and where it was called from. Zooming and panning To work effectively with the Flame Chart, you'll need to be able to navigate it. There are two main controls you can use to navigate the Flame Chart: Zoom: increase/decrease the selected
portion of the complete profile that's displayed in the Flame Chart 1) Mouse wheel up/down in the Flame Chart. 2) Trackpad 2 fingers up/down in the Flame Chart. Pan: move the selected
portion of the complete profile left and right 1) Click and drag the selected
portion in the recording overview pane. 2) Click and drag anywhere in the Flame Chart. An ...
Frame rate - Firefox Developer Tools
appear sluggish or will occasionally freeze. In general, a high and consistent frame rate will make the user's interaction with the site more enjoyable and engaging. A frame rate of 60fps is reckoned to be the target for smooth performance, giving you a time budget of 16.7ms for all the updates that need to be made synchronously in response to some event. However, consistency is especially im
portant: if you can't deliver 60fps, it's better to deliver lower frame rates more consistently, and avoid sudden dips in the frame rate which cause the site to freeze. Frame rate graph The frame rate graph is found in the Recording overview part of the Performance tool. It takes a timestamp when the browser finishes a frame, and uses this to keep track of the frame rate over the course of the reco...
How to - Firefox Developer Tools
the Toolbar, if you have one: Record a profile To start a new recording, press the stopwatch icon in the Recordings pane. To stop, press it again: You can also start and stop recording from the Web Console, using console.profile() and console.profileEnd(). Save a profile To save a profile, click the link labeled "Save" in the Recordings pane: Load a profile To load a profile, click "Im
port..." and choose the file: Clear all loaded profiles To clear all loaded profiles, click "Clear". If you do this, you'll lose any loaded profiles that you have not saved. Select a tool To switch between the Waterfall, Call Tree, and Flame Chart tools, use the buttons in the toolbar: Configure markers displayed To control which markers are shown in the Waterfall, use the button in the...
Animating CSS properties - Firefox Developer Tools
r style recalculation. Frame rate Compared with the version that uses margin, this is looking pretty good. We're averaging nearly 60fps, and apart from one dip near the start, we're getting a consistently high frame rate. Waterfall The timeline view shows the reason for the improved frame rate. Compared with the version that uses margin, we're not spending any time time in layout or (more im
portantly in this case) in paint: In this case, using transform significantly improved the site's performance, and the performance tools were able to show how and why it did. ...
UI Tour - Firefox Developer Tools
The performance tool's UI consists of 4 main pieces: Toolbar Recordings pane Recording overview Details pane, which may contain any one of: Waterfall Call Tree Flame Chart Toolbar The toolbar contains buttons to: start and stop a recording im
port a recording you previously saved clear the Recordings pane. Note that if you do this, you lose any recordings you have not saved. filter the markers that are displayed in the Waterfall view switch the active tool in the Details pane. access the Settings popup Recordings pane The recordings pane lists all the recordings you have loaded, including any you have made in this session and any you have im
ported. At any given time, one recording is selected, and that recording is displayed in the rest of the...
Waterfall - Firefox Developer Tools
which are painted independently and then combined in a process called "Composition". This sequence needs to fit into a single frame, since the screen isn't updated until it is complete. It's commonly accepted that 60 frames per second is the rate at which animations will appear smooth. For a rate of 60 frames per second, that gives the browser 16.7 milliseconds to execute the complete flow. Im
portantly for responsiveness, the browser doesn't always have to go through every step: CSS animations update the page without having to run any JavaScript. Not all CSS property changes cause a reflow. Changing properties that can alter an object's geometry and position, such as width, display, font-size, or top, will cause a reflow. However, changing properties that don't alter geometry or positi...
Debugging Firefox Desktop - Firefox Developer Tools
Tools Settings. You only need to do this once: the setting values persist across restarts. Start the debugger server Next, you need to start the debugger server in the debuggee. Run the debuggee from the command line, passing it the --start-debugger-server option: /path/to/firefox --start-debugger-server Passed with no arguments, --start-debugger-server makes the debugger server listen on
port 6000. To use a different
port, pass the desired
port number: /path/to/firefox --start-debugger-server 1234 Note: in Windows, the start-debugger-server call will only have one dash: firefox.exe -start-debugger-server 1234 Note: By default, and for security reasons, the devtools.debugger.force-local option is set. If you want to debug a Firefox instance from an external machine, you can change...
Rulers - Firefox Developer Tools
To be able to toggle rulers for a page, you first need to enable the button by going to the settings page for the Developer Tools and checking "Toggle rulers for the page" under Available Toolbox Buttons. Once enabled, the "Toggle rulers for the page" button appears at the top right of the Toolbox, in the same place as the Settings/Options button. ...
Settings - Firefox Developer Tools
ut panel Enable the experimental layout panel. This setting only exists in Firefox Nightly. Web Console Enable timestamps Controls whether the Web Console displays timestamps. The Web Console defaults to hiding timestamps. Enable new console frontend Switch to the experimental new console. This setting only exists in Firefox Nightly. Debugger Enable Source Maps Enable source map sup
port in the debugger. Enable new debugger frontend Enable the new debugger. This setting only exists in Firefox Nightly. Style Editor Show original sources When a CSS preprocessor sup
porting source maps is used, this enables the Style Editor to display the original, preprocessor, sources rather than the generated CSS. Learn more about Style Editor sup
port for CSS source maps. With this setting...
Rich output - Firefox Developer Tools
splayed in the console. The right-arrow key opens the details of an object and the left-arrow key closes open objects. Examining request details Similar to examining object details, you can see the details about a network request directly in the console. Click on the arrow next to the request and a details panel will open that is equivalent to the Headers panel in the Network Monitor tool. Ex
port output to the clipboard Once you have output in the console window, you can save it to the clipboard by right-clicking on the output and selecting Ex
port visible messages to clipboard: This will copy all of the output to the clipboard. Then you can paste it into a document. The output will look something like this: console.log(todoList) Array(4) [ {...}, {...}, {...}, {...} ] debugger eval c...
Web Console remoting - Firefox Developer Tools
twork bandwidth. The getRequestPostData packet: { "to": "conn0.netEvent15", "type": "getRequestPostData" } { "from": "conn0.netEvent15", "postData": { text: "foobar" }, "postDataDiscarded": false } The getResponseContent packet: { "to": "conn0.netEvent15", "type": "getResponseContent" } { "from": "conn0.netEvent15", "content": { "mimeType": "text/css", "text": "\n@im
port \"test.css\";\n\n.foobar { color: green }\n\n" }, "contentDiscarded": false } The request and response content text value is most commonly sent using a LongStringActor grip. For very short request/response bodies we send the raw text. Starting with Firefox 19: for non-text response types we send the content in base64 encoding (again, most likely a LongStringActor grip). To tell the differ...
Firefox Developer Tools
are keeping memory in use. Storage Inspector Inspect cookies, local storage, indexedDB, and session storage present in a page. DOM Property Viewer Inspect the page's DOM properties, functions, etc. Eyedropper Select a color from the page. Style Editor View and edit CSS styles for the current page. Taking screenshots Take a screenshot of the entire page or of a single element. Measure a
portion of the page Measure a specific area of a web page. Rulers Overlay horizontal and vertical rulers on a web page For the latest developer tools and features, try Firefox Developer Edition. Download Firefox Developer Edition Connecting the Developer Tools If you open the developer tools using keyboard shortcuts or the equivalent menu items, they'll target the document hosted by t...
ANGLE_instanced_arrays - Web APIs
ion() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: This extension is only available to WebGL1 contexts. In WebGL2, the functionality of this extension is available on the WebGL2 context by default and the constants and methods are available without the "ANGLE" suffix. Despite the name "ANGLE", this extension works on any device if the hardware sup
ports it and not just on Windows when using the ANGLE library. "ANGLE" just indicates that this extension has been written by the ANGLE library authors. Constants This extension exposes one new constant, which can be used in the gl.getVertexAttrib() method: ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE Returns a GLint describing the frequency divisor used for instanced rendering when used in the gl.get...
AbortController.AbortController() - Web APIs
oller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { re
ports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with an AbortError. You can find a full working example on GitHub -- see abort-api (see it running live also). Specifications Specification Status Comment DOMThe definition of 'AbortController()' in that specification. Living Standard Initial definiti...
AbortController.abort() - Web APIs
oller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { re
ports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with an AbortError. You can find a full working example on GitHub -- see abort-api (see it running live also). Specifications Specification Status Comment DOMThe definition of 'abort()' in that specification. Living Standard Initial definition ...
AbortController.signal - Web APIs
oller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { re
ports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with an AbortError. You can find a full working example on GitHub -- see abort-api (see it running live also). Specifications Specification Status Comment DOMThe definition of 'signal' in that specification. Living Standard Initial definition ...
AbortController - Web APIs
oller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { re
ports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with a DOMException named AbortError. You can find a full working example on GitHub -- see abort-api (see it running live also). Specifications Specification Status Comment DOMThe definition of 'AbortController' in that specification. Living Standard ...
AbortSignal - Web APIs
oller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { re
ports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with an AbortError. Current version of Firefox rejects the promise with a DOMException You can find a full working example on GitHub -- see abort-api (see it running live also). Specifications Specification Status Comment DOMThe definition of 'AbortSigna...
AmbientLightSensor.AmbientLightSensor() - Web APIs
nt light around the hosting device. If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Syntax var ambientLightSensor = new AmbientLightSensor(options) Parameters options Optional Currently only one option is sup
ported: frequency: The desired number of times per second a sample should be taken, meaning the number of times per second that sensor.onreading will be called. A whole number or decimal may be used, the latter for frequencies less than a second. The actual reading frequency depends device hardware and consequently may be less than requested. Specifications Specification Status ...
Animation.onfinish - Web APIs
the finish event. This event is sent when the animation finishes playing. The finish event occurs when the animation completes naturally, as well as when the Animation.finish() method is called to immediately cause the animation to finish up. The "paused" play state supersedes the "finished" play state; if the animation is both paused and finished, the "paused" state is the one that will be re
ported. You can force the animation into the "finished" state by setting its startTime to document.timeline.currentTime - (Animation.currentTime * Animation.playbackRate). Syntax var finishHandler = Animation.onfinish; Animation.onfinish = finishHandler; Value A function to be called to handle the finish event, or null if no finish event handler is set. Examples Animation.onfinish is used seve...
AnimationPlaybackEvent - Web APIs
Constructor AnimationPlaybackEvent.AnimationPlaybackEvent() Constructs a new AnimationPlaybackEvent object instance. Attributes AnimationPlaybackEvent.currentTime The current time of the animation that generated the event. AnimationPlaybackEvent.timelineTime The time value of the timeline of the animation that generated the event. ...
Attr - Web APIs
Attribute() instead. createAttributeNS() Use Element.setAttributeNS() instead. getAttributeNode() Use Element.getAttribute() instead. getAttributeNodeNS() Use Element.getAttributeNS() instead. hasAttributes() Obsolete since Gecko 21.0 This method now always returns false. hasChildNodes() This method now always returns false. insertBefore() Modify the value of Attr.value instead. isSup
ported() You shouldn't have been using this in the first place, so you probably don't care that this is going away. isEqualNode() You shouldn't have been using this in the first place, so you probably don't care that this is going away. normalize() You shouldn't have been using this in the first place, so you probably don't care that this is going away. removeAttributeNode() Use Element.removeA...
AudioBufferSourceNode.playbackRate - Web APIs
.0 indicates it should play at the same speed as its sampling rate, values less than 1.0 cause the sound to play more slowly, while values greater than 1.0 result in audio playing faster than normal. The default value is 1.0. When set to another value, the AudioBufferSourceNode resamples the audio before sending it to the output. Syntax AudioBufferSourceNode.playbackRate.value = playbackRatePro
portion; Value An AudioParam whose value is a floating-point value indicating the playback rate of the audio as a decimal pro
portion of the original sampling rate. Consider a sound buffer containing audio sampled at 44.1 kHz (44,100 samples per second). Let's see what a few values of playbackRate do: A playbackRate of 1.0 plays the audio at full speed, or 44,100 Hz. A playbackRate of 0.5 plays...
AudioContext.createJavaScriptNode() - Web APIs
See also ScriptProcessorNode. Syntax var jsNode = audioCtx.createJavaScriptNode(bufferSize, numInputChannels, numOutputChannels); Parameters bufferSize The buffer size must be in units of sample frames, i.e., one of: 256, 512, 1024, 2048, 4096, 8192, or 16384. It controls the frequency of callbacks asking for a buffer refill. ...
AudioContextOptions.sampleRate - Web APIs
The AudioContextOptions dictionary (used when instantiating an AudioContext) may contain a property named sampleRate, which indicates the sample rate to use for the new context. The value must be a floating-point value indicating the sample rate, in samples per second, for which to configure the new context; additionally, the value must be one which is sup
ported by AudioBuffer.sampleRate. Syntax audioContextOptions.sampleRate = 44100; var sampleRate = audioContextOptions.sampleRate; Value The desired sample rate for the AudioContext, specified in samples per second. The value must be compatible with AudioBuffer.sampleRate. This value should typically be between 8,000 Hz and 96,000 Hz; the default will vary depending on the output device, but the sample rate 44,100 Hz is the most common. ...
AudioContextOptions - Web APIs
double-precision floating-point value indicating the preferred maximum latency of the context in seconds. The user agent may or may not choose to meet this request; check the value of AudioContext.baseLatency to determine the true latency after creating the context. sampleRate Optional The sampleRate to be used by the AudioContext, specified in samples per second. The value may be any value sup
ported by AudioBuffer. If not specified, the preferred sample rate for the context's output device is used by default. Constants Standard values for latencyHint The latencyHint property can be number specifying a preferred maximum latency in seconds or a string from the AudioContextLatencyCategory enumerated string, which selects a standard value for a given type of audio usage: Value ...
AudioNode - Web APIs
set individually. You can sub-class an audio node. While the actual processing is done internally by the browser and cannot be altered, you could write a wrapper around an audio node to provide custom properties and methods. Slightly better performance: In both Chrome and Firefox, the factory methods call the constructors internally. Keep in mind that Microsoft Edge does not yet appear to sup
port the constructors; it will throw a "Function expected" error when you use the constructors. Brief history: The first version of the Web Audio spec only defined the factory methods. After a design review in October 2013, it was decided to add constructors because they have numerous benefits over factory methods. The constructors were added to the spec from August to October 2016. Factory methods c...
AudioParam.setTargetAtTime() - Web APIs
Syntax var paramRef = param.setTargetAtTime(target, startTime, timeConstant); Parameters target The value the parameter will start to transition towards at the given start time. startTime The time that the exponential transition will begin, in the same time coordinate system as AudioContext.currentTime. If it is less than or equal to AudioContext.currentTime, the parameter will start changing immediately. ...
AudioTrack.id - Web APIs
The id property contains a string which uniquely identifies the track represented by the AudioTrack. This ID can be used with the AudioTrackList.getTrackById() method to locate a specific track within the media associated with a media element. The track ID can also be used as the fragment of a URL that loads the specific track (if the media sup
ports media fragments). Syntax var trackID = AudioTrack.id; Value A DOMString which identifies the track, suitable for use when calling getTrackById() on an AudioTrackList such as the one specified by a media element's audioTracks property. Specifications Specification Status Comment HTML Living StandardThe definition of 'AudioTrack.id' in that specification. Living Standard HTML5The definition of 'A...
AudioTrack.language - Web APIs
var audioTrackLanguage = AudioTrack.language; Value A DOMString specifying the BCP 47 (RFC 5646) format language tag of the primary language used in the audio track, or an empty string ("") if the language is not specified or known, or if the track doesn't contain speech. For example, if the primary language used in the track is United States English, this value would be "en-US". For Brazilian
Portuguese, the value would be "pt-BR". Example This example locates all of a media element's primary language and translated audio tracks and returns a list of objects containing each of those tracks' id, kind, and language. This could then be used to build a user interface for selecting the language the user would like to listen to while watching a movie, for example. function getAvailableLangu...
AudioTrack - Web APIs
lean value which controls whether or not the audio track's sound is enabled. Setting this value to false mutes the track's audio. id Read only A DOMString which uniquely identifies the track within the media. This ID can be used to locate a specific track within an audio track list by calling AudioTrackList.getTrackById(). The ID can also be used as the fragment part of the URL if the media sup
ports seeking by media fragment per the Media Fragments URI specification. kind Read only A DOMString specifying the category into which the track falls. For example, the main audio track would have a kind of "main". label Read only A DOMString providing a human-readable label for the track. For example, an audio commentary track for a movie might have a label of "Commentary with director John Q...
AudioTrackList.length - Web APIs
Example This snippet gets the number of audio tracks in the first <video> element found in the DOM by querySelector(). var videoElem = document.querySelector("video"); var numAudioTracks = 0; if (videoElem.audioTracks) { numAudioTracks = videoElem.audioTracks.length; } Note that this sample checks to be sure HTMLMediaElement.audioTracks is defined, to avoid failing on browsers without sup
port for AudioTrack. Specifications Specification Status Comment HTML Living StandardThe definition of 'AudioTrackList.length' in that specification. Living Standard HTML5The definition of 'AudioTrackList.length' in that specification. Recommendation ...
AudioWorkletGlobalScope.registerProcessor - Web APIs
d from AudioWorkletProcessor. Note: A key-value pair { name: constructor } is saved internally in the AudioWorkletGlobalScope once the processor is registered. The name is to be referred to when creating an AudioWorkletNode based on the registered processor. A new processor by the given name is internally created and associated with the new node. Return value undefined Exceptions NotSup
portedError The name is an empty string, or a constructor under the given name is already registered. Registering the same name twice is not allowed. TypeError The processorCtor is not a callable constructor, or the parameterDescriptors property of the constructor exists and doesn't return an array of AudioParamDescriptor-based objects. Examples In this example we create a ...
AudioWorkletNode() - Web APIs
ntaining the initial values of custom AudioParam objects on this node (in its parameters property), with key being the name of a custom parameter and value being its initial value. processorOptions Optional Any additional data that can be used for custom initialization of the underlying AudioWorkletProcessor. Return value The newly constructed AudioWorkletNode instance. Exceptions NotSup
portedError The specified options.outputChannelCount is 0 or larger than the current implementation sup
ports. IndexSizeError The length of options.outputChannelCount array does not match options.numberOfOutputs. Example For a complete example demonstrating user-defined audio processing, see the AudioWorkletNode page. Specifications Specification Status Comment Web Audio...
AudioWorkletNode - Web APIs
ass for a user-defined AudioNode, which can be connected to an audio routing graph along with other nodes. It has an associated AudioWorkletProcessor, which does the actual audio processing in a Web Audio rendering thread. Constructor AudioWorkletNode() Creates a new instance of an AudioWorkletNode object. Properties Also Inherits properties from its parent, AudioNode. AudioWorkletNode.
port Read only Returns a Message
Port used for bidirectional communication between the node and its associated AudioWorkletProcessor. The other end is available under the
port property of the processor. AudioWorkletNode.parameters Read only Returns an AudioParamMap -- a collection of AudioParam objects. They are instantiated during the creation of the underlying AudioWorkletProcessor. If the Audio...
AudioWorkletNodeOptions - Web APIs
s parameters property), with key being the name of a custom parameter and value being its initial value. processorOptions Optional Any additional data that can be used for custom initialization of the underlying AudioWorkletProcessor. Usage notes When creating an AudioWorkletNode, these options can have various effects. If the number of inputs and number of outputs are both set to 0, a NotSup
portedError will be thrown and the node construction process aborted. If the length of the outputChannelCount array doesn't match numberOfOutputs, an IndexSizeError will be thrown. If outputChannelCount isn't specified, and numberOfInputs and numberOfOutputs are both 1, the AudioWorkletNode's initial channel count is set to 1. This has the effect of changing the output channel count to dynamically ch...
AudioWorkletProcessor.process - Web APIs
AudioWorkletProcessor must provide a process() method. The method is called synchronously from the audio rendering thread, once for each block of audio (also known as a rendering quantum) being directed through the processor's corresponding AudioWorkletNode. In other words, every time a new block of audio is ready for your processor to manipulate, your process() function is invoked to do so. Im
portant: Currently, audio data blocks are always 128 frames long--that is, they contain 128 32-bit floating-point samples for each of the inputs' channels. However, plans are already in place to revise the specification to allow the size of the audio blocks to be changed depending on circumstances (for example, if the audio hardware or CPU utilization is more efficient with larger block sizes). Theref...
AudioWorkletProcessor - Web APIs
ctly from a user-supplied code. Instead, they are created only internally by the creation of an associated AudioWorkletNodes. The constructor of the deriving class is getting called with an options object, so you can perform a custom initialization procedures -- see constructor page for details. AudioWorkletProcessor() Creates a new instance of an AudioWorkletProcessor object. Properties
port Read only Returns a Message
Port used for bidirectional communication between the processor and the AudioWorkletNode which it belongs to. The other end is available under the
port property of the node. Methods The AudioWorkletProcessor interface does not define any methods of its own. However, you must provide a process() method, which is called in order to process the audio stream. Events ...
AuthenticatorAttestationResponse - Web APIs
ecure contextRead only Client data for the authentication, such as origin and challenge. The clientDataJSON property is inherited from the AuthenticatorResponse. AuthenticatorAttestationResponse.attestationObject Secure contextRead only An ArrayBuffer containing authenticator data and an attestation statement for a newly-created key pair. Methods AuthenticatorAttestationResponse.getTrans
ports()Secure context Returns an Array of strings describing which trans
port methods (e.g. usb, nfc) are believed to be sup
ported with the authenticator. The array may be empty if the information is not available. Examples var publicKey = { challenge: /* from the server */, rp: { name: "Example CORP", id : "login.example.com" }, user: { id: new Uint8Array(16), name: "jdoe@...
AuthenticatorResponse.clientDataJSON - Web APIs
.challenge. origin The fully qualified origin of the requester which has been given by the client/browser to the authenticator. We should expect the relying party's id to be a suffix of this value. tokenBindingId Optional An object describing the state of the token binding protocol for the communication with the relying party. It has two properties: status: A string which is either "sup
ported" which indicates the client sup
port token binding but did not negotiate with the relying party or "present" when token binding was used already id: A DOMString which is the base64url encoding of the token binding ID which was used for the communication. Should this property be absent, it would indicate that the client does not sup
port token binding. Examples function arrayBufferToStr...
BaseAudioContext.createDynamicsCompressor() - Web APIs
The createDynamicsCompressor() method of the BaseAudioContext Interface is used to create a DynamicsCompressorNode, which can be used to apply compression to an audio signal. Compression lowers the volume of the loudest parts of the signal and raises the volume of the softest parts. Overall, a louder, richer, and fuller sound can be achieved. It is especially im
portant in games and musical applications where large numbers of individual sounds are played simultaneously, where you want to control the overall signal level and help avoid clipping (distorting) of the audio output. Syntax baseAudioCtx.createDynamicsCompressor(); Returns A DynamicsCompressorNode. Example The below code demonstrates a simple usage of createDynamicsCompressor() to add compression to an audio track. For a more...
BaseAudioContext.createGain() - Web APIs
mute.onclick = voiceMute; function voiceMute() { if(mute.id == "") { // 0 means mute. If you still hear something, make sure you haven't // connected your source into the output in addition to using the GainNode. gainNode.gain.setValueAtTime(0, audioCtx.currentTime); mute.id = "ac...
BaseAudioContext.createIIRFilter() - Web APIs
ack (denominator) coefficients for the transfer function of the IIR filter. This array may have up to 20 members, the first of which must not be zero. Return value An IIRFilterNode implementing the filter with the specified feedback and feedforward coefficient arrays. Exceptions InvalidStateError All of the feedforward coefficients are 0, and/or the first feedback coefficient is 0. NotSup
portedError One or both of the input arrays exceeds 20 members. Specifications Specification Status Comment Web Audio APIThe definition of 'createIIRFilter()' in that specification. Working Draft ...
BaseAudioContext.createScriptProcessor() - Web APIs
result in a lower (better) latency. Higher values will be necessary to avoid audio breakup and glitches. It is recommended for authors to not specify this buffer size and allow the implementation to pick a good buffer size to balance between latency and audio quality. numberOfInputChannels Integer specifying the number of channels for this node's input, defaults to 2. Values of up to 32 are sup
ported. numberOfOutputChannels Integer specifying the number of channels for this node's output, defaults to 2. Values of up to 32 are sup
ported. Im
portant: Webkit currently (version 31) requires that a valid bufferSize be passed when calling this method. Note: It is invalid for both numberOfInputChannels and numberOfOutputChannels to be zero. Returns A ScriptProcessorNode. Example The fo...
BaseAudioContext.sampleRate - Web APIs
Syntax baseAudioContext.sampleRate; Value A floating point number indicating the audio context's sample rate, in samples per second. Example Note: for a full Web Audio example implementation, see one of our Web Audio Demos on the MDN Github repo, like panner-node. ...
BatteryManager.dischargingTime - Web APIs
them to a higher interval (typically to the closest 15 minutes) for privacy reasons. Syntax var time = battery.dischargingTime On return, time is the remaining time in seconds until the battery, which is a BatteryManager object, is fully discharged and the system will suspend. This value is Infinity if the battery is currently charging rather than discharging, or if the system is unable to re
port the remaining discharging time. Example HTML Content <div id="dischargingTime">(discharging time unknown)</div> JavaScript Content navigator.getBattery().then(function(battery) { var time = battery.dischargingTime; document.querySelector('#dischargingTime').textContent = battery.dischargingTime; }); Specifications Specification Status Comment Batte...
Using the Beacon API - Web APIs
e worker myWorker.onmessage = function(event) { var msg = event.data; // Log worker's send status console.log("Worker reply: sendBeacon() status = " + msg); }; } This code snippet is for the worker (worker-using.js): onmessage = function(event) { var msg = event.data; // Split the URL and data from the message var url = msg[0]; var data = msg[1]; // If the browser sup
ports worker sendBeacon(), then send the beacon; otherwise // return failure message to the global context if (self.navigator.sendBeacon) { var status = self.navigator.sendBeacon(url, data); postMessage(status ? "success" : "fail"); } else { postMessage("Worker: self.navigator.sendBeacon is unsup
ported"); } } See Also Beacon API (Overview) Beacon standard Beacon CanIUse data...
Beacon API - Web APIs
Beacon API are logging activity and sending analytics data to the server. Example code of the interfaces described in this document is included in Using the Beacon API. Why use Beacon? The Beacon interface addresses the needs of analytics and diagnostics code that typically attempts to send data to a web server before unloading the document. Sending the data any sooner may result in a missed op
portunity to gather data. However, ensuring that the data is sent during the unloading of a document is something that has traditionally been difficult for developers. User agents will typically ignore asynchronous XMLHttpRequests made in an unload handler. To solve this problem, analytics and diagnostics code will typically make a synchronous XMLHttpRequest in an unload or beforeunload handler to su...
Blob - Web APIs
The Blob object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data. Blobs can represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to sup
port files on the user's system. Using blobs To construct a Blob from other non-blob objects and data, use the Blob() constructor. To create a blob that contains a subset of another blob's data, use the slice() method. To obtain a Blob object for a file on the user's file system, see the File documentation. The APIs accepting Blob objects are also listed in the File documentation. Constructor Blob() Returns...
Bluetooth.getAvailability() - Web APIs
a BluetoothDevice). Also, user can configure User Agent to return a fixed value instead of a real one. Syntax var readerPromise = Bluetooth.getAvailability(); Parameters None. Return value A Promise that resolves with Boolean. Exceptions This method doesn't throw any exceptions. Examples The following snippet prints out a message in the console specifying wheter or not Bluetooth is sup
ported: navigator.bluetooth.getAvailability().then(available => { if (available) console.log("This device sup
ports Bluetooth!"); else console.log("Doh! Bluetooth is not sup
ported"); }); Specifications Specification Status Comment Web BluetoothThe definition of 'getAvailability()' in that specification. Draft Initial definition. ...
Bluetooth - Web APIs
allows the user to open. A BluetoothDevice representing the beacon would be available through navigator.bluetooth.referringDevice. Events Bluetooth.onavailabilitychanged An event handler that runs when an event of type availabilitychanged has fired. Methods Bluetooth.getAvailability() Returns a Promise that resolved to a Boolean indicating whether the user-agent has the ability to sup
port Bluetooth. Some user-agents let the user configure an option that affects what is returned by this value. If this option is set, that is the value returned by this method. Bluetooth.getDevices() Returns a Promise that resolved to an array of BluetoothDevices which the origin already obtained permission for via a call to Bluetooth.requestDevice(). Bluetooth.requestDevice() Returns a Promise to...
BluetoothRemoteGATTCharacteristic - Web APIs
es to the first BluetoothGATTDescriptor for a given descriptor UUID. BluetoothRemoteGATTCharacteristic.getDescriptors() Returns a Promise that resolves to an Array of all BluetoothGATTDescriptor objects for a given descriptor UUID. BluetoothRemoteGATTCharacteristic.readValue() Returns a Promise that resolves to an ArrayBuffer holding a duplicate of the value property if it is available and sup
ported. Otherwise it throws an error. BluetoothRemoteGATTCharacteristic.writeValue() Sets the value property to the bytes contained in an ArrayBuffer and returns a Promise. BluetoothRemoteGATTCharacteristic.startNotifications() Returns a Promise when navigator.bluetooth is added to the active notification context. BluetoothRemoteGATTCharacteristic.stopNotifications() Returns a Promise when navig...
CDATASection - Web APIs
The symbols < and & don't need escaping as they normally do when inside a CDATA section. In XML, a CDATA section looks like: <![CDATA[ ... ]]> For example: <foo>Here is a CDATA section: <![CDATA[ < > & ]]> with all kinds of unescaped text.</foo> The only sequence which is not allowed within a CDATA section is the closing sequence of a CDATA section itself, ]]>: <![CDATA[ ]]> will cause an error ]]> Note that CDATA sections should not be used within HTML; they only work in XML. ...
CSS - Web APIs
onsible for all the classes related to painting. Methods The CSS interface is a utility interface and no object of this type can be created: only static methods are defined on it. Static methods No inherited static methods. CSS.registerProperty() Registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. CSS.sup
ports() Returns a Boolean indicating if the pair property-value, or the condition, given in parameter is sup
ported. CSS.escape() Can be used to escape a string mostly for use as part of a CSS selector. CSS factory functions Can be used to return a new CSSUnitValue with a value of the parameter number of the units of the name of the factory function method used. CSS.em(3) // CSSUnitValue {value...
CSSConditionRule - Web APIs
Syntax The syntax is described using the WebIDL format. interface CSSConditionRule : CSSGroupingRule { attribute DOMString conditionText; } Properties The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all properties of these classes. ...
Using dynamic styling information - Web APIs
yle in the examples chapter for more information on how to use this method. DOM Style Object The style object represents an individual style statement. Unlike the individual rules available from the document.styleSheets collection, the style object is accessed from the document or from the elements to which that style is applied. It represents the in-line styles on a particular element. ...
Cache.add() - Web APIs
a URL. Return value A Promise that resolves with undefined. Exceptions Exception Happens when TypeError The URL scheme is not http or https. The Response status is not in the 200 range (i.e., not a successful response.) This occurs if the request does not return successfully, but also if the request is a cross-origin no-cors request (in which case the re
ported status is always 0.) Examples This code block waits for an InstallEvent to fire, then calls waitUntil() to handle the install process for the app. This consists of calling CacheStorage.open to create a new cache, then using Cache.add to add an asset to it. this.addEventListener('install', function(event) { event.waitUntil( caches.open('v1').then(function(cache) { return...
Cache.addAll() - Web APIs
he URL. Return value A Promise that resolves with undefined. Exceptions Exception Happens when TypeError The URL scheme is not http or https. The Response status is not in the 200 range (i.e., not a successful response.) This occurs if the request does not return successfully, but also if the request is a cross-origin no-cors request (in which case the re
ported status is always 0.) Examples This code block waits for an InstallEvent to fire, then runs waitUntil() to handle the install process for the app. This consists of calling CacheStorage.open to create a new cache, then using addAll() to add a series of assets to it. this.addEventListener('install', function(event) { event.waitUntil( caches.open('v1').then(function(cache) { ...
Cache - Web APIs
, // i.e. have a Content-Type response header that starts with "font/". // Note that for opaque filtered responses (https://fetch.spec.whatwg.org/#concept-filtered-response-opaque) // we can't access to the response headers, so this check will always fail and the font won't be cached. // All of the Google Web Fonts are served off of a domain that sup
ports CORS, so that isn't an issue here. // It is something to keep in mind if you're attempting to cache other resources from a cross-origin // domain that doesn't sup
port CORS, though! // We call .clone() on the response to save a copy of it to the cache. By doing so, we get to keep // the original response object which we will return back to the contr...
CanvasPattern.setTransform() - Web APIs
ementById('svg1'); var matrix = svg1.createSVGMatrix(); var img = new Image(); img.src = 'https://mdn.mozillademos.org/files/222/Canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createPattern(img, 'repeat'); pattern.setTransform(matrix.rotate(-45).scale(1.5)); ctx.fillStyle = pattern; ctx.fillRect(0, 0, 400, 400); }; Note that newer browser versions started to sup
port DOMMatrix as an input to setTransform(), so for example you could replace the SVGMatrix in the above example with the following: const matrix = new DOMMatrix([1, .2, .8, 1, 0, 0]); Edit the code below and see your changes update live in the canvas: Playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <svg id="svg1" style="display:none"></svg> <div clas...
CanvasRenderingContext2D.addHitRegion() - Web APIs
); // Eyes ctx.beginPath(); ctx.arc(70, 80, 10, 0, 2 * Math.PI); ctx.arc(130, 80, 10, 0, 2 * Math.PI); ctx.fill(); ctx.addHitRegion({id: "eyes"}); // Mouth ctx.beginPath(); ctx.arc(100, 110, 50, 0, Math.PI); ctx.stroke(); Edit the code below to see your changes update live in the canvas. ...
CanvasRenderingContext2D.drawImage() - Web APIs
dth when drawn. dHeight Optional The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn. Exceptions thrown INDEX_SIZE_ERR If the canvas or source rectangle width or height is zero. INVALID_STATE_ERR The image has no image data. TYPE_MISMATCH_ERR The specified source element isn't sup
ported. NS_ERROR_NOT_AVAILABLE The image is not loaded yet. Use .complete === true and .onload to determine when it is ready. Examples Drawing an image to the canvas This example draws an image to the canvas using the drawImage() method. HTML <canvas id="canvas"></canvas> <div style="display:none;"> <img id="source" src="https://udn.realityripple.com/samples/db/f374e9c6fc.jpg" ...
CanvasRenderingContext2D.drawWidgetAsOnScreen() - Web APIs
The non-standard and internal only CanvasRenderingContext2D.drawWidgetAsOnScreen() method of the Canvas 2D API renders the root widget of a window into the canvas. Unlike drawWindow(), this API uses the operating system to snapshot the widget on-screen, rather than reading from Gecko's own compositor. This API cannot be used by Web content. It is only sup
ported on Windows, only on widgets that use OMTC, and only from within the chrome process. Syntax void ctx.drawWidgetAsOnScreen(window); Parameters window The Window to render. Specifications Not part of any current specification or draft. This is a non-standard and internal only API. ...
CanvasRenderingContext2D.filter - Web APIs
te() A CSS <percentage>. Saturates the drawing. A value of 0% means completely un-saturated. A value of 100% leaves the drawing unchanged. sepia() A CSS <percentage>. Converts the drawing to sepia. A value of 100% means completely sepia. A value of 0% leaves the drawing unchanged. none No filter is applied. Initial value. Examples To view these examples, make sure to use a browser that sup
ports this feature; see the compatibility table below. Applying a blur This example blurs a piece of text using the filter property. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.filter = 'blur(4px)'; ctx.font = '48px serif'; ctx.fillText('Hello world', 50, 100); Result Applying multiple filters Yo...
CanvasRenderingContext2D.isPointInPath() - Web APIs
Syntax ctx.isPointInPath(x, y [, fillRule]); ctx.isPointInPath(path, x, y [, fillRule]); Parameters x The x-axis coordinate of the point to check, unaffected by the current transformation of the context. y The y-axis coordinate of the point to check, unaffected by the current transformation of the context. fillRule The algorithm by which to determine if a point is inside or outside the path. Possible values: "nonzero": The non-zero winding rule. Default rule. "evenodd": The even-odd winding rule. path A Path2D path to check against. ...
CanvasRenderingContext2D.isPointInStroke() - Web APIs
Syntax ctx.isPointInStroke(x, y); ctx.isPointInStroke(path, x, y); Parameters x The x-axis coordinate of the point to check. y The y-axis coordinate of the point to check. path A Path2D path to check against. If unspecified, the current path is used. Return value Boolean A Boolean, which is true if the point is inside the area contained by the stroking of a path, otherwise false. ...
CanvasRenderingContext2D.putImageData() - Web APIs
a will be extracted. Defaults to 0. dirtyY Optional Vertical position (y coordinate) of the top-left corner from which the image data will be extracted. Defaults to 0. dirtyWidth Optional Width of the rectangle to be painted. Defaults to the width of the image data. dirtyHeight Optional Height of the rectangle to be painted. Defaults to the height of the image data. Errors thrown NotSup
portedError Thrown if any of the arguments is infinite. InvalidStateError Thrown if the ImageData object's data has been detached. Examples Understanding putImageData To understand what this algorithm does under the hood, here is an implementation on top of CanvasRenderingContext2D.fillRect(). HTML <canvas id="canvas"></canvas> JavaScript var canvas = document.getElementById('canvas'); var...
Applying styles and colors - Web APIs
hapes, we used only the default line and fill styles. Here we will explore the canvas options we have at our disposal to make our drawings a little more attractive. You will learn how to add different colors, line styles, gradients, patterns and shadows to your drawings. Colors Up until now we have only seen methods of the drawing context. If we want to apply colors to a shape, there are two im
portant properties we can use: fillStyle and strokeStyle. fillStyle = color Sets the style used when filling shapes. strokeStyle = color Sets the style for shapes' outlines. color is a string representing a CSS <color>, a gradient object, or a pattern object. We'll look at gradient and pattern objects later. By default, the stroke and fill color are set to black (CSS color value #000000). No...
Compositing and clipping - Web APIs
ask to hide unwanted parts of shapes. This is visualized in the image on the right. The red star shape is our clipping path. Everything that falls outside of this path won't get drawn on the canvas. If we compare clipping paths to the globalCompositeOperation property we've seen above, we see two compositing modes that achieve more or less the same effect in source-in and source-atop. The most im
portant differences between the two are that clipping paths are never actually drawn to the canvas and the clipping path is never affected by adding new shapes. This makes clipping paths ideal for drawing multiple shapes in a restricted area. In the chapter about drawing shapes I only mentioned the stroke() and fill() methods, but there's a third method we can use with paths, called clip(). clip()...
Drawing text - Web APIs
value Baseline alignment setting. Possible values: top, hanging, middle, alphabetic, ideographic, bottom. The default value is alphabetic. direction = value Directionality. Possible values: ltr, rtl, inherit. The default value is inherit. These properties might be familiar to you, if you have worked with CSS before. The following diagram from the WHATWG demonstrates the various baselines sup
ported by the textBaseline property. A textBaseline example Edit the code below and see your changes update live in the canvas: ctx.font = '48px serif'; ctx.textBaseline = 'hanging'; ctx.strokeText('Hello world', 0, 100); Playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <div class="playable-buttons"> <input id="edit" type="button" value="Edit" /> ...
Hit regions and accessibility - Web APIs
tmap and does not provide information about any drawn objects. Canvas content is not exposed to accessibility tools like semantic HTML is. In general, you should avoid using canvas in an accessible website or app. The following guidelines can help to make it more accessible. Fallback content The content inside the <canvas> ... </canvas> tags can be used as a fallback for browsers which don't sup
port canvas rendering. It's also very useful for assistive technology users (like screen readers) which can read and interpret the sub DOM in it. A good example at html5accessibility.com demonstrates how this can be done: <canvas> <h2>Shapes</h2> <p>A rectangle with a black border. In the background is a pink circle. Partially overlaying the <a href="http://en.wikipedia.org/wiki/Circle" onf...
Canvas tutorial - Web APIs
ribes how to use the <canvas> element to draw 2D graphics, starting with the basics. The examples provided should give you some clear ideas about what you can do with canvas, and will provide code snippets that may get you started in building your own content. First introduced in WebKit by Apple for the OS X Dashboard, <canvas> has since been implemented in browsers. Today, all major browsers sup
port it. Before you start Using the <canvas> element is not very difficult, but you do need a basic understanding of HTML and JavaScript. The <canvas> element is not sup
ported in some older browsers, but is sup
ported in recent versions of all major browsers. The default size of the canvas is 300 pixels x 150 pixels (width x height). But custom sizes can be defined using the HTML height and width pro...
Canvas API - Web APIs
ions. Konva.js is a 2D canvas library for desktop and mobile applications. p5.js has a full set of canvas drawing functionality for artists, designers, educators, and beginners. Paper.js is an open-source vector graphics scripting framework that runs on top of the HTML5 Canvas. Phaser is a fast, free and fun open source framework for Canvas and WebGL powered browser games. Processing.js is a
port of the Processing visualization language. Pts.js is a library for creative coding and visualization in canvas and SVG. Rekapi is an animation key-framing API for Canvas. Scrawl-canvas is an open-source JavaScript library for creating and manipulating 2D canvas elements. The ZIM framework provides conveniences, components, and controls for coding creativity on the canvas -- includes accessibil...
Clipboard.write() - Web APIs
Be sure to check the compatibility table as well as Clipboard availability in Clipboard for more information. ...
Clipboard.writeText() - Web APIs
The Clipboard interface's writeText() property writes the specified text string to the system clipboard. Text may be read back using either read() or readText(). The "clipboard-write" permission of the Permissions API, is granted automatically to pages when they are in the active tab. Note: Browser sup
port for the asynchronous clipboard APIs is still in the process of being implemented. Be sure to check the compatibility table as well as Clipboard availability in Clipboard for more information. Syntax var promise = navigator.clipboard.writeText(newClipText) Parameters newClipText The DOMString to be written to the clipboard. Return value A Promise which is resolved once the clipboard's contents have been updated. The promise is rejected if the caller does not have permission...
Clipboard - Web APIs
resolved once the text is fully copied into the clipboard. Clipboard availability The asynchronous clipboard API is a relatively recent addition, and the process of implementing it in browsers is not yet complete. Due to both potential security concerns and technical complexities, the process of integrating this API is happening gradually in most browsers. For example, Firefox does not yet sup
port the "clipboard-read" and "clipboard-write" permissions, so access to the methods that access and change the contents of the clipboard are restricted in other ways. For WebExtensions, you can request the clipboardRead and clipboardWrite permissions to be able to use clipboard.readText() and clipboard.writeText(). Content scripts applied on HTTP sites do not have access to the clipboard object. Se...
ClipboardItem() - Web APIs
See the browser compatibility table for the Clipboard interface. Syntax var ClipboardItem = new ClipboardItem(ClipboardItemData); Parameters ClipboardItemData An Object with the MIME type as the key and Blob as the value. ...
Console.group() - Web APIs
ou can use nested groups to help organize your output by visually associating related messages. To create a new nested block, call console.group(). The console.groupCollapsed() method is similar, but the new block is collapsed and requires clicking a disclosure button to read it. Note: From Gecko 9 until Gecko 51, the groupCollapsed() method was the same as group(). Collapsed groups are fully sup
ported starting in Gecko 52. See bug 1088360. To exit the current group, call console.groupEnd(). For example, given this code: console.log("This is the outer level"); console.group(); console.log("Level 2"); console.group(); console.log("Level 3"); console.warn("More of level 3"); console.groupEnd(); console.log("Back to level 2"); console.groupEnd(); console.log("Back to the outer level"); The o...
ConstrainDouble - Web APIs
Additionally, you can specify the property's value as a simple floating-point value, in which case the user agent does its best to match the value once all other more stringent constraints are met. ...
ConstrainULong - Web APIs
In addition, you can specify the value as a simple long integer value, in which case the user agent does its best to match the value once all other more stringent constraints are met. ...
Content Index API - Web APIs
etadata of already cached pages, under the scope of the current service worker. The browser can then use these entries to display offline reading to a user. As a developer you can also display these entries within your application. Indexed entries do not automatically expire. It's good practice to present an interface for clearing out entries, or periodically remove older entries. The API sup
ports indexing URLs corresponding to HTML documents. A URL for a cached media file, for example, can't be indexed directly. Instead, you need to provide a URL for a page that displays media, and which works offline. Interfaces ContentIndex The ContentIndex interface provides functionality to register content available offline. ContentIndexEvent The ContentIndexEvent interface of the Cont...
CredentialsContainer.preventSilentAccess() - Web APIs
. Mediation varies by origin, and is an added check point of browser stored credentials, informing a user of an account login status. This method is typically called after a user signs out of a website, ensuring this user's login information is not automatically passed on the next site visit. Earlier versions of the spec called this method requireUserMediation(). See Browser compatibility for sup
port details. Syntax var Promise = CredentialsContainer.preventSilentAccess() Parameters None. Returns An empty Promise. Specifications Specification Status Comment Credential Management Level 1The definition of 'preventSilentAccess()' in that specification. Working Draft Initial definition. ...
CredentialsContainer - Web APIs
cure context Sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty Promise. For example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. Earlier versions of the spec called this method requireUserMediation(). See Browser compatibility for sup
port details. CredentialsContainer.store()Secure context Stores a set of credentials for a user, inside a provided Credential instance and returns that instance in a Promise. Examples // TBD Specifications Specification Status Comment Credential Management Level 1 Working Draft Initial definition. Web Authentication: An API for accessing Public Key Credent...
CryptoKeyPair - Web APIs
is used to sign. CryptoKey.publicKey A CryptoKey object representing the public key. For encryption and decryption algorithms, this key is used to encrypt. For signing and verification algorithms it is used to verify signatures. Examples The examples for SubtleCrypto methods often use CryptoKeyPair objects. For example: SubtleCrypto.generateKey() SubtleCrypto.deriveKey() SubtleCrypto.im
portKey() SubtleCrypto.ex
portKey() SubtleCrypto.wrapKey() SubtleCrypto.unwrapKey() SubtleCrypto.encrypt() SubtleCrypto.decrypt() SubtleCrypto.sign() SubtleCrypto.verify() Specifications Specification Status Comment Web Cryptography APIThe definition of 'CryptoKeyPair' in that specification. Recommendation Initial definition. ...
CustomEvent - Web APIs
lorer and eventually adopted into the DOM specification in order to ensure existing sites continue to work. Ideally, you should try to use Event.preventDefault() and Event.defaultPrevented instead, but you can use returnValue if you choose to do so. Event.srcElement A non-standard alias (from old versions of Microsoft Internet Explorer) for Event.target. Some other browsers are starting to sup
port it for web compatibility purposes. Event.target Read only A reference to the target to which the event was originally dispatched. Event.timeStamp Read only The time at which the event was created (in milliseconds). By specification, this value is time since epoch--but in reality, browsers' definitions vary. In addition, work is underway to change this to be a DOMHighResTimeStamp instead. E...
DOMConfiguration - Web APIs
Note: This interface has never been sup
ported in Gecko, and has been removed from the DOM specification. Pre-defined parameters: "canonical-form", "cdata-sections", "check-character-normalization", "comments", "datatype-normalization", "element-content-whitespace", "entities", "error-handler", "infoset", "namespaces", "namespace-declarations", "normalize-characters","schema-location", "schema-type", "split-cdata-sections", "validate", "validate-if-schema", "well-formed" Properties DOMConfiguration.parameterNames Read only Is a DOMStringList Methods DOMConfiguration.canSetParameter() Returns a Boolean DOMConfiguration.getParameter() Returns a DOMUserData DOMConfiguration.setParameter() Sets a parameter Specification http://www.w3.org/TR/DOM-Level-3-Cor...MConfiguration ...
DOMImplementation.hasFeature() - Web APIs
The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use. Syntax const flag = document.implementation.hasFeature(feature, version); Parameters feature A DOMString representing the feature name. version A DOMString representing the version of the specification defining the feature. ...
DOMImplementation - Web APIs
has no specific property and doesn't inherit any. Methods No inherited method. DOMImplementation.createDocument() Creates and returns an XMLDocument. DOMImplementation.createDocumentType() Creates and returns a DocumentType. DOMImplementation.createHTMLDocument() Creates and returns an HTML Document. DOMImplementation.hasFeature() Returns a Boolean indicating if a given feature is sup
ported or not. This function is unreliable and kept for compatibility purpose alone: except for SVG-related queries, it always returns true. Old browsers are very inconsistent in their behavior. Specifications Specification Status Comment DOMThe definition of 'DOMImplementation' in that specification. Living Standard Removed the getFeature() method. Added the creat...
DOMTokenList - Web APIs
o the list's length. DOMTokenList.contains(token) Returns true if the list contains the given token, otherwise false. DOMTokenList.add(token1[, token2[, ...tokenN]]) Adds the specified token(s) to the list. DOMTokenList.remove(token1[, token2[, ...tokenN]]) Removes the specified token(s) from the list. DOMTokenList.replace(oldToken, newToken) Replaces token with newToken. DOMTokenList.sup
ports(token) Returns true if a given token is in the associated attribute's sup
ported tokens. DOMTokenList.toggle(token [, force]) Removes token from the list if it exists, or adds token to the list if it doesn't. Returns a boolean indicating whether token is in the list after the operation. DOMTokenList.entries() Returns an iterator, allowing you to go through all key/value pairs contained in th...
DataTransfer.mozSetDataAt() - Web APIs
item is added, and the mozItemCount is incremented by one. Data should be added in order of preference, with the most specific format added first and the least specific format added last. If data of the given format already exists, it is replaced in the same position as the old data. The data should be either a string, a Boolean or number type (which will be converted into a string) or an nsISup
ports. Note: This method is Gecko-specific. Syntax void dataTransfer.mozSetDataAt([type], data, index); Arguments type A string representing the type of the drag data to add to the drag data object. data A nsIVariant representing the data to add to the drag data object. index A unsigned long representing the index of the data to add. Return value void Example This example shows ...
DataTransfer.setDragImage() - Web APIs
. Return value void Example This example shows how to use the setDragImage() method. Note the example refers to an image file named example.gif. If that file is present, it will be used as the drag image and if that file is not present, the browser will use its default drag image. demo <!DOCTYPE html> <html lang=en> <title>Example of DataTransfer.setDragImage()</title> <meta name="view
port" content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragStart"); // Set the drag's format and data. Use the event target's id for the data ev.dataTransfer.setData("text/plain", ev.target.id);...
DataTransferItemList.DataTransferItem() - Web APIs
Syntax dataItem = DataTransferItem[index]; Parameters index The zero-based index of the item in the drag data list to return. Return value The DataTransferItem object at the specified index in the item list. If the index is less than zero or greater than or equal to the number of items in the list (as indicated by the list's length property, undefined is returned. The returned value is never null. Example This example shows how to use drag and drop. ...
DataTransferItemList.add() - Web APIs
esenting the drag item's data. type A string of the drag item's type. Some example types are text/html and text/plain. file A File object. No type needs to be given in this case. Return value A DataTransferItem containing the specified data. If the drag item couldn't be created (for example, if the associated DataTransfer object has no data store), null is returned. Exceptions NotSup
portedError A string data parameter was provided, and the list already contains an item whose kind is "Plain Unicode string" and whose type is equal to the specified type parameter. Example This example shows the use of the add() method. HTML <div> <p id="source" ondragstart="dragstart_handler(event);" ondragend="dragend_handler(event);" draggable="true"> Select this element, drag it to the Dr...
DedicatedWorkerGlobalScope.postMessage() - Web APIs
his may be any value or JavaScript object handled by the structured clone algorithm, which includes cyclical references. transferList Optional An optional array of Transferable objects to transfer ownership of. If the ownership of an object is transferred, it becomes unusable (neutered) in the context it was sent from and it becomes available only to the main thread it was sent to. Only Message
Port and ArrayBuffer objects can be transferred. Returns Void. Example The following code snippet shows worker.js, in which an onmessage handler is used to handle messages from the main script. Inside the handler a calculation is done from which a result message is created; this is then sent back to the main thread using postMessage(workerResult); onmessage = function(e) { console.log('Message...
DedicatedWorkerGlobalScope - Web APIs
.close() Discards any tasks queued in the WorkerGlobalScope's event loop, effectively closing this particular scope. DedicatedWorkerGlobalScope.postMessage() Sends a message -- which can consist of any JavaScript object -- to the parent document that first spawned the worker. Inherited from WorkerGlobalScope WorkerGlobalScope.dump() Writes a message to the console. WorkerGlobalScope.im
portScripts() Im
ports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example: im
portScripts('foo.js', 'bar.js'); Implemented from other places WindowBase64.atob() Decodes a string of data which has been encoded using base-64 encoding. WindowBase64.btoa() Creates a base-64 encoded ASCII string from a string of binary data. WindowTi...
DeviceProximityEvent.max - Web APIs
The max property provides the maximum sensing distance the sensor is able to re
port, in centimeters. Syntax var value = instanceOfDeviceProximityEvent.max; Value A positive number indicating the maximum distance, in centimeters (cm), that the device's proximity sensor is able to detect and re
port. ...
DeviceProximityEvent.min - Web APIs
The min property provides the minimum distance the sensor can re
port, in centimeters. Syntax var value = instanceOfDeviceProximityEvent.min; Value A positive number indicating the minimum distance, in centimeters (cm), the device's proximity sensor can re
port. ...
DeviceProximityEvent - Web APIs
The DeviceProximityEvent interface provides information about the distance of a nearby physical object using the proximity sensor of a device. Properties DeviceProximityEvent.max Read only The maximum sensing distance the sensor is able to re
port, in centimeters. DeviceProximityEvent.min Read only The minimum sensing distance the sensor is able to re
port, in centimeters. Ususally zero. DeviceProximityEvent.value Read only The current device proximity, in centimeters. Examples window.addEventListener('deviceproximity', function(event) { console.log("value: " + event.value, "max: " + event.max, "min: " + event.min); }); ...
Document.alinkColor - Web APIs
ue, darkblue, etc.) or the hexadecimal value of the color (e.g., #0000FF) Notes The default value for this property in Mozilla Firefox is red (#ee0000 in hexadecimal). document.alinkColor is deprecated in DOM Level 2 HTML. One alternative is the CSS selector :active. Another alternative is document.body.aLink, although this is deprecated in HTML 4.01 in favor of the CSS alternative. Gecko sup
ports both alinkColor/:active and :focus. Internet Explorer 6 and 7 sup
port alinkColor/:active only for HTML anchor (<a>) links and the behavior is the same as :focus under Gecko. There is no sup
port for :focus in IE. ...
Document.caretRangeFromPoint() - Web APIs
The caretRangeFromPoint() method of the Document interface returns a Range object for the document fragment under the specified coordinates. Syntax var range = document.caretRangeFromPoint(float x, float y); Parameters x A horizontal position within the current view
port. y A vertical position within the current view
port. Returns One of the following: A Range. Null, if x or y are negative, outside view
port, or there is no text entry node. Example Basic demo: When clicking in a paragraph insert a line break at the caret position: HTML <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd ...
Document.createElementNS() - Web APIs
you to pass a string here instead of an object, where the string's value is the custom element's tag name. See Extending native HTML elements for more information on how to use this parameter. The new element will be given an is attribute whose value is the custom element's tag name. Custom elements are an experimental feature only available in some browsers. Return value The new Element. Im
portant Namespace URIs HTML http://www.w3.org/1999/xhtml SVG http://www.w3.org/2000/svg MathML http://www.w3.org/1998/Math/MathML XUL http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul XBL http://www.mozilla.org/xbl Example This creates a new <div> element in the XHTML namespace and appends it to the vbox element. Although this is not an extremely useful XUL document, i...
Document.currentScript - Web APIs
The Document.currentScript property returns the <script> element whose script is currently being processed and isn't a JavaScript module. (For modules use im
port.meta instead.) It's im
portant to note that this will not reference the <script> element if the code in the script is being called as a callback or event handler; it will only reference the element while it's initially being processed. Syntax var curScriptElement = document.currentScript; Example This example checks to see if the script is being executed asynchronously: if (document.currentScript.async) { console.log("Executing asynchronously"); } else { console.log("Executing synchronously"); } View Live Examples Specifications Specification Status Comment HTML Living StandardThe definition o...
Document.doctype - Web APIs
Specifications Specification Status Comment DOMThe definition of 'Document: doctype' in that specification. Living Standard ...
Document.domain - Web APIs
The domain property of the Document interface gets/sets the domain
portion of the origin of the current document, as used by the same origin policy. If this property is successfully set, the
port part of the origin is also set to null. Syntax const domainString = document.domain document.domain = domainString Value The domain
portion of the current document's origin. Exceptions SecurityError An attempt has been made to set domain under one of the following conditions: The document is inside a sandboxed <iframe> The document has no browsing context The document's effective domain is null The given value is not equal to the document's effective domain (or it is not a registerable domain suffix of it) The document-domain Feature-Policy is enabled Examples Getting the...
Document.fullscreen - Web APIs
The obsolete Document interface's fullscreen read-only property re
ports whether or not the document is currently displaying content in full-screen mode. Although this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored. Note: Since this property is deprecated, you can determine if full-screen mode is active on the document by checking to see if Document.fullscreenElement is not null. Syntax var isFullScreen = document.fullscreen; Value A Boolean value which is true if the document is currently displaying an element in full-screen mode; otherwise, the value is false. Example This simple function re
ports whether or not full-screen mode is currently active, using the obsolete fullscreen property. func...
Document.getElementsByName() - Web APIs
ype="hidden" name="up"> <input type="hidden" name="down"> <script> var up_names = document.getElementsByName("up"); console.log(up_names[0].tagName); // displays "INPUT" </script> </html> Notes The name attribute can only be applied in (X)HTML documents. The returned NodeList Collection contains all elements with the given name, such as <meta>, <object>, and even elements which do not sup
port the name attribute at all. The getElementsByName method works differently in IE10 and below. There, getElementsByName() also returns elements that have an id attribute with the specified value. Be careful not to use the same string as both a name and an id. The getElementsByName method works differently in IE. There, getElementsByName() does not return all elements which may not have a name ...
Document.getElementsByTagNameNS() - Web APIs
</div> </div> <p>Some outer text</p> <p>Some outer text</p> <button onclick="getAllParaElems();"> show all p elements in document</button><br /> <button onclick="div1ParaElems();"> show all p elements in div1 element</button><br /> <button onclick="div2ParaElems();"> show all p elements in div2 element</button> </body> </html> Potential Workaround for other browsers which do not sup
port If the desired browser did not sup
port XPath, another approach (such as traversing the DOM through all its children, identifying all @xmlns instances, etc.) would be necessary to find all tags with the desired local name and namespace, but XPath is much faster. (To accommodate Explorer, one could call an XPath wrapper instead of the XPath in the function below (as Explorer sup
ports XPath with a ...
Document.height - Web APIs
Instead, use document.body.clientHeight. See element.clientHeight. Returns the height of the document object. In most cases, this is equal to the <body> element of the current document. ...
Document.implementation - Web APIs
The Document.implementation property returns a DOMImplementation object associated with the current document. Syntax DOMImpObj = document.implementation; Example var modName = "HTML"; var modVer = "2.0"; var conformTest = document.implementation.hasFeature( modName, modVer ); alert( "DOM " + modName + " " + modVer + " sup
ported?: " + conformTest ); // alerts with: "DOM HTML 2.0 sup
ported?: true" if DOM Level 2 HTML module is sup
ported. A list of module names (e.g., Core, HTML, XML, etc.) is available in the DOM Level 2 Conformance Section. Notes The W3C's DOM Level 1 Recommendation only specified the hasFeature method, which is one way to determine if a DOM module is sup
ported by a browser (see example above and What does your user agent claim to sup
port?). If available, other DOMI...
Document: keydown event - Web APIs
eydown event is fired for all keys, regardless of whether they produce a character value. Bubbles Yes Cancelable Yes Interface KeyboardEvent Event handler property onkeydown The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. For example, a lowercase "a" will be re
ported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is re
ported as 65 by all events. Since Firefox 65, the keydown and keyup events are now fired during IME composition, to improve cross-browser compatibility for CJKT users (bug 354358, also see keydown and keyup events are now fired during IME composition for more useful details). To ignore all keydown events that are part of ...
Document: keyup event - Web APIs
The keyup event is fired when a key is released. Bubbles Yes Cancelable Yes Interface KeyboardEvent Event handler property onkeyup The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. For example, a lowercase "a" will be re
ported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is re
ported as 65 by all events. Note: If you're looking for a way to react to changes in an input's value, you should use the input event. Some changes are not detectable by keyup, for example pasting text from the context menu in a text input. Since Firefox 65, the keydown and keyup events are now fired during IME composition, to improve cross-browser compatibili...
Document.ononline - Web APIs
vents bubble up from document.body, to document, ending at window. Both events are non-cancellable (you can't prevent the user from coming online, or going offline). window.navigator.onLine returns boolean true if the browser is online and false if it is definitely offline (disconnected from the network). The online and offline events are fired when the value of this attribute changes. It is im
portant to note that this event and attribute are inherently unreliable. A computer can be connected to a network without having Internet access. You can register listeners for these events in a few familiar ways: Using addEventListener on the window, document, or document.body By setting the .ononline or .onoffline properties on document or document.body to a JavaScript Function object. (Note: ...
Document.open() - Web APIs
out principals. Three-argument document.open() There is a lesser-known and little-used three-argument version of document.open() , which is an alias of Window.open() (see its page for full details). This call, for example opens github.com in a new window, with its opener set to null: document.open('https://www.github.com','', 'noopener=true') Two-argument document.open() Browsers used to sup
port a two-argument document.open(), with the following signature: document.open(type, replace) Where type specified the MIME type of the data you are writing (e.g. text/html) and replace if set (i.e. a string of "replace") specified that the history entry for the new document would replace the current history entry of the document being written to. This form is now obsolete; it won't throw an erro...
Document: pointerenter event - Web APIs
The pointerenter event fires when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown event from a device that does not sup
port hover (see pointerdown). Bubbles No Cancelable No Interface PointerEvent Event handler property onpointerenter Examples Using addEventListener(): document.addEventListener('pointerenter', (event) => { console.log('Pointer entered element'); }); Using the onpointerenter event handler property: document.onpointerenter = (event) => { console.log('Pointer entered element'); }; Specifications Specification Status Pointer Events Obsolete ...
Document: pointerout event - Web APIs
The pointerout event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not sup
port hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover range detectable by the digitizer. Bubbles Yes Cancelable Yes Interface PointerEvent Event handler property onpointerout Examples Using addEventListener(): document.addEventListener('pointerout', (event) => { console.log('Pointer moved out'); }); Using the onpointerout event handler property: document.onpointerout = (event) => { console.log('Pointer moved out'); }; Specifications Specification Status ...
Document.queryCommandEnabled() - Web APIs
Return value Returns a Boolean which is true if the command is enabled and false if the command isn't. Notes For 'cut' and 'copy' commands the method only returns true when called from a user-initiated thread. The 'paste' command return false not only if the feature is unavailable, but also if the script calling it has insufficient privileges to perform the action. ...
Document.width - Web APIs
Note: Starting in Gecko 6.0, document.width is no longer sup
ported. Instead, use document.body.clientWidth. See element.clientWidth. Returns the width of the <body> element of the current document in pixels. Not sup
ported by Internet Explorer. Syntax pixels = document.width; Example function init() { alert("The width of the document is " + document.width + " pixels."); } Alternatives document.body.clientWidth /* width of <body> */ document.documentElement.clientWidth /* width of <html> */ window.innerWidth /* window's width */ Specification HTML5 ...
Document.write() - Web APIs
ent.open(). After writing, call document.close() to tell the browser to finish loading the page. If the document.write() call is embedded within an inline HTML <script> tag, then it will not call document.open(). For example: <script> document.write("<h1>Main title</h1>") </script> Note: document.write() and document.writeln do not work in XHTML documents (you'll get an "Operation is not sup
ported" [NS_ERROR_DOM_NOT_SUP
PORTED_ERR] error in the error console). This happens when opening a local file with the .xhtml file extension or for any document served with an application/xhtml+xml MIME type. More information is available in the W3C XHTML FAQ. Note: Using document.write() in deferred or asynchronous scripts will be ignored and you'll get a message like "A call to document.write() from...
Document.writeln() - Web APIs
a string of text followed by a newline character to a document. Syntax document.writeln(line); Parameters line is string containing a line of text. Example document.writeln("<p>enter password:</p>"); Notes document.writeln is the same as document.write but adds a newline. Note: document.writeln (like document.write) does not work in XHTML documents (you'll get a "Operation is not sup
ported" (NS_ERROR_DOM_NOT_SUP
PORTED_ERR) error on the error console). This is the case if opening a local file with a .xhtml file extension or for any document served with an application/xhtml+xml MIME type. More information is available in the W3C XHTML FAQ. Specifications Specification Status Comment HTML Living StandardThe definition of 'document.writeln()' in that spe...
Document.xmlEncoding - Web APIs
nderbird 10.0 / SeaMonkey 2.7)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Returns the encoding as determined by the XML declaration. Should be null if unspecified or unknown. Warning: Do not use this attribute; it has been removed from the DOM Level 4 specification and is no longer sup
ported in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7). If the XML Declaration states: <?xml version="1.0" encoding="UTF-16"?> ...the result should be "UTF-16". However, Firefox 3.0 includes information on endianness (e.g., UTF-16BE for big endian encoding), and while this extra information is removed as of Firefox 3.1b3, Firefox 3.1b3 is still consulting the file's encoding, rath...
DocumentOrShadowRoot.activeElement - Web APIs
element = DocumentOrShadowRoot.activeElement Value The Element which currently has focus, <body> or null if there is no focused element. Example HTML <p>Select some text from one of the text areas below:</p> <form> <textarea name="ta-example-one" id="ta-example-one" rows="7" cols="40">This is Text Area One. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tincidunt, lorem a
porttitor molestie, odio nibh iaculis libero, et accumsan nunc orci eu dui.</textarea> <textarea name="ta-example-two" id="ta-example-two" rows="7" cols="40">This is Text Area Two. Fusce ullamcorper, nisl ac
porttitor adipiscing, urna orci egestas libero, ut accumsan orci lacus laoreet diam. Morbi sed euismod diam.</textarea> </form> <p>Active element ID: <b id="output-element"></b></p> <p>Selected...
DocumentTimeline.DocumentTimeline() - Web APIs
The DocumentTimeline() constructor of the Web Animations API creates a new instance of the DocumentTimeline object associated with the active document of the current browsing context. Syntax var sharedTimeline = new DocumentTimeline(options); Parameters options An object specifying options for the new timeline. Currently the only sup
ported option is the originTime member which specifies the zero time for the documentTimeline as a real number of milliseconds relative to the navigationStart moment of the active document for the current browsing context. Examples We could share a single documentTimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. This bit of code would start all the cats animating 500 millisecon...
Events and the DOM - Web APIs
er // Assuming myButton is a button element myButton.addEventListener('click', greet, false) function greet(event){ // print and have a look at the event object // always print arguments in case of overlooking any other arguments console.log('greet:', arguments) alert('hello world') } This is the method you should use in modern web pages. Note: Internet Explorer 6-8 didn't sup
port this method, offering a similar EventTarget.attachEvent API instead. For cross-browser compatibility, use one of the many JavaScript libraries available. More details can be found on the EventTarget.addEventListener reference page. HTML attribute <button onclick="alert('Hello world!')"> The JavaScript code in the attribute is passed the Event object via the event parameter. The return value...
How to create a DOM tree - Web APIs
treet="123 main st" city="arlington" state="ma" country="usa"/> </person> <person first-name="jed" last-name="brown"> <address street="321 north st" city="atlanta" state="ga" country="usa"/> <address street="123 west st" city="seattle" state="wa" country="usa"/> <address street="321 south avenue" city="denver" state="co" country="usa"/> </person> </people> The W3C DOM API, sup
ported by Mozilla, can be used to create an in-memory representation of this document like so: var doc = document.implementation.createDocument("", "", null); var peopleElem = doc.createElement("people"); var personElem1 = doc.createElement("person"); personElem1.setAttribute("first-name", "eric"); personElem1.setAttribute("middle-initial", "h"); personElem1.setAttribute("last-name", "jung"); var a...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
world are a single node, but remember that in the document model, there are two nodes. The second node is a new node of type TEXT_NODE, and it is the second child of the second <p> tag. The following figure shows the recently created Text Node object inside the document tree. createTextNode() and appendChild() is a simple way to include white space between the words hello and world. Another im
portant note is that the appendChild method will append the child after the last child, just like the word world has been added after the word hello. So if you want to append a Text Node between hello and world, you will need to use insertBefore instead of appendChild. Creating New Elements with the document object and the createElement(..) method You can create new HTML elements or any other eleme...
Using the W3C DOM Level 1 Core - Web APIs
What is a DOM tree? A DOM tree is a kind of tree whose nodes represent an HTML or XML document's contents. Each HTML or XML document has a unique DOM tree representation. ...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
ences of spaces at the beginning and end of a line are removed, so we finally get this: <h1>Helloo<span>World!</span></h1> This is why people visiting the web page will simply see the phrase "Hello World!" nicely written at the top of the page, rather than a weirdly indented "Hello" followed but an even more weirdly indented "World!" on the line below that. Note: Firefox DevTools have sup
ported highlighting text nodes since version 52, making it easier to see exactly what nodes whitespace characters are contained within. Pure whitespace nodes are marked with a "whitespace" label. Whitespace in block formatting contexts Above we just looked at elements that contain inline elements, and inline formatting contexts. If an element contains at least one block element, then it instead est...
DoubleRange - Web APIs
Properties max A floating-point value specifying the largest permissible value of the property it describes. min A floating-point value specifying the smallest permissible value of the property it describes. ...
DynamicsCompressorNode.knee - Web APIs
The knee property's default value is 30 and it can be set between 0 and 40. Syntax var audioCtx = new AudioContext(); var compressor = audioCtx.createDynamicsCompressor(); compressor.knee.value = 40; Value An AudioParam. Note: Though the AudioParam returned is read-only, the value it represents is not. ...
DynamicsCompressorNode - Web APIs
rties Inherits properties from its parent, AudioNode. DynamicsCompressorNode.threshold Read only Is a k-rate AudioParam representing the decibel value above which the compression will start taking effect. DynamicsCompressorNode.knee Read only Is a k-rate AudioParam containing a decibel value representing the range above the threshold where the curve smoothly transitions to the compressed
portion. DynamicsCompressorNode.ratio Read only Is a k-rate AudioParam representing the amount of change, in dB, needed in the input for a 1 dB change in the output. DynamicsCompressorNode.reduction Read only Is a float representing the amount of gain reduction currently applied by the compressor to the signal. DynamicsCompressorNode.attack Read only Is a k-rate AudioParam representing the am...
EXT_float_blend - Web APIs
fers by enabling the extension WEBGL_color_buffer_float (for WebGL1) or EXT_color_buffer_float (for WebGL2). Doing so automatically enables EXT_float_blend as well. With this extension enabled, calling drawArrays() or drawElements() with blending enabled and a draw buffer with 32-bit floating-point components will no longer result in an INVALID_OPERATION error. Usage notes On devices that sup
port the EXT_float_blend extension, it is automatically, implicitly, enabled when any one or more of EXT_color_buffer_float, OES_texture_float, or WEBGL_color_buffer_float are enabled. This ensures that content written before EXT_float_blend was exposed by WebGL will function as expected. Examples const gl = canvas.getContext('webgl2'); // enable necessary extensions gl.getExtension('EXT_color_buff...
EXT_sRGB - Web APIs
WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: This extension is only available to WebGL1 contexts. In WebGL2, the functionality of this extension is available on the WebGL2 context by default. The constants in WebGL2 are: gl.SRGB, gl.SRGB8, gl.SRGB8_ALPHA8 and gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING. Constants This extension exposes the following constants, which can be used in the texImage2D(), texSubImage2D(), renderbufferStorage() and getFramebufferAttachmentParameter() methods. ...
EXT_texture_compression_bptc - Web APIs
The EXT_texture_compression_bptc extension is part of the WebGL API and exposes 4 BPTC compressed texture formats. These compression formats are called BC7 and BC6H in Microsoft's DirectX API. WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: Sup
port depends on the system's graphics driver. There is no sup
port on Windows. This extension is available to both, WebGL1 and WebGL2 contexts. Constants The compressed texture formats are exposed by 4 constants and can be used in two functions: compressedTexImage2D() and compressedTexSubImage2D(). ext.COMPRESSED_RGBA_BPTC_UNORM_EXT Compresses 8-bit fixed-point data. Each 4x4 block of texels consists of 128 bits of RGBA o...
EXT_texture_compression_rgtc - Web APIs
extension is part of the WebGL API and exposes 4 RGTC compressed texture formats. RGTC is a block-based texture compression format suited for unsigned and signed red and red-green textures (Red-Green Texture Compression). WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: Sup
port depends on the system's graphics driver. There is no sup
port on Windows. This extension is available to both, WebGL1 and WebGL2 contexts. Constants The compressed texture formats are exposed by 4 constants and can be used in two functions: compressedTexImage2D() and compressedTexSubImage2D(). ext.COMPRESSED_RED_RGTC1_EXT Each 4x4 block of texels consists of 64 bits of unsigned red image d...
EcdsaParams - Web APIs
leCrypto.sign() or SubtleCrypto.verify() when using the ECDSA algorithm. Properties name A DOMString. This should be set to ECDSA. hash A DOMString. An identifier for the digest algorithm to use. This should be one of the following: SHA-256: selects the SHA-256 algorithm. SHA-384: selects the SHA-384 algorithm. SHA-512: selects the SHA-512 algorithm. Warning: SHA-1 is also sup
ported here but the SHA-1 algorithm is considered vulnerable and should no longer be used. Examples See the examples for SubtleCrypto.sign() or SubtleCrypto.verify(). Specifications Specification Status Comment Web Cryptography APIThe definition of 'SubtleCrypto.EcdsaParams' in that specification. Recommendation ...
EffectTiming.iterations - Web APIs
onEffectReadOnly, KeyframeEffectReadOnly, and KeyframeEffect. Syntax var timingProperties = { iterations: numberOfIterations }; timingProperties.iterations = numberOfIterations; Value A floating-point value specifying the number of times the animation sequence will play through. Any value from 0 (don't play the animation at all) to positive Infinity (run the animation indefinitely) is sup
ported. Defaults to 1, meaning the animation sequence plays through once then stops automatically. Exceptions TypeError An attempt was made to set the value of this property to a negative number or NaN. The property's value is left unchanged. Examples In the Forgotten Key example, Alice waves her arm up and down the entire time the page is open by passing Infinity as the value for her iteratio...
Element.attachShadow() - Web APIs
ment issues around focusability. When a non-focusable part of the shadow DOM is clicked, the first focusable part is given focus, and the shadow host is given any available :focus styling. Return value Returns a ShadowRoot object. Exceptions Exception Explanation InvalidStateError The element you are trying to attach to is already a shadow host. NotSup
portedError You are trying to attach a shadow root to an element outside the HTML namespace, or the element cannot have a shadow attached to it (see above). Examples The following example is taken from our word-count-web-component demo (see it live also). You can see that we use attachShadow() in the middle of the code to create a shadow root, which we then attach our custom element's conte...
Element: auxclick event - Web APIs
Interface MouseEvent Event handler property onauxclick Preventing default actions For the vast majority of browsers that map middle click to opening a link in a new tab, including Firefox, it is possible to cancel this behavior by calling preventDefault() from within an auxclick event handler. When listening for auxclick events originating on elements that do not sup
port input or navigation, you will often want to explicitly prevent other default actions mapped to the down action of the middle mouse button. On Windows this is usually autoscroll, and on macOS and Linux this is usually clipboard paste. This can be done by preventing the default behaviour of the mousedown or pointerdown event. Additionally, you may need to avoid opening a system context menu after ...
Element.classList - Web APIs
future elements in the doc. document.documentElement.firstChild.appendChild(document.createElement('style')).styleSheet.cssText=( '_*{x-uCLp:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' + // IE6 '[class]{x-uCLp/**/:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' //IE7-8 ); } })(window); // 3. ...
Element.clientHeight - Web APIs
e layout boxes; otherwise, it's the inner height of an element in pixels. It includes padding but excludes borders, margins, and horizontal scrollbars (if present). clientHeight can be calculated as: CSS height + CSS padding - height of horizontal scrollbar (if present). When clientHeight is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the view
port's height (excluding any scrollbar) is returned. This is a special case of clientHeight. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Syntax var intElemClientHeight = element.clientHeight; intElemClientHeight is an integer corresponding to the clientHeight of element in pixels. The clientHeight property is read-...
Element.clientWidth - Web APIs
The Element.clientWidth property is zero for inline elements and elements with no CSS; otherwise, it's the inner width of an element in pixels. It includes padding but excludes borders, margins, and vertical scrollbars (if present). When clientWidth is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the view
port's width (excluding any scrollbar) is returned. This is a special case of clientWidth. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Syntax var intElemClientWidth = element.clientWidth; intElemClientWidth is an integer corresponding to the clientWidth of element in pixels. The clientWidth property is read-only. Example Specification Specif...
Element.computedStyleMap() - Web APIs
In other browsers you'll just see a link. Did you realize how many default CSS properties a link had? Update the 'a' to the 'p', and you'll notice a difference in the margin-top and margin-bottom default computed values. Specifications Specification Status Comment CSS Typed OM Level 1The def...
Element: keydown event - Web APIs
wn event is fired for all keys, regardless of whether they produce a character value. Bubbles Yes Cancelable Yes Interface KeyboardEvent Event handler property onkeydown The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. For example, a lowercase "a" will be re
ported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is re
ported as 65 by all events. Keyboard events are only generated by <inputs>, <textarea> and anything with the contentEditable attribute or with tabindex="-1". Since Firefox 65, the keydown and keyup events are now fired during IME composition, to improve cross-browser compatibility for CJKT users (bug 354358, also see key...
Element: keyup event - Web APIs
The keyup event is fired when a key is released. Bubbles Yes Cancelable Yes Interface KeyboardEvent Event handler property onkeyup The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. For example, a lowercase "a" will be re
ported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is re
ported as 65 by all events. Since Firefox 65, the keyup and keydown events are now fired during IME composition, to improve cross-browser compatibility for CJKT users (bug 354358, also see keydown and keyup events are now fired during IME composition for more useful details). To ignore all keyup events that are part of composition, do something like this (229...
Element.requestFullscreen() - Web APIs
een" permission must be granted. Detecting full-screen activation You can determine whether or not your attempt to switch to full-screen mode is successful by using the Promise returned by requestFullscreen(), as seen in the Example below. To learn when other code has toggled full-screen mode on and off, you should establish listeners for the fullscreenchange event on the Document. It's also im
portant to listen for fullscreenchange to be aware when, for example, the user manually toggles full-screen mode, or when the user switches applications, causing your application to temporarily exit full-screen mode. Examples This function toggles the first <video> element found in the document into and out of full-screen mode. function toggleFullscreen() { let elem = document.querySelector("vide...
Element.scrollWidth - Web APIs
The width is measured in the same way as clientWidth: it includes the element's padding, but not its border, margin or vertical scrollbar (if present). ...
Element: webkitmouseforcechanged event - Web APIs
The non-standard webkitmouseforcechanged event is fired by Safari each time the amount of pressure changes on the trackpad/touchscreen. Bubbles Unknown Cancelable Unknown Interface MouseEvent webkitmouseforcechanged is a proprietary, WebKit-specific event introduced by Apple to sup
port their Force Touch events feature. This event first fires after the mousedown event and stops firing before the mouseup event. Specifications Not part of any specification. Apple has a description at the Mac Developer Library. ...
Element: webkitmouseforcewillbegin event - Web APIs
To instruct macOS not to engage any default Force Touch actions if the user apply enough pressure to activate a Force Touch event, call preventDefault() on the webkitmouseforcewillbegin event object. Bubbles Unknown Cancelable Unknown Interface MouseEvent webkitmouseforcewillbegin is a proprietary, WebKit-specific event. ...
Element - Web APIs
from the current node and returns it as an Object. Element.getAttributeNames() Returns an array of attribute names from the current element. Element.getAttributeNS() Retrieves the value of the attribute with the specified name and namespace, from the current node and returns it as an Object. Element.getBoundingClientRect() Returns the size of an element and its position relative to the view
port. Element.getClientRects() Returns a collection of rectangles that indicate the bounding rectangles for each line of text in a client. Element.getElementsByClassName() Returns a live HTMLCollection that contains all descendants of the current element that possess the list of classes given in the parameter. Element.getElementsByTagName() Returns a live HTMLCollection containing all descendant...
Encoding API - Web APIs
The Encoding API provides a mechanism for handling text in various character encodings, including legacy non-UTF-8 encodings. The API provides four interfaces: TextDecoder, TextEncoder, TextDecoderStream and TextEncoderStream. Interfaces TextDecoder TextEncoder TextDecoderStream TextEncoderStream Tutorials & tools A shim allowing to use this interface in browsers that don't sup
port it. StringView - a C-like representation of strings based on typed arrays. Specifications Specification Status Comment Encoding Living Standard Initial definition. ...
Event.srcElement - Web APIs
Initially implemented in Internet Explorer, Event.srcElement is a now-standard alias (defined in the DOM Standard but flagged as "historical") for the Event.target property. It's sup
ported in all major browser engines, but only for compatibility reasons. Use Event.target instead. Specifications Specification Status Comment DOMThe definition of 'Event.srcElement' in that specification. Living Standard ...
Event.timeStamp - Web APIs
Syntax time = event.timeStamp; Value This value is the number of milliseconds elapsed from the beginning of the current document's lifetime till the event was created. In newer implementations, the value is a DOMHighResTimeStamp accurate to 5 microseconds (0.005 ms). In older implementations, the value is a DOMTimeStamp, accurate to a millisecond. ...
Event - Web APIs
lorer and eventually adopted into the DOM specification in order to ensure existing sites continue to work. Ideally, you should try to use Event.preventDefault() and Event.defaultPrevented instead, but you can use returnValue if you choose to do so. Event.srcElement A non-standard alias (from old versions of Microsoft Internet Explorer) for Event.target. Some other browsers are starting to sup
port it for web compatibility purposes. Event.target Read only A reference to the target to which the event was originally dispatched. Event.timeStamp Read only The time at which the event was created (in milliseconds). By specification, this value is time since epoch--but in reality, browsers' definitions vary. In addition, work is underway to change this to be a DOMHighResTimeStamp instead. E...
EventTarget - Web APIs
EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. Element, Document, and Window are the most common event targets, but other objects can be event targets, too. For example XMLHttpRequest, AudioNode, AudioContext, and others. Many event targets (including elements, documents, and windows) also sup
port setting event handlers via onevent properties and attributes. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rec...
ExtendableMessageEvent - Web APIs
can be any data type. ExtendableMessageEvent.origin Read only Returns the origin of the Client that sent the message. ExtendableMessageEvent.lastEventId Read only Represents, in server-sent events, the last event ID of the event source. This is an empty string. ExtendableMessageEvent.source Read only Returns a reference to the Client object that sent the message. ExtendableMessageEvent.
ports Read only Returns the array containing the Message
Port objects representing the
ports of the associated message channel. Methods Inherits methods from its parent, ExtendableEvent. Examples In the below example a page gets a handle to the ServiceWorker object via ServiceWorkerRegistration.active, and then calls its postMessage() function. // in the page being controlled if (navigator.serv...
FeaturePolicy - Web APIs
The FeaturePolicy interface of the Feature Policy API represents the set of policies applied to the current execution context. FeaturePolicy Methods FeaturePolicy.allowsFeature Returns a Boolean that indicates whether or not a particular feature is enabled in the specified context. FeaturePolicy.features Returns a list of names of all features sup
ported by the User Agent. Feature whose name appears on the list might not be allowed by the Feature Policy of the current execution context and/or might not be accessible because of user's permissions. FeaturePolicy.allowedFeatures Returns a list of names of all features sup
ported by the User Agent and allowed by the Feature Policy. Note that features appearing on this list might still be behind a user permission. FeaturePolicy.getAllow...
FetchEvent.resultingClientId - Web APIs
The resultingClientId read-only property of the FetchEvent interface is the id of the client that replaces the previous client during a page navigation. For example, when navigating from page A to page B resultingClientId is the ID of the client associated with page B. If the fetch request is a subresource request or the request's destination is re
port, resultingClientId will be an empty string. Syntax var myResultingClientId = fetchEvent.resultingClientId; Value A DOMString. Example self.addEventListener('fetch', function(event) { console.log(event.resultingClientId); }); Specifications Specification Status Comment Service WorkersThe definition of 'resultingClientId' in that specification. Working Draft Initial definition. ...
Using Fetch - Web APIs
t by passing body parameters: const form = new FormData(document.getElementById('login-form')); fetch('/login', { method: 'POST', body: form }); Both request and response (and by extension the fetch() function), will try to intelligently determine the content type. A request will also automatically set a Content-Type header if none is set in the dictionary. Feature detection Fetch API sup
port can be detected by checking for the existence of Headers, Request, Response or fetch() on the Window or Worker scope. For example: if (window.fetch) { // run my fetch request here } else { // do something with XMLHttpRequest? } Polyfill To use Fetch in unsup
ported browsers, there is a Fetch Polyfill available that recreates the functionality for non-sup
porting browsers. Specifications ...
Fetch API - Web APIs
ome version 68. If you are targetting older versions of these browsers, be sure to include credentials: 'same-origin' init option on all api requests that may be affected by cookies/user login state. Note: Find out more about using the Fetch API features in Using Fetch, and study concepts in Fetch basic concepts. Aborting a fetch Browsers have started to add experimental sup
port for the AbortController and AbortSignal interfaces (aka The Abort API), which allow operations like Fetch and XHR to be aborted if they have not already completed. See the interface pages for more details. Fetch Interfaces WindowOrWorkerGlobalScope.fetch() The fetch() method used to fetch a resource. Headers Represents response/request headers, allowing you to query them and take different...
Using files from web applications - Web APIs
s case the input element must not be hidden using display: none (nor visibility: hidden), otherwise the label would not be keyboard-accessible. Use the visually-hidden technique instead. Consider this HTML: <input type="file" id="fileElem" multiple accept="image/*" class="visually-hidden"> <label for="fileElem">Select some files</label> and this CSS: .visually-hidden { position: absolute !im
portant; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); } /* Separate rule for compatibility, :focus-within is required on modern Firefox and Chrome */ input.visually-hidden:focus + label { outline: thin dotted; } input.visually-hidden:focus-within + label { outline: thin dotted; } There is no need to add JavaScript code to call fileElem.click(). Also in this...
FileReader.readAsDataURL() - Web APIs
For a full compatibility code you can see our crossbrowser possible solution for image preview. See also this more powerful example. Specifications Specification Status Comment File APIThe definition of 'readAsDataURL()' in that specification. Working Draft Initial definition ...
FileReader - Web APIs
asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. File objects may be obtained from a FileList object returned as a result of a user selecting files using the <input> element, from a drag and drop operation's DataTransfer object, or from the mozGetAsFile() API on an HTMLCanvasElement. Im
portant note: FileReader is used to read file content from the user's (remote) system in secure ways only. It cannot be used to simply read a file by pathname from a file system. To read files by pathname in JavaScript, standard Ajax solutions should be used to do server-side file reading, with CORS permission if reading cross-domain. Note: This feature is available in Web Workers. Constructor F...
FileHandle API - Web APIs
ess = function(){ var DB = this.result; var buildHandle = DB.mozCreateFileHandle("test.txt", "plain/text"); buildHandle.onsuccess = function(){ var myFileHandle = this.result; console.log('handle', myFileHandle); }; }; mozCreateFileHandle() takes two arguments: a name and an optional type. Both of these are just descriptive and are not used by the database. However, they are im
portant for the FileHandle object as it can generate File objects which inherit their own name and type from those values. That said, as the name does not match any real filename it can be an empty string, for example, and it doesn't even have to be unique. Note: the above code only creates a "temporary file" that exists only while you hold the FileHandle instance. If you want a file to survive a pa...
Force Touch events - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. Force Touch events are a proprietary, Apple-specific feature which makes possible (where sup
ported by the input hardware) new interactions based on how hard the user clicks or presses down on the touchscreen or trackpad. Events webkitmouseforcewillbegin This event is fired before the mousedown event. Its main use is that it can be Event.preventDefault()ed. webkitmouseforcedown This event is fired after the mousedown event as soon as sufficient pressure has been applied for it to qualify as a "forc...
FormData.append() - Web APIs
of this method: a two and a three parameter version: formData.append(name, value); formData.append(name, value, filename); Parameters name The name of the field whose data is contained in value. value The field's value. This can be a USVString or Blob (including subclasses such as File). If none of these are specified the value is converted to a string. filename Optional The filename re
ported to the server (a USVString), when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. Note: If you specify a Blob as the data to append to the FormData object, the filename that will be re
ported to the server in the "Content-Disposition" header used to vary from browser to browser. ...
FormData.set() - Web APIs
rsions of this method: a two and a three parameter version: formData.set(name, value); formData.set(name, value, filename); Parameters name The name of the field whose data is contained in value. value The field's value. This can be a USVString or Blob (including subclasses such as File). If none of these are specified the value is converted to a string. filename Optional The filename re
ported to the server (a USVString), when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. Note: If you specify a Blob as the data to append to the FormData object, the filename that will be re
ported to the server in the "Content-Disposition" header used to vary from browser to browser. ...
GainNode.gain - Web APIs
mute.onclick = voiceMute; function voiceMute() { if(mute.id == "") { // 0 means mute. If you still hear something, make sure you haven't // connected your source into the output in addition to using the GainNode. gainNode.gain.setValueAtTime(0, audioCtx.currentTime); mute.id = "ac...
GainNode - Web APIs
mute.onclick = voiceMute; function voiceMute() { if(mute.id == "") { // 0 means mute. If you still hear something, make sure you haven't // connected your source into the output in addition to using the GainNode. gainNode.gain.setValueAtTime(0, audioCtx.currentTime); mute.id = "ac...
Gamepad.mapping - Web APIs
If the browser is able to map controls on the device to that layout the mapping property will be set to the string standard. ...
Gamepad.timestamp - Web APIs
pers to determine if the axes and button data have been updated from the hardware. The value must be relative to the navigationStart attribute of the PerformanceTiming interface. Values are monotonically increasing, meaning that they can be compared to determine the ordering of updates, as newer values will always be greater than or equal to older values. Note: This property is not currently sup
ported anywhere. Syntax readonly attribute DOMHighResTimeStamp timestamp; Example var gp = navigator.getGamepads()[0]; console.log(gp.timestamp); Value A DOMHighResTimeStamp. Specifications Specification Status Comment GamepadThe definition of 'Gamepad.timestamp' in that specification. Working Draft Initial definition ...
GeolocationCoordinates.altitudeAccuracy - Web APIs
The GeolocationCoordinates.altitudeAccuracy read-only property is a strictly positive double representing the accuracy, with a 95% confidence level, of the altitude expressed in meters. This value is null if the implementation doesn't sup
port measuring altitude. Syntax let altAcc = geolocationCoordinatesInstance.altitudeAccuracy Value A positive double representing the accuracy, with a 95% confidence level, of the altitude expressed in meters. Specifications Specification Status Comment Geolocation APIThe definition of 'GeolocationCoordinates.altitudeAccuracy' in that specification. Recommendation Initial specification. ...
Using the Geolocation API - Web APIs
tude = position.coords.longitude; status.textContent = ''; mapLink.href = `https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`; mapLink.textContent = `Latitude: ${latitude} ?, Longitude: ${longitude} ?`; } function error() { status.textContent = 'Unable to retrieve your location'; } if(!navigator.geolocation) { status.textContent = 'Geolocation is not sup
ported by your browser'; } else { status.textContent = 'Locating...'; navigator.geolocation.getCurrentPosition(success, error); } } document.querySelector('#find-me').addEventListener('click', geoFindMe); Result ...
GlobalEventHandlers.onanimationcancel - Web APIs
ox').addEventListener('click', function() { if (box.style.display == "none") { box.style.display = "flex"; document.getElementById("toggleBox").innerHTML = "Hide the box"; } else { box.style.display = "none"; document.getElementById("toggleBox").innerHTML = "Show the box"; } }); Toggling the box to display: none has the effect of aborting its animation. In browsers that sup
port animationcancel, the event is fired and this handler is called. Result Assembled together, you get this: If your browser sup
ports animationcancel, hiding the box using the button will cause a message to be displayed about the event. Specification Specification Status Comment CSS AnimationsThe definition of 'onanimationcancel' in that specification. Working Draft ...
GlobalEventHandlers.onplay - Web APIs
tion; var handlerFunction = element.onplay; handlerFunction should be either null or a JavaScript function specifying the handler for the event. Example <p>This example demonstrates how to assign an "onplay" event to a video element.</p> <video controls onplay="alertPlay()"> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> Your browser does not sup
port HTML5 video. </video> <p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p> <script> function alertPlay() { alert("The video has started to play."); } </script> Specification Specification Status Comment HTML Living StandardThe definition of 'onplay' in that specification. Living Standard ...
GlobalEventHandlers.onpointerdown - Web APIs
in turn, looks at the value of pointerType to determine what kind of pointing device was used, then uses that information to customize a string to replace the contents of the target box. Then the event's preventDefault() method is called to ensure that the mousedown event isn't triggered, potentially causing events to be handled twice if we had a handler for those events in case Pointer Event sup
port is missing. We also have a handler for pointerup events: targetBox.onpointerup = handleUp; function handleUp(evt) { targetBox.innerHTML = "Tap me, click me, or touch me!"; evt.preventDefault(); } This code's job is to just restore the original text into the target box after the user's interaction with the element ends (for example, when they release the mouse button, or when they lift the...
HTMLInputElement - Web APIs
ing from a custom validity error, and does not validate. checkValidity() Returns a Boolean that is false if the element is a candidate for constraint validation, and it does not satisfy its constraints. In this case, it also fires an invalid event at the element. It returns true if the element is not a candidate for constraint validation, or if it satisfies its constraints. re
portValidity() Runs the checkValidity() method, and if it returns false (for an invalid input or no pattern attribute provided), then it re
ports to the user that the input is invalid in the same manner as if you submitted a form. HTMLInputElement.stepDown() Decrements the value by (step * n), where n defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception: if the method ...
HTMLLinkElement - Web APIs
LLinkElement.target Is a DOMString representing the name of the target frame to which the resource applies. Methods No specific method; inherits methods from its parent, HTMLElement, and LinkStyle. Specifications Specification Status Comment Preload Candidate Recommendation Defines <link rel="preload">, and the as property. Note that currently Firefox only sup
ports preloading of cacheable resources. HTML Living StandardThe definition of 'HTMLLinkElement' in that specification. Living Standard Adds the following properties: crossOrigin, referrerPolicy, and as. HTML 5.1The definition of 'HTMLLinkElement' in that specification. Recommendation HTML5The definition of 'HTMLLinkElement' in that specification. Recommendat...
HTMLMediaElement.canPlayType() - Web APIs
Note: This feature is not available in Web Workers. Syntax canPlayResponse = audioOrVideo.canPlayType(mediaType); Parameters mediaType A DOMString containing the MIME type of the media. Return value A DOMString indicating how likely it is that the media can be played. The string will be one of the following values: probably Media of the type indicated by the mediaType parameter is probably playable on this device. maybe Not enough information is available to determine for sure whether or not the media will play until playback is actually attempted. ...
HTMLMediaElement.defaultPlaybackRate - Web APIs
The HTMLMediaElement.defaultPlaybackRate property indicates the default playback rate for the media. Syntax var dSpeed = video.defaultPlaybackRate; audio.defaultPlaybackRate = 1.0; Value A double. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. The value 0.0 is invalid and throws a NOT_SUP
PORTED_ERR exception. Example var obj = document.createElement('video'); console.log(obj.defaultPlaybackRate); // 1 Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.defaultPlaybackRate' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement.defaultPlaybackRate' in that specification. Recomme...
HTMLMediaElement.load() - Web APIs
ct. Syntax mediaElement.load(); Parameters None. Return value undefined. Usage notes Calling load() aborts all ongoing operations involving this media element, then begins the process of selecting and loading an appropriate media resource given the options specified in the <audio> or <video> element and its src attribute or child <source> element(s). This is described in more detail in Sup
porting multiple formats in Video and audio content. The process of aborting any ongoing activities will cause any outstanding Promises returned by play() being resolved or rejected as appropriate based on their status before the loading of new media can begin. Pending play promises are aborted with an "AbortError" DOMException. Appropriate events will be sent to the media element itself as the load...
HTMLMediaElement.play() - Web APIs
exception name passed in as its sole input parameter (as opposed to a traditional exception being thrown). Possible errors include: NotAllowedError The user agent (browser) or operating system doesn't allow playback of media in the current context or situation. This may happen, for example, if the browser requires the user to explicitly start media playback by clicking a "play" button. NotSup
portedError The media source (which may be specified as a MediaStream, MediaSource, Blob, or File, for example) doesn't represent a sup
ported media format. Other exceptions may be re
ported, depending on browser implementation details, media player implementation, and so forth. Usage notes Although the term "autoplay" is usually thought of as referring to pages that immediately begin playing media...
HTMLMediaElement.seekToNextFrame() - Web APIs
You should not use this method in production code, because its implementation may change--or be removed outright--without notice. You are, however, invited to experiment with it. This method lets you access frames of video media without the media being performed in real time. ...
HTMLOrForeignElement.tabIndex - Web APIs
The tabIndex property of the HTMLOrForeignElement interface represents the tab order of the current element. Tab order is as follows: Elements with a positive tabIndex. Elements that have identical tabIndex values should be navigated in the order they appear. Navigation proceeds from the lowest tabIndex to the highest tabIndex. Elements that do not sup
port the tabIndex attribute or sup
port it and assign tabIndex to 0, in the order they appear. Elements that are disabled do not participate in the tabbing order. Values don't need to be sequential, nor must they begin with any particular value. They may even be negative, though each browser trims very large values. Syntax element.tabIndex = index; var index = element.tabIndex; Value index is an integer Example const b1 = document.
HTMLSlotElement - Web APIs
Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLSlotElement' in that specification. Living Standard ...
HTMLTableCellElement - Web APIs
ning the background color of the cells. It reflects the obsolete bgcolor attribute. HTMLTableCellElement.ch A DOMString containing one single chararcter. This character is the one to align all the cell of a column on. It reflects the char and default to the decimal points associated with the language, e.g. '.' for English, or ',' for French. This property was optional and was not very well sup
ported. HTMLTableCellElement.chOff A DOMString containing a integer indicating how many characters must be left at the right (for left-to-right scripts; or at the left for right-to-left scripts) of the character defined by HTMLTableCellElement.ch. This property was optional and was not very well sup
ported. HTMLTableCellElement.height A DOMString containing a length of pixel of the hinted heigh...
HTMLTableRowElement - Web APIs
MLCollection is live and is automatically updated when cells are added or removed. HTMLTableRowElement.ch Is a DOMString containing one single character. This character is the one to align all the cell of a column on. It reflects the char and default to the decimal points associated with the language, e.g. '.' for English, or ',' for French. This property was optional and was not very well sup
ported. HTMLTableRowElement.chOff Is a DOMString containing a integer indicating how many characters must be left at the right (for left-to-right scripts; or at the left for right-to-left scripts) of the character defined by HTMLTableRowElement.ch. This property was optional and was not very well sup
ported. HTMLTableRowElement.rowIndex Read only Returns a long value which gives the logical posi...
HTMLTableSectionElement - Web APIs
llection is live and is automatically updated when rows are added or removed. HTMLTableSectionElement.ch Is a DOMString containing one single chararcter. This character is the one to align all the cell of a column on. It reflects the char and default to the decimal points associated with the language, e.g. '.' for English, or ',' for French. This property was optional and was not very well sup
ported. HTMLTableSectionElement.chOff Is a DOMString containing a integer indicating how many characters must be left at the right (for left-to-right scripts; or at the left for right-to-left scripts) of the character defined by HTMLTableRowElement.ch. This property was optional and was not very well sup
ported. HTMLTableSectionElement.vAlign Is a DOMString representing an enumerated value indi...
HTMLVideoElement - Web APIs
The HTMLVideoElement interface provides special properties and methods for manipulating video objects. It also inherits properties and methods of HTMLMediaElement and HTMLElement. The list of sup
ported media formats varies from one browser to the other. You should either provide your video in a single format that all the relevant browsers sup
ports, or provide multiple video sources in enough different formats that all the browsers you need to sup
port are covered. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/A...
Working with the History API - Web APIs
la.org/foo.html, and the document will get a popstate event, this time with a null state object. Here too, going back doesn't change the document's contents from what they were in the previous step, although the document might update its contents manually upon receiving the popstate event. Note: Calling history.back() normally behaves the same way as clicking the Back button. But there is one im
portant exception: After using history.pushState(), calling history.back() does not raise a popstate event. Clicking the browser's Back button (still) does. The pushState() method pushState() takes three parameters: a state object; a title (currently ignored); and (optionally), a URL. Let's examine each of these three parameters in more detail. state object The state object is a JavaScript o...
HkdfParams - Web APIs
me length as the output of the digest function. Unlike the input key material passed into deriveKey(), salt does not need to be kept secret. info A BufferSource representing application-specific contextual information. This is used to bind the derived key to an application or context, and enables you to derive different keys for different contexts while using the same input key material. It's im
portant that this should be independent of the input key material itself. This property is required but may be an empty buffer. Examples See the examples for SubtleCrypto.deriveKey(). Specifications Specification Status Comment Web Cryptography APIThe definition of 'SubtleCrypto.HkdfParams' in that specification. Recommendation ...
IDBDatabaseSync - Web APIs
It may however be reintroduced in the future if there is enough demand from web developers. The DatabaseSync interface in the IndexedDB API represents a synchronous connection to a database. ...
IDBEnvironmentSync - Web APIs
It may however be reintroduced in the future if there is enough demand from web developers. The Unimplemented IDBEnvironmentSync interface of the IndexedDB API will be implemented by worker objects. Attributes Attribute Type Description indexedDBSync readonly IDBFactorySync Provides a synchronous means of accessing the capabilities of indexed databases. Note: Until the Indexed Database API specification is finalized, this attribute should be accessed as moz_indexedDBSync. ...
IDBFactorySync - Web APIs
It may however be reintroduced in the future if there is enough demand from web developers. The IDBFactorySync interface of the IndexedDB API provide a synchronous means of accessing the capabilities of indexed databases. Method overview IDBDatabaseSync open (in DOMString name, in DOMString description, in optional boolean modifyDatabase) raises (IDBDatabaseException); Methods open() Opens and returns a connection to a database. Blocks the calling thread until the connection object is ready to return. ...
IDBIndexSync - Web APIs
It may however be reintroduced in the future if there is enough demand from web developers. The IDBIndexSync interface of the IndexedDB API provides synchronous access to an index in a database. ...
IDBObjectStoreSync - Web APIs
It may however be reintroduced in the future if there is enough demand from web developers. The IDBObjectStoreSync interface of the IndexedDB API provides synchronous access to an object store of a database. ...
IDBTransactionSync - Web APIs
It may however be reintroduced in the future if there is enough demand from web developers. The IDBTransactionSync interface of the IndexedDB API provides a synchronous transaction on a database. When an application creates an IDBTransactionSync object, it blocks until the browser is able to reserve the require database objects. ...
IDBVersionChangeEvent - Web APIs
Read only Returns the new version of the database. Deprecated properties IDBVersionChangeEvent.version Read only The new version of the database in a versionchange transaction. Warning: While this property is still implemented in older browsers, the latest specification replaces it with the oldVersion and newVersion attributes. See the compatibility table to know what browsers sup
port them. Methods No specific method, but inherits properties from its parent, Method. Example In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. Upon a version change (after an upgradedneeded event), the success event will implement the IDBVersionChangeEvent interface. For a full working example, see our To-do Notificat...
IIRFilterNode.getFrequencyResponse() - Web APIs
of frequencies, specified in Hertz, which you want to filter. magResponseOutput A Float32Array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyArray. phaseResponseOutput A Float32Array to receive the computed phase response values in radians for each frequency value in the input frequencyArray. Return value undefined Exceptions NotSup
portedError The three arrays provided are not all of the same length. Examples In the following example we are using an IIR filter on a media stream (for a complete full demo, see our stream-source-buffer demo live, or read its source.) As part of this demo, we get the frequency responses for this IIR filter, for five sample frequencies. We first create the Float32Array objects we need, one contai...
IdleDeadline.didTimeout - Web APIs
The read-only didTimeout property on the IdleDeadline interface is a Boolean value which indicates whether or not the idle callback is being invoked because the timeout interval specified when Window.requestIdleCallback() was called has expired. If didTimeout is true, the IdleDeadline object's timeRemaining() method will return approximately 0. Idle callbacks sup
port the concept of a timeout in order to ensure that whatever task they're meant to perform actually happens, even if the user agent never has enough idle time available. Your callback will typically check the value of didTimeout if it needs to perform an action even if the browser is too busy to grant you the time; you should react by performing the needed task or, ideally, a minimal amount of work that can be done to keep things ...
ImageCapture.getPhotoSettings() - Web APIs
ettings. Syntax const settingsPromise = imageCapture.getPhotoSettings() Return value A Promise that resolves with a PhotoSettings object containing the following properties: fillLightMode: The flash setting of the capture device, one of "auto", "off", or "on". imageHeight: The desired image height as an integer. The user agent selects the closest width value to this setting if it only sup
ports discrete heights. imageWidth: The desired image width as an integer. The user agent selects the closest width value to this setting if it only sup
ports discrete widths. redEyeReduction: A boolean indicating whether the red-eye reduction should be used if it is available. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from get...
InputEvent.data - Web APIs
oesn't insert text (such as when deleting characters, for example). Syntax var aString = inputEvent.data; Value A DOMString. Examples In the following simple example we've set up an event listener on the input event so that when any change is made to the contents of the <input> element (either by typing or pasting), the text that was added is retrieved via the InputEvent.data property and re
ported in the paragraph below the input. <p>Some text to copy and paste.</p> <input type="text"> <p class="result"></p> var editable = document.querySelector('input') var result = document.querySelector('.result'); editable.addEventListener('input', (e) => { result.textContent = "Inputted text: " + e.data; }); Specifications Specification Status Comment Input Events ...
getVersion - Web APIs
disabled, this method returns NULL. Otherwise, it returns an InstallVersion object representing the version of the component. If the component has not been registered in the Client Version Registry or if the specified component was installed with a null version, this method returns null. Installing a component with a NULL version indicates that the component should always be updated when the op
portunity arises. ...
IntersectionObserver.IntersectionObserver() - Web APIs
n array of IntersectionObserverEntry objects, each representing one threshold which was crossed, either becoming more or less visible than the percentage specified by that threshold. observer The IntersectionObserver for which the callback is being invoked. options Optional An optional object which customizes the observer. If options isn't specified, the observer uses the document's view
port as the root, with no margin, and a 0% threshold (meaning that even a one-pixel change is enough to trigger a callback). You can provide any combination of the following options: root An Element or Document object which is an ancestor of the intended target, whose bounding rectangle will be considered the view
port. Any part of the target not visible in the visible area of the root is not con...
IntersectionObserver.observe() - Web APIs
. Note that this design allows multiple elements' intersection changes to be processed by a single call to the callback. Syntax IntersectionObserver.observe(targetElement); Parameters targetElement An element whose visibility within the root is to be monitored. This element must be a descendant of the root element (or contained wtihin the current document, if the root is the document's view
port). Return value undefined. Examples <<<...>>> Specifications Specification Status Comment Intersection ObserverThe definition of 'IntersectionObserver.observe()' in that specification. Working Draft Initial definition. ...
IntersectionObserverEntry.intersectionRect - Web APIs
Syntax var intersectionRect = IntersectionObserverEntry.intersectionRect; Value A DOMRectReadOnly which describes the part of the target element that's currently visible within the root's intersection rectangle. ...
IntersectionObserverEntry.rootBounds - Web APIs
The IntersectionObserverEntry interface's read-only rootBounds property is a DOMRectReadOnly corresponding to the target's root intersection rectangle, offset by the IntersectionObserver.rootMargin if one is specified. Syntax var rootBounds = IntersectionObserverEntry.rootBounds; Value A DOMRectReadOnly which describes the root intersection rectangle. For roots which are the Document's view
port, this rectangle is the bounds rectangle of the entire document. Otherwise, it's the bounds of the root element. This rectangle is offset by the values in IntersectionObserver.rootMargin. Specifications Specification Status Comment Intersection ObserverThe definition of 'IntersectionObserverEntry.rootBounds' in that specification. Working Draft Initial definition ...
KeyboardEvent.code - Web APIs
ity between physical and virtual input devices. This property is useful when you want to handle keys based on their physical positions on the input device rather than the characters associated with those keys; this is especially common when writing code to handle input for games that simulate a gamepad-like environment using keys on the keyboard. Be aware, however, that you can't use the value re
ported by KeyboardEvent.code to determine the character generated by the keystroke, because the keycode's name may not match the actual character that's printed on the key or that's generated by the computer when the key is pressed. For example, the code returned is "KeyQ" for the Q key on a QWERTY layout keyboard, but the same code value also represents the ' key on Dvorak keyboards and the A key on...
KeyboardEvent.key - Web APIs
tion dependent interval and the KeyboardEvent.repeat read only property is set to true. If the key produces a character key that would result in a character being inserted into possibly an <input>, <textarea> or an element with HTMLElement.contentEditable set to true, the beforeinput and input event types are fired in that order. Note that some other implementations may fire keypress event if sup
ported. The events will be fired repeatedly while the key is held down. A keyup event is fired once the key is released. This completes the process. In sequence 1 & 3, the KeyboardEvent.key attribute is defined and is set appropriately to a value according to the rules defined ealier. KeyboardEvent sequence example Consider the event sequence generated when we interact with the Shift and the 2 ke...
KeyboardEvent.keyCode - Web APIs
. This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key. If the key can't be identified, this value is 0. You should avoid using this if possible; it's been deprecated for some time. Instead, you should use KeyboardEvent.code, if it's implemented. Unfortunately, some browsers still don't have it, so you'll have to be careful to make sure you use one which is sup
ported on all target browsers. Web developers shouldn't use the keyCode attribute for printable characters when handling keydown and keyup events. As described above, the keyCode attribute is not useful for printable characters, especially those input with the Shift or Alt key pressed. When implementing a shortcut key handler, the keypress event is usually better (at least when Gecko is the runtime ...
LargestContentfulPaint - Web APIs
| lastEntry.loadTime; }); po.observe({type: 'largest-contentful-paint', buffered: true}); // Send data to the server. addEventListener('visibilitychange', function fn() { if (lcp && document.visibilityState === 'hidden') { console.log('LCP:', lcp); removeEventListener('visibilitychange', fn, true); } }, true); } catch (e) { // Do nothing if the browser doesn't sup
port this API. } Specifications Specification Status Comment Largest Contentful PaintThe definition of 'LargestContentfulPaint' in that specification. Editor's Draft Initial definition. ...
Location: origin - Web APIs
The origin read-only property of the Location interface is a USVString containing the Unicode serialization of the origin of the represented URL; that is: for URL using the http or https, the scheme followed by '://', followed by the domain, followed by ':', followed by the
port (the default
port, 80 and 443 respectively, if explicitely specified); for URL using file: scheme, the value is browser dependant; for URL using the blob: scheme, the origin of the URL following blob:. E.g "blob:https://mozilla.org" will have "https://mozilla.org". Note: This feature is available in Web Workers. Syntax string = object.origin; Examples // On this page, returns the origin var result = window.location.origin; // Returns:'https://developer.mozilla.org' Specifications Specification ...
LockedFile.getMetadata() - Web APIs
ws to retrieve some metadata about the locked file. Syntax var request = instanceOfLockedFile.getMetadata(param); Parameters param Optional An object used to request specific metadata. Each key is a boolean where true means the metadata is expected and where false means it is not expected. Note that if the key is undefined, it is considered as if it were true. The following metadata are sup
ported: size : will provide the size of the file lastModified : will provide the date when the file was last modified Return A FileRequest object. In case of success, the request's result is an object with the metadata requested through the param object. They have the following format: size : a number lastModified : a Date object Specifications Specification Status Commen...
Long Tasks API - Web APIs
e task occurred within. For tasks that don't occur within the top level page, the containerId, containerName and containerSrc fields may provide information as to the source of the task. Usage var observer = new PerformanceObserver(function(list) { var perfEntries = list.getEntries(); for (var i = 0; i < perfEntries.length; i++) { // Process long task notifications: // re
port back for analytics and monitoring // ... } }); // register observer for long task notifications observer.observe({entryTypes: ["longtask"]}); // Long script execution after this will result in queueing // and receiving "longtask" entries in the observer. Interfaces PerformanceLongTaskTiming Re
ports instances of long tasks. TaskAttributionTiming Returns information about the wo...
MIDIConnectionEvent - Web APIs
The MIDIConnectionEvent interface of the Web MIDI API is the event passed to the onstatechange event handler of the MIDIAccess interface and the onstatechange event of the MIDI
Ports interface. This occurs any time a new
port becomes available, or when a previously available
port becomes unavailable. For example, this event is fired whenever a MIDI device is either plugged in to or unplugged from a computer. Constructor MIDIConnectionEvent.MIDIConnectionEvent Creates a new MIDIConnectionEvent object. Properties MIDIConnectionEvent.
port Returns a reference to a MIDI
Port instance for a
port that has been connected or disconnected." Examples Specifications Specification Status Comment Web MIDI API Working Draft Initial definition. ...
MIDIInput - Web APIs
Use the MIDIInput interface of the Web MIDI API to access and pass messages to a MIDI input
port. Properties None. Event handlers MIDIInput.onmidimessage When the current
port receives a MIDIMessage it triggers a call to this event handler. Specifications Specification Status Comment Web MIDI API Working Draft Initial definition. ...
MIDIInputMap - Web APIs
Though it works generally like a map, because it is read-only it does not contain clear(), delete(), or set() functions. ...
MIDIMessageEvent - Web APIs
eEvent Creates a new MIDIMessageEvent object instance. Properties MIDIConnectionEvent.data A Uint8Array containing the data bytes of a single MIDI message. See the MIDI specification for more information on its form. Note: Even though the Web MIDI API specifies a receivedTime property that returns a DOMHighResTimeStamp, Chrome (the only implementation at the time of writing) does not sup
port that property since the basic Event.timeStamp property already returns a DOMHighResTimeStamp in Chrome. Examples // Printing all messages to console navigator.requestMIDIAccess().then(midiAccess => { Array.from(midiAccess.inputs).forEach(input => { input[1].onmidimessage = console.log; }) }); Specifications Specification Status Comment Web MIDI APIThe definiti...
MIDIOutputMap - Web APIs
The MIDIOutputMap read-only interface of the Web MIDI API provides a Map-like interface to the currently available MIDI output
ports. Although it works like a map, because it is read-only, it does not contain clear(), delete(), or set() functions. Specifications Specification Status Comment Web MIDI API Working Draft Initial definition. ...
MSCandidateWindowHide - Web APIs
tations and the behavior may change in the future. MSCandidateWindowHide fires after the Input Method Editor (IME) candidate window closes and is fully hidden. This proprietary method is specific to Internet Explorer. General info Synchronous No Bubbles No Cancelable No Note Windows 8.1 and Windows 7 IMEs for certain languages on Internet Explorer for the desktop might not sup
port this event. On Internet Explorer in the new Windows UI, this event is sup
ported in Windows 8.1 IMEs of all languages. Syntax Event Property object.oncandidatewindowhide = handler; addEventListener Method object.addEventListener("MSCandidateWindowHide", handler, useCapture) nbsp; Parameters pEvtObj [in] Type: IHTMLEventObj Pointer to an IHTMLEventObj interface ...
MSCandidateWindowShow - Web APIs
may change in the future. MSCandidateWindowShow fires immediately after the Input Method Editor (IME) candidate window is set to appear, but before it renders. This proprietary method is specific to Internet Explorer. General info Synchronous No Bubbles No Cancelable No Note Windows 8.1 and Windows 7 IMEs for certain languages on Internet Explorer for the desktop might not sup
port this event. On Internet Explorer in the new Windows UI, this event is sup
ported in Windows 8.1 IMEs of all languages. Syntax Event Property object.oncandidatewindowshow = handler; addEventListener Method object.addEventListener("MSCandidateWindowShow", handler, useCapture) Parameters pEvtObj [in] Type: IHTMLEventObj Pointer to an IHTMLEventObj interface for t...
MSCandidateWindowUpdate - Web APIs
dateWindowUpdate fires after the Input Method Editor (IME) candidate window has been identified as needing to change size, but before any visual updates have rendered. This proprietary method is specific to Internet Explorer. General info Synchronous No Bubbles No Cancelable No Note Windows 8.1 and Windows 7 IMEs for certain languages on Internet Explorer for the desktop might not sup
port this event. On Internet Explorer in the new Windows UI, this event is sup
ported in Windows 8.1 IMEs of all languages. Syntax Event Property object.oncandidatewindowupdate = handler; addEventListener Method object.addEventListener("MSCandidateWindowUpdate", handler, useCapture) Parameters pEvtObj [in] Type: IHTMLEventObj Pointer to an IHTMLEventObj interface f...
MSSiteModeEvent - Web APIs
recated. preventDefault Cancels the default action of an event. stopImmediatePropagation Prevents any further propagation of an event. stopPropagation Prevents propagation of an event beyond the current target. Properties Property Description actionURL Gets the URL of a Jump List item that is removed. *This property is not sup
ported for Windows Store apps using JavaScript. bubbles Gets a value that indicates whether an event propagates up from the event target. buttonID Gets the Thumbnail Toolbar button ID that is clicked. *This property is not sup
ported for Windows Store apps using JavaScript. cancelable Gets a value that indicates whether you can cancel an event's default action. ...
MediaCapabilities - Web APIs
ates. The information can be used to serve optimal media streams to the user and determine if playback should be smooth and power efficient. The information is accessed through the mediaCapabilities property of the Navigator interface. Methods MediaCapabilities.encodingInfo() When passed a valid media configuration, it returns a promise with information as to whether the media type is sup
ported, and whether encoding such media would be smooth and power efficient. MediaCapabilities.decodingInfo() When passed a valid media configuration, it returns a promise with information as to whether the media type is sup
ported, and whether decoding such media would be smooth and power efficient. Specifications Specification Status Comment Media CapabilitiesThe d...
MediaDeviceInfo - Web APIs
ists or the user has granted persistent permission for media device access. The set of device labels could otherwise be used as part of a fingerprinting mechanism to identify a user. Methods None. Example Here's an example that uses enumerateDevices() to get a list of devices. if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) { console.log("enumerateDevices() not sup
ported."); return; } // List cameras and microphones. navigator.mediaDevices.enumerateDevices() .then(function(devices) { devices.forEach(function(device) { console.log(device.kind + ": " + device.label + " id = " + device.deviceId); }); }) .catch(function(err) { console.log(err.name + ": " + err.message); }); This might produce: videoinput: id = csO9c0YpAf274OuCPUA53C...
MediaDevices.enumerateDevices() - Web APIs
is fulfilled. Each object in the array describes one of the available media input and output devices. If enumeration fails, the promise is rejected. Example Here's an example of using enumerateDevices(). It simply outputs a list of the device IDs, with their labels if available. if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) { console.log("enumerateDevices() not sup
ported."); return; } // List cameras and microphones. navigator.mediaDevices.enumerateDevices() .then(function(devices) { devices.forEach(function(device) { console.log(device.kind + ": " + device.label + " id = " + device.deviceId); }); }) .catch(function(err) { console.log(err.name + ": " + err.message); }); This might produce: videoinput: id = csO9c0YpAf274OuCPUA53C...
MediaError.code - Web APIs
by the user's request. MEDIA_ERR_NETWORK 2 Some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available. MEDIA_ERR_DECODE 3 Despite having previously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error. MEDIA_ERR_SRC_NOT_SUP
PORTED 4 The associated resource or media provider object (such as a MediaStream) has been found to be unsuitable. Example This example creates a <video> element, establishes an error handler for it, and then sets the element's src attribute to the video resource to present in the element. The error handler simply outputs a message var obj = document.createElement('video'); obj.onerror ...
MediaError.message - Web APIs
switch(err.code) { case MediaError.MEDIA_ERR_ABORTED: s += "The user canceled the audio."; break; case MediaError.MEDIA_ERR_NETWORK: s+= "A network error occurred while fetching the audio."; break; case MediaError.MEDIA_ERR_DECODE: s+= "An error occurred while decoding the audio."; break; case MediaError.MEDIA_ERR_SRC_NOT_SUP
PORTED: s+= "The audio is missing or is in a format not sup
ported by your browser."; break; default: s += "An unknown error occurred."; break; } let message = err.message; if (message && message.length) { s += " " + message; } displayErrorMessage("<strong>Error " + err.code + ":</strong> " + s + "<br>"); }; This gets the MediaError ...
MediaError - Web APIs
by the user's request. MEDIA_ERR_NETWORK 2 Some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available. MEDIA_ERR_DECODE 3 Despite having previously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error. MEDIA_ERR_SRC_NOT_SUP
PORTED 4 The associated resource or media provider object (such as a MediaStream) has been found to be unsuitable. MediaError.message A DOMString object containing a human-readable string which provides specific diagnostic information to help the reader understand the error condition which occurred; specifically, it isn't simply a summary of what the error code means, but actual diagnost...
MediaImage - Web APIs
ntexts, like player interface to show the current playing video or audio track. Properties src The URL from which user agent can fetch the image's data. sizes Specifies the resource in multiple sizes so that user agent does not have to scale a single image. type The MIME type hint for the user agant. Note that it is just a hint so that user agent may ignore images of types it does not sup
port; user agent still may use mime type sniffing after downloading the image to determine its type. Specifications Specification Status Comment Media Session StandardThe definition of 'MediaImage' in that specification. Draft Initial definition. ...
getConfiguration() - Web APIs
The MediaKeySystemAccess.getConfiguration() method returns a MediaKeySystemConfiguration object with the sup
ported combination of configuration options. Syntax var mediaKeySystemConfiguration = mediaKeySystemAccess.getConfiguration(); Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'getConfiguration()' in that specification. Recommendation Initial definition ...
MediaKeySystemAccess - Web APIs
f this object using the Navigator.requestMediaKeySystemAccess() method. Properties MediaKeySystemAccess.keySystem Read only Returns a DOMString identifying the key system being used. Methods MediaKeySystemAccess.createMediaKeys() Returns a Promise that resolves to a new MediaKeys object. MediaKeySystemAccess.getConfiguration() Returns a MediaKeySystemConfiguration object with the sup
ported combination of configuration options. Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'MediaKeySystemAccess' in that specification. Recommendation Initial definition. ...
audioCapabilities - Web APIs
The MediaKeySystemConfiguration.audioCapabilities read-only property returns an array of sup
ported audio type and capability pairs. Syntax var audioCapabilities[ {contentType: 'contentType', robustness:'robustness'}] = mediaSystemConfiguration.audioCapabilities; Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'audioCapabilities' in that specification. Recommendation Initial definition ...
videoCapabilities - Web APIs
The MediaKeySystemConfiguration.videoCapabilities read-only property returns an array of sup
ported video type and capability pairs. Syntax var videoCapabilities[{contentType: 'contentType', robustness:'robustness'}] = mediaSystemConfiguration.videoCapabilities; Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'videoCapabilities' in that specification. Recommendation Initial definition ...
MediaKeySystemConfiguration - Web APIs
The MediaKeySystemConfiguration dictionary holds configuration information about the media key system in use. Properties MediaKeySystemConfiguration.initDataTypes Read only Returns a list of sup
ported initialization data type names. An initialization data type is a string indicating the format of the initialization data. MediaKeySystemConfiguration.audioCapabilities Read only Returns a list of sup
ported audio type and capability pairs. MediaKeySystemConfiguration.videoCapabilities Read only Returns a list of sup
ported video type and capability pairs. MediaKeySystemConfiguration.distinctiveIdentifier Read only Indicates whether a persistent distinctive identifier is required. MediaKeySystemConfiguration.persistentState Read only Indicates whether the ability to pers...
MediaPositionState.position - Web APIs
Example In this example, a player for a non-standard media file format, written in JavaScript, uses setInterval() to establish a callback which fires once per second to refresh the position information by calling setPositionState(). If the media is still playing when the interval is fired, setPositionState() is called with an object that specifies the duration, playback rate, and position as re
ported by a myMedia object that describes the track being played. If the media is not playing, clearInterval() is used to remove the interval handler. let positionInterval = window.setInterval(() => { if (myMedia.isPlaying) { navigator.mediaSession.setPositionState({ duration: myMedia.trackDurationInSeconds, playbackRate: myMedia.playbackRate, position: myMedia.trackPlayPosit...
MediaPositionState - Web APIs
rate at which the media is being played, as a ratio relative to its normal playback speed. Thus, a value of 1 is playing at normal speed, 2 is playing at double speed, and so forth. Negative values indicate that the media is playing in reverse; -1 indicates playback at the normal speed but backward, -2 is double speed in reverse, and so on. position A floating-point value indicating the last re
ported playback position of the media in seconds. This must always be a positive value. Specifications Specification Status Comment Media Session StandardThe definition of 'MediaPositionState' in that specification. Draft Initial definition. ...
MediaRecorder: error event - Web APIs
Bubbles No Cancelable No Interface MediaRecorderErrorEvent Event handler property onerror For details of the all the possible errors see the documentation for the event handler property: onerror. ...
MediaRecorder.onerror - Web APIs
ade on a source that has been deleted or removed. SecurityError The MediaStream is configured to disallow recording. This may be the case, for example, with sources obtained using getUserMedia() when the user denies permission to use an input device. This also happens when a MediaStreamTrack within the stream is marked as isolated due to the peerIdentity constraint on the source stream. NotSup
portedError An attempt was made to instantiate a MediaRecorder using a MIME type that isn't sup
ported on the user's device; one or more of the requested container, codecs, or profiles as well as other information may be invalid. UnknownError An non-security related error occurred that cannot otherwise be categorized. Recording stops, the MediaRecorder's state becomes inactive, one last dataavailabl...
MediaRecorder.stream - Web APIs
The MediaRecorder.stream read-only property returns the stream that was passed into the MediaRecorder() constructor when the MediaRecorder was created. Syntax var stream = MediaRecorder.stream Values The MediaStream passed into the MediaRecorder() constructor when the MediaRecorder was originally created. Example if (navigator.getUserMedia) { console.log('getUserMedia sup
ported.'); navigator.getUserMedia ( // constraints - only audio needed for this app { audio: true }, // Success callback function(stream) { var mediaRecorder = new MediaRecorder(stream); var myStream = mediaRecorder.stream; console.log(myStream); ... Specifications Specification Status Comment MediaStream Recording...
MediaRecorderErrorEvent.error - Web APIs
f media recording, including these specifically identified by the specification. The descriptions here are generic ones; you'll find more specific ones to various scenarios in which they may occur in the corresponding method references. InvalidStateError An operation was attempted in a context in which it isn't allowed, or a request has been made on an object that's deleted or removed. NotSup
portedError A MediaRecorder couldn't be created because the specified options weren't valid. The message atttribute should provide additional information, if it exists. SecurityError The MediaStream is configured to disallow recording. This may be the case, for example, with sources obtained using getUserMedia() when the user denies permission to use an input device. This also happens when a Media...
MediaSession - Web APIs
For example, a smartphone might have a standard panel in its lock screen that provides controls for media. A browser on that device might deliver the metadata provided by calling MediaSession to the device in order to be controllable using the global user interface. ...
MediaSource.endOfStream() - Web APIs
xample The following snippet is from a simple example written by Nick Desaulniers (view the full demo live, or download the source for further investigation.) var assetURL = 'frag_bunny.mp4'; // Need to be specific for Blink regarding codecs // ./mp4info frag_bunny.mp4 | grep Codec var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; if ('MediaSource' in window && MediaSource.isTypeSup
ported(mimeCodec)) { var mediaSource = new MediaSource; //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsup
ported MIME type or codec: ', mimeCodec); } function sourceOpen (_) { //console.log(this.readyState); // open var mediaSource = this; var sourceBuffer ...
MediaStreamTrack.getCapabilities() - Web APIs
er's capabilities are, your script can use applyConstraints() to ask for the track to be configured to match ideal or acceptable settings. See Capabilities, constraints, and settings for details on how to work with constrainable properties. Syntax const capabilities = track.getCapabilities() Return value A MediaTrackCapabilities object which specifies the value or range of values which are sup
ported for each of the user agent's sup
ported constrainable properties. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'getCapabilities()' in that specification. Candidate Recommendation Initial definition. ...
MediaStreamTrack - Web APIs
event handler property. unmute Sent to the track when data becomes available again, ending the muted state. Also available through the onunmute event handler property. Specifications Specification Status Comment Identity for WebRTCThe definition of 'Isolated tracks' in that specification. Candidate Recommendation Additional properties for isolated track sup
port Media Capture and StreamsThe definition of 'MediaStreamTrack' in that specification. Candidate Recommendation Initial definition ...
MediaStream Recording API - Web APIs
sec setTimeout(event => { console.log("stopping"); mediaRecorder.stop(); }, 9000); Examining and controlling the recorder status You can also use the properties of the MediaRecorder object to determine the state of the recording process, and its pause() and resume() methods to pause and resume recording of the source media. If you need or want to check to see if a specific MIME type is sup
ported, that's possible as well. Just call MediaRecorder.isTypeSup
ported(). Examining potential input sources If your goal is to record camera and/or microphone input, you may wish to examine the available input devices before beginning the process of constructing the MediaRecorder. To do so, you'll need to call navigator.mediaDevices.enumerateDevices() to get a list of the available media devices. ...
MediaTrackConstraints.displaySurface - Web APIs
ackConstraints dictionary's displaySurface property is a ConstrainDOMString describing the requested or mandatory constraints placed upon the value of the displaySurface constrainable property. This is used to specify the type or types of display surfaces which getDisplayMedia() will let the user select among for sharing purposes. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.displaySurface as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var constraintsObject = { displaySurface: constraint }; constraintsObject.displaySurface = constraint; Value A ConstrainDOMString whic...
MediaTrackConstraints.echoCancellation - Web APIs
The MediaTrackConstraints dictionary's echoCancellation property is a ConstrainBoolean describing the requested or mandatory constraints placed upon the value of the echoCancellation constrainable property. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.echoCancellation as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Because RTP doesn't include this information, tracks associated with a WebRTC RTCPeerConnection will never include this property. Syntax var constraintsObject = { echoCancellation: constraint }; constraintsObject.echoCancellation = constraint; Value If this value...
MediaTrackConstraints.logicalSurface - Web APIs
ogicalSurface constrainable property. This is used to specify whether or not getDisplayMedia() should allow the user to choose display surfaces which are not necessarily fully visible on the screen, such as occluded windows or the complete content of windows which are large enough to require scrolling to see their entire contents. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.logicalSurface as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var constraintsObject = { logicalSurface: constraint }; constraintsObject.logicalSurface = constraint; Value A ConstrainBoolean which ...
MediaTrackConstraints.noiseSuppression - Web APIs
The MediaTrackConstraints dictionary's noiseSuppression property is a ConstrainBoolean describing the requested or mandatory constraints placed upon the value of the noiseSuppression constrainable property. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.noiseSuppression as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Noise suppression is typically provided by microphones, although it can be provided by other input sources as well. Syntax var constraintsObject = { noiseSuppression: constraint }; constraintsObject.noiseSuppression = constraint; Value If this value is a simple t...
MediaTrackControls.volume - Web APIs
The MediaTrackConstraints dictionary's volume property is a ConstrainDouble describing the requested or mandatory constraints placed upon the value of the volume constrainable property. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.volume as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var constraintsObject = { volume: constraint }; constraintsObject.volume = constraint; Value A ConstrainDouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest sup
ported volume. If this value i...
MediaTrackConstraints - Web APIs
le values, and/or a value which you'd like to be as close to as possible. The specifics vary somewhat depending on the type of the constrainable property. To learn more about how constraints work, see Capabilities, constraints, and settings. Properties Some combination--but not necessarily all--of the following properties will exist on the object. This may be because a given browser doesn't sup
port the property, or because it doesn't apply. For example, because RTP doesn't provide some of these values during negotiation of a WebRTC connection, a track associated with a RTCPeerConnection will not include certain values, such as facingMode or groupId. Properties of all media tracks deviceId A ConstrainDOMString object specifying a device ID or an array of device IDs which are acceptable ...
MediaTrackSettings.aspectRatio - Web APIs
the aspect ratio of the MediaStreamTrack as currently configured. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.aspectRatio property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.aspectRatio as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var aspectRatio = MediaTrackSettings.aspectRatio; Value A double-precision floating-point number indicating the current configuration of t...
MediaTrackSettings.autoGainControl - Web APIs
er getUserMedia() or MediaStreamTrack.applyConstraints(). Automatic gain control is a feature in which a sound source automatically manages changes in the volume of its source media to maintain a steady overall volume level. This feature is typically used on microphones, although it can be provided by other input sources as well. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.autoGainControl as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var autoGainControl = MediaTrackSettings.autoGainControl; Value A Boolean value which is true if the track has automatic gain control ...
MediaTrackSettings.channelCount - Web APIs
io channel the MediaStreamTrack is currently configured to have. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.channelCount property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.channelCount as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var channelCount = MediaTrackSettings.channelCount; Value An integer value indicating the number of audio channels on the track. A value ...
MediaTrackSettings.deviceId - Web APIs
ies the source for the corresponding MediaStreamTrack for the origin corresponding to the browsing session. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.deviceId property you provided when calling either getUserMedia(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.deviceId as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Because RTP doesn't include this information, tracks associated with a WebRTC RTCPeerConnection will never include this property. Syntax var deviceId ...
MediaTrackSettings.displaySurface - Web APIs
tream presents the complete contents of one or more of the user's screens. Any empty space (if the displays are of different dimensions) is filled with a backdrop chosen by the user agent. window The stream's video track presents the contents of a single window selected by the user. The window may be from any application, not necessarily just from within the user agent. Not all user agents sup
port all of these surface types. Specifications Specification Status Comment Screen CaptureThe definition of 'MediaTrackSettings.displaySurface' in that specification. Working Draft Initial definition ...
MediaTrackSettings.echoCancellation - Web APIs
hich attempts to prevent echo effects on a two-way audio connection by attempting to reduce or eliminate crosstalk between the user's output device and their input device. For example, it might apply a filter that negates the sound being produced on the speakers from being included in the input track generated from the microphone. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.echoCancellation as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Because RTP doesn't include this information, tracks associated with a WebRTC RTCPeerConnection will never include this property. Syntax var e...
MediaTrackSettings.facingMode - Web APIs
deo track represented by the MediaStreamTrack is currently facing. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.facingMode property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.facingMode as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Because RTP doesn't include this information, tracks associated with a WebRTC RTCPeerConnection will never include this property. Syntax var facingM...
MediaTrackSettings.frameRate - Web APIs
frames per second, of the MediaStreamTrack as currently configured. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.frameRate property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.frameRate as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var frameRate = MediaTrackSettings.frameRate; Value A double-precision floating-point number indicating the current configuration of the tra...
MediaTrackSettings.groupId - Web APIs
n unique DOMString which identifies the group of devices which includes the source for the MediaStreamTrack. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.groupId property you provided when calling either getUserMedia(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.groupId as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Because RTP doesn't include this information, tracks associated with a WebRTC RTCPeerConnection will never include this property. Syntax var groupId = ...
MediaTrackSettings.height - Web APIs
number of pixels tall MediaStreamTrack is currently configured to be. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.height property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.height as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var height = MediaTrackSettings.height; Value An integer value indicating the height, in pixels, of the video track as currently configured. E...
MediaTrackSettings.latency - Web APIs
th your specified constraints for this property's value as described in the MediaTrackConstraints.latency property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). This is, of course, an approximation, since latency can vary for many reasons including CPU, transmission, and storage overhead. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.latency as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Because RTP doesn't include this information, tracks associated with a WebRTC RTCPeerConnection will never include this property. Syntax var latency = ...
MediaTrackSettings.logicalSurface - Web APIs
on scenario in which a display surface may be a logical one is if the selected surface contains the entire content area of a window which is too large to display onscreen at once. Since the window that contains the surface has to be scrolled to show the rest of the contents, the surface is a logical one. A visible display surface (that is, a surface for which logicalSurface returns false) is the
portion of a logical display surface which is currently visible onscreen. For example, a user agent may choose to allow the user to choose whether to share the entire document (a browser with logicalSurface value of true), or just the currently visible
portion of the document (where the logicalSurface of the browser surface is false). Specifications Specification Status Comment ...
MediaTrackSettings.noiseSuppression - Web APIs
reamTrack.applyConstraints(). Noise suppression automatically filters the audio to remove background noise, hum caused by equipment, and the like from the sound before delivering it to your code. This feature is typically used on microphones, although it is technically possible it could be provided by other input sources as well. If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.noiseSuppression as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var noiseSuppression = MediaTrackSettings.noiseSuppression; Value A Boolean value which is true if the input track has noise suppress...
MediaTrackSettings.sampleRate - Web APIs
mples per second the MediaStreamTrack is currently configured for. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.sampleRate property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.sampleRate as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var sampleRate = MediaTrackSettings.sampleRate; Value An integer value indicating how many samples each second of audio data includes. Comm...
MediaTrackSettings.sampleSize - Web APIs
bits per sample) the MediaStreamTrack is currently configured for. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.sampleSize property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.sampleSize as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var sampleSize = MediaTrackSettings.sampleSize; Value An integer value indicating how many bits each audio sample is represented by. The mo...
MediaTrackSettings.volume - Web APIs
The MediaTrackSettings dictionary's volume property is a double-precision floating-point number indicating the volume of the MediaStreamTrack as currently configured, as a value from 0.0 (silence) to 1.0 (maximum sup
ported volume for the device). This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.volume property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.volume as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints t...
MediaTrackSettings.width - Web APIs
e number of pixels wide MediaStreamTrack is currently configured to be. This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.width property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is sup
ported by checking the value of MediaTrackSup
portedConstraints.width as returned by a call to MediaDevices.getSup
portedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var width = MediaTrackSettings.width; Value An integer value indicating the width, in pixels, of the video track as currently configured. Examp...
MerchantValidationEvent() - Web APIs
ant. This is an empty string by default. Return value A newly-created MerchantValidationEvent providing the information that needs to be delivered to the client-side code to present to the user agent by calling complete(). Exceptions TypeError The string specified as validationURL could not be parsed as a URL. RangeError The specified methodName does not correspond to a known and sup
ported merchant or is not a well-formed standard payment method identifier. Specifications Specification Status Comment Payment Request APIThe definition of 'MerchantValidationEvent()' in that specification. Candidate Recommendation Initial definition. ...
MerchantValidationEvent.complete() - Web APIs
rejection handler for the promise: InvalidStateError The event did not come directly from the user agent, but was instead dispatched by other code. another payment request is currently being processed, the current payment request is not currently being displayed to the user, or payment information is currently being updated. Example In this example, we see the client-side code needed to sup
port merchant validation for a payment request called payRequest: payRequest.onmerchantvalidation = event => { const validationDataPromise = getValidationData(event.validationURL); event.complete(validationDataPromise); } function getValidationData(url) { /* ...retrieve the validation data from the URL... */ } This code sets up a handler for the merchantvalidation event. The event handler ca...
MessageEvent.MessageEvent() - Web APIs
ageEvent. This can be of any data type, and will default to null if not specified. origin: A USVString representing the origin of the message emitter. This defaults to an empty string ("") if not specified. lastEventId: A DOMString representing a unique ID for the event. This defaults to an empty string ("") if not specified. source: An MessageEventSource (which can be a WindowProxy, Message
Port, or ServiceWorker object) representing the message emitter. This defaults to null if not set.
ports: An array of Message
Port objects representing the
ports associated with the channel the message is being sent through (where appropriate, e.g. in channel messaging or when sending a message to a shared worker). This defaults to an empty array ([]) if not specified. Example var myMessage = ...
MessageEvent.source - Web APIs
The source read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, Message
Port, or ServiceWorker object) representing the message emitter. Syntax let mySource = messageEvent.source; Value a MessageEventSource (which can be a WindowProxy, Message
Port, or ServiceWorker object) representing the message emitter. Example myWorker.onmessage = function(e) { result.textContent = e.data; console.log('Message received from worker'); console.log(e.source); }; Specifications Specification Status Comment HTML Living StandardThe definition of ' MessageEvent: source' in that specification. Living Standard ...
Microdata DOM API - Web APIs
collection[name] Returns a PropertyNodeList object containing any elements that add a property named name. The name index has to be one of the values listed in the names list. collection . names Returns an array with the property names of the elements in the collection. propertyNodeList . getValues() Returns an array of the various values that the relevant elements have. The object's sup
ported property indices are as defined for HTMLCollection objects. The sup
ported property names consist of the property names of all the elements represented by the collection, in tree order, ignoring later duplicates. The names attribute must return a live read only array object giving the property names of all the elements represented by the collection, listed in tree order, but with duplicates re...
Microsoft API extensions - Web APIs
These extensions are prefixed with MS or ms. Note: These APIs will only work in Microsoft applications, and are not on a standards track. ...
MimeType - Web APIs
ype of the associated plugin. MimeType.description Returns a description of the associated plugin or an empty string if there is none. MimeType.suffixes A string containing valid file extensions for the data displayed by the plugin, or an empty string if an extension is not valid for the particular module. For example, a browser's content decryption module may appear in the plugin list but sup
port more file extensions than can be anticipated. It might therefore return an empty string. MimeType.enabledPlugin Returns an instance of Plugin containing information about the plugin itself. Specifications Specification Status Comment HTML Living StandardThe definition of 'MimeType' in that specification. Living Standard Initial definition. ...
MimeTypeArray - Web APIs
The MimeTypeArray interface returns an array of MimeType instances, each of which contains information about a sup
ported browser plugins. This object is returned by NavigatorPlugins.mimeTypes. Properties MimeTypeArray.length The number of items in the array. Methods MimeTypeArray.item() Returns the MimeType object with the specified index. MimeTypeArray.namedItem() Returns the MimeType object with the specified name. Example The following example tests whether a plugin is available for the application/pdf mime type and if so, which plugin that is. var mimeTypes = navigator.MimeType; var flashPlugin = mimeTypes['video/x-flv']; if (typeof flashPlugin === "undefined") { var vid = document.createElement('video'); // Use vid.canPlayType() to test for a sup
ported mime type. }...
MutationObserver.MutationObserver() - Web APIs
The DOM MutationObserver() constructor -- part of the MutationObserver interface -- creates and returns a new observer which invokes a specified callback when DOM events occur. DOM observation does not begin immediately; the observe() method must be called first to establish which
portion of the DOM to watch and what kinds of changes to watch for. Syntax const observer = new MutationObserver(callback) Parameters callback A function which will be called on each DOM change that qualifies given the observed node or subtree and options. The callback function takes as input two parameters: An array of MutationRecord objects, describing each change that occurred; and the MutationObserver which invoked the callback. See the example below for more details. Return valu...
MutationObserver.disconnect() - Web APIs
The MutationObserver method disconnect() tells the observer to stop watching for mutations. The observer can be reused by calling its observe() method again. Syntax mutationObserver.disconnect() Parameters None. Return value undefined. Note: All notifications of mutations that have already been detected, but not yet re
ported to the observer, are discarded. Usage notes If the element being observed is removed from the DOM, and then subsequently released by the browser's garbage collection mechanism, the MutationObserver is likewise deleted. Example This example creates an observer, then disconnects from it, leaving it available for possible reuse. const targetNode = document.querySelector("#someElement"); const observerOptions = { childList: true, attributes: true } cons...
MutationObserver.takeRecords() - Web APIs
The most common use case for this is to immediately fetch all pending mutation records immediately prior to disconnecting the observer, so that any pending mutations can be processed when stopping down the observer. Syntax const mutationRecords = mutationObserver.takeRecords() Parameters None. Return value An array MutationRecord objects, each describing one change applied to the observed
portion of the document's DOM tree. Note: The queue of mutations which have occurred, but not been delivered to the observer's callback is left empty after calling takeRecords(). Example In this example, we demonstrate how to handle any undelivered MutationRecords by calling takeRecords() just before disconnecting the observer. const targetNode = document.querySelector("#someElement"); const obs...
MutationObserverInit.attributeFilter - Web APIs
nformation when doing lookups in our local array of users. When observe() is called, the specified options include both attributeFilter and subtree, so that we monitor the attribute values for all of the nodes contained within the subtree rooted at the node with the ID "userlist". The attributeOldValue option is set to true because we want the prior value of the changed attributes recorded and re
ported in the mutation records we receive. Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit: attributeFilter' in that specification. Living Standard ...
MutationObserverInit.childList - Web APIs
t: true | false } Value A Boolean value indicating whether or not to invoke the callback function when new nodes are added to or removed from the section of the DOM being monitored.. If subtree is false, only the node indicated by the observer's target node is monitored for changes. Setting subtree to true causes addition or removal of nodes anywhere within the subtree rooted at target to be re
ported. Example Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.childList' in that specification. Living Standard ...
NDEFMessage - Web APIs
Constructor NDEFMessage.NDEFMessage() Returns a new NDEFMessage containing specified data. ...
NDEFReader.onreading - Web APIs
The onreading property of NDEFReader interface of the Web NFC API is called whenever a new reading is available from compatible NFC devices, e.g. NFC tags sup
porting NDEF, when these devices are within the reader's magnetic induction field. Specifications Specification Status Comment Web NFC, NDEFReader.onreadig Draft Initial definition. ...
NDEFReader.scan() - Web APIs
th undefined immediatelly after scheduling read operations for the NFC adapter. Exceptions This method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a DOMException whose name is one of the following: AbortError The scan operation was aborted with AbortSignal passed in options. NotAllowedError The permission for this operation was rejected. NotSup
portedError There is no NFC adapter compatible with Web NFC, or a connection can not be established. Specifications Specification Status Comment Web NFC, scan() Draft Initial definition. ...
NDEFReader - Web APIs
Constructor NDEFReader.NDEFReader() Returns an NDEFReader with configuration specified in the parameters or default ones if no parameters are specified. Properties In addition to the properties listed below, NDEFReader inherits properties from its parent interface, EventTarget. NDEFReader.onreading An event handler for reading event, that notifies about availability of a new reading. ...
NDEFRecord() - Web APIs
The NDEFRecord() constructor of the Web NFC API returns a newly constructed NDEFRecord object that represents data that can be read from or written to compatible NFC devices, e.g. NFC tags sup
porting NDEF. Syntax writer = new NDEFRecord(NDEFRecordInit); Parameters NDEFRecordInit Read only NDEFRecordInit with initialization data. Return value A new NDEFRecord. Specifications Specification Status Comment Web NFC, NDEFRecord Draft Initial definition. ...
NDEFRecord.toRecords() - Web APIs
The toRecords() method of the NDEFRecord interface of Web NFC API parses record payload NDEFRecord.data besed on NDEFRecord.recordType and returns the result. In practice, it's possible to implement the parsing mechanism manually, but this method simplifies the process. Syntax NDEFRecord.toRecords() Parameters None. Return value A list of NDEFRecords. Exceptions NotSup
ported The User Agent does not know how to parse this combination of NDEFRecord.data and NDEFRecord.recordType. Specifications Specification Status Comment Web NFC, NDEFRecord.toRecords() Draft Initial definition. ...
NDEFRecord - Web APIs
Constructor NDEFRecord() Returns a new NDEFRecord with configuration specified in the parameters or default ones if no parameters are specified. Attributes NDEFRecord.recordType Read only Represents the NDEF record type. NDEFRecord.mediaType Read only Represents the MIME type of the NDEF record payload. NDEFRecord.id Read only Represents the identificator of the record. ...
NDEFWriter.write() - Web APIs
ully completed. Exceptions This method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a DOMException whose name is one of the following: AbortError The write operation was aborted with AbortSignal passed in options. NotAllowedError The permission for this operation was rejected or overwrite is false and there are already records on the tag. NotSup
portedError There is no NFC adapter compatible with Web NFC, or the available NFC adapter does not sup
port pushing messages, or connection can not be established. NotReadableError The UA is not allowed to access underlying NFC adapter (e.g., due to user preference). NetworkError Transfer failed after it already started (e.g., the tag was removed from the reader). Specifications Specif...
Navigator.cookieEnabled - Web APIs
to set a cookie in such scenario would fail). It returns false in Firefox and Chromium-based browsers. Note: Web browsers may prevent writing certain cookies in certain scenarios. For example, Chrome 80+ does not allow creating cookies with SameSite=None attribute, unless they are created over HTTPS and with Secure attribute. Example if (!navigator.cookieEnabled) { // The browser does not sup
port or is blocking cookies from being set. } Specifications Specification Status Comment HTML Living StandardThe definition of 'Navigator.cookieEnabled' in that specification. Living Standard Initial definition ...
Navigator.deviceMemory - Web APIs
It's approximated by rounding down to the nearest power of 2, then dividing that number by 1024. It is then clamped within lower and upper bounds to protect the privacy of owners of very low- or high-memory devices. Syntax memoryAmount = navigator.deviceMemory Value A floating point number; one of 0.25, 0.5, 1, 2, 4, 8. ...
Navigator.getUserMedia() - Web APIs
rue, video: { width: 1280, height: 720 } }, function(stream) { var video = document.querySelector('video'); video.srcObject = stream; video.onloadedmetadata = function(e) { video.play(); }; }, function(err) { console.log("The following error occurred: " + err.name); } ); } else { console.log("getUserMedia not sup
ported"); } ...
Navigator.maxTouchPoints - Web APIs
The maxTouchPoints read-only property of the Navigator interface returns the maximum number of simultaneous touch contact points are sup
ported by the current device. Syntax touchPoints = navigator.maxTouchPoints; Example if (navigator.maxTouchPoints > 1) { // browser sup
ports multi-touch } Specifications Specification Status Comment Pointer Events - Level 2The definition of 'maxTouchPoints' in that specification. Recommendation Non-stable version. Pointer EventsThe definition of 'maxTouchPoints' in that specification. Obsolete Initial definition. ...
Navigator.msLaunchUri() - Web APIs
URI, the successCallback is invoked, otherwise, the noHandlerCallback is called. To help protect a user's privacy, Windows displays a prompt for the user to allow the service or app to be launched. The user can choose to not see the prompt after the first instance for a particular protocol and automatically open the app or service without a user intervention. The msLaunchUri() method does not sup
port HTTP, Secure Hypertext Transfer Protocol (HTTPS), File Transfer Protocol (FTP), file, res, JavaScript, or Microsoft Visual Basic Scripting Edition (VBScript) protocols. If the user's system does not have a program registered to handle a specific protocol, and a noHandlerCallback is provided, Windows Internet Explorer will invoke the noHandlerCallback. This enables developers to provide a custom ...
Navigator.registerContentHandler() - Web APIs
is the URI to the handler as a string. title is the title of the handler presented to the user as a string. Example navigator.registerContentHandler( "application/vnd.mozilla.maybe.feed", "http://www.example.tld/?foo=%s", "My Feed Reader" ); Notes For Firefox 2 and above, only the application/vnd.mozilla.maybe.feed, application/atom+xml, and application/rss+xml MIME types are sup
ported. All values have the same effect, and the registered handler will receive feeds in all Atom and RSS versions (see bug 391286). Firefox is the only browser that implemented this feature, and it wasn't implemented to match the standard. This feature has since been removed from the HTML standard and shouldn't be used. Specifications Specification Status Comment HTML ...
Web-based protocol handlers - Web APIs
use a mailto: link when they want to provide a convenient way for users to send an email, directly from the webpage. When the link is activated, the browser should launch the default desktop application for handling email. You can think of this as a desktop-based protocol handler. Web-based protocol handlers allow web-based applications to participate in the process too. This is becoming more im
portant as more types of applications migrate to the web. In fact, there are many web-based email handling applications that could process a mailto link. Registering Setting up a web application as a protocol handler is not a difficult process. Basically, the web application uses registerProtocolHandler() to register itself with the browser as a potential handler for a given protocol. For example: ...
Navigator.sendBeacon() - Web APIs
handler. This results in the next page load to be delayed. window.addEventListener("unload", function logData() { var xhr = new XMLHttpRequest(); xhr.open("POST", "/log", false); // third parameter of `false` means synchronous xhr.send(analyticsData); }); This is what sendBeacon() replaces. With the sendBeacon() method, the data is transmitted asynchronously when the User Agent has an op
portunity to do so, without delaying unload or the next navigation. This solves all of the problems with submission of analytics data: The data is sent reliably It's sent asynchronously It doesn't impact the loading of the next page In addition, the code is simpler to write than any of the older techniques! The following example shows a theoretical analytics code pattern that submits data to a...
Navigator.serviceWorker - Web APIs
tor.serviceWorker read-only property returns the ServiceWorkerContainer object for the associated document, which provides access to registration, removal, upgrade, and communication with the ServiceWorker. The feature may not be available in private mode. Syntax var workerContainerInstance = navigator.serviceWorker; Value ServiceWorkerContainer Examples This code checks if the browser sup
ports service workers. if ('serviceWorker' in navigator) { // Sup
ported! } Specifications Specification Status Comment Service WorkersThe definition of 'navigator.serviceWorker' in that specification. Working Draft Initial definition. ...
Navigator.vibrate() - Web APIs
If a vibration pattern is already in progress when this method is called, the previous pattern is halted and the new one begins instead. If the method was unable to vibrate because of invalid parameters, it will return false, else it returns true. If the pattern leads to a too long vibration, it is truncated: the max length depends on the implementation. Syntax var successBool = window.navigator.vibrate(pattern); pattern Provides a pattern of vibration and pause intervals. ...
NavigatorID.appVersion - Web APIs
Returns either "4.0" or a string representing version information about the browser. Note: Do not rely on this property to return the correct browser version. Syntax window.navigator.appVersion Value Either "4.0" or a string representing version information about the browser. Example alert('Your browser version is re
ported as ' + navigator.appVersion); Notes The window.navigator.userAgent property may also contain the version number (for example "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape 6/6.1"), but you should be aware of how easy it is to change the user agent string and "spoof" other browsers, platforms, or user agents, and also how cavalier the browser vendor themselves are with these properties. The window.navigator.appVersion, window.navigator.
NavigatorID.platform - Web APIs
ty string or a string representing the platform on which the browser is executing. For example: "MacIntel", "Win32", "FreeBSD i386", "WebTV OS" Example console.log(navigator.platform); Usage notes Most browsers, including Chrome, Edge, and Firefox 63 and later, return "Win32" even if running on a 64-bit version of Windows. Internet Explorer and versions of Firefox prior to version 63 still re
port "Win64". Specifications Specification Status Comment HTML Living StandardThe definition of 'NavigatorID.platform' in that specification. Living Standard Initial definition. ...
Navigator.onLine - Web APIs
rk state by listening for the events on window.ononline and window.onoffline. Syntax online = window.navigator.onLine; Value online is a boolean true or false. Example View a live example. To check if you are online, query window.navigator.onLine, as in the following example: if (navigator.onLine) { console.log('online'); } else { console.log('offline'); } If the browser doesn't sup
port navigator.onLine the above example will always come out as false/undefined. To see changes in the network state, use addEventListener to listen for the events on window.online and window.offline, as in the following example: window.addEventListener('offline', function(e) { console.log('offline'); }); window.addEventListener('online', function(e) { console.log('online'); }); Specifications ...
NavigatorPlugins.javaEnabled() - Web APIs
This method indicates whether the current browser is Java-enabled or not. Syntax result = window.navigator.javaEnabled() Example if (window.navigator.javaEnabled()) { // browser has java } Notes The return value for this method indicates whether the preference that controls Java is on or off - not whether the browser offers Java sup
port in general. Specifications Specification Status Comment HTML Living StandardThe definition of 'NavigatorPlugins.javaEnabled' in that specification. Living Standard Initial definition. ...
NavigatorPlugins.plugins - Web APIs
enumerating the navigator.plugins array and comparing every plugin's name. This privacy change does not disable any plugins; it just hides some plugin names from enumeration. Syntax var plugins = navigator.plugins; plugins is PluginArray object used to access Plugin objects either by name or as a list of items. The returned value is not a JavaScript array, but has the length property and sup
ports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and namedItem("name") methods. Examples The following example function returns the version of the Shockwave Flash plugin. function getFlashVersion() { var flash = navigator.plugins.namedItem('Shockwave Flash'); if (typeof flash != 'object') { // flash is not present return undefined; } i...
NavigatorPlugins - Web APIs
NavigatorPlugins.plugins Read only Returns a PluginArray listing the plugins installed in the browser. Methods The NavigatorPlugins interface doesn't inherit any methods. ...
NetworkInformation.downlink - Web APIs
s value is based on recently observed application layer throughput across recently active connections, excluding connections made to a private address space. In the absence of recent bandwidth measurement data, the attribute value is determined by the properties of the underlying connection technology. Note that Chrome-based browsers do not conform to the specification, and arbitrarily cap the re
ported downlink at a maximum of 10 Mbps as an anti-fingerprinting measure. Similar caps exist for the re
ported latency. Syntax var downLink = NetworkInformation.downlink Value A double. Specifications Specification Status Comment Network Information APIThe definition of 'downlink' in that specification. Draft Initial definition. ...
Node.appendChild() - Web APIs
tion. The Node.cloneNode() method can be used to make a copy of the node before appending it under the new parent. Note that the copies made with cloneNode will not be automatically kept in sync. If the given child is a DocumentFragment, the entire contents of the DocumentFragment are moved into the child list of the specified parent node. Newer API avaliable! The ParentNode.append() method sup
ports multiple arguments and appending strings. Syntax element.appendChild(aChild) Parameters aChild The node to append to the given parent node (commonly an element). Return value The returned value is the appended child (aChild), except when aChild is a DocumentFragment, in which case the empty DocumentFragment is returned. Notes Chaining may not work as expected, due to appendChild() r...
Node.cloneNode() - Web APIs
s not copied. Warning: cloneNode() may lead to duplicate element IDs in a document! If the original node has an id attribute, and the clone will be placed in the same document, then you should modify the clone's ID to be unique. Name attributes may need to be modified also, depending on whether duplicate names are expected. To clone a node to insert into a different document, use Document.im
portNode() instead. Specifications Specification Status Comment DOMThe definition of 'Node.cloneNode()' in that specification. Living Standard Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.cloneNode()' in that specification. Obsolete Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Nod...
Node.compareDocumentPosition() - Web APIs
The return value is a bitmask of the following values: Name Value DOCUMENT_POSITION_DISCONNECTED 1 DOCUMENT_POSITION_PRECEDING 2 DOCUMENT_POSITION_FOLLOWING 4 DOCUMENT_POSITION_CONTAINS 8 DOCUMENT_POSITION_CONTAINED_BY 16 DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC 32 Syntax compareMask = node.compareDocumentPosition(otherNode) Parameters otherNode The other Node with which to compare the first node's document position. ...
Node.rootNode - Web APIs
Im
portant: For compatibility reasons, this property has been replaced by the Node.getRootNode() method. The Node.rootNode read-only property returns a Node object representing the topmost node in the tree, or the current node if it's the topmost node in the tree. This is found by walking backward along Node.parentNode until the top is reached. Syntax rootNode = node.rootNode; Value A Node object representing the topmost node in the tree. Example Running the following line in sup
porting browsers should return a reference to the HTML/document node: console.log(document.body.rootNode); Notes Gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. Therefore a node obtained, for example, using Node.firstChild or Node.previousSibling may ...
NodeList - Web APIs
ts length and item properties and cause errors if your script assumes it only has to deal with element objects. Also, for..in is not guaranteed to visit the properties in any particular order. for...of loops will loop over NodeList objects correctly: const list = document.querySelectorAll('input[type=checkbox]'); for (let checkbox of list) { checkbox.checked = true; } Recent browsers also sup
port iterator methods (forEach()) as well as entries(), values(), and keys(). There is also an Internet Explorer-compatible way to use Array.prototype.forEach for iteration: const list = document.querySelectorAll('input[type=checkbox]'); Array.prototype.forEach.call(list, function (checkbox) { checkbox.checked = true; }); Specifications Specification Status Comment DO...
Notification.maxActions - Web APIs
Note: This feature is available in Web Workers. The maxActions attribute of the Notification interface returns the maximum number of actions sup
ported by the device and the User Agent. Effectively, this is the maximum number of elements in Notification.actions array which will be respected by the User Agent. Syntax Notification.maxActions Value An integer Number which indicates the largest number of notification actions that can be presented to the user by the User Agent and the device. Examples The following snippet logs the maximum number of sup
ported actions. const maxActions = Notification.maxActions; console.log('This device can display at most ' + maxActions + ' actions on each notification.'); Specifications Specification Status Comment N...
Notification.onclick - Web APIs
Note: This feature is available in Web Workers. The onclick property of the Notification interface specifies an event listener to receive click events. These events occur when the user clicks on a displayed Notification. Syntax Notification.onclick = function(event) { ... }; The default behavior is to move the focus to the view
port of the notification's related browsing context. If you don't want that behaviour, call preventDefault() on the event object. Examples In the following example, we use an onclick handler to open a webpage in a new tab (specified by the inclusion of the '_blank' parameter) once a notification is clicked: notification.onclick = function(event) { event.preventDefault(); // prevent the browser from focusing the Notification's tab window.open('http://...
Notifications API - Web APIs
Note: This feature is available in Web Workers. The Notifications API allows web pages to control the display of system notifications to the end user. These are outside the top-level browsing context view
port, so therefore can be displayed even when the user has switched tabs or moved to a different app. The API is designed to be compatible with existing notification systems, across different platforms. Concepts and usage On sup
ported platforms, showing a system notification generally involves two things. First, the user needs to grant the current origin permission to display system notifications, which is generally done when the app or site initialises, using the Notification.requestPermission() method. This should be done in response to a user gesture, such as clicking a button, ...
OES_element_index_uint - Web APIs
WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: This extension is only available to WebGL1 contexts. In WebGL2, the functionality of this extension is available on the WebGL2 context by default. Extended methods This extension extends WebGLRenderingContext.drawElements(): The type parameter now accepts gl.UNSIGNED_INT. ...
OES_texture_float - Web APIs
AR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and use floating-point textures, the texture will be marked as incomplete. To use linear filtering on floating-point textures, enable the OES_texture_float_linear extension in addition to this extension. Floating-point color buffers This extension implicitly enables the WEBGL_color_buffer_float extension (if sup
ported), which allows rendering to 32-bit floating-point color buffers. Examples var ext = gl.getExtension('OES_texture_float'); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.FLOAT, image); Specifications Specification Status Comment OES_texture_floatThe definition of 'OES_texture_float' in ...
OES_texture_half_float - Web APIs
AREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and use half floating-point textures, the texture will be marked as incomplete. To use linear filtering on half floating-point textures, enable the OES_texture_half_float_linear extension in addition to this extension. Half floating-point color buffers This extension implicitly enables the EXT_color_buffer_half_float extension (if sup
ported), which allows rendering to 16-bit floating point formats. Examples var ext = gl.getExtension('OES_texture_half_float'); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, ext.HALF_FLOAT_OES, image); Specifications Specification Status Comment OES_texture_half_floatThe definition of 'OES_text...
OfflineAudioCompletionEvent - Web APIs
The Web Audio API OfflineAudioCompletionEvent interface represents events that occur when the processing of an OfflineAudioContext is terminated. The complete event implements this interface. Note: This interface is marked as deprecated; it is still sup
ported for legacy reasons, but it will soon be superseded when the promise version of OfflineAudioContext.startRendering is sup
ported in browsers, which will no longer need it. Constructor OfflineAudioCompletionEvent.OfflineAudioCompletionEvent Creates a new OfflineAudioCompletionEvent object instance. Properties Also inherits properties from its parent, Event. OfflineAudioCompletionEvent.renderedBuffer Read only An AudioBuffer containing the result of processing an OfflineAudioContext. Methods Inherits methods from its paren...
OfflineAudioContext.OfflineAudioContext() - Web APIs
create for the audio context, in sample-frames, where one sample-frame is a unit that can contain a single sample of audio data for every channel in the audio data. For example, a 5-second buffer with a sampleRate of 48000Hz would have a length of 5 * 48000 = 240000 sample-frames. sampleRate The sample-rate of the linear audio data in sample-frames per second. All user agents are required to sup
port a range of 22050Hz to 96000Hz, and may sup
port a wider range than that. The most commonly-used rate is 44100Hz, which is the sample rate used by CD audio. It is im
portant to note that, whereas you can create a new AudioContext using the new AudioContext() constructor with no arguments, the OfflineAudioContext() constructor requires three arguments, since it needs to create an AudioBuffer. This ...
OfflineAudioContext.startRendering() - Web APIs
The startRendering() method of the OfflineAudioContext Interface starts rendering the audio graph, taking into account the current connections and the current scheduled changes. The complete event (of type OfflineAudioCompletionEvent) is raised when the rendering is finished, containing the resulting AudioBuffer in its renderedBuffer property. Browsers currently sup
port two versions of the startRendering() method -- an older event-based version and a newer promise-based version. The former will eventually be removed, but currently both mechanisms are provided for legacy reasons. Syntax Event-based version: offlineAudioCtx.startRendering(); offlineAudioCtx.oncomplete = function(e) { // e.renderedBuffer contains the output buffer } Promise-based version: offlineAudioCtx.startRenderin...
OffscreenCanvas.getContext() - Web APIs
Syntax offscreen.getContext(contextType, contextAttributes); Parameters contextType Is a DOMString containing the context identifier defining the drawing context associated to the canvas. Possible values are: "2d" creates a CanvasRenderingContext2D object representing a two-dimensional rendering context. ...
ParentNode.childElementCount - Web APIs
dn't affect compatibility. Syntax var count = node.childElementCount; count The return value, which is an unsigned long (simply an integer) type. node An object representing a Document, DocumentFragment, or Element. Example var foo = document.getElementById('foo'); if (foo.childElementCount > 0) { // Do something } Polyfill for IE8 & IE9 & Safari This property is completely unsup
ported prior to IE9. In IE9 and Safari, it is unsup
ported in the Document and DocumentFragment objects. ;(function(constructor) { if (constructor && constructor.prototype && constructor.prototype.childElementCount == null) { Object.defineProperty(constructor.prototype, 'childElementCount', { get: function() { var i = 0, count = 0, node, nodes = this.childNodes; ...
ParentNode.children - Web APIs
) method on the collection, or by using JavaScript array-style notation. If the node has no element children, then children is an empty list with a length of 0. Example const foo = document.getElementById('foo'); for (let i = 0; i < foo.children.length; i++) { console.log(foo.children[i].tagName); } Polyfill // Overwrites native 'children' prototype. // Adds Document & DocumentFragment sup
port for IE9 & Safari. // Returns array instead of HTMLCollection. ;(function(constructor) { if (constructor && constructor.prototype && constructor.prototype.children == null) { Object.defineProperty(constructor.prototype, 'children', { get: function() { let i = 0, node, nodes = this.childNodes, children = []; while (node = nodes[i++]) { if (node.nodeType...
ParentNode.firstElementChild - Web APIs
ntax var element = node.firstElementChild; Example <ul id="foo"> <li>First (1)</li> <li>Second (2)</li> <li>Third (3)</li> </ul> <script> var foo = document.getElementById('foo'); // yields: First (1) console.log(foo.firstElementChild.textContent); </script> Polyfill for IE8, IE9 and Safari // Overwrites native 'firstElementChild' prototype. // Adds Document & DocumentFragment sup
port for IE9 & Safari. ;(function(constructor) { if (constructor && constructor.prototype && constructor.prototype.firstElementChild == null) { Object.defineProperty(constructor.prototype, 'firstElementChild', { get: function() { var node, nodes = this.childNodes, i = 0; while (node = nodes[i++]) { if (node.nod...
ParentNode.lastElementChild - Web APIs
oved to ParentNode. This is a fairly technical change that shouldn't affect compatibility. Syntax const element = node.lastElementChild Example <ul id="foo"> <li>First (1)</li> <li>Second (2)</li> <li>Third (3)</li> </ul> <script> const foo = document.getElementById('foo'); console.log(foo.lastElementChild.textContent); // logs: Third (3) </script> Polyfill The code below adds sup
port of lastElementChild() to Document and DocumentFragment in Internet Explorer and Safari. // Overwrites native 'lastElementChild' prototype. // Returns array instead of HTMLCollection. ;(function(constructor) { if(constructor && constructor.prototype && constructor.prototype.lastElementChild == null) { Object.defineProperty(constructor.prototype, 'lastElementChild', { get: func...
ParentNode.querySelector() - Web APIs
the elements matching the selector list, use querySelectorAll() instead. Note: This method is implemented as Document.querySelector(), DocumentFragment.querySelector() and Element.querySelector(). Syntax element = parentNode.querySelector(selectors); Parameters selectors A DOMString containing one or more selectors to match against. This string must be a valid compound selector list sup
ported by the browser; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas. Note: Characters which are not part of standard CSS syntax must be escaped using a backslash character. Since JavaScript also uses backspace escaping, spe...
PasswordCredential - Web APIs
Syntax var myCredential = new PasswordCredential(passwordCredentialData) var myCredential = new PasswordCredential(HTMLFormElement) Parameters Either of the following: passwordCredentialData A PasswordCredentialData dictionary containing the following fields: iconURL: (Optional) the URL of a user's avatar image. id: The ID of the user signing in. name: (Optional) The name of the user signing in. password: The password of the user signing in. ...
PaymentAddress.city - Web APIs
The city read-only property of the PaymentAddress interface returns a string containing the city or town
portion of the address. Syntax var paymentCity = PaymentAddress.city; Value A DOMString indicating the city or town
portion of the address described by the PaymentAddress object. Specifications Specification Status Comment Payment Request APIThe definition of 'PaymentAddress.city' in that specification. Candidate Recommendation Initial definition. ...
PaymentAddress.dependentLocality - Web APIs
The read-only dependentLocality property of the PaymentAddress interface is a string containing a sublocality designation within a city, such as a neighborhood, borough, district, or, in the United Kingdom, a dependent locality. Also known as a post town. Syntax var paymentDependentLocality = PaymentAddress.dependentLocality; Value A DOMString indicating the sublocality
portion of the address. This may be an empty string if no sublocality is available or required. It's used to provide disambiguation when a city may include areas that duplicate street names A sublocality is an area within a city, such as a neighborhood, borough, or district. In the United Kingdom, this is used to indicate the post town in the United Kingdom (known officially by the Royal Mail as the dependent locality). ...
PaymentAddress.postalCode - Web APIs
The postalCode read-only property of the PaymentAddress interface returns a string containing a code used by a jurisdiction for mail routing, for example, the ZIP Code in the United States or the Postal Index Number (PIN code) in India. Syntax var paymentPostalCode = PaymentAddress.postalCode; Value A DOMString which contains the postal code
portion of the address. A postal code is a string (either numeric or alphanumeric) which is used by a postal service to optimize mail routing and delivery. Various countries use different terms for this. In most of the world, it's known as the "post code" or "postal code." In the United States, the ZIP code is used. India uses PIN codes. Specifications Specification Status Comment Payment Request APIThe definition of 'Paymen...
PaymentAddress.sortingCode - Web APIs
The sortingCode read-only property of the PaymentAddress interface returns a string containing a postal sorting code such as is used in France. Syntax var sortingCode = PaymentAddress.sortingCode; Value A DOMString containing the sorting code
portion of the address. Specifications Specification Status Comment Payment Request APIThe definition of 'PaymentAddress.sortingCode' in that specification. Candidate Recommendation Initial definition. ...
PaymentCurrencyAmount.value - Web APIs
ng containing the decimal numeric value of the payment, specified in the currency units indicated by the currency property. The contents of this string must be a valid decimal number; that is, some number of digits between 0 and 9 with up to one optional decimal point. An optional leading minus sign ("-") can be included to indicate a negative value, such as to represent a refund or discount. Im
portant note: The number given in this string is always specified using the period (".") as the decimal point, rather than the comma (","), even if the user's locale normally uses the comma. You must convert the entered text to this form or it will not be valid. Syntax value = paymentCurrencyAmount.value; Value A DOMString indicating the numeric value of the payment. This must be a valid decimal ...
PaymentMethodChangeEvent.methodName - Web APIs
The read-only methodName property of the PaymentMethodChangeEvent interface is a string which uniquely identifies the payment handler currently selected by the user. The payment handler may be a payment technology, such as Apple Pay or Android Pay, and each payment handler may sup
port multiple payment methods; changes to the payment method within the payment handler are described by the PaymentMethodChangeEvent. Syntax var methodName = paymentMethodChangeEvent.methodName; Value A DOMString which uniquely identifies the currently-selected payment handler. This may be a string chosen from the list of standardized payment method identifiers, or a URL used by the payment processing service. See Payment method identifiers in Payment Request API for more information. The default val...
PaymentRequest.shippingAddress - Web APIs
tRequest constructor. In the example below, the cost of shipping varies by geography. When the PaymentRequest.onshippingaddresschange is called, updateDetails() is called to update the details of the PaymentRequest, using shippingAddress to set the correct shipping cost. // Initialization of PaymentRequest arguments are excerpted for the sake of // brevity. var payment = new PaymentRequest(sup
portedInstruments, details, options); payment.addEventListener('shippingaddresschange', function(evt) { evt.updateWith(new Promise(function(resolve) { updateDetails(details, request.shippingAddress, resolve); })); }); payment.show().then(function(paymentResponse) { // Processing of paymentResponse exerpted for brevity. }).catch(function(err) { console.error("Uh oh, something bad happ...
PaymentRequest: shippingaddresschange event - Web APIs
ss or changes details of their shipping address. Bubbles No Cancelable No Interface PaymentRequestUpdateEvent Event handler property onshippingaddresschange Usage notes Depending on the browser, the shipping address information may be redacted for privacy reasons. That is, the PaymentAddress which contains the shipping address may have some
portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address). Example In this example, a handler for the shippingaddresschange event is set up to validate that the address meets requirements set by the web application. const paymentRequest = new Payme...
PaymentResponse.retry() - Web APIs
ere are any fields whose values are not acceptable, call the response's complete() method with a value of "fail" to indicate failure. If the response's data is valid and acceptable, call complete("success") to finalize the payment and proces it. If show() is rejected, the payment request failed, usually because either there's already one being processed, because the user agent doesn't sup
port any of the specified payment methods, or because of a security issue. See the list of exceptions for show() for further details. Call complete("fail") to close the payment request. async function handlePayment() { const payRequest = new PaymentRequest(methodData, details, options); try { let payResponse = await payRequest.show(); while (payResponse has errors) { /* let the u...
Payment Request API - Web APIs
hant hopefully without requiring a HTML form. Advantages of using the Payment Request API with "basic-card" (card-based payments): Fast purchase experience: Users enter their details once into the browser and are then ready to pay for goods and services on the web. They no longer have to fill out the same details repeatedly across different sites. Consistent experience on every site (that sup
ports the API): As the payment sheet is controlled by the browser, it can tailor the experience to the user. This can include localizing the UI into the user's preferred language. Accessibility: As the browser controls the input elements of the payment sheet, it can assure consistent keyboard and screen reader accessibility on every website without developers needing to do anything. A browser could a...
performance.getEntries() - Web APIs
orkers. Syntax General syntax: entries = window.performance.getEntries(); Return value entries An array of PerformanceEntry objects. The items will be in chronological order based on the entries' startTime. Example function use_PerformanceEntry_methods() { console.log("PerformanceEntry tests ..."); if (performance.mark === undefined) { console.log("... ...
performance.getEntriesByName() - Web APIs
gument is not specified, only the name will be used to determine the entries to return. The items will be in chronological order based on the entries' startTime. If no objects meet the specified criteria, an empty list is returned. Example function use_PerformanceEntry_methods() { log("PerformanceEntry tests ..."); if (performance.mark === undefined) { log("... ...
performance.getEntriesByType() - Web APIs
list of PerformanceEntry objects that have the specified type. The items will be in chronological order based on the entries' startTime. If no objects have the specified type, or no argument is provided, an empty list is returned. Example function usePerformanceEntryMethods() { log("PerformanceEntry tests ..."); if (performance.mark === undefined) { log("... ...
performance.now() - Web APIs
oints: In dedicated workers created from a Window context, the value in the worker will be lower than performance.now() in the window who spawned that worker. It used to be the same as t0 of the main context, but this was changed. In shared or service workers, the value in the worker might be higher than that of the main context because that window can be created after those workers. It's im
portant to keep in mind that to mitigate potential security threats such as Spectre, browsers typically round the returned value by some amount in order to be less predictable. This inherently introduces a degree of inaccuracy by limiting the resolution or precision of the timer. For example, Firefox rounds the returned time to 1 millisecond increments. The precision of the returned value is subject ...
PerformanceNavigationTiming - Web APIs
urns a timestamp that is the difference between the PerformanceNavigationTiming.loadEventEnd and PerformanceEntry.startTime properties. This interface also extends following PerformanceResourceTiming properties for navigation performance entry types by qualifying and constraining them as follows: PerformanceResourceTiming.initiatorTypeRead only Returns "navigation". The interface also sup
ports the following properties: PerformanceNavigationTiming.domComplete Read only A DOMHighResTimeStamp representing a time value equal to the time immediately before the browser sets the current document readiness of the current document to complete. PerformanceNavigationTiming.domContentLoadedEventEnd Read only A DOMHighResTimeStamp representing the time value equal to the time immediately a...
PerformanceObserverEntryList.getEntries() - Web APIs
s dictionary, having the following fields: "name", the name of a performance entry. "entryType", the entry type. The valid entry types are listed in the PerformanceEntry.entryType method. "initiatorType", the type of the initiating resource (for example an HTML element). The values are defined by the PerformanceResourceTiming.initiatorType interface. This parameter is currently not sup
ported on Chrome or Opera. Return value A list of explicitly observed PerformanceEntry objects that meets the criteria of the filter. The items will be in chronological order based on the entries' startTime. If no objects that meet the filter are found, an empty list is returned. If no argument is given, all entries are returned. Example function print_perf_entry(pe) { console.log("name: " ...
PerformancePaintTiming - Web APIs
The time to first-contentful-paint was 2787.460 milliseconds. Specifications Specification Status Comment Paint TimingThe definition of 'PerformancePaintTiming' in that specification. Working Draft Initial definition. ...
PerformanceResourceTiming.domainLookupStart - Web APIs
d properties properties = ["connectStart", "connectEnd", "domainLookupStart", "domainLookupEnd", "fetchStart", "redirectStart", "redirectEnd", "requestStart", "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'domainLookupStart' in that specification.
PerformanceResourceTiming.secureConnectionStart - Web APIs
d properties properties = ["connectStart", "connectEnd", "domainLookupStart", "domainLookupEnd", "fetchStart", "redirectStart", "redirectEnd", "requestStart", "responseStart", "responseEnd", "secureConnectionStart"]; for (var i=0; i < properties.length; i++) { // check each property var sup
ported = properties[i] in perfEntry; if (sup
ported) { var value = perfEntry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = NOT sup
ported"); } } } Specifications Specification Status Comment Resource Timing Level 1The definition of 'secureConnectionStart' in that specificat...
PerformanceTiming.connectEnd - Web APIs
This interface of this property is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. The legacy PerformanceTiming.connectEnd read-only property returns an unsigned long long representing the moment, in miliseconds since the UNIX epoch, where the connection is opened network. If the trans
port layer re
ports an error and the connection establishment is started again, the last connection establisment end time is given. If a persistent connection is used, the value will be the same as PerformanceTiming.fetchStart. A connection is considered as opened when all secure connection handshake, or SOCKS authentication, is terminated. Syntax time = performanceTiming.connectEnd; Specifications Specification Status ...
PerformanceTiming.connectStart - Web APIs
This interface of this property is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. The legacy PerformanceTiming.connectStart read-only property returns an unsigned long long representing the moment, in miliseconds since the UNIX epoch, where the request to open a connection is sent to the network. If the trans
port layer re
ports an error and the connection establishment is started again, the last connection establisment start time is given. If a persistent connection is used, the value will be the same as PerformanceTiming.fetchStart. Syntax time = performanceTiming.connectStart; Specifications Specification Status Comment Navigation TimingThe definition of 'PerformanceTiming.connectStart' i...
PerformanceTiming.requestStart - Web APIs
s property is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. The legacy PerformanceTiming.requestStart read-only property returns an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the browser sent the request to obtain the actual document, from the server or from a cache. If the trans
port layer fails after the start of the request and the connection is reopened, this property will be set to the time corresponding to the new request. Syntax time = performanceTiming.requestStart; Specifications Specification Status Comment Navigation TimingThe definition of 'PerformanceTiming.requestStart' in that specification. Recommendation Initial definition. ...
Using the Performance API - Web APIs
he Performance object is done via the toJSON() method. In the following example, JSON serialization for the Performance, Performance.timing and Performance.navigation objects is printed in the object element. ...
Permissions API - Web APIs
ission-related tasks, for example querying a permission using the Permissions.query() method to return a promise that resolves with the PermissionStatus for a specific API. Not all APIs' permission statuses can be queried using the Permissions API. Notable APIs that are Permissions-aware include: Clipboard API Notifications API Push API Web MIDI API More APIs will gain Permissions API sup
port over time. Examples We have made a simple example available called Location Finder. You can run the example live, or view the source code on Github. Read more about how it works in our article Using the Permissions API. Interfaces Navigator.permissions and WorkerNavigator.permissions Read only Provides access to the Permissions object from the main context and worker context respectively...
Plugin - Web APIs
es of Plugin objects are no longer enumerable in the latest browser versions. Properties Plugin.description Read only A human readable description of the plugin. Plugin.filename Read only The filename of the plugin file. Plugin.name Read only The name of the plugin. Plugin.version Read only The plugin's version number string. Methods Plugin.item Returns the MIME type of a sup
ported content type, given the index number into a list of sup
ported types. Plugin.namedItem Returns the MIME type of a sup
ported item. Specifications Specification Status Comment HTML Living StandardThe definition of 'Plugin' in that specification. Living Standard Initial definition. ...
PluginArray - Web APIs
Note: Own properties of PluginArray objects are no longer enumerable in the latest browser versions. Properties PluginArray.lengthRead only The number of plugins in the array. ...
PointerEvent.height - Web APIs
The height read-only property of the PointerEvent interface represents the height of the pointer's contact geometry, along the y-axis (in CSS pixels). Depending on the source of the pointer device (for example a finger), for a given pointer, each event may produce a different value. If the input hardware cannot re
port the contact geometry to the browser, the height defaults to 1. Syntax var contactHeight = pointerEvent.height; Return value contactHeight The height of the event's contact area (in CSS pixels). Example An example of this property is included in the PointerEvent.width example. Specifications Specification Status Comment Pointer Events - Level 2The definition of 'height' in that specification. Recommendation Non-stable version. ...
PointerEvent.isPrimary - Web APIs
The isPrimary read-only property of the PointerEvent interface indicates whether or not the pointer device that created the event is the primary pointer. It returns true if the pointer that caused the event to be fired is the primary device and returns false otherwise. In a multi-pointer scenario (such as a touch screen that sup
ports more than one touch point), this property is used to identify a master pointer among the set of active pointers for each pointer type. Only a primary pointer will produce compatibility mouse events. Authors who desire only single-pointer interaction can achieve that by ignoring non-primary pointers. A pointer is considered primary if the pointer represents a mouse device. A pointer representing pen input is considered the primary pen input if its pointerdown ev...
PointerEvent.pressure - Web APIs
read-only property of the PointerEvent interface indicates the normalized pressure of the pointer input. Syntax var pressure = pointerEvent.pressure; Return value pressure The normalized pressure of the pointer input in the range of 0 to 1, inclusive, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively. For hardware that does not sup
port pressure, such as a mouse, the value is 0.5 when the pointer is active buttons state and 0 otherwise. Example In this snippet, when a pointerdown event is fired, different functions are called depending on the value of the event's pressure property. someElement.addEventListener('pointerdown', function(event) { if (event.pressure == 0) { // No pressure process_no_pressure(event); }...
PointerEvent.tangentialPressure - Web APIs
interface represents the normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress). Syntax var tanPressure = pointerEvent.tangentialPressure; Return value A float representing the normalized tangential pressure of the pointer input in the range -1 to 1, inclusive, where 0 is the neutral position of the control. Note that some hardware may only sup
port positive values in the range 0 to 1. For hardware that does not sup
port tangential pressure, the value will be 0. Example In this snippet, when a pointerdown event is fired, different functions are called depending on the value of the event's tangentialPressure property. someElement.addEventListener('pointerdown', function(event) { if (event.tangentialPressure == 0) { // No pressure ...
PointerEvent.tiltX - Web APIs
ty is typically only useful for a pen/stylus pointer type. For an illustration of this property see Figure 2 in the specification. Syntax var tiltX = pointerEvent.tiltX; Return value tiltX The angle in degrees between the Y-Z plane of the pointer (stylus) and the screen. The range of values is -90 to 90, inclusive, where a positive value is a tilt to the right. For devices that do not sup
port this property, the value is 0. Example This example illustrates simple accessing of the tiltX and tiltY properties. someElement.addEventListener("pointerdown", function(event) { process_tilt(event.tiltX, event.tiltY); }, false); Specifications Specification Status Comment Pointer Events - Level 2The definition of 'tiltX' in that specification. Recommendation ...
PointerEvent.tiltY - Web APIs
typically only useful for a pen/stylus pointer type. For an illustration of this property, see Figure 3 in the specification. Syntax var tiltY = pointerEvent.tiltY; Return value tiltY The angle in degrees between the X-Z plane of the pointer (stylus) and the screen. The range of values is -90 to 90, inclusive, where a positive value is a tilt towards the user. For devices that do not sup
port this property, the value is 0. Example This example illustrates simple accessing of the tiltX and tiltY properties. someElement.addEventListener("pointerdown", function(event) { process_tilt(event.tiltX, event.tiltY); }, false); Specifications Specification Status Comment Pointer Events - Level 2The definition of 'tiltY' in that specification. Recommendation ...
PointerEvent.twist - Web APIs
The twist read-only property of the PointerEvent interface represents the clockwise rotation of the pointer (e.g., pen stylus) around its major axis, in degrees. Syntax var twist = pointerEvent.twist; Return value A long value representing the amount of twist, in degrees, applied to the transducer (pointer). The value is in the range 0 to 359, inclusive. For devices that do not re
port twist, the value is 0. Example When a pointerdown event is fired, different functions are called depending on the value of the event's twist property. someElement.addEventListener('pointerdown', function(event) { if (event.twist == 0) { // No twist process_no_twist(event); } else { // Default process_twist(event); } }, false); Specifications Specification Status Co...
PointerEvent.width - Web APIs
The width read-only property of the PointerEvent interface represents the width of the pointer's contact geometry along the x-axis, measured in CSS pixels. Depending on the source of the pointer device (such as a finger), for a given pointer, each event may produce a different value. If the input hardware cannot re
port the contact geometry to the browser, the width defaults to 1. Syntax var contactWidth = pointerEvent.width; Return value contactWidth The width of the event's contact area (in CSS pixels). Example This example illustrates using the PointerEvent interface's width and height properties to calculate the contact area. target.addEventListener("pointerdown", function(ev) { // Calculate the contact area var area = ev.width * ev.height; }, false); Specifications ...
Pointer Lock API - Web APIs
It gives you access to raw mouse movement, locks the target of mouse events to a single element, eliminates limits on how far mouse movement can go in a single direction, and removes the cursor from view. It is ideal for first person 3D games, for example. ...
PromiseRejectionEvent() - Web APIs
It also becomes easier to write a global handler for errors. There are two types of PromiseRejectionEvent: unhandledrejection is sent by the JavaScript runtime when a promise is rejected but the rejection goes unhandled. ...
Proximity Events - Web APIs
andy way to know when a user is close to a device. These events make it possible to react to such a change, for example by shutting down the screen of a smartphone when the user is having a phone call with the device close to their ear. Note: Obviously, the API requires the device to have a proximity sensor, which are mostly available only on mobile devices. Devices without such a sensor may sup
port those events but will never fire them. Proximity Events When the device proximity sensor detects a change between the device and an object, it notifies the browser of that change. When the browser gets such a notification, it fires a DeviceProximityEvent for any change, and a UserProximityEvent event in the case of a more rough change. This event can be captured at the window object level by ...
PublicKeyCredential.getClientExtensionResults() - Web APIs
ublicKeyCredential.getClientExtensionResults() Parameters None. Return value An ArrayBuffer containing the result of the processing of the different extensions by the client. This object contains a map between the extensions' identifiers and their results from the processing. Warning! As of March 2019, only appId (used during creation with PublicKeyCredentialRequestOptions.extensions) is sup
ported by Chrome and Edge. Firefox does not seem to sup
port any extension. Examples var publicKey = { // Here are the extensions (as "inputs") extensions: { "loc": true, // This extension has been defined to include location information in attestation "uvi": true // user verification index: how the user was verified }, challenge: new Uint8Array(16) /* from the server */, rp: { ...
PublicKeyCredentialCreationOptions.attestation - Web APIs
The attestation is a mean for the relying party to verify the origin of the authenticator with an attestation certificate authority. The information contained in the attestation may thus disclose some information about the user (e.g. which device they are using). ...
PublicKeyCredentialCreationOptions.excludeCredentials - Web APIs
An Array whose elements are objects with the following properties: type A string describing type of public-key credential to be created. As of this writing (March 2019), only "public-key" may be used. id A BufferSource matching an existing public key credential identifier (PublicKeyCredential.rawId). This identifier is generated during the creation of the PublicKeyCredential instance. trans
ports Optional An Array of strings describing the possible trans
ports between the client and the authenticator. The value of the strings may be: "usb": the authenticator can be contacted via a removable USB link "nfc": the authenticator may be used over NFC (Near Field Communication) "ble": the authenticator may be used over BLE (Bluetooth Low Energy) "internal": the authenticator is specif...
PublicKeyCredentialCreationOptions - Web APIs
lic key credentials for an existing user who already have some. PublicKeyCredentialCreationOptions.authenticatorSelection Optional An object whose properties are criteria used to filter out the potential authenticators for the creation operation. PublicKeyCredentialCreationOptions.attestation Optional A String which indicates how the attestation (for the authenticator's origin) should be trans
ported. PublicKeyCredentialCreationOptions.extensions Optional An object with several client extensions' inputs. Those extensions are used to request additional processing (e.g. dealing with legacy FIDO APIs credentials, prompting a specific text on the authenticator, etc.). Methods None. Examples // some examples of COSE algorithms const cose_alg_ECDSA_w_SHA256 = -7; const cose_alg_ECDSA_w_SHA...
PublicKeyCredentialRequestOptions.extensions - Web APIs
sts for the creation operation (navigators.credentials.create()), see PublicKeyCredentialCreationOptions.extensions. Syntax extensions = publicKeyCredentialRequestOptions.extensions Value An object with various keys and values. Here is the current (as of March 2019) list of potential extensions which may be used during the registration operation. Warning! As of June 2020, only appid is sup
ported by Chrome and Edge. Firefox does not seem to sup
port any extension. Also Chrome doesn't plan to sup
port any other extension in future Extension identifier Type Description appid USVString FIDO appID. An appID which was used with legacy FIDO JS APIs to identify the current relying party. txAuthSimple USVString Simple transaction authorization. T...
PushManager.subscribe() - Web APIs
console.log(pushSubscription.endpoint); // The push subscription details needed by the application // server are now available, and can be sent to it using, // for example, an XMLHttpRequest. }, function(error) { // During development it often helps to log errors to the // console. In a production environment it might make sense to // also re
port information about errors back to the // application server. console.log(error); } ); }); Responding to user gestures subscribe() calls should be done in response to a user gesture, such as clicking a button, for example: btn.addEventListener('click', function() { serviceWorkerRegistration.pushManager.subscribe(options) .then(function(pushSubscription) { // h...
PushMessageData - Web APIs
uffer object. PushMessageData.blob() Extracts the data as a Blob object. PushMessageData.json() Extracts the data as a JSON object. PushMessageData.text() Extracts the data as a plain text string. Examples self.addEventListener('push', function(event) { var obj = event.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') { fireNotification(obj, event);
port.postMessage(obj); } else if(obj.action === 'init' || obj.action === 'chatMsg') {
port.postMessage(obj); } }); Specifications Specification Status Comment Push APIThe definition of 'PushMessageData' in that specification. Working Draft Initial definition. ...
Web Push API Notifications best practices - Web APIs
elopers and marketers are using to get attention for their sites. Searching the web for "web push notifications," you'll find articles from marketing experts who believe you should use push to re-engage people who have left your site so they can complete a purchase, or be sent the latest news, or receive links to recommended products. The dark side Their novelty provides a new and unexploited op
portunity for enterprising sites to reach potential customers. Has the customer switched tabs to answer an email? Win them back with an expiring offer of free shipping that they can't ignore! But really, is this the best use of push notifications? Or is it a new iteration on the old and tired pop-up ad? "Web push doesn't risk ending up in the spam folder. Nor can it be blocked by ad blockers. It sh...
Push API - Web APIs
pplications the ability to receive messages pushed to them from a server, whether or not the web app is in the foreground, or even currently loaded, on a user agent. This lets developers deliver asynchronous notifications and updates to users that opt in, resulting in better engagement with timely new content. Push concepts and usage When implementing PushManager subscriptions, it is vitally im
portant that you protect against CSRF/XSRF issues in your app. See the following articles for more information: Cross-Site Request Forgery (CSRF) Prevention Cheat Sheet Preventing CSRF and XSRF Attacks For an app to receive push messages, it has to have an active service worker. When the service worker is active, it can subscribe to push notifications, using PushManager.subscribe(). The result...
RTCConfiguration.certificates - Web APIs
ficates for use by an RTCPeerConnection instead of having the RTCPeerConnection generate them automatically, you do so by calling the static RTCPeerConnection.generateCertificate() function. The certificates property's value cannot be changed once it's first specified. If it's included in the configuration passed into a call to a connection's setConfiguration(), it is ignored. This attribute sup
ports providing multiple certificates because even though a given DTLS connection uses only one certificate, providing multiple certificates allows sup
port for multiple encryption algorithms. The implementation of RTCPeerConnection will choose which certificate to use based on the algorithms it and the remote peer sup
port, as determined during DTLS handshake. If you don't provide certificates, new on...
RTCDTMFSender - Web APIs
The RTCDTMFSender interface provides a mechanism for transmitting DTMF codes on a WebRTC RTCPeerConnection. You gain access to the connection's RTCDTMFSender through the RTCRtpSender.dtmf property on the audio track you wish to send DTMF with. The primary purpose for WebRTC's DTMF sup
port is to allow WebRTC-based communication clients to be connected to a public-switched telephone network (PSTN) or other legacy telephone service, including extant voice over IP (VoIP) services. For that reason, DTMF can't be used between two WebRTC-based devices, because there is no mechanism provided by WebRTC for receiving DTMF codes. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"...
RTCDTMFToneChangeEvent - Web APIs
ifying the tone which has begun playing, or an empty string ("") if the previous tone has finished playing. Constructors RTCDTMFToneChangeEvent() Returns a new RTCDTMFToneChangeEvent. It takes two parameters, the first being a DOMString representing the type of the event (always "tonechange"); the second a dictionary containing the initial state of the properties of the event. Methods Sup
ports the methods defined in Event. There are no additional methods. Examples This snippet is derived loosely from the full, working example you'll find in When a tone finishes playing in Using DTMF with WebRTC. It appends each tone to a display box as it's played, and, once all tones have been sent, re-enabled a previously-disabled "Send" button, allowing the next DMTF string to be entered. dtmfSe...
RTCDataChannel.close() - Web APIs
ng the connection is handled asynchronously; you can detect when the channel has finished closing by watching for a close event on the data channel. The sequence of events which occurs in response to this method being called: RTCDataChannel.readyState is set to "closing". A background task is established to handle the remainder of the steps below, and close() returns to the caller. The trans
port layer deals with any buffered messages; the protocol layer decides whether to send them or discard them. The underlying data trans
port is closed. The RTCDataChannel.readyState property is set to "closed". If the trans
port was closed with an error, the RTCDataChannel is sent a NetworkError event. A close event is sent to the channel. In Firefox, the RTCDataChannel interface was implemented ...
RTCDataChannel: close event - Web APIs
Before any further data can be transferred using RTCDataChannel, a new data channel instance must be created. Bubbles No Cancelable No Interface Event Event handler property RTCDataChannel.onclose Examples This example sets up a handler for the close event for the RTCDataChannel named dc; its responsibility in this example is to update user interface elements to reflect that there is no longer an ongoing call, and to allow a new call to be started. ...
RTCDataChannel.onclosing - Web APIs
The RTCDataChannel.onclosing property is an EventHandler which specifies a function to be called by the browser when the closing event is received by the RTCDataChannel. This is a simple Event which indicates that the data channel is being closed, that is, RTCDataChannel transitions to "closing" state. For example, after RTCDataChannel.close() was called but the underlying data trans
port might not have been closed yet. Syntax RTCDataChannel.onclosing = function; Value A function which the browser will call to handle the closing event. The function receives as its sole input parameter the event itself, as an object of type Event. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCDataChannel...
RTCDataChannel.onopen - Web APIs
Syntax RTCDataChannel.onopen = function; Value A function which the browser will call to handle the open event. The function receives as its only input parameter the event itself, of type Event. ...
RTCDataChannel: open event - Web APIs
Bubbles No Cancelable No Interface RTCDataChannelEvent Event handler property onopen Examples This example adds to the RTCDataChannel dc a handler for the open event that adjusts the user interface to indicate that a chat window is ready to be used after a connection has been established. It enables the message input box and send button as well as enabling the disconnect button and disabling the connect button. ...
RTCDataChannel.stream - Web APIs
65,535) which uniquely identifies the RTCDataChannel. This ID is set at the time the data channel is created, either by the user agent (if RTCDataChannel.negotiated is false) or by the site or app script (if negotiated is true). This property has been replaced with the RTCDataChannel.id property. If you have code that uses stream, you will need to update, since browsers have begun to remove sup
port for stream. Syntax var stream = aDataChannel.stream; Value An unsigned short value (that is, an integer between 0 and 65,535) which uniquely identifies the data channel. Example var dataChannel = pc.createDataChannel("SampleChannel"); console.log("Data channel stream ID: " + dataChannel.stream); ...
RTCIceCandidate.RTCIceCandidate() - Web APIs
IceCandidate. If any of the fields is invalid, parsing of the string silently aborts without throwing an exception. The default value of candidate is the empty string, which indicates that the candidate is an "end-of-candidates" message. The following fields are initialized to null if they are not included in the RTCIceCandidate.candidate property: foundation, component, priority , ip, protocol,
port, type, tcpType, relatedAddress, and related
Port. Note: Parsing of the candidate string is performed using the candidate-attribute grammar from the WebRTC Specification. Exceptions TypeError The specified RTCIceCandidateInit has values of null in both the sdpMid and sdpMLineIndex properties. Usage notes This constructor does not do complete validation of the specified candidateInfo obj...
RTCIceCandidate.candidate - Web APIs
rity, all else being equal. In the example above, the priority is 2043278322. The attributes are all separated by a single space character, and are in a specific order. The complete list of attributes for this example candidate is: foundation = 4234997325 component = "rtp" (the number 1 is encoded to this string; 2 becomes "rtcp") protocol = "udp" priority = 2043278322 ip = "192.168.0.56"
port = 44323 type = "host" Example In this example, we see a function which receives as input an SDP string containing an ICE candidate received from the remote peer during the signaling process. function handleNewIceCandidate(candidateSDP) { var candidateObj = new RTCIceCandidate(candidateSDP); myPeerConnection.addIceCandidate(candidateObj).catch({ /* handle the error thrown by addIceCa...
RTCIceCandidate.component - Web APIs
Syntax var component = RTCIceCandidate.component; Value A DOMString which is "rtp" for RTP (or RTP and RTCP multiplexed together) candidates or "rtcp" for RTCP candidates. ...
RTCIceCandidate.tcpType - Web APIs
ate type. The tcpType field's value is set when the RTCIceCandidate() constructor is used. You can't directly set its value; instead, its value is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var tcpType = RTCIceCandidate.tcpType; Value A DOMString whose value is one of those defined by the RTCIceTcpCandidateType enumerated type. "active" The trans
port will try to open an outbound connection but won't receive inoming connection requests. "passive" The trans
port will receive incoming connection requests but won't try to open an outbound connection. "so" The trans
port will try to open a connection simultaneously with its peer. tcpType is null for UDP candidates. Example In this example, the candidate's protocol and tcpType are used to adj...
RTCIceCandidateInit.candidate - Web APIs
rity, all else being equal. In the example above, the priority is 2043278322. The attributes are all separated by a single space character, and are in a specific order. The complete list of attributes for this example candidate is: foundation = 4234997325 component = "rtp" (the number 1 is encoded to this string; 2 becomes "rtcp") protocol = "udp" priority = 2043278322 ip = "192.168.0.56"
port = 44323 type = "host" Example When a new ICE candidate is received by your signaling code from the remote peer, you need to construct the RTCIceCandidate object that encapsulates it. This is done in the event handler for the icecandidate event. If your client-side signaling layer builds and transmits a JSON string including the candidate to the remote peer, the remote peer might handle receiv...
RTCIceParameters - Web APIs
Properties usernameFragment A DOMString specifying the value of the ICE session's username fragment field, ufrag. ...
RTCIceRole - Web APIs
The RTCIceRole enumerated type lists the string values that identify whether a connection's ICE agent is serving as the controlling agent or the controlled agent, as indicated by RTCIceTrans
port.role. You can learn more about ICE roles in Choosing a candidate pair in WebRTC connectivity. Values "controlling" The RTCIceTrans
port object is serving as the controlling agent. "controlled" The trans
port is the controlled agent. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceRole' in that specification. Candidate Recommendation Initial definition. ...
RTCIceServer.url - Web APIs
The obsolete RTCIceServer dictionary's url property specifies the URL of a single ICE server to be used while negotiating connections. It was removed from the specification in June 2013 but is still broadly used in older examples and books, so we include documentation here to help adapt old code to new browsers. This property has been removed from the specification; while it's still sup
ported by many browsers, it should no longer be used. You should instead use the newer urls property, which allows you to optionally specify multiple URLs for the server. Try to update any existing code to use that property instead. Syntax var iceServer = { ... url = iceServerUrl, ... }; var serverUrl = iceServer.url; iceServer.u...
RTCInboundRtpStreamStats.nackCount - Web APIs
The nackCount property of the RTCInboundRtpStreamStats dictionary is a numeric value indicating the number of times the receiver sent a NACK packet to the sender. A NACK (Negative ACKnowledgement, also called "Generic NACK") packet tells the sender that one or more of the RTP packets it sent were lost in trans
port. Syntax var nackCount = rtcInboundRtpStreamStats.nackCount; Value An integer value indicating how many times the receiver sent a NACK packet to the sender after detecting that one or more packets were lost during trans
port. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats.nackCount' in that specification. Candidate Recommendation Initial definition. ...
RTCInboundRtpStreamStats.qpSum - Web APIs
Quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. This value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. The quantization process and the amount of compression can be controlled using one or more parameters. It's im
portant to keep in mind that the value of QP can change periodically--even every frame--so it's difficult to know for certain how substantial the compression is. The best you can do is make an estimate. You can, for example, use the value of RTCReceivedRtpStreamStats.framesDecoded if receiving the media or RTCSentRtpStreamStats.framesEncoded if sending it to get the number of frames handled so far, an...
RTCOutboundRtpStreamStats.nackCount - Web APIs
The nackCount property of the RTCOutboundRtpStreamStats dictionary is a numeric value indicating the number of times the RTCRtpSender described by this object received a NACK packet from the remote receiver. A NACK (Negative ACKnowledgement, also called "Generic NACK") packet is used by the RTCRtpReceiver to inform the sender that one or more RTP packets it sent were lost in trans
port. Syntax var nackCount = RTCOutboundRtpStreamStats.nackCount; Value An integer value indicating how many times the sender received a NACK packet from the receiver, indicating the loss of one or more packets. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCOutboundRtpStreamStats.nackCount' in that specification. Candidate Rec...
RTCOutboundRtpStreamStats.qpSum - Web APIs
Quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. This value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. The quantization process and the amount of compression can be controlled using one or more parameters. It's im
portant to keep in mind that the value of QP can change periodically--even every frame--so it's difficult to know for certain how substantial the compression is. The best you can do is make an estimate. You can use the value of RTCSentRtpStreamStats.framesEncoded to get the number of frames that have been encoded so far, and compute an average from there. See Calculating average quantization below for...
RTCPeerConnection: addstream event - Web APIs
The obsolete addstream event is sent to an RTCPeerConnection when new media, in the form of a MediaStream object, has been added to it. Im
portant: This event has been removed from the WebRTC specification. You should instead watch for the track event, which is sent for each media track added to the RTCPeerConnection. Bubbles No Cancelable No Interface MediaStreamEvent Event handler property RTCPeerConnection.onaddstream You can, similarly, watch for streams to be removed from the connection by monitoring the removestream event. Examples This example looks to determine if the user's browser sup
ports the track event. If it does, a track event listener is set up; otherwise, an addstream event listener is set up. pc is an RTCPeerConne...
RTCPeerConnection.getConfiguration() - Web APIs
n object which indicates the current configuration of the RTCPeerConnection on which the method is called. The returned configuration is the last configuration applied via setConfiguration(), or if setConfiguration() hasn't been called, the configuration the RTCPeerConnection was constructed with. The configuration includes a list of the ICE servers used by the connection, information about trans
port policies, and identity information. Syntax var configuration = RTCPeerConnection.getConfiguration(); Parameters This method takes no input parameters. Return value An RTCConfiguration object describing the RTCPeerConnection's current configuration. Example This example adds a new certificate to an active connection if it doesn't already have one in use. let configuration = myPeerConnecti...
RTCPeerConnection.getStreamById() - Web APIs
ction.getStreamById() method returns the MediaStream with the given id that is associated with local or remote end of the connection. If no stream matches, it returns null. This property has been replaced with the RTCPeerConnection.getLocalStreams and RTCPeerConnection.getRemoteStreams properties. If you have code that uses stream, you will need to update, since browsers have begun to remove sup
port for stream. Syntax var mediaStream = pc.getStream(id); Parameters id Is a DOMString corresponding to the stream to return. Example var stream = pc.getStreamById(myTrackId); if (stream) { console.log("Found stream: " + stream.id); } Polyfill Running the following code before any other code will create RTCPeerConnection.prototype.getStreamById() if it's not natively available. // f...
RTCPeerConnection: icegatheringstatechange event - Web APIs
n when the state of the ICE candidate gathering process changes. This signifies that the value of the connection's iceGatheringState property has changed. When ICE firststarts to gather connection candidates, the value changes from new to gathering to indicate that the process of collecting candidate configurations for the connection has begun. When the value changes to complete, all of the trans
ports that make up the RTCPeerConnection have finished gathering ICE candidates. Bubbles No Cancelable No Interface Event Event handler onicegatheringstatechange Note: While you can determine that ICE candidate gathering is complete by watching for icegatheringstatechange events and checking for the value of iceGatheringState to become complete,...
RTCPeerConnection: icecandidateerror event - Web APIs
errors occur only when the connection's ICE gathering state is gathering. Example The following example establishes a handler for icecandidateerrors that occur on the RTCPeerConnection pc. This handler looks specifically for 701 errors that indicate that candidates couldn't reach the STUN or TURN server. When this happens, the server URL and the error message are passed to a function called re
portConnectFail() to log or output the connection failure. pc.addEventListener("icecandidateerror", (event) => { if (event.errorCode === 701) { re
portConnectFail(event.url, event.errorText); } }); Note that if multiple STUN and/or TURN servers are provided when creating the connection, this error may happen more than once, if more than one of those servers fails. Each provided server is tri...
RTCPeerConnection: identityresult event - Web APIs
An identityresult event is sent to an RTCPeerConnection object's onidentityresult event handler to inform it that an assertion has been generated by an associated identity provider (IdP) during the process of creating an SDP offer or answer. Note: While older versions of the WebRTC specification used events to re
port assertions, this has been deprecated and removed from the specification. Instead, the peerIdentity property returns a Promise that resolves with an identity or rejects if an error occurs or if unable to validate the identity. Bubbles No Cancelable No Interface RTCIdentityEvent Event handler property onidentityresult Specifications Specification Status Comment WebRTC 1.0: Real-time Communication ...
RTCPeerConnection.onaddstream - Web APIs
he RTCPeerConnection.onaddstream event handler is a property containing the code to execute when the addstream event, of type MediaStreamEvent, is received by this RTCPeerConnection. Such an event is sent when a MediaStream is added to this connection by the remote peer. The event is sent immediately after the call setRemoteDescription() and doesn't wait for the result of the SDP negotiation. Im
portant: This property has been removed from the specification; you should now use RTCPeerConnection.ontrack to watch for track events instead. It is included here in order to help you adapt existing code and understand existing samples, which may not be up-to-date yet. Syntax rtcPeerConnection.onaddstream = eventHandler; Value A function which handles addstream events. These events, of type Med...
RTCPeerConnection.onnegotiationneeded - Web APIs
a handler for negotiationneeded events to handle creating an offer, configuring the local end of the connection, and sending the offer to the remote peer. pc.onnegotiationneeded = function() { pc.createOffer().then(function(offer) { return pc.setLocalDescription(offer); }) .then(function() { // Send the offer to the remote peer through the signaling server }); }) .catch(re
portError); } First, it creates the offer by calling createOffer(). When that succeeds, the offer is passed into setLocalDescription() to set the local description for the connection. Once that's succeeded in turn, the offer can be sent to the signaling server for delivery to the remote peer. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication...
RTCPeerConnection: peeridentity event - Web APIs
sent to the connection concerned when peer identity has been set and verified on it. The new identiy can be access using the RTCPeerConnection.peerIdentity property. An event handler for this event can be added via the RTCPeerConnection.onpeeridentity property. Bubbles No Cancelable No Interface Event Event handler property onpeeridentity Im
portant: This event and its event handler have been removed from the specification and are no longer available. Instead of using this event to detect when an identity is available, simply wait for the Promise returned by RTCPeerConnection.peerIdentity to be resolved. Once resolved, its value is the new identity. Examples For the correct way to detect a new peer identity, see RTCPeerConnection.peerI...
RTCPeerConnection.removeTrack() - Web APIs
If the track is already stopped, or is not in the connection's senders list, this method has no effect. If the connection has already been negotiated (signalingState is set to "stable"), it is marked as needing to be negotiated again; the remote peer won't experience the change until this negotiation occurs. ...
RTCPeerConnection: removestream event - Web APIs
that a MediaStream had been removed from the connection. You can use the RTCPeerConnection interface's onremovestream property to set a handler for this event. This is the counterpart to the addstream event, which is also obsolete. Bubbles No Cancelable No Interface MediaStreamEvent Event handler property RTCPeerConnection.onremovestream Im
portant: This event has been removed from the WebRTC specification in favor of the existing removetrack event on the remote MediaStream and the corresponding MediaStream.onremovetrack event handler property of the remote MediaStream. The RTCPeerConnection API is now track-based, so having zero tracks in the remote stream is equivalent to the remote stream being removed, which caused a removestream eve...
RTCPeerConnection.sctp - Web APIs
The read-only sctp property on the RTCPeerConnection interface returns an RTCSctpTrans
port describing the SCTP trans
port over which SCTP data is being sent and received. If SCTP hasn't been negotiated, this value is null. The SCTP trans
port is used for transmitting and receiving data for any and all RTCDataChannels on the peer connection. Syntax var sctp = RTCPeerConnection.sctp; Value A RTCSctpTrans
port object describing the SCTP trans
port being used by the RTCPeerConnection for transmitting and receiving on its data channels, or null if SCTP negotiation hasn't happened. Example var pc = new RTCPeerConnection(); var channel = pc.createDataChannel("Mydata"); channel.onopen = function(event) { channel.send('sending a message'); } channel.onmessage = function(event) { console.log(...
RTCPeerConnection.setLocalDescription() - Web APIs
offer or answer The example below shows the implementation of a handler for the negotiationneeded event that explicitly creates an offer, rather than letting setLocalDescription() do it. async function handleNegotiationNeededEvent() { try { await offer = pc.createOffer(); pc.setLocalDescription(offer); signalRemotePeer({ description: pc.localDescription }); } catch(err) { re
portError(err); } } This begins by creating an offer by calling createOffer(); when that succeeds, we call setLocalDescription(). We can then send the newly-created offer along to the other peer using the signaling server, which here is done by calling a function called signalRemotePeer(). Specifications Specification Status Comment WebRTC 1.0: Real-time Communication ...
RTCPeerConnection.signalingState - Web APIs
it to the local peer, which has set the offer as the remote description by calling RTCPeerConnection.setRemoteDescription(). "have-local-pranswer" The offer sent by the remote peer has been applied and an answer has been created (usually by calling RTCPeerConnection.createAnswer()) and applied by calling RTCPeerConnection.setLocalDescription(). This provisional answer describes the sup
ported media formats and so forth, but may not have a complete set of ICE candidates included. Further candidates will be delivered separately later. "have-remote-pranswer" A provisional answer has been received and successfully applied in response to an offer previously sent and established by calling setLocalDescription(). "closed" The connection is closed. N...
RTCPeerConnectionIceErrorEvent.address - Web APIs
teerror events which creates human readable messages describing the local network interface for the connection as well as the ICE server that was being used to try to open the connection, then calls a function to display those as well as the event's errorText property's contents. pc.addEventListener("icecandidateerror", (event) => { let networkInfo = `[Local interface: ${event.address}:${event.
port}`; let iceServerInfo = `[ICE server: ${event.url}`; showMessage(errorText, iceServerInfo, networkInfo); }); Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCPeerConnectionIceErrorEvent.address' in that specification. Candidate Recommendation Initial definition. ...
RTCPeerConnectionIceErrorEvent - Web APIs
outside the range of valid STUN error codes. The 701 error is fired only once per server URL, and only while the is icegatheringstate is gathering. errorText Read only A DOMString containing the STUN reason text returned by the STUN or TURN server. If communication with the STUN or TURN server couldn't be established at all, this string will be a browser-specific string explaining the error.
port Read only An unsigned integer value giving the
port number over which communication with the STUN or TURN server is taking place, using the IP address given in address. null if the connection hasn't been established (that is, if address is null). url Read only A DOMString indicating the URL of the STUN or TURN server with which the error occurred. Methods RTCPeerConnectionIceErrorEvent ha...
RTCPeerConnectionIceEvent.candidate - Web APIs
ty of the RTCPeerConnectionIceEvent interface returns the RTCIceCandidate associated with the event. Syntax var candidate = event.candidate; Value An RTCIceCandidate object representing the ICE candidate that has been received, or null to indicate that there are no further candidates for this negotiation session. Example pc.onicecandidate = function( ev ) { alert("The ICE candidate (trans
port address: '" + ev.candidate.candidate + "') has been added to this connection."); } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCPeerConnectionIceEvent.candidate' in that specification. Candidate Recommendation Initial specification. ...
RTCPeerConnectionIceEvent - Web APIs
nIceEvent. It takes two parameters, the first being a DOMString representing the type of the event; the second a dictionary containing the RTCIceCandidate it refers to. Methods A RTCPeerConnectionIceEvent being an Event, this event also implements these properties. There is no specific RTCDataChannelEvent method. Examples pc.onicecandidate = function( ev ) { alert("The ICE candidate (trans
port address: '" + ev.candidate.candidate + "') has been added to this connection."); } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCPeerConnectionIceEvent' in that specification. Candidate Recommendation Initial definition. ...
RTCPeerConnection: idpvalidationerror event - Web APIs
target, a RTCPeerConnection object, that the identity provider (IdP) encountered an error when trying to validate an identity assertion. An event handler for this event can be added via the RTCPeerConnection.onidpvalidationerror property. Bubbles No Cancelable No Interface RTCIdentityErrorEvent Event handler property onidpvalidationerror Im
portant: This event is no longer used; it was removed from the specification long ago. Instead, you should watch for the RTCPeerConnection.peerIdentity promise to be rejected with an OperationError. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'idpvalidationerror' in that specification. Candidate Recomme...
RTCRemoteOutboundRtpStreamStats.remoteTimestamp - Web APIs
cally. Syntax let remoteTimestamp = rtcRemoteOutboundRtpStreamStats.remoteTimestamp; Value A DOMHighResTimeStamp value indicating the timestamp on the remote peer at which it sent these statistics. This is different from the value timestamp, which gives the time at which the statistics were generated or received by the local peer. If this property is present, it comes from the RTCP Sender Re
port (SR) block, which reflects the clock on the remote peer at the time the message was sent. Keep in mind that this means the clock may not be synchronized with the local clock, and that both the current time and the pace at which the clock runs may differ to some extent. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'R...
RTCRemoteOutboundRtpStreamStats - Web APIs
ization Source (SSRC). remoteTimestamp A DOMHighResTimeStamp specifying the timestamp (on the remote device) at which the statistics in the RTCRemoteOutboundRtpStreamStats object were sent by the remote endpoint. This is different from the timestamp found in the base RTCStats dictionary; it represents the time at which the object's statistics were received or generated by the local endpoint. re
portsSent An integer value indicating the total number of RTCP Sender Re
port (SR) blocks that this SSRC has sent. Usage notes The RTCRemoteOutboundRtpStreamStats object's remoteTimestamp proeprty provides statistics based on the received data's NTP timestamp taken from an RTCP Sender Re
port (SR) block. Be aware that the remote clock may not be synchronized with the local clock (either in current t...
RTCRtpCodecParameters - Web APIs
clockRate Optional An unsigned long integer value specifying the codec's clock rate in hertz (Hz). The clock rate is the rate at which the codec's RTP timestamp advances. Most codecs have specific values or ranges of values they permit; see the IANA payload format media type registry for details. channels Optional An unsigned short integer indicating the number of channels the codec should sup
port. For example, for audio codecs, a value of 1 specifies monaural sound while 2 indicates stereo. sdpFmtpLine Optional A DOMString containing the format-specific parameters field from the "a=fmtp" line in the codec's SDP, if one is present; see section 5.8 of the IETF specification for JSEP. Note: On an RTCRtpReceiver, the format-specific parameters come from the SDP sent by the remote peer, whi...
RTCRtpEncodingParameters.maxBitrate - Web APIs
xBitrate; Value An unsigned long integer value specifying the maximum bandwidth this encoding is permitted to use for a track of media it encodes in terms of bits per second. Other parameters may further reduce the bandwidth used by the track; for example, maxFramerate will, if set low enough, constrain the bandwidth as well. In addition, there's no guarantee that the network interface can sup
port the specified bandwidth, in which case the actual bandwidth will be lower. This value is computed using the standard Trans
port Independent Application Specific Maximum (TIAS) bandwidth as defined by RFC 3890, section 6.2.2; this is the maximum bandwidth needed without considering protocol overheads from IP, TCP or UDP, and so forth. Specifications Specification Status Comment ...
RTCRtpEncodingParameters - Web APIs
nsmission (a feature by which a phone is turned off or the microphone muted automatically in the absence of voice activity). The value is taken from the enumerated string type RTCDtxStatus. maxBitrate An unsigned long integer indicating the maximum number of bits per second to allow for this encoding. Other parameters may further constrain the bit rate, such as the value of maxFramerate or trans
port or physical network limitations. maxFramerate A double-precision floating-point value specifying the maximum number of frames per second to allow for this encoding. ptime An unsigned long integer value indicating the preferred duration of a media packet in milliseconds. This is typically only relevant for audio encodings. The user agent will try to match this as well as it can, but there is n...
RTCRtpParameters - Web APIs
The RTCRtpParameters dictionary is the basic object describing the parameters of an RTP trans
port. It is extended separately for senders and receivers in the form of the RTCRtpSendParameters and RTCRtpReceiveParameters dictionaries. To obtain the parameters of a sender or receiver, call its getParameters() method: getParameters() getParameters() Properties codecs An array of RTCRtpCodecParameters objects describing the set of codecs from which the sender or receiver will choose. This parameter cannot be changed once initially set. headerExtensions An array of zero or more RTP header extensions, each identifying an extension sup
ported by the sender or receiver. Header extensions are described in RFC 3550: 5.3.1. This parameter cannot be changed once initially set. rtcp An RTCRtc...
RTCRtpSendParameters.encodings - Web APIs
nsmission (a feature by which a phone is turned off or the microphone muted automatically in the absence of voice activity). The value is taken from the enumerated string type RTCDtxStatus. maxBitrate An unsigned long integer indicating the maximum number of bits per second to allow for this encoding. Other parameters may further constrain the bit rate, such as the value of maxFramerate or trans
port or physical network limitations. maxFramerate A double-precision floating-point value specifying the maximum number of frames per second to allow for this encoding. ptime An unsigned long integer value indicating the preferred duration of a media packet in milliseconds. This is typically only relevant for audio encodings. The user agent will try to match this as well as it can, but there is n...
RTCRtpSender.dtmf - Web APIs
ns a RTCDTMFSender object which can be used to send DTMF tones over the RTCPeerConnection . See Using DTMF for details on how to make use of the returned RTCDTMFSender object. Syntax var dtmfSender = RTCRtpSender.dtmf; Value An RTCDTMFSender which can be used to send DTMF over the RTP session, or null if the track being carried by the RTP session or the RTCPeerConnection as a whole doesn't sup
port DTMF. Only audio tracks can sup
port DTMF, and typically only one audio track per RTCPeerConnection will have an associated RTCDTMFSender Example tbd Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpSender.dtmf' in that specification. Candidate Recommendation ...
RTCRtpSender.getStats() - Web APIs
The RTCRtpSender method getStats() asynchronously requests an RTCStatsRe
port object which provides statistics about outgoing traffic on the RTCPeerConnection which owns the sender, returning a Promise which is fulfilled when the results are available. Syntax var promise = RTCRtpSender.getStats(); Return value A JavaScript Promise which is fulfilled once the statistics are available. The promise's fulfillment handler receives as a parameter a RTCStatsRe
port object containing the collected statistics. The returned RTCStatsRe
port accumulates the statistics for all of the streams being sent using the RTCRtpSender, as well as the statistics for any dependencies those streams have. Example This simple example obtains the statistics for an RTCRtpSender and updates an element's innerText to d...
RTCRtpSender.setStreams() - Web APIs
of the streams, renegotiation of the connection will be triggered by the negotiationneeded event being dispatched to the RTCPeerConnection to which the sender belongs. Example This example adds all of an RTCPeerConnection's tracks to the specified stream. function addTracksToStream(stream) { let senders = pc.getSenders(); senders.forEach((sender) => { if (sender.track && (sender.trans
port.state === connected)) { sender.setStreams(stream); } }); } After calling the RTCPeerConnection method getSenders() to get the list of the connection's senders, the addTracksToStream() function iterates over the list. For each sender, if the sender's track is non-null and its trans
port's state is connected, we call setStreams() to add the track to the stream specified. Specification...
RTCRtpStreamStats.nackCount - Web APIs
The nackCount property of the RTCRtpStreamStats dictionary is a numeric value indicating the number of times the receiver sent a NACK packet to the sender. A NACK (Negative ACKnowledgement, also called "Generic NACK") packet tells the sender that one or more of the RTP packets it sent were lost in trans
port. Syntax var nackCount = RTCRtpStreamStats.nackCount; Value An integer value indicating how many times the receiver sent a NACK packet to the sender after detecting that one or more packets were lost during trans
port. Note: This value is only available on the receiver. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats: nackCount' in that specification. Candidate Recommendation ...
RTCRtpStreamStats.qpSum - Web APIs
Quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. This value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. The quantization process and the amount of compression can be controlled using one or more parameters. It's im
portant to keep in mind that the value of QP can change periodically--even every frame--so it's difficult to know for certain how substantial the compression is. The best you can do is make an estimate. You can, for example, use the value of RTCReceivedRtpStreamStats.framesDecoded if receiving the media or RTCSentRtpStreamStats.framesEncoded if sending it to get the number of frames handled so far, an...
RTCRtpStreamStats.ssrc - Web APIs
The RTCRtpStreamStats dictionary's ssrc property provides the Synchronization Source (SSRC), an integer which uniquely identifies the source of the RTP packets whose statistics are covered by the RTCStatsRe
port that includes this RTCRtpStreamStats dictionary. Syntax var ssrc = RTCRtpStreamStats.ssrc; Value The Synchronization Source (SSRC) is a 32-bit integer uniquely identifying the source of the RTP packets whose statistics are covered by the RTCStatsRe
port object of which this RTCRtpStreamStats object is a component. The manner in which these values are generated is not mandated by the specification, although it does make recommendations. You should not make any assumptions based on the value of ssrc other than that any two objects with the same ssrc value refer to the same source. Se...
RTCRtpStreamStats.trackId - Web APIs
ch uniquely identifies the RTCMediaStreamTrackStats object which contains the track statistics for the MediaStreamTrack for which statistics are provided in this object. Syntax var trackID = RTCRtpStreamStats.trackId; Value A DOMString which uniquely identifies the RTCMediaStreamTrackStats object that provides statistics for the track for which statistics are being collected by this RTCStatsRe
port. Note: This value is not the same as the value of MediaStramTrack.id. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCRtpStreamStats.trackId' in that specification. Candidate Recommendation Initial definition. ...
RTCRtpSynchronizationSource - Web APIs
ved. While the published specification describes this as an interface, it has since been changed to a dictionary in follow-up drafts. Properties Also implements the properties of RTCRtpContributingSource. voiceActivityFlag Optional A Boolean value indicating whether or not voice activity is included in the last RTP packet played from the source. If the peer has indicated that it's not sup
porting voice activity detection, this field is not provided. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpSynchronizationSource' in that specification. Candidate Recommendation Initial definition. ...
RTCRtpTransceiver - Web APIs
nent pairing of an RTCRtpSender and an RTCRtpReceiver, along with some shared state. Each SDP media section describes one bidirectional SRTP ("Secure Real Time Protocol") stream (excepting the media section for RTCDataChannel, if present). This pairing of send and receive SRTP streams is significant for some applications, so RTCRtpTransceiver is used to represent this pairing, along with other im
portant state from the media section. Each non-disabled SRTP media section is always represented by exactly one transceiver. A transceiver is uniquely identified using its mid property, which is the same as the media ID (mid) of its corresponding m-line. An RTCRtpTransceiver is associated with an m-line if its mid is non-null; otherwise it's considered disassociated. Properties currentDirection R...
RTCSessionDescription - Web APIs
ion consists of a description type indicating which part of the offer/answer negotiation process it describes and of the SDP descriptor of the session. The process of negotiating a connection between two peers involves exchanging RTCSessionDescription objects back and forth, with each description suggesting one combination of connection configuration options that the sender of the description sup
ports. Once the two peers agree upon a configuration for the connection, negotiation is complete. Properties The RTCSessionDescription interface doesn't inherit any properties. RTCSessionDescription.type Read only An enum of type RTCSdpType describing the session description's type. RTCSessionDescription.sdp Read only A DOMString containing the SDP describing the session. Constants RTC...
Range.compareBoundaryPoints() - Web APIs
ge. Range.END_TO_START compares the end boundary-point of sourceRange to the start boundary-point of Range. Range.START_TO_END compares the start boundary-point of sourceRange to the end boundary-point of Range. Range.START_TO_START compares the start boundary-point of sourceRange to the start boundary-point of Range. If the value of the parameter is invalid, a DOMException with a NotSup
portedError code is thrown. sourceRange A Range to compare boundary points with the range. Example var range, sourceRange, compare; range = document.createRange(); range.selectNode(document.getElementsByTagName("div")[0]); sourceRange = document.createRange(); sourceRange.selectNode(document.getElementsByTagName("div")[1]); compare = range.compareBoundaryPoints(Range.START_TO_END, sourceRange)...
ReadableStreamDefaultController.desiredSize - Web APIs
The desiredSize read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue. Syntax var desiredSize = readableStreamDefaultController.desiredSize; Value An integer. Note that this can be negative if the queue is over-full. Examples The A readable stream with an underlying push source and backpressure sup
port example in the spec provides a good example of using desiredSize to manually detect when the stream is full and apply backpressure, and also of using ReadableStreamDefaultController.error() to manually trigger a stream error if another part of the system it relies on fails. Specifications Specification Status Comment StreamsThe definition of 'desiredSize' in that specification. ...
ReadableStreamDefaultController.error() - Web APIs
e stream is not readable. Syntax readableStreamDefaultController.error(e); Parameters e The error you want future interactions to fail with. Return value undefined. Exceptions TypeError The source object is not a ReadableStreamDefaultController, or the stream is not readable for some other reason. Examples The A readable stream with an underlying push source and backpressure sup
port example in the spec provides a good example of using ReadableStreamDefaultController.desiredSize to manually detect when the stream is full and apply backpressure, and also of using error() to manually trigger a stream error if another part of the system it relies on fails. Specifications Specification Status Comment StreamsThe definition of 'error()' in that specificati...
RenderingContext - Web APIs
RenderingContext is a WebIDL typedef which can refer to any one of the interfaces that represent a graphics rendering context within a <canvas> element: CanvasRenderingContext2D, WebGLRenderingContext, or WebGL2RenderingContext. By using the shorthand RenderingContext, methods and properties which can make use of any of these interfaces can be specified and written more easily; since <canvas> sup
ports several rendering systems, it's helpful from a specification and browser implementation perspective to have a shorthand that means "one of these interfaces." As such, RenderingContext is an implementation detail, and isn't something web developers directly use. There is no RenderingContext interface, and there are no objects which implement type RenderingContext. The primary use of this type i...
Request.mode - Web APIs
eWorkers do not affect the semantics of the Web and prevents security and privacy issues arising from leaking data across domains. cors -- Allows cross-origin requests, for example to access various APIs offered by 3rd party vendors. These are expected to adhere to the CORS protocol. Only a limited set of headers are exposed in the Response, but the body is readable. navigate -- A mode for sup
porting navigation. The navigate value is intended to be used only by HTML navigation. A navigate request is created only while navigating between documents. Default mode Requests can be initiated in a variety of ways, and the mode for a request depends on the particular means by which it was initiated. For example, when a Request object is created using the Request.Request constructor, the va...
RequestDestination - Web APIs
audio" The target is audio data. "audioworklet" The target is data being fetched for use by an audio worklet. "document" The target is a document (HTML or XML). "embed" The target is embedded content. "font" The target is a font. "image" The target is an image. "manifest" The target is a manifest. "object" The target is an object. "paintworklet" The target is a paint worklet. "re
port" The target is a re
port. "script" The target is a script. "serviceworker" The target is a service worker. "sharedworker" The target is a shared worker. "style" The target is a style "track" The target is an HTML <track>. "video" The target is video data. "worker" The target is a worker. "xslt" The target is an XLST transform. Specifications Specification Status ...
ResizeObserver() - Web APIs
Syntax var ResizeObserver = new ResizeObserver(callback) Parameters callback The function called whenever an observed resize occurs. The function is called with two parameters: entries An array of ResizeObserverEntry objects that can be used to access the new dimensions of the element after each change. observer A reference to the ResizeObserver itself, so it will definitely be accessible from inside the callback, should you need it. ...
ResizeObserverEntry.borderBoxSize - Web APIs
The borderBoxSize read-only property of the ResizeObserverEntry interface returns an array containing the new border box size of the observed element when the callback is run. Syntax var myBorderBoxSize = ResizeObserverEntry.borderBoxSize; Value An array containing objects with the new border box size of the observed element. The array is necessary to sup
port elements that have multiple fragments, which occur in multi-column scenarios. Each object in the array contains two properties: blockSize The length of the observed element's border box in the block dimension. For boxes with a horizontal writing-mode, this is the vertical dimension, or height; if the writing-mode is vertical, this is the horizontal dimension, or width. inlineSize The length of the observed element's ...
ResizeObserverEntry.contentBoxSize - Web APIs
ntal dimension, or width; if the writing-mode is vertical, this is the vertical dimension, or height. Note: For more explanation of writing modes and block and inline dimensions, read Handling different text directions. Examples The following snippet is taken from the resize-observer-border-radius.html (see source) example. This example includes a green box, sized as a percentage of the view
port size. When the view
port size is changed, the box's rounded corners change in pro
portion to the size of the box. We could just implement this using border-radius with a percentage, but that quickly leads to ugly-looking elliptical corners; this solution gives you nice square corners that scale with the box size. const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) {...
ResizeObserverEntry.target - Web APIs
to the Element or SVGElement that is being observed. Syntax var element = ResizeObserverEntry.target; var svgElement = ResizeObserverEntry.target; Value An Element or SVGElement representing the element being observed. Examples The following snippet is taken from the resize-observer-border-radius.html (see source) example. This example includes a green box, sized as a percentage of the view
port size. When the view
port size is changed, the box's rounded corners change in pro
portion to the size of the box. We could just implement this using border-radius with a percentage, but that quickly leads to ugly-looking elliptical corners; this solution gives you nice square corners that scale with the box size. To grab a reference to the observed element so we can update its border-radius value ...
Resource Timing API - Web APIs
source" type performance entry. Implementation status As shown in the PerformanceResourceTiming interface's Browser Compatibility table, most of these interfaces are broadly implemented by desktop browsers. However, note that some properties have little to no implementation so see each property's "Browser compatibility" section for more specific interoperability data. To test your browser's sup
port for these interfaces, run the perf-api-sup
port application. See Also Resource Timing Standard; W3C Editor's Draft CanIUse data Resource Timing practical tips; Steve Souders; 2014 August 21 Measuring network performance with Resource Timing API; Ilya Grigorik; 2013 December 11 A Primer for Web Performance Timing APIs; Xiaoqian Wu; W3C Editor's Draft ...
Response.error() - Web APIs
levant to ServiceWorkers; the error method is used to return an error if you so wish it. An error response has its type set to error. Note: An "error" Response never really gets exposed to script: such a response to a fetch() would reject the promise. Syntax var errorResponse = Response.error(); Parameters None. Return value A Response object. Example TBD (does not yet appear to be sup
ported anywhere). Specifications Specification Status Comment FetchThe definition of 'error()' in that specification. Living Standard ...
format - Web APIs
perty. If the font is in one of the formats listed in CSS2([CSS2], section15.3.5), then its value is the corresponding <string> parameter of the font. Syntax string = myGlyph.format; myGlyph.format = string; Value The format values listed below are taken from CSS2([CSS2], section15.3.5). ...
SVGAngle - Web APIs
rsed as a valid <angle>. A DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read-only attribute, or when the object itself is read-only. Methods newValueSpecifiedUnits Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object. Exceptions: A DOMException with code NOT_SUP
PORTED_ERR is raised if unitType is SVG_ANGLETYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_ANGLETYPE_* constants defined on this interface). A DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only. convertToSpecifiedUnits Preserve the same underlying stored value, but reset the ...
SVGAnimationElement: repeatEvent event - Web APIs
epeats. It will be fired each time the element repeats, after the first iteration. Note: Associated with the repeatEvent event is an integer that indicates which repeat iteration is beginning; this can be found in the detail property of the event object. The value is a 0-based integer, but the repeat event is not raised for the first iteration and so the observed values will be >= 1. This is sup
ported in Firefox, but not in Chrome. Bubbles No Cancelable No Interface TimeEvent Event handler property onrepeat Examples Animated circle <svg xmlns="http://www.w3.org/2000/svg" width="300px" height="100px"> <title>SVG SMIL Animate with Path</title> <circle cx="0" cy="50" r="50" fill="blue" stroke="black" stroke-width="1"> <animateMo...
SVGAnimationElement - Web APIs
rown. SVGAnimationElement.getCurrentTime() Returns a float representing the current time in seconds relative to time zero for the given time container. SVGAnimationElement.getSimpleDuration() Returns a float representing the number of seconds for the simple duration for this animation. If the simple duration is undefined (e.g., the end time is indefinite), then a DOMException with code NOT_SUP
PORTED_ERR is raised. SVGAnimationElement.beginElement() Creates a begin instance time for the current time. The new instance time is added to the begin instance times list. The behavior of this method is equivalent to beginElementAt(0). SVGAnimationElement.beginElementAt() Creates a begin instance time for the current time plus the specified offset. The new instance time is added to the beg...
SVGElement - Web APIs
ttribute on the given element, or the empty string if class is not present. This attribute is deprecated and may be removed in a future version of this specification. Authors are advised to use Element.classList instead. SVGElement.ownerSVGElementRead only An SVGSVGElement referring to the nearest ancestor <svg> element. null if the given element is the outermost <svg> element. SVGElement.view
portElementRead only The SVGElement, which established the current view
port. Often, the nearest ancestor <svg> element. null if the given element is the outermost <svg> element. Methods This interface has no methods, but inherits methods from: DocumentAndElementEventHandlers, Element, ElementCSSInlineStyle, GlobalEventHandlers, HTMLOrForeignElement, SVGElementInstance Events Listen to these eve...
getBBox() - Web APIs
tes on all the elements contained in the target element). Note: getBBox() must return the actual bounding box at the time the method was called--even in case the element has not yet been rendered. It also does not account for any transformation applied to the element or its parents. getBBox returns different values than getBoundingClientRect(), as the latter returns value relative to the view
port Syntax let bboxRect = object.getBBox(); Return value The returned value is a SVGRect object, which defines the bounding box. This value is irrespective of any transformation attribute applied to it or the parent elements. Example HTML <svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <g id="group_text_1"> <text x="5" y="16" transform="scale(2, 2)">Hello World!</te...
SVGGraphicsElement - Web APIs
and its corresponding transform attribute of the given element. Methods This interface also inherits methods from its parent, SVGElement. SVGGraphicsElement.getBBox() Returns a DOMRect representing the computed bounding box of the current element. SVGGraphicsElement.getCTM() Returns a DOMMatrix representing the matrix that transforms the current element's coordinate system to its SVG view
port's coordinate system. SVGGraphicsElement.getScreenCTM() Returns a DOMMatrix representing the matrix that transforms the current element's coordinate system to the coordinate system of the SVG view
port for the SVG document fragment. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGGraphicsElement' in that specificatio...
The 'X' property - Web APIs
The x property describes the horizontal coordinate of the position of the element. Usage context Name x Value <length> | <percentage> Initial 0 Applies to <mask> , 'svg', 'rect', 'image', 'foreignObject' Inherited no Percentages refer to the size of the current view
port (see Units) Media visual Computed value absolute length or percentage Animatable yes Simple usage A <coordinate> is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for X coordinates, the y-axis for Y coordinates). Its syntax is the same as that for <length> // Rect draws a rectangle with upper left-hand c...
SVGTests - Web APIs
The SVGTests interface is used to reflect conditional processing attributes and is mixed into other interfaces for elements that sup
port these attributes. Properties SVGTests.requiredFeatures Read only An SVGStringList corresponding to the requiredFeatures attribute of the given element. SVGTests.requiredExtensions Read only An SVGStringList corresponding to the requiredExtensions attribute of the given element. SVGTests.systemLanguage Read only An SVGStringList corresponding to the systemLanguage attribute of the given element. Methods SVGTests.hasExtension() Read only Returns true if the browser sup
ports the given extension, specified by a URI. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVG...
SVGTextContentElement - Web APIs
It is inherited by various text-related interfaces, such as SVGTextElement, SVGTSpanElement, SVGTRefElement, SVGAltGlyphElement and SVGTextPathElement. ...
SVGZoomAndPan - Web APIs
The SVGZoomAndPan interface is used to reflect the zoomAndPan attribute, and is mixed in to other interfaces for elements that sup
port this attribute. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/SVGZoomAndPan" target="_top"><rect x="1" y="1" width="130" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="66" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGZoomAndPan</text></a></svg></div>...
Screen.height - Web APIs
ll of the height given by this property may be available to the window itself. Widgets such as taskbars or other special application windows that integrate with the OS (e.g., the Spinner player minimized to act like an additional toolbar on windows) may reduce the amount of space available to browser windows and other applications. Internet Explorer will take into account the zoom setting when re
porting the screen height. It will only return the real height of the screen if the zoom is set to 100%. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Screen.height' in that specification. Working Draft ...
Screen.mozBrightness - Web APIs
tes how bright the screen's backlight is, on a scale from 0 (very dim) to 1 (full brightness); this value is a double-precision float. You can read and write this attribute even when the screen is disabled, but the backlight is off while the screen is disabled. If you write a value of X into this attribute, the attribute may not have the same value X when you later read it. Most screens don't sup
port as many different brightness levels as there are doubles between 0 and 1. The value's precision might be reduced before storing it. Syntax let screenBrightness = window.screen.mozBrightness; Specifications Not part of specification. ...
Screen.orientation - Web APIs
prefixed versions returned a DOMString equivalent to ScreenOrientation.type. Example var orientation = (screen.orientation || {}).type || screen.mozOrientation || screen.msOrientation; if (orientation === "landscape-primary") { console.log("That looks good."); } else if (orientation === "landscape-secondary") { console.log("Mmmh... the screen is upside down!"); } else if (orientation === "
portrait-secondary" || orientation === "
portrait-primary") { console.log("Mmmh... you should rotate your device to landscape"); } else if (orientation === undefined) { console.log("The orientation API isn't sup
ported in this browser :("); } Specifications Specification Status Comment Screen Orientation APIThe definition of 'orientation' in that specification. Work...
Screen.width - Web APIs
en.height >= 768) { // Resolution is 1024x768 or above } Notes Note that not all of the width given by this property may be available to the window itself. When other widgets occupy space that cannot be used by the window object, there is a difference in window.screen.width and window.screen.availWidth. See also screen.height. Internet Explorer will take into account the zoom setting when re
porting the screen width. It will only return the real width of the screen if the zoom is set to 100%. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Screen.width' in that specification. Working Draft Initial definition. ...
Screen - Web APIs
Properties Screen.availTop Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features. Screen.availLeft Returns the first available pixel available from the left side of the screen. ...
Screen Wake Lock API - Web APIs
pplication needs to keep running. WakeLockSentinel Provides a handle to the underlying platform wake lock and if referenced can be manually released and reacquired. Get an instance of the object by calling WakeLock.request. Navigator.wakelock Returns a WakeLock object instance, from which all other functionality can be accessed. Examples Feature Detection This code checks for wake lock sup
port and updates the UI accordingly. if ('wakeLock' in navigator) { isSup
ported = true; statusElem.textContent = 'Screen Wake Lock API sup
ported!'; } else { wakeButton.disabled = true; statusElem.textContent = 'Wake lock is not sup
ported by this browser.'; } Requesting a wake lock The following example demonstrates how to request a WakeLockSentinel object. The WakeLock.request method is Pr...
SecurityPolicyViolationEvent.disposition - Web APIs
The disposition read-only property of the SecurityPolicyViolationEvent interface indicates how the violated policy is configured to be treated by the user agent. Syntax let disposition = violationEventInstance.disposition; Value A value defined in the SecurityPolicyViolationEventDisposition enum representing the URI of the blocked resource. Possible values are "enforce" or "re
port" Example document.addEventListener("securitypolicyviolation", (e) => { console.log(e.disposition); }); Specifications Specification Status Comment Content Security Policy Level 3The definition of 'disposition' in that specification. Working Draft Initial definition ...
SecurityPolicyViolationEvent - Web APIs
ad only A USVString representing the URI of the resource that was blocked because it violates a policy. SecurityPolicyViolationEvent.columnNumberRead only The column number in the document or worker at which the violation occurred. SecurityPolicyViolationEvent.dispositionRead only Indicates how the violated policy is configured to be treated by the user agent. This will be "enforce" or "re
port". SecurityPolicyViolationEvent.documentURIRead only A USVString representing the URI of the document or worker in which the violation was found. SecurityPolicyViolationEvent.effectiveDirectiveRead only A DOMString representing the directive whose enforcement uncovered the violation. SecurityPolicyViolationEvent.lineNumberRead only The line number in the document or worker at which the vi...
Selection.addRange() - Web APIs
The Selection.addRange() method adds a Range to a Selection. Syntax selection.addRange(range); Parameters range A Range object that will be added to the Selection. Example Currently only Firefox sup
ports multiple selection ranges, other browsers will not add new ranges to the selection if it already contains one. HTML <p>I <strong>insist</strong> that you <strong>try</strong> selecting the <strong>strong words</strong>.</p> <button>Select strong words</button> JavaScript let button = document.querySelector('button'); button.addEventListener('click', function () { let selection = window.getSelection(); let strongs = document.getElementsByTagName('strong'); if (selection.rangeCount > 0) { selection.removeAllRanges(); } for (let i = 0; i < strongs.lengt...
Selection - Web APIs
tion with a mouse, the focus is where in the document the mouse button is released. As the user changes the selection using the mouse or the keyboard, the focus is the end of the selection that moves. This is not the same as the focused element of the document, as returned by document.activeElement. range A range is a contiguous part of a document. A range can contain entire nodes as well as
portions of nodes (such as a
portion of a text node). A user will normally only select a single range at a time, but it's possible for a user to select multiple ranges (e.g., by using the Control key). A range can be retrieved from a selection as a range object. Range objects can also be created via the DOM and programmatically added or removed from a selection. Specifications Specificatio...
SensorErrorEvent.SensorErrorEvent() - Web APIs
The SensorErrorEvent constructor creates a new SensorErrorEvent object which provides information about errors thrown by any of the interfaces based on Sensor. Syntax sensorErrorEvent = new SensorErrorEvent(type, {error: domException}); Parameters type Will always be 'SensorErrorEvent'. options Optional Currently only one option is sup
ported: error: An instance of DOMException. Specifications Specification Status Comment Generic Sensor APIThe definition of 'SensorErrorEvent' in that specification. Candidate Recommendation Initial definition. ...
Server-sent events - Web APIs
Simple SSE demo using PHP Specification Specification Status Comment HTML Living StandardThe definition of 'Server-sent events' in that specification. Living Standard See also Tools EventSource polyfill for Node.js Remy Sharp's EventSource polyfill Yaffle's EventSource polyfill Rick Waldron's jquery plugin intercooler.js declarative SSE sup
port Related Topics AJAX JavaScript WebSockets Other resources A Twitter like application powered by server-sent events and its code on Github. HTML5 and Server-sent events Server-sent events using Asp.Net ...
ServiceWorker - Web APIs
} Specifications Specification Status Comment Service WorkersThe definition of 'ServiceWorker' in that specification. Working Draft Initial definition. ...
ServiceWorkerContainer.controller - Web APIs
ct. Example if ('serviceWorker' in navigator) { // Do a one-off check to see if a service worker's in control. if (navigator.serviceWorker.controller) { console.log(`This page is currently controlled by: ${navigator.serviceWorker.controller}`); } else { console.log('This page is not currently controlled by a service worker.'); } } else { console.log('Service workers are not sup
ported.'); } Specifications Specification Status Comment Service WorkersThe definition of 'ServiceWorkerRegistration.controller' in that specification. Working Draft Initial definition ...
ServiceWorkerContainer.ready - Web APIs
h a ServiceWorkerRegistration. Example if ('serviceWorker' in navigator) { navigator.serviceWorker.ready .then(function(registration) { console.log('A service worker is active:', registration.active); // At this point, you can call methods that require an active // service worker, like registration.pushManager.subscribe() }); } else { console.log('Service workers are not sup
ported.'); } Specifications Specification Status Comment Service WorkersThe definition of 'ServiceWorkerRegistration.ready' in that specification. Working Draft Initial definition. ...
ServiceWorkerGlobalScope.onpushsubscriptionchange - Web APIs
rGlobalScope.onpushsubscriptionchange event of the ServiceWorkerGlobalScope interface is fired to indicate a change in push subscription that was triggered outside the application's control, e.g. when browser refresh the push subscription. Previously, it was defined as the event interface that is fired whenever a push subscription has been invalidated (or is about to become so). This offers an op
portunity to resubscribe in order to continue receiving push messages, if desired. This might happen if, for example, the push service sets an expiration time a subscription. Syntax ServiceWorkerGlobalScope.onpushsubscriptionchange = function() { ... } self.addEventListener('pushsubscriptionchange', function() { ... }) Example self.addEventListener('pushsubscriptionchange', function() { // do s...
ServiceWorkerGlobalScope - Web APIs
ntentdelete property. fetch Occurs when a fetch() is called. Also available via the ServiceWorkerGlobalScope.onfetch property. install Occurs when a ServiceWorkerRegistration acquires a new ServiceWorkerRegistration.installing worker. Also available via the ServiceWorkerGlobalScope.oninstall property. message Occurs when incoming messages are received. Controlled pages can use the Message
Port.postMessage() method to send messages to service workers. The service worker can optionally send a response back via the Message
Port exposed in event.data.
port, corresponding to the controlled page. Also available via the ServiceWorkerGlobalScope.onmessage property. notificationclick Occurs when a user clicks on a displayed notification. Also available via the ServiceWorkerGlobalScope.onnotif...
ShadowRoot.innerHTML - Web APIs
The innerHTML property of the ShadowRoot interface sets or returns a reference to the DOM tree inside the ShadowRoot. Syntax var domString = shadowRoot.innerHTML shadowRoot.innerHTML = domString Value A DOMString. Examples let customElem = document.querySelector('my-shadow-dom-element'); let shadow = customElem.shadowRoot; shadow.innerHTML = '<strong>This element should be more im
portant!</strong>'; Specifications This property is not defined by any specifications yet; see this open spec issue to specify it. ...
SourceBuffer - Web APIs
ten by Nick Desaulniers and can be viewed live here (you can also download the source for further investigation.) var video = document.querySelector('video'); var assetURL = 'frag_bunny.mp4'; // Need to be specific for Blink regarding codecs // ./mp4info frag_bunny.mp4 | grep Codec var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; if ('MediaSource' in window && MediaSource.isTypeSup
ported(mimeCodec)) { var mediaSource = new MediaSource(); //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsup
ported MIME type or codec: ', mimeCodec); } function sourceOpen (_) { //console.log(this.readyState); // open var mediaSource = this; var sourceBuffe...
SpeechGrammar - Web APIs
Constructor SpeechGrammar.SpeechGrammar() Creates a new SpeechGrammar object. Properties SpeechGrammar.src Sets and returns a string containing the grammar from within in the SpeechGrammar object instance. SpeechGrammar.weight Optional Sets and returns the weight of the SpeechGrammar object. ...
SpeechGrammarList.addFromString() - Web APIs
(e.g. stored in a variable) and adds it to the SpeechGrammarList as a new SpeechGrammar object. Syntax speechGrammarListInstance.addFromString(string,weight); Returns Void. Parameters string A DOMString representing the grammar to be added. weight Optional A float representing the weight of the grammar relative to other grammars present in the SpeechGrammarList. The weight means the im
portance of this grammar, or the likelihood that it will be recognised by the speech recognition service. The value can be between 0.0 and 1.0; If not specified, the default used is 1.0. Examples var grammar = '#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | gree...
SpeechGrammarList.addFromURI() - Web APIs
The addFromURI() method of the SpeechGrammarList interface takes a grammar present at a specific URI and adds it to the SpeechGrammarList as a new SpeechGrammar object. Note that some speech recognition services may sup
port built-in grammars that can be specified by URI. Syntax speechGrammarListInstance.addFromURI(src,weight); Returns Void. Parameters src A DOMString representing the URI of the grammar to be added. weight Optional A float representing the weight of the grammar relative to other grammars present in the SpeechGrammarList. The weight means the im
portance of this grammar, or the likelihood that it will be recognised by the speech recognition service. The value can be between 0.0 and 1.0; If not specified, the default used is 1.0. Examples var grammar = '#JSGF V1.
SpeechGrammarList - Web APIs
Constructor SpeechGrammarList.SpeechGrammarList() Creates a new SpeechGrammarList object. Properties SpeechGrammarList.length Read only Returns the number of SpeechGrammar objects contained in the SpeechGrammarList. ...
SpeechRecognitionError.error - Web APIs
s to cancel speech input. audio-capture Audio capture failed. network Network communication required for completing the recognition failed. not-allowed The user agent disallowed any speech input from occurring for reasons of security, privacy or user preference. service-not-allowed The user agent disallowed the requested speech recognition service, either because the user agent doesn't sup
port it or because of reasons of security, privacy or user preference. In this case it would allow another more suitable speech recognition service to be used instead. bad-grammar There was an error in the speech recognition grammar or semantic tags, or the chosen grammar format or semantic tag format was unsup
ported. language-not-sup
ported The language was not sup
ported. Examples var recogniti...
SpeechRecognitionErrorEvent.error - Web APIs
s to cancel speech input. audio-capture Audio capture failed. network Network communication required for completing the recognition failed. not-allowed The user agent disallowed any speech input from occurring for reasons of security, privacy or user preference. service-not-allowed The user agent disallowed the requested speech recognition service, either because the user agent doesn't sup
port it or because of reasons of security, privacy or user preference. In this case it would allow another more suitable speech recognition service to be used instead. bad-grammar There was an error in the speech recognition grammar or semantic tags, or the chosen grammar format or semantic tag format was unsup
ported. language-not-sup
ported The language was not sup
ported. Examples var recogniti...
SpeechRecognitionEvent.emma - Web APIs
rns an Extensible MultiModal Annotation markup language (EMMA) -- XML -- representation of the result. Note: EMMA is defined in the specification EMMA: Extensible MultiModal Annotation markup language. You can see muliple EMMA examples in the spec. Syntax var myEmma = event.emma; Value A valid XML document. The exact contents can vary across user agents and recognition engines, but all sup
porting implementations will expose a valid XML document complete with an EMMA namespace. If the speech recognition system does not supply EMMA data then the user agent will return null. Examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textContent = 'Result received: ' + color + '.'; bg.style.backgroundColor = color; console.log(event.e...
SpeechSynthesis.onvoiceschanged - Web APIs
oices list is being determined asynchronously, or when client-side voices are installed/uninstalled while a speech synthesis application is running. Syntax speechSynthesisInstance.onvoiceschanged = function() { ... }; Examples This could be used to populate a list of voices that the user can choose between when the event fires (see our Speak easy synthesis demo.) Note that Firefox doesn't sup
port it at present, and will just return a list of voices when SpeechSynthesis.getVoices() is fired. With Chrome however, you have to wait for the event to fire before populating the list, hence the bottom if statement seen below. var voices = []; function populateVoiceList() { voices = synth.getVoices(); for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); ...
SpeechSynthesisUtterance.text - Web APIs
Syntax var myText = speechSynthesisUtteranceInstance.text; speechSynthesisUtteranceInstance.text = 'Hello I am speaking'; Value A DOMString representing the text to the synthesised. ...
SpeechSynthesisVoice - Web APIs
Every SpeechSynthesisVoice has its own relative speech service including information about language, name and URI. Properties SpeechSynthesisVoice.default Read only A Boolean indicating whether the voice is the default voice for the current app language (true), or not (false.) SpeechSynthesisVoice.lang Read only Returns a BCP 47 language tag indicating the language of the voice. ...
StorageQuota - Web APIs
Methods StorageQuota.queryInfo Returns a StorageInfo object containting the current data usage and available quota information for the application. ...
Using readable streams - Web APIs
explains the basics. Note: This article assumes that you understand the use cases of readable streams, and are aware of the high-level concepts. If not, we suggest that you first read the Streams concepts and usage overview and dedicated Streams API concepts article, then come back. Note: If you are looking for information on writable streams try Using writable streams instead. Browser sup
port You can consume Fetch Body objects as streams and create your own custom readable streams in Firefox 65+ and Chrome 42+ (and equivalent Chromium-based browsers). Pipe chains are only sup
ported in Chrome at the moment, and that functionality is subject to change. Finding some examples We will look at various examples in this article, taken from our dom-examples/streams repo. You can find the fu...
Using writable streams - Web APIs
am functionality. Note: This article assumes that you understand the use cases of writable streams, and are aware of the high-level concepts. If not, we suggest that you first read the Streams concepts and usage overview and dedicated Streams API concepts article, then come back. Note: If you are looking for information about readable streams, try Using readable streams instead. Browser sup
port The Streams API is experimental, and sup
port is at an early stage right now. Only Chrome currently has basic writable streams implemented. Introducing an example In our dom-examples/streams repo you'll find a Simple writer example (see it live also). This takes a given message and writes it into a writable stream, displaying each chunk on the UI as it is written to the stream and also displayi...
Streams API - Web APIs
bject is constructed, you can pass it a ReadableStream in the body property of its RequestInit dictionary. This Request could then be passed to a WindowOrWorkerGlobalScope.fetch() to commence fetching the stream. Body The response Body returned by a successful fetch request is exposed by default as a ReadableStream, and can have a reader attached to it, etc. ByteStream-related interfaces Im
portant: these are not implemented anywhere as yet, and questions have been raised as to whether the spec details are in a finished enough state for them to be implemented. This may change over time. ReadableStreamBYOBReader Represents a BYOB ("bring your own buffer") reader that can be used to read stream data supplied by the developer (e.g. a custom ReadableStream() constructor). ReadableByteS...
StyleSheet.ownerNode - Web APIs
of <?xml-stylesheet ?>. Syntax nodeRef = stylesheet.ownerNode Example <html lang="en"> <head> <link rel="stylesheet" href="example.css"> </head> <body> <button onclick="alert(document.styleSheets[0].ownerNode)">Show example.css's ownerNode</button> </body> </html> // Displays "object HTMLLinkElement" Notes For style sheets that are included by other style sheets, such as with @im
port, the value of this property is null. Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'StyleSheet: ownerNode' in that specification. Working Draft ...
StyleSheet.parentStyleSheet - Web APIs
face returns the style sheet, if any, that is including the given style sheet. Syntax objRef = stylesheet.parentStyleSheet Example // Find the top level stylesheet if (stylesheet.parentStyleSheet) { sheet = stylesheet.parentStyleSheet; } else { sheet = stylesheet; } Notes This property returns null if the current stylesheet is a top-level stylesheet or if stylesheet inclusion is not sup
ported. Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'StyleSheet: parentStyleSheet' in that specification. Working Draft ...
SubtleCrypto.decrypt() - Web APIs
ing exceptions are encountered: InvalidAccessError Raised when the requested operation is not valid for the provided key (e.g. invalid encryption algorithm, or invalid key for the specified encryption algorithm). OperationError Raised when the operation failed for an operation-specific reason (e.g. algorithm parameters of invalid sizes, or there was an error decrypting the ciphertext). Sup
ported algorithms The decrypt() method sup
ports the same algorithms as the encrypt() method. Examples Note: You can try the working examples on GitHub. RSA-OAEP This code decrypts ciphertext using RSA-OAEP. See the complete code on GitHub. function decryptMessage(privateKey, ciphertext) { return window.crypto.subtle.decrypt( { name: "RSA-OAEP" }, privateKey, ciphertext ...
SubtleCrypto.generateKey() - Web APIs
enerate and providing extra algorithm-specific parameters. For RSASSA-PKCS1-v1_5, RSA-PSS, or RSA-OAEP: pass an RsaHashedKeyGenParams object. For ECDSA or ECDH: pass an EcKeyGenParams object. For HMAC: pass an HmacKeyGenParams object. For AES-CTR, AES-CBC, AES-GCM, or AES-KW: pass an AesKeyGenParams object. extractable is a Boolean indicating whether it will be possible to ex
port the key using SubtleCrypto.ex
portKey() or SubtleCrypto.wrapKey(). keyUsages is an Array indicating what can be done with the newly generated key. Possible values for array elements are: encrypt: The key may be used to encrypt messages. decrypt: The key may be used to decrypt messages. sign: The key may be used to sign messages. verify: The key may be used to verify signatures. ...
SubtleCrypto.verify() - Web APIs
alue result is a Promise that fulfills with a Boolean: true if the signature is valid, false otherwise. Exceptions The promise is rejected when the following exception is encountered: InvalidAccessError Raised when the encryption key is not a key for the requested verifying algorithm or when trying to use an algorithm that is either unknown or isn't suitable for a verify operation. Sup
ported algorithms The verify() method sup
ports the same algorithms as the sign() method. Examples Note: You can try the working examples out on GitHub. RSASSA-PKCS1-v1_5 This code uses a public key to verify a signature. See the complete code on GitHub. /* Fetch the contents of the "message" textbox, and encode it in a form we can use for sign operation. */ function getMessageEncoding() { co...
TextDecoder() - Web APIs
'iso-2022-jp' "csshiftjis", "ms_kanji", "shift-jis", "shift_jis", "sjis", "windows-31j", "x-sjis" 'shift-jis' "cseuckr", "csksc56011987", "euc-kr", "iso-ir-149", "korean", "ks_c_5601-1987", "ks_c_5601-1989", "ksc5601", "ksc_5601", "windows-949" 'euc-kr' "csiso2022kr", "iso-2022-kr" 'iso-2022-kr' ...
TextEncoder() - Web APIs
The TextEncoder() constructor returns a newly created utf-8 TextEncoder object. Syntax encoder = new TextEncoder(); Parameters TextEncoder() takes no parameters since Firefox 48 and Chrome 53 Note: Prior to Firefox 48 and Chrome 53, an encoding type label was accepted as a paramer to the TextEncoder object, since then both browers have removed sup
port for any encoder type other than utf-8, to match the spec. Any type label passed into the TextEncoder constructor will now be ignored and a utf-8 TextEncoder will be created. Exceptions TextEncoder() throws no exceptions since Firefox 48 and Chrome 53 Note: Prior to Firefox 48 and Chrome 53 an exception would be thrown for an unknown encoding type. Specifications Specification Status Comment Encodi...
TextTrack - Web APIs
label needs to be exposed to the user. TextTrack.language Read only A DOMString which specifies the text language in which the text track's contents is written. The value must adhere to the format specified in the Tags for Identifying Languages (BCP 47) document from the IETF, just like the HTML lang attribute. For example, this can be "en-US" for United States English or "pt-BR" for Brazilian
Portuguese. TextTrack.mode A DOMString specifying the track's current mode. Changing this property's value changes the track's current mode to match. Permitted values are listed under Text track mode constants. The default is disabled, unless the <track> element's default Boolean attribute is specified, in which case the default mode is started. Events cuechange Fired when cues are entered and...
TextTrackList.length - Web APIs
. Example This snippet gets the number of text tracks in the first media element found in the DOM by querySelector(). var mediaElem = document.querySelector("video, audio"); var numTextTracks = 0; if (mediaElem.textTracks) { numTextTracks = mediaElem.textTracks.length; } Note that this sample checks to be sure HTMLMediaElement.textTracks is defined, to avoid failing on browsers without sup
port for TextTrack. Specifications Specification Status Comment HTML Living StandardThe definition of 'TextTrackList: length' in that specification. Living Standard ...
TimeRanges - Web APIs
A TimeRanges object includes one or more ranges of time, each specified by a starting and ending time offset. You reference each time range by using the start() and end() methods, passing the index number of the time range you want to retrieve. The term "normalized TimeRanges object" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). ...
msManipulationViewsEnabled - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The msManipulationViewsEnabled read-only property returns true if manipulation features are sup
port available, such as touch panning and zooming using CSS rules. This proprietary property is specific to Internet Explorer and Microsoft Edge. Value Returns true if manipulation features are sup
port available, such as touch panning and zooming using CSS rules. Example Using a JSON file: { msManipulationViewsEnabled: true, } See also Touch API Microsoft API extensions ...
Touch.clientX - Web APIs
The Touch.clientX read-only property returns the X coordinate of the touch point relative to the view
port, not including any scroll offset. Syntax touchItem.clientX; Return value A long representing the X coordinate of the touch point relative to the view
port, not including any scroll offset. Example This example illustrates using the Touch object's Touch.clientX and Touch.clientY properties. The Touch.clientX property is the horizontal coordinate of a touch point relative to the browser's view
port excluding any scroll offset. The Touch.clientY property is the vertical coordinate of the touch point relative to the browser's view
port excluding any scroll offset . In this example, we assume the user initiates a touch on an element with an id of source, moves within the element or out of ...
Touch.clientY - Web APIs
The Touch.clientY read-only property returns the Y coordinate of the touch point relative to the browser's view
port, not including any scroll offset. Syntax touchItem.clientY; Return value A long value representing the Y coordinate of the touch point relative to the view
port, not including any scroll offset. Example This example illustrates using the Touch object's Touch.clientX and Touch.clientY properties. The Touch.clientX property is the horizontal coordinate of a touch point relative to the browser's view
port excluding any scroll offset. The Touch.clientY property is the vertical coordinate of the touch point relative to the browser's view
port excluding any scroll offset . In this example, we assume the user initiates a touch on an element with an id of source, moves within the el...
Touch.force - Web APIs
essure the user is applying to the touch surface for a Touch point. Syntax touchItem.force; Return value A float that represents the amount of pressure the user is applying to the touch surface. This is a value between 0.0 (no pressure) and 1.0 (the maximum amount of pressure the hardware can recognize). A value of 0.0 is returned if no value is known (for example the touch device does not sup
port this property). In environments where force is known, the absolute pressure represented by the force attribute, and the sensitivity in levels of pressure, may vary. Example This example illustrates using the Touch interface's Touch.force property. This property is a relative value of pressure applied, in the range 0.0 to 1.0, where 0.0 is no pressure, and 1.0 is the highest level of pressure th...
Touch.pageX - Web APIs
The Touch.pageX read-only property returns the X coordinate of the touch point relative to the view
port, including any scroll offset. Syntax touchItem.pageX; Return value A long representing the X coordinate of the touch point relative to the view
port, including any scroll offset. Example This example illustrates how to access the Touch object's Touch.pageX and Touch.pageY properties. The Touch.pageX property is the horizontal coordinate of a touch point relative to the view
port (in CSS pixels), including any scroll offset. The Touch.pageY property is the vertical coordinate of a touch point relative to the view
port (in CSS pixels), including any scroll offset. In following simple code snippet, we assume the user initiates one or more touch contacts on the source element, moves the tou...
Touch.pageY - Web APIs
The Touch.pageY read-only property returns the Y coordinate of the touch point relative to the view
port, including any scroll offset. Syntax touchItem.pageY; Return value A long value that representes the Y coordinate of the touch point relative to the view
port, including any scroll offset. Example This example illustrates how to access the Touch object's Touch.pageX and Touch.pageY properties. The Touch.pageX property is the horizontal coordinate of a touch point relative to the view
port (in CSS pixels), including any scroll offset. The Touch.pageY property is the vertical coordinate of a touch point relative to the view
port (in CSS pixels), including any scroll offset. In following simple code snippet, we assume the user initiates one or more touch contacts on the source element, mov...
TouchEvent.touches - Web APIs
kes different handlers depending on the number of touch points. someElement.addEventListener('touchstart', function(e) { // Invoke the appropriate handler depending on the // number of touch points. switch (e.touches.length) { case 1: handle_one_touch(e); break; case 2: handle_two_touches(e); break; case 3: handle_three_touches(e); break; default: console.log("Not sup
ported"); break; } }, false); Specifications Specification Status Comment Touch Events - Level 2 Draft Non-stable version. Touch Events Recommendation Initial definition. ...
TrackEvent - Web APIs
The TrackEvent interface, which is part of the HTML DOM specification, is used for events which represent changes to a set of available tracks on an HTML media element; these events are addtrack and removetrack. It's im
portant not to confuse TrackEvent with the RTCTrackEvent interface, which is used for tracks which are part of an RTCPeerConnection. Events based on TrackEvent are always sent to one of the media track list types: Events involving video tracks are always sent to the VideoTrackList found in HTMLMediaElement.videoTracks Events involving audio tracks are always sent to the AudioTrackList specified in HTMLMediaElement.audioTracks Events affecting text tracks are sent to the TextTrackList object indicated by HTMLMediaElement.textTracks. Constructor TrackEvent() Creat...
Transferable - Web APIs
cts that can be used in specific conditions, such as being transfered to a Worker using the Worker.postMessage() method. Note: The Transferable interface technically no longer exists. The functionality of Transferable objects still exists, however, but is implemented at a more fundamental level (technically speaking, using the [Transferable] WebIDL extended attribute). The ArrayBuffer, Message
Port, ImageBitmap and OffscreenCanvas types implement this interface. Properties The Transferable interface does not implement or inherit specific properties. Methods The Transferable interface does not implement or inherit specific properties. Specifications Specification Status Comment HTML Living StandardThe definition of 'Transferable' in that specification. Li...
TransformStream - Web APIs
ue(this.textencoder.encode(String(chunk))) break }, flush() { /* do any destructor work here */ } } class AnyToU8Stream extends TransformStream { constructor() { super({...transformContent, textencoder: new TextEncoder()}) } } Polyfilling TextEncoderStream and TextDecoderStream Note that this is deprecated by the native constructors. This is intended as a polyfill for unsup
ported platforms. const tes = { start(){this.encoder = new TextEncoder()}, transform(chunk, controller) { controller.enqueue(this.encoder.encode(chunk)) } } let _jstes_wm = new WeakMap(); /* info holder */ class JSTextEncoderStream extends TransformStream { constructor() { let t = {...tes} super(t) _jstes_wm.set(this, t) } get encoding() {return _jstes_wm.get(this).encode...
UIEvent.pageX - Web APIs
The non-standard, read-only UIEvent property pageX returns the horizontal coordinate of the event relative to the whole document. This property was never part of any standard, and was only implemented across a subset of browsers, and only for a limited number of versions. A standardized version of pageX was added to the MouseEvent interface, however, and is well-sup
ported. You should not expect to find pageX on any non-mouse events. Do not look for pageX on any non-mouse events in new code and update existing code as soon as possible. Syntax var pos = event.pageX Value An integer value, in pixels, indicating the X coordinate at which the mouse pointer was located when the event occurred. This value is relative to the left edge of the entire document, regardless of the current...
ULongRange - Web APIs
Properties max A numeric value in the range of signed 32-bit integers, specifying the largest permissible value of the property it describes. min A numeric value in the range of signed 32-bit integers, specifying the smallest permissible value of the property it describes. ...
URL API - Web APIs
let addr = new URL("https://mysite.com/login"); addr.username = myUsername; Setting the value of username not only sets that property's value, but it updates the overall URL. After executing the code snippet above, the value returned by addr.href is https://someguy@mysite.com/login. This is true for any of the writable properties. Queries The search property on a URL contains the query string
portion of the URL. For example, if the URL is https://mysite.com/login?user=someguy&page=news, then the value of the search property is ?user=someguy&page=news. You can also look up the values of individual parameters with the URLSearchParams object's get() method: let addr = new URL("https://mysite.com/login?user=someguy&page=news"); try { loginUser(addr.searchParams.get("user")); gotoPage(addr...
USBAlternateInterface - Web APIs
ementers Forum. A value of 0xFF indicates a vendor-defined interface. USBAlternateInterface.interfaceSubclassRead only Returns the subclass of this interface. This is equal to the bInterfaceSubClass field of the interface descriptor defining this interface. The meaning of this value depends on the interfaceClass field. USBAlternateInterface.interfaceProtocolRead only Returns the protocol sup
ported by this interface. This is equal to the bInterfaceProtocol field of the interface descriptor defining this interface. The meaning of this value depends on the interfaceClass and interfaceSubclass fields. USBAlternateInterface.interfaceNameRead only Returns the name of the interface, if one is provided by the device. This is the value of the string descriptor with the index specified by the i...
USBDevice.claimInterface() - Web APIs
Interfaces are device-specific. Return value A promise. Example The following example shows claimInterface() in the context of connecting to a USB device. ...
USBDevice.selectAlternateInterface() - Web APIs
The selectAlternateInterface() method of the USBDevice interface returns a promise that resolves when the specified alternative endpoint is selected. Syntax var promise = USBDevice.selectAlternateInterface(interfaceNumber, alternateSetting) Parameters interfaceNumber The index of one of the interfaces sup
ported by the device. Interfaces are device-specific. alternateSetting The configuration of the selected interface. Return value A promise. Specifications Specification Status Comment WebUSBThe definition of 'selectAlternateInterface()' in that specification. Draft Initial definition. ...
USBDevice.usbVersionMajor - Web APIs
The usbVersionMajor read only property of the USBDevice interface is one of three properties that declare the USB protocol version sup
ported by the device. The other two properties are USBDevice.usbVersionMinor and USBDevice.usbVersionSubminor. Syntax var serialNumber = USBDevice.usbVersionMajor Value The last of three properties that declare the USB protocol version sup
ported by the device. Specifications Specification Status Comment WebUSBThe definition of 'usbVersionMajor' in that specification. Draft Initial definition. ...
USBDevice.usbVersionMinor - Web APIs
The usbVersionMinor read only property of the USBDevice interface is one of three properties that declare the USB protocol version sup
ported by the device. The other two properties are USBDevice.usbVersionMajor and USBDevice.usbVersionSubminor. Syntax var serialNumber = USBDevice.usbVersionMinor Value The second of three properties that declare the USB protocol version sup
ported by the device. Specifications Specification Status Comment WebUSBThe definition of 'usbVersionMinor' in that specification. Draft Initial definition. ...
USBDevice.usbVersionSubminor - Web APIs
The usbVersionSubminor read only property of the USBDevice interface is one of three properties that declare the USB protocol version sup
ported by the device. The other two properties are USBDevice.usbVersionMajor and USBDevice.usbVersionMinor. Syntax var serialNumber = USBDevice.usbVersionSubminor Value The first of three properties that declare the USB protocol version sup
ported by the device. Specifications Specification Status Comment WebUSBThe definition of 'usbVersionSubminor' in that specification. Draft Initial definition. ...
USBEndpoint - Web APIs
dpoint numbers will depend on what other interfaces the device provides. This code identifies the correct endpoints by searching for the interface implementing the USB CDC interface class and then identifying the candidate endpoints based on their type and direction. let inEndpoint = undefined; let outEndpoint = undefined; for (const interface of device.configuration.interfaces) { // Only sup
port devices with out multiple alternate interfaces. const alternate = interface.alternates[0]; // Identify the interface implementing the USB CDC class. const USB_CDC_CLASS = 10; if (alternate.interfaceClass != USB_CDC_CLASS) { continue; } for (const endpoint of alternate.endpoints) { // Identify the bulk transfer endpoints. if (endpoint.type != "bulk") { continue; ...
USBIsochronousInTransferResult - Web APIs
sochronousInTransferResult.USBIsochronousInTransferResult() Creates a new USBIsochronousInTransferResult object with the provided packets and data fields. Properties USBIsochronousInTransferResult.dataRead only Returns a DataView object containing the data received from the device. This is the combined data from all packets. See the individual DataView objects in the packets array for the
portion of this buffer containing data from each packet. USBIsochronousInTransferResult.packetsRead only Returns an array of USBIsochronousInTransferPacket objects containing the result of each request to receive a packet from the device. Specifications Specification Status Comment WebUSBThe definition of 'USBIsochronousInTransferResult' in that specification. Draft ...
User Timing API - Web APIs
removed. If this method is called with no arguments, all measure type entries will be removed from the performance timeline. Interoperability As shown in the Performance interface's Browser Compatibility table, the User Timing methods are broadly implemented by desktop and mobile browsers (the only exceptions are Desktop Safari and Mobile Safari, however the Safari Technology Preview 24 has sup
port). To test your browser's sup
port for this API, run the perf-api-sup
port application. See Also User Timing Standard; W3C Editor's Draft CanIUse data A Primer for Web Performance Timing APIs; Xiaoqian Wu; W3C Editor's Draft ...
validityState.badInput - Web APIs
The read-only badInput property of a ValidityState object indicates if the user has provided input that the browser is unable to convert. For example, if you have a number input element whose content is a string. Note: While this is unsup
ported in Internet Explorer, any non-numeric value will be dismissed from the field if it is a number input. Example <input type="number" id="age"> var input = document.getElementById("age"); if (input.validity.badInput) { console.log("Bad input detected..."); } else { console.log("Content of input ok."); } Specifications Specification Status Comment HTML Living StandardThe definition of 'ValidityState.badInput' in that specification. Living Standard Live Standard HTML 5.1The definition of 'ValidityState.badInp...
ValidityState.patternMismatch - Web APIs
The read-only patternMismatch property of a ValidityState object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's pattern attribute. If the field sup
ports the pattern attribute -- which means the <input> is of type text, tel, email, url, password, or search -- and the pattern value is set to a valid regular expression, if the value don't doesn't conform to the constraints set by the pattern value, the patternMismatch property will be true. Examples Given the following: <p> <label>Enter your phone number in the format (123)456-7890 (<input name="tel1" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit area code" size="2"/>)- <input name="tel2" type="tel" pattern="[0-9]{3}" placeholde...
Vibration API - Web APIs
Describing vibrations Vibration is described as a pattern of on-off pulses, which may be of varying lengths. ...
VideoConfiguration - Web APIs
The VideoConfiguration dictionary of the Media Capabilities API is used to define the video file being tested when calling the MediaCapabilities methods encodingInfo() and decodingInfo() to determine whether or not the described video configuration is sup
ported, and how smoothly and how smoooth and power-efficient it can be handled. Properties The VideoConfiguration dictionary is made up of five video properties, including: contentType: A valid video MIME type. See our web video codec guide for types which may be sup
ported. width: The width of the video. height: The height of the video. bitrate: The number of bits used to encode one second of the video file. framerate: The number of frames making up one second of video playback. Examples // Create media configuration to be tested ...
VideoPlaybackQuality.creationTime - Web APIs
Syntax value = videoPlaybackQuality.creationTime; Value A DOMHighResTimeStamp object which indicates the number of milliseconds that elapased between the time the browsing context was created and the time at which this sample of the video quality was obtained. For details on how the time is determined, see Performance.now(). Example This example calls getVideoPlaybackQuality() to obtain a VideoPlaybackQuality object, then determines what percentage of frames have been lost by either corruption or being dropped. ...
VideoTrack.id - Web APIs
The id property contains a string which uniquely identifies the track represented by the VideoTrack. This ID can be used with the VideoTrackList.getTrackById() method to locate a specific track within the media associated with a media element. The track ID can also be used as the fragment of a URL that loads the specific track (if the media sup
ports media fragments). Syntax var trackID = VideoTrack.id; Value A DOMString which identifies the track, suitable for use when calling getTrackById() on an VideoTrackList such as the one specified by a media element's videoTracks property. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrack: id' in that specification. Living Standard ...
Videotrack.language - Web APIs
Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrack: language' in that specification. Living Standard ...
VideoTrack - Web APIs
any given time, so setting this property to true for one track while another track is active will make that other track inactive. id Read only A DOMString which uniquely identifies the track within the media. This ID can be used to locate a specific track within a video track list by calling VideoTrackList.getTrackById(). The ID can also be used as the fragment part of the URL if the media sup
ports seeking by media fragment per the Media Fragments URI specification. kind Read only A DOMString specifying the category into which the track falls. For example, the main video track would have a kind of "main". label Read only A DOMString providing a human-readable label for the track. For example, a track whose kind is "sign" might have a label of "A sign-language interpretation". This st...
VideoTrackList.length - Web APIs
Example This snippet gets the number of video tracks in the first <video> element found in the DOM by querySelector(). var videoElem = document.querySelector("video"); var numVideoTracks = 0; if (videoElem.videoTracks) { numVideoTracks = videoElem.videoTracks.length; } Note that this sample checks to be sure HTMLMediaElement.videoTracks is defined, to avoid failing on browsers without sup
port for VideoTrack. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrackList: length' in that specification. Living Standard ...
WEBGL_compressed_texture_astc - Web APIs
WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: ASTC compression is typically available on Mali ARM GPUs, Intel GPUs, and Nividia Tegra chips. This extension is available to both, WebGL1 and WebGL2 contexts. Methods This extension exposes one new methods. ext.getSup
portedProfiles() Returns an array of strings containing the names of the ASTC profiles sup
ported by the implementation. Constants The compressed texture formats are exposed by 28 constants and can be used in two functions: compressedTexImage2D() and compressedTexSubImage2D(). Constants Blocks Bits per pixel ArrayBuffer byteLength bytes if height and width are 512 ...
WEBGL_compressed_texture_etc1 - Web APIs
n textures. WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: This extension is available to both, WebGL1 and WebGL2 contexts. Constants The compressed texture format is exposed by a constant and can be used with the compressedTexImage2D() method (note that ETC1 is not sup
ported with the compressedTexSubImage2D() method). ext.COMPRESSED_RGB_ETC1_WEBGL Compresses 24-bit RGB data with no alpha channel. Examples var ext = gl.getExtension('WEBGL_compressed_texture_etc1'); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ext.COMPRESSED_RGB_ETC1_WEBGL, 512, 512, 0, textureData); Specifications ...
WEBGL_compressed_texture_pvrtc - Web APIs
lowing for higher resolution textures or more of the same resolution textures. WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: PVRTC is typically only available on mobile devices with PowerVR chipsets. It is used in all generations of the iPhone, iPod Touch and iPad and sup
ported on certain Android devices that use a PowerVR GPU. This extension is available to both, WebGL1 and WebGL2 contexts. Note: On iOS devices, this extension is named WEBKIT_WEBGL_compressed_texture_pvrtc. Constants The compressed texture formats are exposed by four constants and can be used in two functions: compressedTexImage2D() (where the height and width parameters must be powers of 2) and...
WEBGL_debug_renderer_info - Web APIs
ormation about the graphics driver for debugging purposes. Depending on the privacy settings of the browser, this extension might only be available to privileged contexts. Generally, the graphics driver information should only be used in edge cases to optimize your WebGL content or to debug GPU problems. The WebGLRenderingContext.getParameter() method can help you to detect which features are sup
ported and the failIfMajorPerformanceCaveat context attribute lets you control if a context should be returned at all, if the performance would be dramatically slow. WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: Depending on the privacy settings of the browser, this extension...
WebGL2RenderingContext.getInternalformatParameter() - Web APIs
The WebGL2RenderingContext.getInternalformatParameter() method of the WebGL 2 API returns information about implementation-dependent sup
port for internal formats. Syntax any gl.getInternalformatParameter(target, internalformat, pname); Parameters target A Glenum specifying the target renderbuffer object. Possible values: gl.RENDERBUFFER: Buffer data storage for single images in a renderable internal format. internalformat A GLenum specifying the internal format about which to retrieve information (must be a color-renderable, depth-renderable or stencil-renderable format). pname A GLenum specifying the type of information to query. Possible values: gl.SAMPLES: Returns a Int32Array containing sample counts sup
ported for internalformat in descending order. ...
WebGL2RenderingContext.getSyncParameter() - Web APIs
the type of the sync object (always gl.SYNC_FENCE). gl.SYNC_STATUS: Returns a GLenum indicating the status of the sync object (gl.SIGNALED or gl.UNSIGNALED). gl.SYNC_CONDITION: Returns a GLenum indicating the sync objects' condition (always gl.SYNC_GPU_COMMANDS_COMPLETE). gl.SYNC_FLAGS: Returns a GLenum indicating the flags with which the sync object was created (always 0 as no flags are sup
ported). Return value Depends on the pname parameter, either a GLenum or a GLbitfield. Examples var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0); gl.getSyncParameter(sync, gl.SYNC_STATUS); Specifications Specification Status Comment WebGL 2.0The definition of 'getSyncParameter' in that specification. Editor's Draft Initial definition for WebGL. ...
WebGL2RenderingContext.invalidateSubFramebuffer() - Web APIs
Syntax void gl.invalidateSubFramebuffer(target, attachments, x, y, width, height); Parameters target A GLenum specifying the binding point (target). Possible values: gl.FRAMEBUFFER: Collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. gl.DRAW_FRAMEBUFFER: Equivalent to gl.FRAMEBUFFER. gl.READ_FRAMEBUFFER: Used as a source for reading operations. attachments An Array of GLenum specifying the attachment points to invalidate. ...
WebGL2RenderingContext.texStorage2D() - Web APIs
. internalformat A GLenum specifying the texture store format. Possible values: gl.R8 gl.R16F gl.R32F gl.R8UI gl.RG8 gl.RG16F gl.RG32F gl.RG8UI gl.RGB8 gl.SRGB8 gl.RGB565 gl.R11F_G11F_B10F gl.RGB9_E5 gl.RGB16F gl.RGB32F gl.RGB8UI gl.RGBA8 gl.SRGB8_APLHA8 gl.RGB5_A1 gl.RGBA4 gl.RGBA16F gl.RGBA32F gl.RGBA8UI Unlike OpenGL 3.0, WebGL 2 doesn't sup
port the following ETC2 and EAC compressed texture formats (see section 5.37 in the WebGL 2 spec). You might be able to enable them via the WEBGL_compressed_texture_etc extension, though. gl.COMPRESSED_R11_EAC gl.COMPRESSED_SIGNED_R11_EAC gl.COMPRESSED_RG11_EAC gl.COMPRESSED_SIGNED_RG11_EAC gl.COMPRESSED_RGB8_ETC2 gl.COMPRESSED_RGBA8_ETC2_EAC gl.COMPRESSED_SRGB8_ETC2 gl.COMPRESSED_S...
WebGL2RenderingContext - Web APIs
WebGL2RenderingContext.blitFramebuffer() Transfers a block of pixels from the read framebuffer to the draw framebuffer. WebGL2RenderingContext.framebufferTextureLayer() Attaches a single layer of a texture to a framebuffer. WebGL2RenderingContext.invalidateFramebuffer() Invalidates the contents of attachments in a framebuffer. WebGL2RenderingContext.invalidateSubFramebuffer() Invalidates
portions of the contents of attachments in a framebuffer WebGL2RenderingContext.readBuffer() Selects a color buffer as the source for pixels. Renderbuffers WebGL2RenderingContext.getInternalformatParameter() Returns information about implementation-dependent sup
port for internal formats. WebGL2RenderingContext.renderbufferStorageMultisample() Creates and initializes a renderbuffer object's d...
WebGLRenderingContext.checkFramebufferStatus() - Web APIs
gl.FRAMEBUFFER_COMPLETE: The framebuffer is ready to display. gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT: The attachment types are mismatched or not all framebuffer attachment points are framebuffer attachment complete. gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: There is no attachment. gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS: Height and width of the attachment are not the same. gl.FRAMEBUFFER_UNSUP
PORTED: The format of the attachment is not sup
ported or if depth and stencil attachments are not the same renderbuffer. When using a WebGL 2 context, the following values can be returned additionally: gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: The values of gl.RENDERBUFFER_SAMPLES are different among attached renderbuffers, or are non-zero if the attached images are a mix of renderbuffers and text...
WebGLRenderingContext.getExtension() - Web APIs
The WebGLRenderingContext.getExtension() method enables a WebGL extension. Syntax gl.getExtension(name); Parameters name A String for the name of the WebGL extension to enable. Return value A WebGL extension object, or null if name does not match (case-insensitive) to one of the strings in WebGLRenderingContext.getSup
portedExtensions. Examples Once a WebGL extension is enabled, you are able to use the methods, properties or constants that this extension object provides. var canvas = document.getElementById('canvas'); gl = canvas.getContext('webgl'); gl.getExtension('WEBGL_lose_context').loseContext(); WebGL extensions Extensions for the WebGL API are registered in the WebGL Extension Registry. The current extensions are: ANGLE_instanced_arrays EXT_blend_minmax EXT_color...
WebGLRenderingContext.getShaderPrecisionFormat() - Web APIs
r a gl.FRAGMENT_SHADER or a gl.VERTEX_SHADER. precisionType A precision type value. Either gl.LOW_FLOAT, gl.MEDIUM_FLOAT, gl.HIGH_FLOAT, gl.LOW_INT, gl.MEDIUM_INT, or gl.HIGH_INT. Return value A WebGLShaderPrecisionFormat object or null, if an error occurs. Exceptions gl.INVALID_ENUM if the shader or precision types aren't recognized. gl.INVALID_OPERATION if the shader compiler isn't sup
ported. Examples The following code gets the precision format of a gl.VERTEX_SHADER with a gl.MEDIUM_FLOAT precision type. var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT); // WebGLShaderPrecisionFormat { rangeMin: 127, rangeMax: 127, precision: 23 } Specifications Specification Statu...
WebGLRenderingContext.lineWidth() - Web APIs
imum and maximum width for a line is implementation defined. The maximum minimum width is allowed to be 1.0. The minimum maximum width is also allowed to be 1.0. Because of these implementation defined limits it is not recommended to use line widths other than 1.0 since there is no guarantee any user's browser will display any other width. As of January 2017 most implementations of WebGL only sup
port a minimum of 1 and a maximum of 1 as the technology they are based on has these same limits. Syntax void gl.lineWidth(width); Parameters width A GLfloat specifying the width of rasterized lines. Default value: 1. Return value None. Examples Setting the line width: gl.lineWidth(5); Getting the line width: gl.getParameter(gl.LINE_WIDTH); Getting the range of available widths. Retu...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
the shader program. We use an imaginary data structure where the attributes of each vertex are stored interleaved with a length of 20 bytes per vertex: position: We need to store the X, Y and Z coordinates. For highest precision, we use 32-bit floats; in total this uses 12 bytes. normal vector: We need to store the X, Y and Z components of the normal vector, but since precision is not that im
portant, we use 8-bit signed integers. For better performance, we align the data to 32 bits by also storing a fourth zero-valued component, bringing the total size to 4 bytes. Also, we tell WebGL to normalize the values because our normals are always in range [-1, 1]. texture coordinate: We need to store the U and V coordinates; for this 16-bit unsigned integers offer enough precision, the total size...
WebGL by example - Web APIs
g of the underlying concepts. Explanations about the examples are found in both the main text and in comments within the code. You should read all comments, because more advanced examples could not repeat comments about parts of the code that were previously explained. Getting to know the rendering context Detect WebGL This example demonstrates how to detect a WebGL rendering context and re
ports the result to the user. Clearing with colors How to clear the rendering context with a solid color. Clearing by clicking How to combine user interaction with graphics operations. Clearing the rendering context with a random color when the user clicks. Simple color animation A very basic color animation, done by clearing the WebGL drawing buffer with a different random color every second. ...
Adding 2D content to a WebGL context - Web APIs
thing we can do is draw a simple square untextured plane, so let's start there, by building code to draw a square plane. The complete source code for this project is available on GitHub. This project uses the glMatrix library to perform its matrix operations, so you will need to include that in your project. We're loading a copy from a CDN in our HTML's <head>. Drawing the scene The most im
portant thing to understand before we get started is that even though we're only rendering a square plane object in this example, we're still drawing in 3D space. It's just we're drawing a square and we're putting it directly in front of the camera perpendicular to the view direction. We need to define the shaders that will create the color for our simple scene as well as draw our object. These will e...
WebGL: 2D and 3D graphics for the web - Web APIs
is a JavaScript API for rendering high-performance interactive 3D and 2D graphics within any compatible web browser without the use of plug-ins. WebGL does so by introducing an API that closely conforms to OpenGL ES 2.0 that can be used in HTML5 <canvas> elements. This conformance makes it possible for the API to take advantage of hardware graphics acceleration provided by the user's device. Sup
port for WebGL is present in Firefox 4+, Google Chrome 9+, Opera 12+, Safari 5.1+, Internet Explorer 11+, and Microsoft Edge build 10240+; however, the user's device must also have hardware that sup
ports these features. The WebGL 2 API introduces sup
port for much of the OpenGL ES 3.0 feature set; it's provided through the WebGL2RenderingContext interface. The <canvas> element is also used by the Can...
Introduction to WebRTC protocols - Web APIs
th the client's public address and whether or not the client is accessible behind the router's NAT. NAT Network Address Translation (NAT) is used to give your device a public IP address. A router will have a public IP address and every device connected to the router will have a private IP address. Requests will be translated from the device's private IP to the router's public IP with a unique
port. That way you don't need a unique public IP for each device but can still be discovered on the Internet. Some routers will have restrictions on who can connect to devices on the network. This can mean that even though we have the public IP address found by the STUN server, not anyone can create a connection. In this situation we need to turn to TURN. TURN Some routers using NAT employ a restri...
Taking still photos with WebRTC - Web APIs
Try this sample then read on to learn how it works. You can also jump straight to the code on Github if you like. The HTML markup Our HTML interface has two main operational sections: the stream and capture panel and the presentation panel. Each of these is presented side-by-side in its own <div> to facilitate styling and control. The first panel on the left contains two components: a <video> element, which will receive the stream from WebRTC, and a <button> the user clicks to capture a video frame. ...
WebSocket() - Web APIs
tring or an array of protocol strings. These strings are used to indicate sub-protocols, so that a single server can implement multiple WebSocket sub-protocols (for example, you might want one server to be able to handle different types of interactions depending on the specified protocol). If you don't specify a protocol string, an empty string is assumed. Exceptions thrown SECURITY_ERR The
port to which the connection is being attempted is being blocked. SyntaxError The URL is invalid. Specifications Specification Status Comment HTML Living StandardThe definition of 'the WebSocket constructor' in that specification. Living Standard ...
WebSocket.close() - Web APIs
tatus codes of CloseEvent for permitted values. reason Optional A human-readable string explaining why the connection is closing. This string must be no longer than 123 bytes of UTF-8 text (not characters). Exceptions thrown INVALID_ACCESS_ERR An invalid code was specified. SYNTAX_ERR The reason string is too long or contains unpaired surrogates. Note: In Gecko, this method didn't sup
port any parameters prior to Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5). Specifications Specification Status Comment HTML Living Standard The definition of 'WebSocket.close()' in that specification. Living Standard Initial definition ...
WebSocket.send() - Web APIs
not currently OPEN. SYNTAX_ERR The data is a string that has unpaired surrogates. Note: Gecko's implementation of the send() method differs somewhat from the specification in Gecko 6.0; Gecko returns a boolean indicating whether or not the connection is still open (and, by extension, that the data was successfully queued or transmitted); this is corrected in Gecko 8.0. As of Gecko 11.0, sup
port for ArrayBuffer is implemented but not Blob data types. Specifications Specification Status Comment HTML Living StandardThe definition of 'WebSocket: send' in that specification. Living Standard Initial definition ...
The WebSocket API (WebSockets) - Web APIs
r the covers when it's available, and gracefully fallback to other techniques and technologies when it isn't, while your application code stays the same. Caddy: A web server capable of proxying arbitrary commands (stdin/stdout) as a websocket. ws: a popular WebSocket client & server library for Node.js. jsonrpc-bidirectional: Asynchronous RPC which, on a single connection, may have functions ex
ported on the server and, and the same time, on the client (client may call server, server may also call client). cowboy: Cowboy is a small, fast and modern HTTP server for Erlang/OTP with WebSocket sup
port. Related Topics AJAX JavaScript Specifications Specification Status Comments HTML Living StandardThe definition of 'WebSocket API' in that specification. Li...
WebXR application life cycle - Web APIs
y, simulating cameras, spatial tracking, and more. Life cycle outline Most applications using WebXR will follow a similar overall design pattern: Check to see if the user's device and browser are both capable of presenting the XR experience you want to provide. Make sure the WebXR API is available; if navigator.xr is undefined, you can assume the user's browser and/or device doesn't sup
port WebXR. If it's not sup
ported, disable any user interface used to activate XR features and abort any attempts to enter XR mode. Call navigator.xr.isSessionSup
ported(), specifying the WebXR experience mode you want to provide: inline, immersive-vr, or immersive-ar, in order to determine whether or not the type of session you wish to provide is available. If the session type you want to use is...
Controlling multiple parameters with ConstantSourceNode - Web APIs
o the AudioContext's destination, so that any sound delivered to the gain nodes will reach the output, whether that output be speakers, headphones, a recording stream, or any other destination type. After setting the window's load event handler to be the setup() function, the stage is set. Let's see how the action plays out. Toggling the oscillators on and off Because OscillatorNode doesn't sup
port the notion of being in a paused state, we have to simulate it by terminating the oscillators and starting them again when the play button is clicked again to toggle them back on. Let's look at the code. function togglePlay(event) { if (playing) { playButton.innerHTML = "?"; stopOscillators(); } else { playButton.innerHTML = "?"; startOscillators(); } } If the playing varia...
Example and tutorial: Simple synth keyboard - Web APIs
uttons & 1) { let dataset = event.target.dataset; if (!dataset["pressed"]) { oscList[dataset["octave"][dataset["note"]]] = playTone(dataset["frequency"]); dataset["pressed"] = "yes"; } } } We start by checking whether the primary mouse button is pressed, for two reasons. First, we want to only allow the primary mouse button to trigger notes playing. Second, and more im
portantly, we are using this to handle mouseover for cases where the user is dragging from note to note, and we only want to start playing the note if the mouse is pressed when it enters the element. If the mouse button is in fact down, we get the pressed key's dataset attribute; this makes it easy to access the custom data attributes on the element. We look for a data-pressed attribute; if there isn...
Using IIR filters - Web APIs
drawn the frequency response of the audio, so you can see what effect the IIR filter has. You can check out the full demo here on Codepen. Also see the source code on GitHub. It includes some different coefficient values for different lowpass frequencies -- you can change the value of the filterNumber constant to a value between 0 and 3 to check out the different available effects. Browser sup
port IIR filters are sup
ported well across modern browsers, although they have been implemented more recently than some of the more longstanding Web Audio API features, like Biquad filters. The IIRFilterNode The Web Audio API now comes with an IIRFilterNode interface. But what is this and how does it differ from the BiquadFilterNode we have already? An IIR filter is a infinite impulse response fil...
Web Audio API - Web APIs
tions, apply spatial effects (such as panning) and much more. Web audio concepts and usage The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources -- with different types of channel layout -- are sup
ported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects. Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be...
Attestation and Assertion - Web APIs
he authenticator signature - a signature over the clientDataJSON and authenticatorData that can be verified with the public key that was created during registration. userHandle - Optional. (Nullable) A user identifier. This may be a username, or a hash of a username, etc. Used by a service to give a scope to credentials. Maximum length of 64 bytes. Older authenticators (U2F) do not sup
port this output. It's im
portant to highlight that the signature for assertion uses a different key pair than attestation. An assertion is signed using the key pair for a service, which was generated during registration. An attestation is signed using the attestation private key and attestation certificate that were burned into all models of the same device. (Except in the case of self-attestation...
Web Speech API - Web APIs
SpeechSynthesisEvent Contains information about the current state of SpeechSynthesisUtterance objects that have been processed in the speech service. SpeechSynthesisUtterance Represents a speech request. It contains the content the speech service should read and information about how to read it (e.g. language, pitch and volume.) SpeechSynthesisVoice Represents a voice that the system sup
ports. Every SpeechSynthesisVoice has its own relative speech service including information about language, name and URI. Window.speechSynthesis Specced out as part of a [NoInterfaceObject] interface called SpeechSynthesisGetter, and Implemented by the Window object, the speechSynthesis property provides access to the SpeechSynthesis controller, and therefore the entry point to speech synthesis func...
Web Storage API - Web APIs
does the same thing, but persists even when the browser is closed and reopened. Stores data with no expiration date, and gets cleared only through JavaScript, or clearing the Browser cache / Locally Stored Data. Storage limit is the maximum amongst the three. These mechanisms are available via the Window.sessionStorage and Window.localStorage properties (to be more precise, in sup
porting browsers the Window object implements the WindowLocalStorage and WindowSessionStorage objects, which the localStorage and sessionStorage properties hang off) -- invoking one of these will create an instance of the Storage object, through which data items can be set, retrieved and removed. A different Storage object is used for the sessionStorage and localStorage for each origin -- they functio...
The structured clone algorithm - Web APIs
is not preserved. Property descriptors, setters, getters, and similar metadata-like features are not duplicated. For example, if an object is marked readonly with a property descriptor, it will be read/write in the duplicate, since that's the default. The prototype chain is not walked or duplicated. Note: Native Error types can be cloned in Chrome, and Firefox is working on it. Sup
ported types Object type Notes All primitive types However, not symbols. Boolean objects String objects Date RegExp lastIndex is not preserved. Blob File FileList ArrayBuffer ArrayBufferView Including other typed arrays. ImageBitmap Image...
Web Workers API - Web APIs
eXML and channel attributes on XMLHttpRequest always return null. In addition to dedicated workers, there are other types of worker: Shared workers are workers that can be utilized by multiple scripts running in different windows, IFrames, etc., as long as they are in the same domain as the worker. They are a little more complex than dedicated workers -- scripts must communicate via an active
port. See SharedWorker for more details. ServiceWorkers essentially act as proxy servers that sit between web applications, the browser, and the network (when available). They are intended, among other things, to enable the creation of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the serv...
WheelEvent - Web APIs
Old versions of browsers implemented the non-standard and non-cross-browser-compatible MouseWheelEvent and MouseScrollEvent interfaces. Use this interface and avoid the non-standard ones. Do not confuse the wheel event with the scroll event: The default action of a wheel event is implementation-defined. Thus, a wheel event doesn't necessarily dispatch a scroll event. ...
Window.applicationCache - Web APIs
Don't use it to offline websites -- consider using service workers instead. Returns a reference to the application cache object for the window. Syntax cache = window.applicationCache Parameters cache is an object reference to an OfflineResourceList. ...
Window.controllers - Web APIs
The controllers property of the Window interface returns the XUL controllers of the chrome window. Syntax controllers = window.controllers controllers is an object of type XULControllers (nsIControllers). Specification XUL-specific. Not part of specification. By default, a window's controller contains the code that sup
ports the global window commands. Chrome code can add controllers (to be used in conjunction with the goDoCommand and goUpdateCommand functions in globalOverlay.js). However, the added controllers must be explicitly removed when the window is unloaded, as this is not done automatically. Each missing removal can cause bug 415775: ASSERTION: XPConnect is being called on a scope without a 'Components' property! ...
Window.convertPointFromNodeToPage() - Web APIs
Given a Point specified in a particular DOM Node's coordinate system, the Window method convertPointFromNodeToPage() returns a Point which specifies the same position in the page's coordinate system. This method is non-standard and should not be used. Please review the Browser compatibility section before using this method, as it's not widely sup
ported (nor is the Point object it uses). Syntax Point = Window.convertPointFromNodeToPage(node, nodePoint); Parameters node The Node in whose coordinate system the Point specified by nodePoint is described. nodePoint A Point object describing a point in node's coordinate system; this point will be converted to the page's coordinate system. Return value A Point object specifying a point in the page's coordinate system. Specifications...
Window.convertPointFromPageToNode - Web APIs
Given a Point specified in the page's coordinate system, the Window method convertPointFromPageToNode() returns a Point object specifying the same location in the coordinate system of the specified DOM Node. Please review the Browser compatibility section before using this method, as it's not widely sup
ported (nor is the Point object it uses). Syntax Point = Window.convertPointFromPageToNode(node, pagePoint); Parameters node The Node into whose coordinate system the point is to be converted. pagePoint A Point object specifying a point in the coordinate system of the page, which is to be converted into the node's coordinate system. Return value A Point object describing the specified location in the node's coordinate system. Specifications This method was specified in the de...
window.dump() - Web APIs
is to debug JavaScript. The message passed to dump() is sent to the System Console (Native Console) if the Firefox process was started with the -console option. If the -console option was not specified then the output goes to stderr. Output from dump() is not sent to the Browser Console. Output can be sent to the Browser Console using console.log(). Privileged code can also use Components.utils.re
portError and nsIConsoleService to log messages to the Error Console/Browser Console. dump() is also available to XPCOM components implemented in JavaScript, even though window is not the global object in components. It is also explicitly made available in sandboxes. However, this use of dump is not affected by the preference mentioned below -- it will always be shown. It is therefore advisable to ei...
Window.find() - Web APIs
See bug 672395. The Window.find() method finds a string in a window. Syntax window.find(aString, aCaseSensitive, aBackwards, aWrapAround, aWholeWord, aSearchInFrames, aShowDialog); aString The text string for which to search. aCaseSensitive Boolean. If true, specifies a case-sensitive search. aBackwards Boolean. If true, specifies a backward search. aWrapAround Boolean. If true, specifies a wrap around search. aWholeWord Unimplemented Boolean. If true, specifies a whole word search. This is not implemented; see bug 481513. aSearchInFrames Boolean. If true, specifies a search in frames. Returns true if the string is found; otherwise, false. ...
Window.getAttention() - Web APIs
ton for the window flashes, if this hasn't been disabled by the user. On Linux, the behaviour varies from window manager to window manager - some flash the taskbar button, others focus the window immediately. This may be configurable as well. On Macintosh, the icon in the upper right corner of the desktop flashes. The function is disabled for web content. Neither Gecko nor Internet Explorer sup
ports this feature now for web content. getAttention will still work when used from chrome in a Gecko application. Specification DOM Level 0. Not part of specification. ...
Window.getComputedStyle() - Web APIs
atch. Omitted (or null) for real elements. The returned style is a live CSSStyleDeclaration object, which updates automatically when the element's styles are changed. Throws TypeError If the passed object is not an Element or the pseudoElt is not a valid pseudo-element selector or is ::part() or ::slotted(). Note: Valid pseudo-element selector refers to syntactic validity, e.g. ::unsup
ported is considered valid, even though the pseudo-element itself is not sup
ported. Examples In this example we style a <p> element, then retrieve those styles using getComputedStyle(), and print them into the text content of the <p>. HTML <p>Hello</p> CSS p { width: 400px; margin: 0 auto; padding: 20px; font: 2rem/2 sans-serif; text-align: center; background: purple; color: w...
Window.localStorage - Web APIs
es are always in the UTF-16 DOMString format, which uses two bytes per character. As with objects, integer keys are automatically converted to strings. Syntax myStorage = window.localStorage; Value A Storage object which can be used to access the current origin's local storage space. Exceptions SecurityError The request violates a policy decision, or the origin is not a valid scheme/host/
port tuple (this can happen if the origin uses the file: or data: scheme, for example). For example, the user may have their browser configured to deny permission to persist data for the specified origin. Example The following snippet accesses the current domain's local Storage object and adds a data item to it using Storage.setItem(). localStorage.setItem('myCat', 'Tom'); The syntax for reading ...
Window.matchMedia() - Web APIs
e document matches the media query at all times, you can instead watch for the change event to be delivered to the object. There's a good example of this in the article on Window.devicePixelRatio. Examples This example runs the media query (max-width: 600px) and displays the value of the resulting MediaQueryList's matches property in a <span>; as a result, the output will say "true" if the view
port is less than or equal to 600 pixels wide, and will say "false" if the window is wider than that. JavaScript let mql = window.matchMedia('(max-width: 600px)'); document.querySelector(".mq-value").innerText = mql.matches; The JavaScript code simply passes the media query to match into matchMedia() to compile it, then sets the <span>'s innerText to the value of the results' matches property, so...
Window.mozInnerScreenX - Web APIs
That means it can be affected by the zoom level; to compute the actual number of physical screen pixels, you should use the nsIDOMWindowUtils.screenPixelsPerCSSPixel property. Syntax screenX = window.mozInnerScreenX; Value screenX stores the window.mozInnerScreenX property value. The window.mozInnerScreenX property is a floating point, read-only value; it has no default value. ...
Window.mozInnerScreenY - Web APIs
That means it can be affected by the zoom level; to compute the actual number of physical screen pixels, you should use the nsIDOMWindowUtils.screenPixelsPerCSSPixel property. Syntax screenY = window.mozInnerScreenY; Value screenY stores the window.mozInnerScreenY property value. The window.mozInnerScreenY property is a floating point, read-only value; it has no default value. ...
Window.navigator - Web APIs
The Window.navigator read-only property returns a reference to the Navigator object, which has methods and properties about the application running the script. Syntax navigatorObject = window.navigator Examples Example #1: Browser detect and return a string var sBrowser, sUsrAg = navigator.userAgent; // The order matters here, and this may re
port false positives for unlisted browsers. if (sUsrAg.indexOf("Firefox") > -1) { sBrowser = "Mozilla Firefox"; // "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0" } else if (sUsrAg.indexOf("SamsungBrowser") > -1) { sBrowser = "Samsung Internet"; // "Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G955F Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/9.4 Chrome/67.0.3396.87 Mobile Safari/...
Obsolete features - Web APIs
fullscreen This feature no longer works in MSIE 6 SP2 the way it worked in MSIE 5.x. The Windows taskbar, as well as the titlebar and the status bar of the window are not visible, nor accessible when fullscreen is enabled in MSIE 5.x. fullscreen always upsets users with large monitor screen or with dual monitor screen. ...
Privileged features - Web APIs
to be modal. The user cannot return to the main window until the modal window is closed. A typical modal window is created by the alert() function. The exact behavior of modal windows depends on the platform and on the Mozilla release version. Note: As of Gecko 1.9, the Internet Explorer equivalent to this feature is the window.showModalDialog() method. For compatibility reasons, it's now sup
ported in Firefox. Note also that starting in Gecko 2.0, you can use window.showModalDialog() without UniversalBrowserWrite privileges. titlebar By default, all new secondary windows have a titlebar. If set to no or 0, this feature removes the titlebar from the new secondary window. Mozilla and Firefox users can force new windows to always render the titlebar by setting dom.disable_window_open...
Window.orientation - Web APIs
Its only possible values are -90, 0, 90, and 180. Positive values are clockwise; negative values are counterclockwise. ...
Window.pageYOffset - Web APIs
The read-only Window property pageYOffset is an alias for scrollY; as such, it returns the number of pixels the document is currently scrolled along the vertical axis (that is, up or down) with a value of 0.0, indicating that the top edge of the Document is currently aligned with the top edge of the window's content area. There is slightly better sup
port for pageYOffset than for scrollY in older browsers, but if you're not concerned about browsers more than a handful of years old, you can use either one. The corresponding pageXOffset property, which returns the number of pixels scrolled along the horizontal axis (left and right), is an alias for scrollX. Syntax yOffset = window.pageYOffset; Value A floating-point number specifying the number of pixels the Document is scrolled verticall...
Window.pkcs11 - Web APIs
Obsolete since Gecko 29 (Firefox 29 / Thunderbird 29 / SeaMonkey 2.26)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Summary Returns the pkcs11 object, which is used to install drivers and other software associated with the pkcs11 protocol. If pkcs11 isn't sup
ported, this property returns null. Note: This property has been returned null since Gecko 1.9.0.14 (Firefox 3.0.14) and removed in Gecko 29.0 (Firefox 29 / Thunderbird 29 / SeaMonkey 2.26)) for security reasons. For more information on installing PKCS11 modules, see installing PKCS11 modules. See bug 326628 for details on why the property was removed. Syntax objRef = window.pkcs11 Example window.pkcs11.addModule(sMod, ...
Window: popstate event - Web APIs
state event will be triggered by doing a browser action such as a click on the back or forward button (or calling history.back() or history.forward() in JavaScript). Browsers tend to handle the popstate event differently on page load. Chrome (prior to v34) and Safari always emit a popstate event on page load, but Firefox doesn't. Note: When writing functions that process popstate event it is im
portant to take into account that properties like window.location will already reflect the state change (if it affected the current URL), but document might still not. If the goal is to catch the moment when the new document state is already fully in place, a zero-delay setTimeout() method call should be used to effectively put its inner callback function that does the processing at the end of the bro...
Window.sessionStorage - Web APIs
e always in the UTF-16 DOMString format, which uses two bytes per character. As with objects, integer keys are automatically converted to strings. Syntax myStorage = window.sessionStorage; Value A Storage object which can be used to access the current origin's session storage space. Exceptions SecurityError The request violates a policy decision, or the origin is not a valid scheme/host/
port tuple (this can happen if the origin uses the file: or data: scheme, for example). For example, the user may have their browser configured to deny permission to persist data for the specified origin. Example The following snippet accesses the current origin's session Storage object and adds data to it with Storage.setItem(). sessionStorage.setItem('myCat', 'Tom'); The following example autos...
Window: unhandledrejection event - Web APIs
You can prevent that from happening by adding a handler for unhandledrejection events that--in addition to any other tasks you wish to perform--calls preventDefault() to cancel the event, preventing it from bubbling up to be handled by the runtime's logging code. This works because unhandledrejection is cancelable. window.addEventListener('...
WindowOrWorkerGlobalScope.atob() - Web APIs
data from encodedData. Exceptions DOMException (name: InvalidCharacterError) Throws if encodedData is not valid base64. Example const encodedData = window.btoa('Hello, world'); // encode a string const decodedData = window.atob(encodedData); // decode the string Polyfill You can use a polifill from https://github.com/MaxArt2501/base64-js/blob/master/base64.js for browsers that don't sup
port it. Specifications Specification Status Comment HTML Living StandardThe definition of 'WindowOrWorkerGlobalScope.atob()' in that specification. Living Standard Method moved to the WindowOrWorkerGlobalScope mixin in the latest spec. HTML 5.1The definition of 'WindowBase64.atob()' in that specification. Recommendation Snapshot of HTML Living Standa...
WindowOrWorkerGlobalScope.btoa() - Web APIs
Specifications Specification Status Comment HTML Living StandardThe definition of 'WindowOrWorkerGlobalScope.btoa()' in that specification. Living Standard Method moved to the WindowOrWorkerGlobalScope mixin in the latest spec. HTML 5.1The definition of 'WindowBase64.btoa()' in that specification. Recommendation Snapshot of HTML Living Standa...
self.createImageBitmap() - Web APIs
The method exists on the global scope in both windows and workers. It accepts a variety of different image sources, and returns a Promise which resolves to an ImageBitmap. Syntax const imageBitmapPromise = createImageBitmap(image[, options]); const imageBitmapPromise = createImageBitmap(image, sx, sy, sw, sh[, options]); Parameters image An image source, which can be an <img>, SVG <image>, <video>, <canvas>, HTMLImageElement, SVGImageElement, HTMLVideoElement, HTMLCanvasElement, Blob, ImageData, ImageBitmap, or OffscreenCanvas object. ...
WindowOrWorkerGlobalScope.origin - Web APIs
ace returns the origin of the global scope, serialized as a string. Syntax var myOrigin = self.origin; // or just origin Value A USVString. Examples Executed from inside a worker script, the following snippet will log the worker's global scope's origin to the console each time it receives a message onmessage = function() { console.log(self.origin); }; If the origin is not a scheme/host/
port tuple (say you are trying to run it locally, i.e. via file:// URL), origin will return the string "null". Specifications Specification Status Comment HTML Living StandardThe definition of 'WindowOrWorkerGlobalScope.origin' in that specification. Living Standard Initial definition. ...
Worker.prototype.postMessage() - Web APIs
ters message The object to deliver to the worker; this will be in the data field in the event delivered to the DedicatedWorkerGlobalScope.onmessage handler. This may be any value or JavaScript object handled by the structured clone algorithm, which includes cyclical references. If the message parameter is not provided, a TypeError will be thrown. If the data to be passed to the worker is unim
portant, null or undefined can be passed explicitly. transfer Optional An optional array of Transferable objects to transfer ownership of. If the ownership of an object is transferred, it becomes unusable (neutered) in the context it was sent from and becomes available only to the worker it was sent to. Transferable objects are instances of classes like ArrayBuffer, Message
Port or ImageBitmap objec...
Worker.terminate() - Web APIs
Syntax myWorker.terminate(); Parameters None. Returns Void. Example The following code snippet shows creation of a Worker object using the Worker() constructor, which is then immediately terminated. ...
Worker - Web APIs
error event is raised. Methods Inherits methods from its parent, EventTarget, and implements methods from AbstractWorker. Worker.postMessage() Sends a message -- consisting of any JavaScript object -- to the worker's inner scope. Worker.terminate() Immediately terminates the worker. This does not let worker finish its operations; it is halted at once. ServiceWorker instances do not sup
port this method. Events message Fires when the worker's parent receives a message from that worker. Also available via the onmessage property. messageerror Fires when a Worker object receives a message that can't be deserialized. Also available via the onmessageerror property. rejectionhandled Fires every time a Promise rejects, regardless of whether or not there is a handler to catch ...
WorkerGlobalScope.location - Web APIs
erved at localhost:8000 console.log(location); inside a worker (which would basically be the equivalent of self.console.log(self.location);, as these are being called on the worker scope, which can be referenced with WorkerGlobalScope.self), you will get a WorkerLocation object written to the console -- something like the following: WorkerLocation {hash: "", search: "", pathname: "/worker.js",
port: "8000", hostname: "localhost"...} hash: "" host: "localhost:8000" hostname: "localhost" href: "http://localhost:8000/worker.js" origin: "http://localhost:8000" pathname: "/worker.js"
port: "8000" protocol: "http:" search: "" __proto__: WorkerLocation You could use this location object to return more information about the document's location, as you might do with a normal Loc...
WritableStream.WritableStream() - Web APIs
}); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer example. Backpressure Because of how backpressure is sup
ported in the API, its implementation in code may be less than obvious. To see how backpressure is implemented look for three things. The highWaterMark property, which is set when creating the counting strategy (line 35), sets the maximum amount of data that the WritableStream instance will handle in a single write() operation. In this example, it's the maximum amount of data that can be sent to de...
XMLDocument.load() - Web APIs
document.load() is a part of an old version of the W3C DOM Level 3 Load & Save module. Can be used with document.async to indicate whether the request is synchronous or asynchronous (the default). As of at least Gecko 1.9, this no longer sup
ports cross-site loading of documents (Use XMLHttpRequest or fetch() instead). Examples var xmlDoc = document.implementation.createDocument("", "test", null); function documentLoaded (e) { alert(new XMLSerializer().serializeToString(e.target)); // Gives querydata.xml contents as string } xmlDoc.addEventListener("load", documentLoaded, false); xmlDoc.load('querydata.xml'); See also the load sample in the XML tests directory. (To test this functionality, create the files on your local disk or on a webserver rather than loading the load.html file ...
Sending and Receiving Binary Data - Web APIs
as well. var myArray = new ArrayBuffer(512); var longInt8View = new Uint8Array(myArray); // generate some data for (var i=0; i< longInt8View.length; i++) { longInt8View[i] = i % 256; } var xhr = new XMLHttpRequest; xhr.open("POST", url, false); xhr.send(myArray); This is building a 512-byte array of 8-bit integers and sending it; you can use any binary data you'd like, of course. Note: Sup
port for sending ArrayBuffer objects using XMLHttpRequest was added to Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6). Add information about other browsers' sup
port here. Submitting forms and uploading files Please, read this paragraph. Firefox-specific examples This example transmits binary content asynchronously, using the POST method, and Firefox's non-standard sendAsBinary(). var r...
Using XMLHttpRequest in IE6 - Web APIs
XMLHttpRequest was first introduced by Microsoft in Internet Explorer 5.0 as an ActiveX control. However, in IE7 and other browsers XMLHttpRequest is a native JavaScript object. ...
XMLHttpRequest() - Web APIs
ely resembles the AnonXMLHttpRequest() constructor described in older versions of the XMLHttpRequest specification. const request = new XMLHttpRequest(paramsDictionary); Parameters (non-standard) objParameters There are two flags you can set: mozAnon Boolean: Setting this flag to true will cause the browser not to expose the origin and user credentials when fetching resources. Most im
portant, this means that cookies will not be sent unless explicitly added using setRequestHeader. mozSystem Boolean: Setting this flag to true allows making cross-site connections without requiring the server to opt-in using CORS. Requires setting mozAnon: true, i.e. this can't be combined with sending cookies or other user credentials. This only works in privileged (reviewed) apps (bug 692677); i...
XMLHttpRequest.getAllResponseHeaders() - Web APIs
by CRLF, or null if no response has been received. If a network error happened, an empty string is returned. An example of what a raw header string looks like: date: Fri, 08 Dec 2017 21:04:30 GMT\r\n content-encoding: gzip\r\n x-content-type-options: nosniff\r\n server: meinheld/0.6.1\r\n x-frame-options: DENY\r\n content-type: text/html; charset=utf-8\r\n connection: keep-alive\r\n strict-trans
port-security: max-age=63072000\r\n vary: Cookie, Accept-Encoding\r\n content-length: 6502\r\n x-xss-protection: 1; mode=block\r\n Each line is terminated by both carriage return and line feed characters (\r\n). These are essentially delimiters separating each of the headers. Note: In modern browsers, the header names are returned in all lower case, as per the latest spec. Example This example e...
XMLHttpRequest.multipart - Web APIs
eature was removed in Firefox/Gecko 22. Please use Server-Sent Events, Web Sockets, or responseText from progress events instead. This boolean indicates if the response is expected to be a stream of possibly multiple XML documents. If set to true, the content type of the initial response must be multipart/x-mixed-replace or an error will occur. All requests must be asynchronous. This enables sup
port for server push; for each XML document that's written to this request, a new XML DOM document is created and the onload handler is called between documents. Note: When this is set, the onload handler and other event handlers are not reset after the first XMLdocument is loaded, and the onload handler is called after each part of the response is received. ...
XMLHttpRequest.open() - Web APIs
ethod does not return until the response is received. If true, notification of a completed transaction is provided using event listeners. This must be true if the multipart attribute is true, or an exception will be thrown. Note: Synchronous requests on the main thread can be easily disruptive to the user experience and should be avoided; in fact, many browsers have deprecated synchronous XHR sup
port on the main thread entirely. Synchronous requests are permitted in Workers. user Optional The optional user name to use for authentication purposes; by default, this is the null value. password Optional The optional password to use for authentication purposes; by default, this is the null value. Specifications Specification Status Comment XMLHttpRequestThe def...
XMLHttpRequest.response - Web APIs
MIME type of the received data. See HTML in XMLHttpRequest to learn more about using XHR to fetch HTML content. json The response is a JavaScript object created by parsing the contents of received data as JSON. text The response is a text in a DOMString object. ms-stream The response is part of a streaming download; this response type is only allowed for download requests, and is only sup
ported by Internet Explorer. Example This example presents a function, load(), which loads and processes a page from the server. It works by creating an XMLHttpRequest object and creating a listener for readystatechange events such that that when readyState changes to DONE (4), the response is obtained and passed into the callback function provided to load(). The content is handled as raw text ...
XMLHttpRequest.status - Web APIs
The read-only XMLHttpRequest.status property returns the numerical HTTP status code of the XMLHttpRequest's response. Before the request completes, the value of status is 0. Browsers also re
port a status of 0 in case of XMLHttpRequest errors. Example var xhr = new XMLHttpRequest(); console.log('UNSENT: ', xhr.status); xhr.open('GET', '/server'); console.log('OPENED: ', xhr.status); xhr.onprogress = function () { console.log('LOADING: ', xhr.status); }; xhr.onload = function () { console.log('DONE: ', xhr.status); }; xhr.send(); /** * Outputs the following: * * UNSENT: 0 * OPENED: 0 * LOADING: 200 * DONE: 200 */ Specifications Specification Status Comment XMLHttpRequest Living Standard WHATWG living standard ...
XMLHttpRequest - Web APIs
olete since Gecko 6 Read only ArrayBuffer. The response to the request, as a JavaScript typed array. XMLHttpRequest.multipartObsolete since Gecko 22 This Gecko-only feature, a boolean, was removed in Firefox/Gecko 22. Please use Server-Sent Events, Web Sockets, or responseText from progress events instead. Event handlers onreadystatechange as a property of the XMLHttpRequest instance is sup
ported in all browsers. Since then, a number of additional event handlers have been implemented in various browsers (onload, onerror, onprogress, etc.). See Using XMLHttpRequest. More recent browsers, including Firefox, also sup
port listening to the XMLHttpRequest events via standard addEventListener() APIs in addition to setting on* properties to a handler function. Methods XMLHttpRequest.abort...
XMLHttpRequestResponseType - Web APIs
MIME type of the received data. See HTML in XMLHttpRequest to learn more about using XHR to fetch HTML content. json The response is a JavaScript object created by parsing the contents of received data as JSON. text The response is a text in a DOMString object. ms-stream The response is part of a streaming download; this response type is only allowed for download requests, and is only sup
ported by Internet Explorer. Deprecated values moz-chunked-arraybuffer A Firefox-only value which instructs XMLHttpRequest to deliver ArrayBuffer objects containing chunks of the incoming data. Accessing response during a progress event returns the data received so far. Outside the progress event handler, the value of response is always null. You shouldn't use this non-standard (and, as of F...
XMLSerializer - Web APIs
object, then passing the Document to be serialized into serializeToString(), which returns the XML equivalent of the document. Inserting nodes into a DOM based on XML This example uses the Element.insertAdjacentHTML() method to insert a new DOM Node into the body of the Document, based on XML created by serializing an Element object. Note: In the real world, you should usually instead call im
portNode() method to im
port the new node into the DOM, then call one of the following methods to add the node to the DOM tree: The Document and Element methods append() and prepend() The Node.replaceWith() method (to replace an existing node with the new one) The Document.insertAdjacentElement() and Element.insertAdjacentElement() methods. Because insertAdjacentHTML() accepts a string and not ...
XPathEvaluator.evaluate() - Web APIs
LID_EXPRESSION_ERR is raised. TYPE_ERR In case result cannot be converted to the specified type, an XPathException of type TYPE_ERR is raised. NAMESPACE_ERR If the expression contains namespace prefixes which cannot be resolved by the specified XPathNSResolver, a DOMException of type NAMESPACE_ERROR is raised. WRONG_DOCUMENT_ERR If the provided context node is from a document that is not sup
ported by the XPathEvaluator, a DOMException of type WRONG_DOCUMENT_ERR is raised. NOT_SUP
PORTED_ERR If the provided context node is not a type permitted as an XPath context node or the request type is not permitted by the XPathEvaluator, a DOMException of type NOT_SUP
PORTED_ERR is raised. Example The following example shows the use of the evaluate() method. HTML <div>XPath example</div> <div>Nu...
XPathException - Web APIs
perties XPathException.code Read only Returns a short that contains one of the error code constants. Constants Constant Value Description INVALID_EXPRESSION_ERR 51 If the expression has a syntax error or otherwise is not a legal expression according to the rules of the specific XPathEvaluator or contains specialized extension functions or variables not sup
ported by this implementation. TYPE_ERR 52 If the expression cannot be converted to return the specified type. Specifications Specification Status Comment Document Object Model (DOM) Level 3 XPath SpecificationThe definition of 'XPathException' in that specification. Recommendation Initial definition ...
XPathExpression.evaluate() - Web APIs
LID_EXPRESSION_ERR is raised. TYPE_ERR In case result cannot be converted to the specified type, an XPathException of type TYPE_ERR is raised. NAMESPACE_ERR If the expression contains namespace prefixes which cannot be resolved by the specified XPathNSResolver, a DOMException of type NAMESPACE_ERROR is raised. WRONG_DOCUMENT_ERR If the provided context node is from a document that is not sup
ported by the XPathEvaluator, a DOMException of type WRONG_DOCUMENT_ERR is raised. NOT_SUP
PORTED_ERR If the provided context node is not a type permitted as an XPath context node or the request type is not permitted by the XPathEvaluator, a DOMException of type NOT_SUP
PORTED_ERR is raised. Example The following example shows the use of the evaluate() method. HTML <div>XPath example</div> <div>Nu...
XRBoundedReferenceSpace.boundsGeometry - Web APIs
you should instead use an unbounded XRReferenceSpace and enforce the bounds on your own, as appropriate. Boundary shape The shape defined by boundsGeometry may be as simple as a square or as complex as is needed, potentially including concave and/or convex sections. However, you can't represent spaces with uneven floor levels using XRBoundedReferenceSpace. The ground is always at y = 0. It's im
portant that your content not be designed to require the user to exit the bounds specified by boundsGeometry. However, if the user's surroundings permit them to move in such a way as to exit the defined bounds, your content must be able to gracefully handle the situation, which is not considered an error condition. Although some samples render a mesh or other shape to display the bounds to the user, ...
XRHandedness - Web APIs
nput device being used. XRHandedness is used as the value of the the XRInputSource property handedness. Values none The input controller is not associated with one of the user's hands. left The input controller is being held in, worn on, or is attached to the user's left hand. right The input controller is being held in, worn on, or is attached to the user's right hand. Examples One im
portant usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. function updateInputSources(session, frame, refSpace) { for (let source of session.inputSources) { if (source.gripSpace) { let gripPose = frame.getPose(source.gripSpace, refSpace); if (gripPose)...
XRInputSource.handedness - Web APIs
being held in, worn on, or is attached to the user's right hand. Usage notes If the input source is not a device associated with a user's hand (whether by being held, attached, or worn), the value of handedness is none. This may indicate, for example, an input source which isn't hand-held, such as controls built into a headset or an input device attached to the head or body. Examples One im
portant usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. function updateInputSources(session, frame, refSpace) { for (let source of session.inputSources) { if (source.gripSpace) { let gripPose = frame.getPose(source.gripSpace, refSpace); if (gripPose)...
XRInputSource.profiles - Web APIs
Specifications Specification Status Comment WebXR Device APIThe definition of 'XRInputSource.profiles' in that specification. Working Draft Initial definition. ...
XRInputSource.targetRaySpace - Web APIs
on the mode: Every gaze input (targetRayMode value of gaze), shares the same XRSpace object as their target ray space, since the gaze input comes from the viewer's head. This shared space represents the same location as the space returned by the XRSession method requestReferenceSpace(), but is maintained as a different object to allow for future enhancements to the API. The target ray space re
ported by tracked pointer inputs (targetRayMode of tracked-pointer) is actually based upon the true spatial position and orientation of the input device. To determine the position and orientation of the target ray while rendering a frame, pass it into the XRFrame method getPose() method, then use the returned XRPose object's transform to gather the spatial information you need. Example This fragme...
XRInputSourceArray.entries() - Web APIs
ntax let inputSourceIterator = xrInputSourceArray.entries(); for (let entry of xrInputSourceArray.entries()) { /* ... */ } Parameters None. Return value An iterator which can be used to walk through the list of XRInputSource objects included in the input source array. Examples This example snippet gets the list of inputs for a session and tries to handle each type of input device it sup
ports using. let sources = xrSession.inputSources; for (let input of sources.entries()) { if (input.gamepad) { checkGamepad(input.gamepad); } else { if (input.targetRayMode === "tracked-pointer" && input.handedness === player.handedness) { /* Handle main hand controller */ handleMainHandInput(input); } else { /* Handle other inputs */ } } } For each ...
XRInputSourceArray.forEach() - Web APIs
ion, you may omit this. thisArg Optional The value to be used for this while executing the callback. Note that if you use arrow function notation (=>) to provide the callback, you can omit thisArg, since all arrow functions lexically bind this. Return value Undefined. Examples This example snippet gets the list of inputs for a session and tries to handle each type of input device it sup
ports using. let inputSources = xrSession.inputSources; inputSources.forEach((input) => { if (input.gamepad) { checkGamepad(input.gamepad); } else { if (input.targetRayMode === "tracked-pointer" && input.handedness === player.handedness) { /* Handle main hand controller */ handleMainHandInput(input); } else { /* Handle other inputs */ } } }); For eac...
XRInputSourceArray.keys() - Web APIs
JavaScript iterator that can be used to walk through the keys for each entry in the list of input sources. The values returned by the iterator are the indexes of each entry in the list; that is, the numbers 0, 1, 2, and so forth through the index of the last item in the list. Examples This example snippet gets the list of inputs for a session and tries to handle each type of input device it sup
ports using. for (const inputIdx of xrSession.inputSources.keys()) { /* the keys are the indexes into the list of inputs */ checkInput(xrSession.inputSources[inputIdx]); } Here, for...of is used to iterate over each of the keys. For each key, the input is retrieved using the index with array notation: xrSession.inputSources[inputIdx]. Specifications Specification Status Comment...
XRPermissionDescriptor.optionalFeatures - Web APIs
their origin point. The viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is sup
ported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Usage notes Examples let xrPermissionDesc = { name: ...
XRPermissionDescriptor - Web APIs
ther returned state--which is almost certainly denied, which is the only other option as of this article's writing--we do nothing, since we can't use WebXR. If the permission request promise is rejected, the error is handled (currently by just dumping it to the console using domxref("console.log()")}}). If the Permissions API isn't available at all, this example simply assumes that WebXR will re
port an appropriate error if permission isn't available, and tries to start up the WebXR session using the same setupXR() function called by the granted case. let xrPermissionDesc = { name: "xr", mode: "immersive-vr", requiredFeatures: [ "local-floor" ] }; if (navigator.permissions) { navigator.permissions.query(xrPermissionDesc).then(({state}) => { switch(state) { case "granted": ...
XRPermissionStatus.granted - Web APIs
their origin point. The viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is sup
ported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Usage notes Examples Specifications Specific...
XRPose.emulatedPosition - Web APIs
osition property is true. Contrariwise, XR devices which can also track movement forward and backward as well as laterally--six degree of freedom (6DoF) devices--don't require any information from other sources to determine the user's position, so the value of emulatedPosition is false. The same notion applies not just to the user's head, but to any object. A hand controller that can directly re
port its position would have a value of false for this property as well. If its position is computed as an offset from another object (such as by basing it off the model representing the user's body), then this value is true. This information is im
portant because devices whose position is emulated are prone to their offset drifting relative to the real world space over time. This is because emulating...
XRReferenceSpaceEvent - Web APIs
erenceSpace's native origin after the event, defined relative to the coordinate system before the event. Methods While XRReferenceSpaceEvent does not define any methods, it inherits the methods of its parent interface, Event. Event types reset The reset event is sent to a reference space when its native origin is changed due to a discontinuity, recalibration, or device reset. This is an op
portunity for your app to update any stored transforms, position/orientation information, or the like--or to dump any cached values based on the reference's space's origin so you can recompute them as needed. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRReferenceSpaceEvent' in that specification. Working Draft Initial definition. ...
XRReferenceSpaceEventInit - Web APIs
You will not usually need to use this, since these events are created by the WebXR infrastructure. Properties referenceSpace The XRReferenceSpace from which the event originated. transform An XRRigidTransform which maps the old coordinate system (from before the changes indicated by this event) to the new coordiante system. ...
XRRenderState - Web APIs
e plane which is parallel to the display beyond which rendering of the scene no longer takes place. This, essentially, specifies the maximum distance the user can see. depthNear Read only The distance, in meters, of the near clip plane from the viewer. The near clip plane is the plane, parallel to the display, at which rendering of the scene begins. Any closer to the viewer than this, and no
portions of the scene are drawn. inlineVerticalFieldOfView Read only The default vertical field of view, defined in radians, to use when the session is in inline mode. null for all immersive sessions. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRRenderState' in that specification. Working Draft Initial definition. ...
XRRigidTransform.inverse - Web APIs
undoes the transformation, resulting in the object returning to its previous pose. In other words, its position and orientation both return to their prior configurations. Examples In this example, the model view matrix for an object is computed by taking the view matrix and multiplying it by the object's pose matrix. let modelViewMatrix = mat4.create(); for (let view of pose.view) { let view
port = glLayer.getView
port(view); gl.view
port(view
port.x, view
port.y, view
port.width, view
port.height); /* ... */ mat4.multiply(modelViewMatrix, view.transform.inverse.matrix, objectMatrix); gl.uniformMatrix4fv(programInfo.uniformLocations.modelViewMatrix, false, modelViewMatrix); /* ... */ } This outline of a renderer's core code shows how the pose's view gets rep...
XRRigidTransform.position - Web APIs
} else { xrReferenceSpace = refSpace.getOffsetReferenceSpace( new XRRigidTransform({y: -1.5}); ); } xrSession.requestAnimationFrame(onFrame); } After setting up the graphics context for WebXR use, this begins by looking to see if a variable immersiveSession is true; if so, we first request a bounded-floor reference space. if that fails (probably because bounded-floor isn't sup
ported), we try requesting a local-floor reference space. If we're not in an immersive session, we instead request a viewer reference space. In all cases, once the space has been obtained, it gets passed into the refSpaceCreated() function. For immersive spaces, the specified space is simply saved for future use. However, for inline sesions, we know we're in a space not automatically adjusted for fl...
XRSession.environmentBlendMode - Web APIs
roperty identifies if--and to what degree--the computer-generated imagery is overlaid atop the real world. This is used to differentiate between fully-immersive VR sessions and AR sessions which render over a pass-through image of the real world, possibly partially transparently. The value is a DOMString which contains one of the values defined by the XREnvironmentBlendMode enumerated type. Im
portant: environmentBlendMode is part of the WebXR Augmented Reality Module, which has not yet reached a stable state. You should use caution when using its features. Syntax blendMode = xrSession.environmentBlendMode; Value A DOMString whose value is one of the strings found in the enumerated type XREnvironmentBlendMode, defining if--and if so, how--virtual, rendered content is overlaid atop the ...
XRSession.inputSources - Web APIs
s an XRInputSourceArray object which lists all controllers and input devices which are expressly associated with the XR device and are currently available. These controllers may include handheld controllers, XR-equipped gloves, optically tracked hands, and gaze-based input methods. Keyboards, gamepads, and mice are not considered WebXR input sources. Note: Traditional gamepad controllers are sup
ported using the Gamepad API. Syntax inputSources = xrSession.inputSources; Value An XRInputSourceArray object listing all of the currently-connected input controllers which are linked specifically to the XR device currently in use. The returned object is live; as devices are connected to and removed from the user's system, the list's contents update to reflect the changes. Usage notes You can ...
XRSession.visibilityState - Web APIs
ndered by the XRSession may currently be visible to the user, it is not the user's primary focus at the moment; it's also possible the session is not currently visible at all. In order to optimize resource utilization, the user agent may be handling the session's requestAnimationFrame() callbacks at a throttled rate. Input controllers are not being processed for the session. Usage notes It's im
portant to keep in mind that because an immersive WebXR session is potentially being shown using a different display than the HTML document in which it's running (such as when being shown on a headset), the value of a session's visibilityState may not necessarily be the same as the owning document's visibilityState. For instance, if the viewer is using a headset tethered to a computer and the immersiv...
XRSystem: devicechange event - Web APIs
e a UI element which the user can use to activate immersive mode. This is shown in the example below. Example The example shown here handles the devicechange event by toggling the availability of the "Enter XR" button based on whether or not any immersive devices are currently available. if (navigator.xr) { navigator.xr.addEventListener("devicechange", event => { navigator.xr.isSessionSup
ported("immersive-vr") .then(immersiveOK) => { if (immersiveOK) { enableXRButton.disabled = false; } else { enableXRButton.disabled = true; } }); }); } When devicechange is received, the handler set up in this code calls the XR method isSessionSup
ported() to find out if there's a device available that can handle immersive VR presentations. If there is, th...
XRView.eye - Web APIs
r); gl.clearColor(0,0, 0, 1.0); gl.clearDepth(1.0); gl.clear(gl.COLOR_BUFFER_BIT, gl.DEPTH_BUFFER_BIT); for (let view of xrPose.views) { let skipView = false; if (view.eye == "left" && body.leftEye.injured) || skipView = updateInjury(body.leftEye); } else if (view.eye == "right" && body.rightEye.injured) { skipView = updateInjury(body.rightEye); } if (!skipView) { let view
port = glLayer.getView
port(view); gl.view
port(view
port.x, view
port.y, view
port.width, view
port.height); renderScene(gl, view); } } For each of the views, the value of eye is checked and if it's either left or right, we check to see if the body.leftEye.injured or body.rightEye.injured property is true; if so, we call a function updateInjury() on that eye to do things such as allow a bit of ...
XRView.projectionMatrix - Web APIs
The XRView interface's read-only projectionMatrix property specifies the projection matrix to apply to the underlying view. This should be used to integrate perspective to everything in the scene, in order to ensure the result is consistent with what the eye expects to see. Im
portant: Failure to apply proper perspective, or inconsistencies in perspective, may result in possibly serious user discomfort or distress. Syntax let projectionMatrix = xrView.projectionMatrix; Value A Float32Array object representing the projection matrix for the view. The projection matrix for each eye's view is used to ensure that the correct area of the scene is presented to each eye in order to create a believable 3D scene without introducing discomfort for the user. Examples Specifications S...
XRWebGLLayer() - Web APIs
The frame buffer's color buffer will be established with an alpha channel if the alpha Boolean property is true. Otherwise, the color buffer will not have an alpha channel. The default value is true. antialias Optional A Boolean value which is true if anti-aliasing is to be used when rendering in the context; otherwise false. The browser selects the anti-aliasing method to use; there is no sup
port for requesting a specific mode yet. The default value is true. depth Optional A Boolean value which, if true, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. The default is true. framebufferScaleFactor Optional A floating-point value which is used to scale the image during compositing, with a value of 1.0 represents the default pixel size for the fram...
XRWebGLLayerInit - Web APIs
The frame buffer's color buffer will be established with an alpha channel if the alpha Boolean property is true. Otherwise, the color buffer will not have an alpha channel. The default value is true. antialias Optional A Boolean value which is true if anti-aliasing is to be used when rendering in the context; otherwise false. The browser selects the anti-aliasing method to use; there is no sup
port for requesting a specific mode yet. The default value is true. depth Optional A Boolean value which, if true, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. The default is true. framebufferScaleFactor Optional A floating-point value which is used to scale the image during compositing, with a value of 1.0 represents the default pixel size for the fram...
Browser Differences - Web APIs
Browser Differences Netscape 7.x (all platforms) and Internet Explorer 6 (Windows) sup
port the W3C XSLT 1.0 standard (http://www.w3.org/TR/xslt). IE 5.0 and 5.5 (both Windows) sup
ported only the working draft of XSLT, and thus are not compatible with XSLT 1.0 stylesheets. Netscape 6.x only partially sup
ported XSLT 1.0. ...
Introduction - Web APIs
ne file) way to change the look of content. CSS (Cascade Style Sheets) was one of the first ways proposed by the W3C. CSS is a simple way to apply style rules to a web document. These style rules define how the document (the content) should be laid out. However, it has several limitations, such as lack of programming structures and ability to create complex layout models. CSS also has limited sup
port for changing the position of an element. XSL (Extensible Stylesheet Language) Transformations are composed of two parts: XSL elements, which allow the transformation of an XML tree into another markup tree and XPath, a selection language for trees. XSLT takes an XML document (the content) and creates a brand new document based on the rules in the XSL stylesheet. This allows XSLT to add, remove a...
ARIA Technique Template - Accessibility
Description Possible effects on user agents and assistive technology Note: Opinions may differ on how assistive technology should handle this technique. The information provided above is one of those opinions and therefore not normative. Examples Example 1: Code Working Examples: Notes ARIA attributes used Related ARIA techniques Compatibility TBD: Add sup
port information for common UA and AT product combinations Additional resources ...
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
elements you want to concatenate into a single accessible name. Both aria-labelledby and aria-describedby are specified on the form element that is to be labelled, for example an <input> In both cases, the label for/label control bindings that may also exist are overridden by aria-labelledby. If on an HTML page you provide aria-labelledby, you should also provide a label for construct to also sup
port older browsers that do not have ARIA sup
port yet. With Firefox 3, your blind users will automatically get better accessibility from the new attribute, but the users of older browsers are not left in the dark this way. Example: Shut down computer after minutes <input aria-labelledby="labelShutdown shutdownTime shutdownUnit" type="checkbox" /> <span id="labelShutdown">Shut down computer after</...
Accessibility FAQ - Accessibility
Where can I find more about Mozilla's accessibility initiatives? Mozilla Accessibility Project What are some of the built-in accessibility features that are currently sup
ported in the browser? Firefox 3 Accessibility Features (archive.org) Which assistive technologies sup
port Firefox and Thunderbird? Assistive Technology Compatibility - Documents assistive technologies for Windows, Linux, UNIX, Mac OS X and the degree of compatibility with Firefox What can I do to make sure my Mozilla extensions are accessible? In general, use the Accessible Toolkit Checklist (archive.org). For interface design with XUL, follow the Accessibile XUL Authoring Guidelines (archive.org). I'm interested in helping promote the fine accessibility features that Firefox provides, what can I do? Jo...
Keyboard-navigable JavaScript widgets - Accessibility
e elements that do not exist in HTML. Grouping controls For grouping widgets such as menus, tablists, grids, or tree views, the parent element should be in the tab order (tabindex="0"), and each descendent choice/tab/cell/row should be removed from the tab order (tabindex="-1"). Users should be able to navigate the descendent elements using arrow keys. (For a full description of the keyboard sup
port that is normally expected for typical widgets, see the WAI-ARIA Authoring Practices.) The example below shows this technique used with a nested menu control. Once keyboard focus lands on the containing <ul> element, the JavaScript developer must programmatically manage focus and respond to arrow keys. For techniques for managing focus within widgets, see "Managing focus inside groups" below. Ex...
Mobile accessibility checklist - Accessibility
r the benefit of screen reader users. Handling State Standard controls such as radio buttons and checkboxes are handled by the operating system. However, for other custom controls state changes must be provided via ARIA States such as aria-checked, aria-disabled, aria-selected, aria-expanded, and aria-pressed. Orientation Content should not be restricted to a single orientation, such as
portrait or landscape, unless essential. WCAG 2.1: Orientation Examples of when an orientation is esssential is a piano application or a bank cheque. General Guidelines An app title MUST be provided. Headings MUST not break hierarchical structure <h1>Top level heading</h1> <h2>Secondary heading</h2> <h2>Another secondary heading</h2> <h3>Low level heading</h3> ARIA Landm...
Operable - Accessibility
lity back in 2.1.2 No keyboard trap (A) When entering a section of functionality using the keyboard, you should be able to get out of that section again using *only* the keyboard. For example, if you press Enter/Return on a focused button to open an options window, you should be able to close that window again and return to the main content using the keyboard. This is very im
portant so that keyboard users do not get trapped on specific sections of your apps. 2.1.3 Keyboard -- all functionality (AAA) This is a further step beyond criterion 2.1.1. To achieve AAA conformance, all functionality should be accessible using keyboard controls -- with no exceptions. See UI controls and Building keyboard accessibility back in 2.1.4 Character Key Shor...
Accessibility
nt that can create accessibility problems is multimedia -- video, audio, and image content need to be given proper textual alternatives so they can be understood by assistive technologies and their users. This article shows how. Mobile accessibility With web access on mobile devices being so popular, and popular platforms such as iOS and Android having fully-fledged accessibility tools, it is im
portant to consider the accessibility of your web content on these platforms. This article looks at mobile-specific accessibility considerations. Other documentation Understanding the Web Content Accessibility Guidelines This set of articles provides quick explanations to help you understand the steps that need to be taken to conform to the recommendations outlined in the W3C Web Content Acc...
-moz-image-rect - CSS: Cascading Style Sheets
Syntax -moz-image-rect(<uri>, top, right, bottom, left); Values <url> The URI of the image from which to take the sub-image. top The top edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. right The right edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. bottom The bottom edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. left The left edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. ...
-moz-user-input - CSS: Cascading Style Sheets
r implementations). A similar property, user-focus, was proposed in early drafts of a predecessor of the CSS3 UI specification, but was rejected by the working group. Syntax Values none The element does not respond to user input, and it does not become :active. enabled The element accepts user input. For textboxes, this is the default behavior. Please note that this value is no longer sup
ported in Firefox 60 onwards (bug 1405087). disabled The element does not accept user input. However, this is not the same as setting disabled to true, in that the element is drawn normally. Please note that this value is no longer sup
ported in Firefox 60 onwards (bug 1405087). Formal definition Initial valueautoApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete F...
-webkit-line-clamp - CSS: Cascading Style Sheets
most cases you will also want to set overflow to hidden, otherwise the contents won't be clipped but an ellipsis will still be shown after the specified number of lines. When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. Note: This property was originally implemented in WebKit and has some issues. It got standardized for legacy sup
port. The CSS Overflow Module Level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues. Syntax /* Keyword value */ -webkit-line-clamp: none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /* Global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none This value ...
-webkit-overflow-scrolling - CSS: Cascading Style Sheets
lling for a given element. Syntax Values auto Use "regular" scrolling, where the content immediately ceases to scroll when you remove your finger from the touchscreen. touch Use momentum-based scrolling, where the content continues to scroll for a while after finishing the scroll gesture and removing your finger from the touchscreen. The speed and duration of the continued scrolling is pro
portional to how vigorous the scroll gesture was. Also creates a new stacking context. Formal definition Initial valueautoApplies toscrolling boxesInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | touch Examples HTML <div class="scroll-touch"> <p> This paragraph has momentum scrolling </p> </div> <div class="scroll-auto"> <p> This paragraph does no...
-webkit-text-security - CSS: Cascading Style Sheets
or <textarea>) by replacing them with a shape. It only affects fields that are not of type=password. Syntax -webkit-text-security: circle; -webkit-text-security: disc; -webkit-text-security: square; -webkit-text-security: none; Formal definition Value not found in DB! Formal syntax Syntax not found in DB! Examples Obscuring a text input Try typing in the field below. If your browser sup
ports this property, the characters should be visually replaced with squares. HTML <label for="name">Name:</label> <input type="text" name="name" id="name" /> CSS input { -webkit-text-security: square; } Result Specifications Not part of any standard. ...
:-moz-locale-dir(ltr) - CSS: Cascading Style Sheets
erface is being displayed left-to-right. This is determined by the preference intl.uidirection.locale (where locale is the current locale) being set to "ltr". Note: This selector is mainly used by extensions and themes to adapt the user interface based on the user's locale. (This can vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't sup
port the user's default locale, since they can sup
port both left-to-right and right-to-left layouts regardless of locale specifics. This selector does not work properly from HTML; it always matches, regardless of whether the UI locale is left-to-right or right-to-left. Syntax :-moz-locale-dir(ltr) Examples This example doesn't work if you're not using Firefox, and may not work even in Firefox ...
:-moz-locale-dir(rtl) - CSS: Cascading Style Sheets
erface is being displayed right-to-left. This is determined by the preference intl.uidirection.locale (where locale is the current locale) being set to "rtl". Note: This selector is mainly used by extensions and themes to adapt the user interface based on the user's locale. (This can vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't sup
port the user's default locale, since they can sup
port both left-to-right and right-to-left layouts regardless of locale specifics. This selector does not work properly from HTML; it never matches, no matter whether the UI locale is left-to-right or right-to-left. Syntax :-moz-locale-dir(rtl) Examples This example will not work if you're not using Firefox, and might not work properly even in F...
:-webkit-autofill - CSS: Cascading Style Sheets
The :-webkit-autofill CSS pseudo-class matches when an <input> element has its value autofilled by the browser. Note: The user agent style sheets of many browsers use !im
portant in their :-webkit-autofill style declarations, making them non-overrideable by webpages without resorting to JavaScript hacks. Syntax :-webkit-autofill Specifications Not part of any standard. ...
::-moz-focus-inner - CSS: Cascading Style Sheets
The ::-moz-focus-inner CSS pseudo-element is a Mozilla extension that represents an inner focus ring of the <button> element as well as the button, submit, reset, and color types of the <input> element. Note: Using ::-moz-focus-inner with anything than the buttons that sup
port it doesn't match anything and has no effect. Syntax Syntax not found in DB! Examples HTML <input type="submit" value="Input"/> <button type="submit">Button</button> CSS button::-moz-focus-inner, input[type="color"]::-moz-focus-inner, input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner { padding-block-start: 0px; padding-inline-end: 2px; padding-block-end: 0px; padding-inline-start: 2px; border: 1px dotted red; } ...
::-webkit-file-upload-button - CSS: Cascading Style Sheets
Syntax selector::-webkit-file-upload-button Examples HTML <form> <label for="fileUpload">Upload file</label><br> <input type="file" id="fileUpload"> </form> CSS input, label { display: block; } input[type=file]::-webkit-file-upload-button { border: 1px solid grey; background: #FFFAAA; } Below is the example for you to try. ...
::-webkit-progress-bar - CSS: Cascading Style Sheets
It is a child of the ::-webkit-progress-inner-element pseudo-element and the parent of the ::-webkit-progress-value pseudo-element. Note: For ::-webkit-progress-value to take effect, appearance needs to be set to none on the <progress> element. ...
::-webkit-progress-value - CSS: Cascading Style Sheets
It is a child of the ::-webkit-progress-bar pseudo-element. Note: In order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. Syntax ::-webkit-progress-value Examples This example will only work in browsers based on Blink or WebKit. ...
::-webkit-scrollbar - CSS: Cascading Style Sheets
#000; } <div class="visible-scrollbar"> Etiam sagittis sem sed lacus laoreet, eu fermentum eros auctor. Proin at nulla elementum, consectetur ex eget, commodo ante. Sed eros mi, bibendum ut dignissim et, maximus eget nibh. Phasellus blandit quam turpis, at mollis velit pretium ut. Nunc consequat efficitur ultrices. Nullam hendrerit posuere est. Nulla libero sapien, egestas ac felis
porta, cursus ultricies quam. Vestibulum tincidunt accumsan sapien, a fringilla dui semper in. Vivamus consectetur ipsum a ornare blandit. Aenean tempus at lorem sit amet faucibus. Curabitur nibh justo, faucibus sed velit cursus, mattis cursus dolor. Pellentesque id pretium est. Quisque convallis nisi a diam malesuada mollis. Aliquam at enim ligula. </div> <div class="invisible-scrollbar"> ...
::-webkit-search-cancel-button - CSS: Cascading Style Sheets
The ::-webkit-search-cancel-button CSS pseudo-element represents a button (the "cancel button") at the edge of an <input> of type="search" which clears away the current value of the <input> element. This button and pseudo-element are non-standard, sup
ported only in WebKit and Blink, hence the vendor prefix. The clear button is only shown on non-empty search <input> elements. Syntax selector::-webkit-search-cancel-button Specifications Not part of any standard. ...
::after (:after) - CSS: Cascading Style Sheets
his text. </span> CSS .ribbon { background-color: #5BC8F7; } .ribbon::after { content: "This is a fancy orange box."; background-color: #FFBA10; border-color: black; border-style: dotted; } Result Tooltips This example uses ::after, in conjunction with the attr() CSS expression and a data-descr custom data attribute, to create tooltips. No JavaScript is required! We can also sup
port keyboard users with this technique, by adding a tabindex of 0 to make each span keyboard focusable, and using a CSS :focus selector. This shows how flexible ::before and ::after can be, though for the most accessible experience a semantic disclosure widget created in some other way (such as with details and summary elements) is likely to be more appropriate. HTML <p>Here we have some <span ta...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
st letter is included in the match. Punctuation includes any Unicode character defined in the open (Ps), close (Pe), initial quote (Pi), final quote (Pf), and other punctuation (Po) classes. Some languages have digraphs that are always capitalized together, like the IJ in Dutch. In these cases, both letters of the digraph should be matched by the ::first-letter pseudo-element. (This is poorly sup
ported by browsers; see the browser compatibility table below.) A combination of the ::before pseudo-element and the content property may inject some text at the beginning of the element. In that case, ::first-letter will match the first letter of this generated content. CSS3 introduced the ::first-letter notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also ...
::grammar-error - CSS: Cascading Style Sheets
grammatically incorrect. Allowable properties Only a small subset of CSS properties can be used in a rule with ::grammar-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow Syntax ::grammar-error Examples Simple document grammar check In this example, eventual sup
porting browsers should highlight any flagged grammatical errors with the styles shown. HTML <p>My friends is coming to the party tonight.</p> CSS ::grammar-error { text-decoration: underline red; color: red; } Result Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::grammar-error' in that specification. Working Dra...
::marker - CSS: Cascading Style Sheets
Syntax ::marker Examples HTML <ul> <li>Peaches</li> <li>Apples</li> <li>Plums</li> </ul> CSS ul li::marker { color: red; font-size: 1.5em; } Result Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::marker' in that specification. Working Draft No significant change. CSS Lists Mo...
::part() - CSS: Cascading Style Sheets
ement::part(tab):hover { background-color: #0c0c0d19; border-color: #0c0c0d33; } tabbed-custom-element::part(tab):hover:active { background-color: #0c0c0d33; } tabbed-custom-element::part(tab):focus { box-shadow: 0 0 0 1px #0a84ff inset, 0 0 0 1px #0a84ff, 0 0 0 4px rgba(10, 132, 255, 0.3); } tabbed-custom-element::part(active) { color: #0060df; border-color: #0a84ff !im
portant; } JavaScript let template = document.querySelector("#tabbed-custom-element"); globalThis.customElements.define(template.id, class extends HTMLElement { constructor() { super(); this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template.content); } }); Result Specifications Specification Status Comment Shadow PartsThe definiti...
::placeholder - CSS: Cascading Style Sheets
::placeholder in its selector. Note: In most browsers, the appearance of placeholder text is a translucent or light gray color by default. Syntax ::placeholder Accessibility concerns Color contrast Contrast Ratio Placeholder text typically has a lighter color treatment to indicate that it is a suggestion for what kind of input will be valid, and is not actual input of any kind. It is im
portant to ensure that the contrast ratio between the color of the placeholder text and the background of the input is high enough that people experiencing low vision conditions will be able to read it while also making sure there is enough of a difference between the placeholder text and input text color that users do not mistake the placeholder for inputed data. Color contrast ratio is determined b...
::selection - CSS: Cascading Style Sheets
ction { color: white; background-color: blue; } Result Accessibility concerns Don't override selected text styles for purely aesthetic reasons -- users can customize them to suit their needs. For people experiencing cognitive concerns or who are less technologically literate, unexpected changes to selection styles may hurt their understanding of the functionality. If overridden, it is im
portant to ensure that the contrast ratio between the text and background colors of the selection is high enough that people experiencing low vision conditions can read it. Color contrast ratio is found by comparing the luminosity of the selected text and the selected text background colors. To meet current Web Content Accessibility Guidelines (WCAG), text content must have a contrast ratio of 4.5:1,...
::spelling-error - CSS: Cascading Style Sheets
d as incorrectly spelled. Allowable properties Only a small subset of CSS properties can be used in a rule with ::spelling-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow Syntax ::spelling-error Examples Simple document spell check In this example, eventual sup
porting browsers should highlight any flagged spelling errors with the styles shown. HTML <p contenteditable spellcheck="true">My friends are coegdfgfddffbgning to the party tonight.</p> CSS ::spelling-error { text-decoration: wavy red; } Result Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::spelling-error' in that sp...
:blank - CSS: Cascading Style Sheets
Note: The :blank selector is considered at risk, as the CSSWG keeps changing it. See CSSWG issue #1967. The :blank CSS pseudo-class selects empty user input elements (eg. <input> or <textarea>). Syntax :blank Examples Simple :blank example In eventual sup
porting browsers, the :blank pseudo-class will enable developers to highlight in some way input controls that are not required, but still have no content filled in, perhaps as a reminder to users. HTML <textarea></textarea> CSS textarea:blank { border: 3px solid red; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':blank' in that specification. Working Draft Initial definition. ...
:empty - CSS: Cascading Style Sheets
The :empty CSS pseudo-class represents any element that has no children. Children can be either element nodes or text (including whitespace). Comments, processing instructions, and CSS content do not affect whether an element is considered empty. Note: In Selectors Level 4 the :empty pseudo-class was changed to act like :-moz-only-whitespace, but no browser currently sup
ports this yet. /* Selects any <div> that contains no content */ div:empty { background: lime; } Syntax :empty Examples HTML <div class="box"><!-- I will be lime. --></div> <div class="box">I will be pink.</div> <div class="box"> <!-- I will be pink in older browsers because of the whitespace around this comment. --> </div> <div class="box"> <p><!-- I will be pink in all browsers because of the non-collapsible whi...
:target - CSS: Cascading Style Sheets
HTML <h3>Table of Contents</h3> <ol> <li><a href="#p1">Jump to the first paragraph!</a></li> <li><a href="#p2">Jump to the second paragraph!</a></li> <li><a href="#nowhere">This link goes nowhere, because the target doesn't exist.</a></li> </ol> <h3>My Fun Article</h3> <p id="p1">You can target <i>this paragraph</i> using a ...
negative - CSS: Cascading Style Sheets
ovided as value for the descriptor is prepended to the counter representation; and a second symbol if specified, will be appended to the representation. The negative descriptor has effect only if the system value is symbolic, alphabetic, numeric, additive, or extends, if the extended counter style itself uses a negative sign. If the negative descriptor is specified for other systems that don't sup
port negative counter values, then the descriptor is ignored. Formal definition Related at-rule@counter-styleInitial value"-" hyphen-minusComputed valueas specified Formal syntax <symbol> <symbol>?where <symbol> = <string> | <image> | <custom-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <imag...
speak-as - CSS: Cascading Style Sheets
ht read it out as if the value of speak-as was numbers. <counter-style-name> The name of another counter style, specified as a <custom-ident>. If included, the counter will be spoken out in the form specified in that counter style, kind of like specifying the fallback descriptor. If the specified style does not exist, speak-as defaults to auto. Accessibility concerns Assistive technology sup
port is very limited for the speak-as property. Do not rely on it to convey information critical to understanding the page's purpose. Let's Talk About Speech CSS | CSS Tricks Formal definition Related at-rule@counter-styleInitial valueautoComputed valueas specified Formal syntax auto | bullets | numbers | words | spell-out | <counter-style-name>where <counter-style-name> = <custom-ident> Exampl...
@document - CSS: Cascading Style Sheets
o the regexp() function must be enclosed in quotes. Escaped values provided to the regexp() function must additionally be escaped from the CSS. For example, a . (period) matches any character in regular expressions. To match a literal period, you would first need to escape it using regular expression rules (to \.), then escape that string using CSS rules (to \\.). @document is currently only sup
ported in Firefox; if you wanted to replicate using such functionality in your own non-Firefox browser, you could try using this polyfill by @An-Error94, which uses a combination of a user script, data-* attributes, and attribute selectors. Note: There is a -moz-prefixed version of this property -- @-moz-document. This has been limited to use only in user and UA sheets in Firefox 59 in Nightly and B...
font-style - CSS: Cascading Style Sheets
font. oblique Specifies that the font-face is an artificially sloped version of the normal font. oblique with angle Selects a font classified as oblique, and additionally specifies an angle for the slant of the text. oblique with angle range Selects a font classified as oblique, and additionally specifies a range of allowable angle for the slant of the text. Note that a range is only sup
ported when the font-style is oblique; for font-style: normal or italic, no second value is allowed. Formal definition Related at-rule@font-faceInitial valuenormalComputed valueas specified Formal syntax normal | italic | oblique <angle>{0,2} Examples Specifying an italic font style As an example, consider the garamond font family, in its normal form, we get the following result: @font-face {...
src - CSS: Cascading Style Sheets
url(path/to/font.otf) format("opentype"); Values <url> [ format( <string># ) ]? Specifies an external reference consisting of a <url>, followed by an optional hint using the format() function to describe the format of the font resource referenced by that URL. The format hint contains a comma-separated list of format strings that denote well-known font formats. If a user agent doesn't sup
port the specified formats, it skips downloading the font resource. If no format hints are supplied, the font resource is always downloaded. <font-face-name> Specifies the name of a locally-installed font face using the local() function, which uniquely identifies a single font face within a larger family. The name can optionally be enclosed in quotes. Description The value of this descriptor is a...
-moz-device-pixel-ratio - CSS: Cascading Style Sheets
in-device-pixel-ratio and -webkit-max-device-pixel-ratio. Syntax <number> The number of device pixels per CSS pixel. Media: media/visual Accepts min/max prefixes: yes Examples Basic compatibility example -moz-device-pixel-ratio may be used for compatibility with Firefox older than 16, and alongside -webkit-device-pixel-ratio for compatibility with WebKit-based browsers that do not sup
port dppx. Example: @media (-webkit-min-device-pixel-ratio: 2), /* Webkit-based browsers */ (min--moz-device-pixel-ratio: 2), /* Older Firefox browsers (prior to Firefox 16) */ (min-resolution: 2dppx), /* The standard way */ (min-resolution: 192dpi) /* dppx fallback */ Note: See this CSSWG article for compatibility good practices regarding resolutio...
-webkit-animation - CSS: Cascading Style Sheets
The -webkit-animation Boolean CSS media feature is a Chrome extension whose value is true if vendor-prefixed CSS animations are sup
ported. Apple has a description in Safari CSS Reference. Note: This media feature is only sup
ported by WebKit. If possible, use an @sup
ports feature query instead. Syntax The -webkit-animation media feature is a Boolean whose value is true if the vendor-prefixed CSS animation properties are sup
ported. Values true The browser sup
ports -webkit prefixed CSS animations. false The browser doesn't sup
port these prefixed CSS animations. Examples @media (-webkit-animation) { /* CSS to use if animations are sup
ported */ } Specifications Not part of any standard. ...
-webkit-transform-3d - CSS: Cascading Style Sheets
The -webkit-transform-3d Boolean CSS media feature is a Chrome extension whose value is true if vendor-prefixed CSS 3D transforms are sup
ported. Note: This media feature is only sup
ported by WebKit and Blink. If possible, use an @sup
ports feature query instead. Syntax -webkit-transform-3d is a Boolean CSS media feature whose value is true if the browser sup
ports -webkit prefixed CSS 3D transforms. Values true The browser sup
ports the 3D CSS transforms with the -webkit prefix. false The 3D CSS transforms prefixed with -webkit are not sup
ported by the browser. Examples @media (-webkit-transform-3d) { .foo { transform-style: preserve-3d; } } @media (-webkit-transform-3d: 1) { .foo { transform-style: preserve-3d; } } Specifications Specificatio...
color-gamut - CSS: Cascading Style Sheets
The color-gamut CSS media feature can be used to test the approximate range of colors that are sup
ported by the user agent and the output device. Syntax The color-gamut feature is specified as a keyword value chosen from the list below. srgb The output device can sup
port approximately the sRGB gamut or more. This includes the vast majority of color displays. p3 The output device can sup
port approximately the gamut specified by the DCI P3 Color Space or more. The p3 gamut is larger than and includes the srgb gamut. rec2020 The output device can sup
port approximately the gamut specified by the ITU-R Recommendation BT.2020 Color Space or more. The rec2020 gamut is larger than and includes the p3 gamut. Examples HTML <p>This is a test.</p> CSS @media (color-gamut: srgb) { p { ...
inverted-colors - CSS: Cascading Style Sheets
rs feature is specified as a keyword value chosen from the list below. none Colors are displayed normally. inverted All pixels within the displayed area have been inverted. Examples HTML <p>If you're using inverted colors, this text should be blue on white (the inverse of yellow on black). ...
prefers-contrast - CSS: Cascading Style Sheets
the user has made no preference known to the system. This keyword value evaluates as false in a Boolean context. more Indicates that user has notified the system that they prefer an interface that has a higher level of contrast. less Indicates that user has notified the system that they prefer an interface that has a lower level of contrast. User preferences Various operating systems do sup
port such preferences and user agents are likely to rely on the settings provided by the operating system. Examples This example has an annoying low contrast by default. HTML <div class="contrast">low contrast box</div> CSS .contrast { width: 100px; height: 100px; outline: 2px dashed black; } @media (prefers-contrast: high) { .contrast { outline: 2px solid black; } } Result ...
prefers-reduced-data - CSS: Cascading Style Sheets
Note: This feature is not sup
ported by any user agent and its specifics are subject to change. The prefers-reduced-data CSS media feature is used to detect if the user has requested the web content that consumes less internet traffic. Syntax no-preference Indicates that the user has made no preference known to the system. This keyword value evaluates as false in the boolean context. reduce Indicates that user has expressed the preference for lightweight alternate content. User preferences Currently no user agent implements this feature, although various operating systems do sup
port such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating system. Examples Note: No browser currently implements ...
prefers-reduced-motion - CSS: Cascading Style Sheets
Readers with vestibular motion disorders may wish to enable the reduce motion feature on their device before viewing the animation. Syntax no-preference Indicates that the user has made no preference known to the system. ...
prefers-reduced-transparency - CSS: Cascading Style Sheets
ence Indicates that the user has made no preference known to the system. This keyword value evaluates as false in the boolean context. reduce Indicates that user has notified the system that they prefer an interface that minimizes the amount of transparent or translucent layer effects. User preferences Currently no user agent implements this feature, although various operating systems do sup
port such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating systems. Examples Note: No browser currently implements this feature so the following example will not work. This example has an annoying transparency effect by default. HTML <div class="transparency">transparent box</div> CSS .transparency { opacity: 0.5...
scripting - CSS: Cascading Style Sheets
The scripting CSS media feature can be used to test whether scripting (such as JavaScript) is available. Syntax The scripting feature is specified as a keyword value chosen from the list below. none Scripting is completely unavailable on the current document. initial-only Scripting is enabled during the initial page load, but not afterwards. enabled Scripting is sup
ported and active on the current document. Examples HTML <p class="script-none">You do not have scripting available. :-(</p> <p class="script-initial-only">Your scripting is only enabled during the initial page load. Weird.</p> <p class="script-enabled">You have scripting enabled! :-)</p> CSS p { color: lightgray; } @media (scripting: none) { .script-none { color: red; } } @media (scripting: initial-on...
@namespace - CSS: Cascading Style Sheets
URL"; Description The defined namespaces can be used to restrict the universal, type, and attribute selectors to only select elements within that namespace. The @namespace rule is generally only useful when dealing with documents containing multiple namespaces--such as HTML5 with inline SVG or MathML, or XML that mixes multiple vocabularies. Any @namespace rules must follow all @charset and @im
port rules, and precede all other at-rules and style declarations in a style sheet. @namespace can be used to define the default namespace for the style sheet. When a default namespace is defined, all universal and type selectors (but not attribute selectors, see note below) apply only to elements in that namespace. The @namespace rule can also be used to define a namespace prefix. When a universal,...
@page - CSS: Cascading Style Sheets
nt beyond the page box at which the page rendering is clipped. Description You can't change all CSS properties with @page. You can only change the margins, orphans, widows, and page breaks of the document. Attempts to change any other CSS properties will be ignored. The @page at-rule can be accessed via the CSS object model interface CSSPageRule. Note: The W3C is discussing how to handle view
port-related <length> units, vh, vw, vmin, and vmax. Meanwhile do not use them within a @page at-rule. Formal syntax @page <page-selector-list> { <page-body> }where <page-selector-list> = [ <page-selector># ]?<page-body> = <declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>where <page-selector> = <pseudo-page>+ | <ident> <pseudo-page>*<page-margin-box> = <page-margin-box-type> '{' <d...
Attribute selectors - CSS: Cascading Style Sheets
e org link</a></li> <li><a href="https://example.org">Example https org link</a></li> </ul> Result Languages CSS /* All divs with a `lang` attribute are bold. */ div[lang] { font-weight: bold; } /* All divs without a `lang` attribute are italicized. */ div:not([lang]) { font-style: italic; } /* All divs in US English are blue. */ div[lang~="en-us"] { color: blue; } /* All divs in
Portuguese are green. */ div[lang="pt"] { color: green; } /* All divs in Chinese are red, whether simplified (zh-CN) or traditional (zh-TW). */ div[lang|="zh"] { color: red; } /* All divs with a Traditional Chinese `data-lang` are purple. */ /* Note: You could also use hyphenated attributes without double quotes */ div[data-lang="zh-TW"] { color: purple; } HTML <div lang="en-us en-...
CSSOM View - CSS: Cascading Style Sheets
CSSOM View is a module of CSS that lets you manipulate the visual view of a document, in particular its scrolling behavior. Reference Properties scroll-behavior Guides Coordinate systems A guide to the coordinate systems used to specify the position of a location in a display context, whether that context is a window on a monitor, a view
port on a mobile device, or a position on a sheet of paper when printing. Specifications Specification Status Comment CSS Object Model (CSSOM) View Module Working Draft Initial definition. ...
CSS Animations tips and tricks - CSS: Cascading Style Sheets
to replay. Here's one way to do it that we feel is stable and reliable enough to suggest to you. HTML content First, let's define the HTML for a <div> we wish to animate and a button that will play (or replay) the animation. <div class="box"> </div> <div class="runButton">Click me to run the animation</div> CSS content Now we'll define the animation itself using CSS. Some CSS that's not im
portant (the style of the "Run" button itself) isn't shown here, for brevity. .runButton { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 12px; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "Open Sans", "Arial", sans-serif; } @keyframes colorchange { 0% { background: yel...
Box-shadow generator - CSS: Cascading Style Sheets
e.setWidth = function setWidth(value) { this.width = value; this.node.style.width = this.width + 'px'; OutputManager.updateProperty(this.id, 'width', this.width + 'px'); } CssClass.prototype.setHeight = function setHeight(value) { this.height = value; this.node.style.height = this.height + 'px'; OutputManager.updateProperty(this.id, 'height', this.height + 'px'); } // Browser sup
port CssClass.prototype.setRotate = function setRotate(value) { var cssvalue = 'rotate(' + value +'deg)'; this.node.style.transform = cssvalue; this.node.style.webkitTransform = cssvalue; this.node.style.msTransform = cssvalue; if (value !== 0) { if (this.rotate === 0) { OutputManager.toggleProperty(this.id, 'transform', true); OutputManager.toggleProperty(this.id, '-webkit-tra...
Box alignment in Multi-column Layout - CSS: Cascading Style Sheets
eatures of Box Alignment across layout methods. In multi-column layout the alignment container is the content box of the multicol container. The alignment subject is the column box. The properties which apply to multi-column layouts are detailed below. Note: Multi-column Layout predates the Box Alignment specification. and the properties listed here, while specified for Multicol, may not be sup
ported in browsers. align-content and justify-content The align-content property applies to the block axis and justify-content to the inline axis. Any spacing added to the columns due to use of space distribution will be added to the gap between the columns, therefore making the gap larger than might be specified by the column-gap property. Using a value of justify-content other than normal or str...
CSS Box Alignment - CSS: Cascading Style Sheets
which allows us to set these properties at once: row-gap column-gap gap In the below example, a grid layout uses the gap shorthand to set a 10px gap between row tracks, and a 2em gap between column tracks. In this example I am using the grid-gap property in addition to gap. The gap properties were originally prefixed with grid- in the Grid Layout specification and some browsers only sup
port these prefixed versions. grid-row-gap grid-column-gap grid-gap The prefixed versions will be maintained as an alias of the unprefixed ones, however you can always double up in the way that you would with vendor prefixes, adding the grid-gap property and then the gap property with the same values. Also, be aware that other things may increase the visual gap displayed, for example using the...
Handling Overflow in Multicol - CSS: Cascading Style Sheets
refore we get columns created outside of the container. In a future version of the specification it would be useful to be able to have overflow columns in continuous media display in the block direction, therefore allowing the reader to scroll down to view the next set of columns. Using vertical media queries One issue with multicol on the web is that, if your columns are taller than the view
port, the reader will need to scroll up and down to read, which is not good user experience. One way to avoid this is to only apply the column properties if you know you have enough height. In the example below we have used a min-height query to check the height before applying the column properties. In the final guide in this series we will see how Multicol works with the Fragmentation spec to gi...
Handling content breaks in multicol - CSS: Cascading Style Sheets
ings don't work as expected If you have small amounts of content and are trying to control breaks in a number of ways or on several elements, your content needs to break somewhere, so you may not always get the result you intended. To some extent your use of fragmentation is always a suggestion to the browser, to control breaks in this way if it is possible. In addition to the above, browser sup
port for these properties is a little patchy. The compatibility data charts on the individual property pages here on MDN can help you see which browsers sup
port which features. In most cases, the fallback to breaks not being controlled is something you can live with, with suboptimal breaking being untidy rather than a disaster to your layout. ...
CSS Multi-column Layout - CSS: Cascading Style Sheets
Basic example In the following example the column-count property has been applied to the element with a class of container. As the value of column-count is 3, the content is arranged into 3 columns of equal size. Relationship to Fragmentation Multiple-column Layout is closely related to Paged Media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. ...
CSS Conditional Rules - CSS: Cascading Style Sheets
CSS Conditional Rules is a CSS module that allows to define a set of rules that will only apply based on the capabilities of the processor or the document the style sheet is being applied to. Reference At-rules @document @media @sup
ports @im
port Specifications Specification Status Comment CSS Conditional Rules Module Level 3 Candidate Recommendation Initial definition ...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
rty works. Once again we can switch our flex-direction to column in order to see how this property behaves when we are working by column. As before, we need enough space in the cross axis to have some free space after displaying all of the items. Note: the value space-evenly is not defined in the flexbox specification and is a later addition to the Box Alignment specification. Browser sup
port for this value is not as good as that of the values defined in the flexbox spec. See the documentation for justify-content on MDN for more details on all of these values and browser sup
port. Aligning content on the main axis Now that we have seen how alignment works on the cross axis, we can take a look at the main axis. Here we only have one property available to us -- justify-content. This ...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
main axis Explaining the flex-grow, flex-shrink and flex-basis properties. Mastering wrapping of flex items How to create flex containers with multiple lines and control the display of the items in those lines. Typical use cases of Flexbox Common design patterns that are typical Flexbox use cases. Backwards compatibility of Flexbox Browser status of Flexbox, interoperability issues and sup
porting older browsers and versions of the spec Specifications Specification Status Comment CSS Flexible Box Layout Module Candidate Recommendation Initial definition. ...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
x level boxes, so their outer display type is dictated by way of them being part of the flex formatting context. They have an inner display type of flow however, meaning that their children participate in normal flow. Items nested inside our flex item lay themselves out as block and inline elements unless something changes their display type. This concept of the outer and inner display type is im
portant as this tells us that a container using a layout method such as Flexbox (display: flex) and Grid Layout (display: grid) is still participating in block and inline layout, due to the outer display type of those methods being block. Changing the Formatting Context an element participates in Browsers display items as part of a block or inline formatting context in terms of what normally makes s...
Flow Layout and Overflow - CSS: Cascading Style Sheets
This guide explains how overflow works when working with normal flow. What is overflow? Giving an element a fixed height and width, then adding significant content to the box, creates a basic overflow example: The content goes into the box. Once it fills the box, it continues to overflow in a visible way, displaying content outside the box, potentially displaying under subsequent content. ...
In Flow and Out of Flow - CSS: Cascading Style Sheets
em position: absolute or position: fixed removes it from flow, and any space that it would have taken up is removed. In the next example I have three paragraph elements, the second element has position absolute, with offset values of top: 30px and right: 30px. It has been removed from document flow. Using position: fixed also removes the item from flow, however the offsets are based on the view
port rather than the containing block. When taking an item out of flow with positioning, you will need to manage the possibility of content overlapping. Out of flow essentially means that the other elements on your page no longer know that element exists so will not respond to it. Relative Positioning and Flow If you give an item relative positioning with position: relative it remains in flow, howe...
Introduction to formatting contexts - CSS: Cascading Style Sheets
s therefore not referring to other possible formatting contexts. As such, it is useful to understand that creating any kind of formatting context will change the way elements inside that formatting context behave. This behavior is always described in the specification and also here on MDN. Summary In this guide, we have looked in more detail at the block and Inline formatting contexts and the im
portant subject of creating a block formatting context (BFC). In the next guide, we will find out how normal flow interacts with different writing modes. ...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
-placed according to the auto-placement rules. Use cases for auto-placement Auto-placement is useful whenever you have a collection of items. That could be items that do not have a logical order such as a gallery of photos, or product listing. In that case you might choose to use the dense packing mode to fill in any holes in your grid. In my image gallery example I have some landscape and some
portrait images. I have set landscape images - with a class of landscape to span two column tracks. I then use grid-auto-flow: dense to create a densely packed grid. .wrapper { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); grid-gap: 10px; grid-auto-flow: dense; list-style: none; margin: 1em auto; padding: 0; max-width: 800px; } .wrapper ...
Layout using named grid lines - CSS: Cascading Style Sheets
visual representation of what your layout looks like, and it is then easy to move things around on the grid. If working with a strict multiple column layout for example the named lines demonstration in the last part of this guide works very well. If you consider grid systems such as those found in frameworks like Foundation or Bootstrap, these are based on a 12 column grid. The framework then im
ports the code to do all of the calculations to make sure that the columns add up to 100%. With grid layout the only code we need for our grid "framework" is: .wrapper { display: grid; grid-gap: 10px; grid-template-columns: repeat(12, [col-start] 1fr); } We can then use that framework to layout our page. For example, to create a three column layout with a header and footer, I might have the ...
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
olumn layout. Note: When grid first shipped in browsers the column-gap, row-gap and gap properties were prefixed with the grid- prefix as grid-column-gap, grid-row-gap and grid-gap respectively. Browsers are updating their rendering engines to remove this prefix, however the prefixed versions will be maintained as aliases, making them safe to use. At the present time, some browsers do not sup
port the unprefixed versions, which is why the live examples in this guide use grid- prefixed versions. Gaps only appear between tracks of the grid, they do not add space to the top and bottom, left or right of the container. We can add gaps to our earlier example by using these properties on the grid container. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radi...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
4fr 1fr; grid-template-areas: "header header header" "nav content sidebar" "nav content ad" "footer footer footer" } nav ul { flex-direction: column; } } The three-column layout has two 1fr unit side columns and a middle column that has 4fr as the track size. This means that the available space in the container is split into 6 and assigned in pro
portion to our three tracks - one part each to the side columns and 4 parts to the center. In this layout I am displaying the nav in the left column, alongside the content. In the right column we have the sidebar and underneath it the advertisements (ad). The footer now spans right across the bottom of the layout. I then use a flexbox to display the navigation as a column. This is a simple exampl...
Subgrid - CSS: Cascading Style Sheets
Introduction to subgrid When you add display: grid to a grid container, only the direct children become grid items and can then be placed on the grid that you have created. ...
Logical properties for sizing - CSS: Cascading Style Sheets
operty also has logical keyword values. Using resize: inline allows resizing in the inline dimension and resize: block allow resizing in the block dimension. The keyword value of both for the resize property works whether you are thinking physically or logically. It sets both dimensions at once. Try playing with the below example. Note that currently the logical values for resize are only sup
ported by Firefox. ...
CSS Masking - CSS: Cascading Style Sheets
CSS Masking is a CSS module that defines means, including masking and clipping, for partially or fully hiding
portions of visual elements. Reference Properties clip clip-path clip-rule mask mask-border mask-border-mode mask-border-outset mask-border-repeat mask-border-slice mask-border-source mask-border-width mask-clip mask-composite mask-image mask-mode mask-origin mask-position mask-repeat mask-size mask-type Specifications Specification Status Comment CSS Masking Module Level 1 Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'mask' in that specification. Recommendation Initial definition ...
Stacking context example 1 - CSS: Cascading Style Sheets
stacking context. This means that all their content, including DIV #2 and DIV #4, belongs to the same root stacking context. In terms of stacking contexts, DIV #1 and DIV #3 are simply assimilated into the root element, and the resulting hierarchy is the following: root stacking context DIV #2 (z-index 1) DIV #4 (z-index 2) Note: DIV #1 and DIV #3 are not translucent. It is im
portant to remember that assigning an opacity less than 1 to a positioned element implicitly creates a stacking context, just like adding a z-index value. And this example shows what happens when a parent element does not create a stacking context. Example HTML <div id="div1"> <br /><span class="bold">DIV #1</span> <br />position: relative; <div id="div2"> <br /><span class="bold">DIV #2</spa...
Using the :target pseudo-class in selectors - CSS: Cascading Style Sheets
l position, since target elements are placed on the top of the browser window if possible. <h4 id="one">...</h4> <p id="two">...</p> <div id="three">...</div> <a id="four">...</a> <em id="five">...</em> <a href="#one">First</a> <a href="#two">Second</a> <a href="#three">Third</a> <a href="#four">Fourth</a> <a href="#five">Fifth</a> Conclusion In cases where a fragment identifier points to a
portion of the document, readers may become confused about which part of the document they're supposed to be reading. By styling the target of a URI, reader confusion can be reduced or eliminated. See also :target Original Document Information Author(s): Eric Meyer, Standards Evangelist, Netscape Communications Original Copyright Information: Copyright (C) 2001-2003 Netscape. All rights res...
Basic Shapes - CSS: Cascading Style Sheets
is used as the value for all of our Basic Shapes. This type uses Functional Notation: the type of shape is followed by brackets, inside of which are additional values used to describe the shape. The arguments which are accepted vary depending on the shape that you are creating. We will cover these in the examples below. The reference box Understanding the reference box used by CSS Shapes is im
portant when using Basic Shapes, as it defines each shape's coordinate system. You have already met the reference box in the guide on creating shapes from Box Values, which directly uses the reference box to create the shape. The Firefox Shapes Inspector helpfully shows the reference box in use when you inspect a shape. In the screenshot below I have created a circle, using shape-outside: circle(50%)...
Center an element - CSS: Cascading Style Sheets
another we make the containing box a flex container. Then set align-items to center to perform centering on the block axis, and justify-content to center to perform centering on the inline axis. In the future we may be able to center elements without needing to turn the parent into a flex container, as the Box Alignment properties used here are specified to apply to block layout too. However, sup
port is currently limited for box alignment properties on block layout, so currently centering using Flexbox is the most robust way to achieve this. ...
Column layouts - CSS: Cascading Style Sheets
styling. A single row of items with equal heights -- flexbox Flexbox can be used to break content into columns by setting flex-direction to row, however flexbox targets the elements inside the flex container and will place each direct child into a new column. This is a different behavior to what you saw with multicol. There is currently no way to add a rule between flex items, and browser sup
port for the column-gap and row-gap properties is limited. Therefore to create gaps between items use a margin. Download this example Flexbox can also be used to create layouts where the flex items wrap onto new rows, by setting the flex-wrap property on the container to wrap. These new flex lines will distribute space along that line only -- the items in the new line will not line up with items...
Cookbook template - CSS: Cascading Style Sheets
creating the pattern. Why did you choose a certain method? If you want to add an additional example here -- for example a version with fallbacks, please do. This section is deliberately loose as patterns range from the very simple to more complex. Useful fallbacks or alternative methods If there are useful alternative methods for building the recipe, or fallback recipes to use if you have to sup
port non-sup
porting browsers, include them in separate sections down here. Accessibility concerns Include this is there are any specific things to watch out for in regard to accessibility. If not relevant for your pattern this can be omitted. ...
Recipe: Media objects - CSS: Cascading Style Sheets
age to the other side -- this is done by adding the media-flip class, which defines a flipped grid template causing the layout to be mirrored. When we nest one media object inside another we need to place it into the second track in the regular layout, and the first track when flipped. Fallbacks There are a number of possible fallbacks for this pattern, depending on the browsers you wish to sup
port. A good catch-all would be to float the image left, and to add a clearfix to the box to ensure that it contained the floats. Download this example Once floated elements become grid items the float no longer applies so you don't need to do anything special to clear the float. What you will need to do is remove any margins applied to the item, and any widths which we don't need in a grid con...
CSS Layout cookbook - CSS: Cascading Style Sheets
. a facebook post or tweet. CSS Grid, float fallback, fit-content() sizing Columns When to choose multi-column layout, flexbox or grid for your columns. CSS Grid, Multicol, Flexbox Center an element How to center an item horizontally and vertically. Flexbox, Box Alignment Sticky footers Creating a footer which sits at the bottom of the container or view
port when the content is shorter. CSS Grid, Flexbox Split navigation A navigation pattern where some links are visually separated from the others. Flexbox, margin Breadcrumb navigation Creating a list of links to allow the visitor to navigate back up through the page hierarchy. Flexbox List group with badges A list of items with a badge to display a count.
Replaced elements - CSS: Cascading Style Sheets
affected by the current document's styles. The position of the replaced element can be affected using CSS, but not the contents of the replaced element itself. Some replaced elements, such as <iframe> elements, may have stylesheets of their own, but they don't inherit the styles of the parent document. The only other impact CSS can have on a replaced element is that there are properties which sup
port controlling the positioning of the element's content within its box. See Controlling object position within the content box for further information. Replaced elements Typical replaced elements are: <iframe> <video> <embed> <img> Some elements are treated as replaced elements only in specific cases: <option> <audio> <canvas> <object> <applet> HTML spec also says that an <input> ...
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
le. The property is only set for the matching selector and its descendants, like any normal CSS. Custom property fallback values Using the var() function, you can define multiple fallback values when the given variable is not yet defined; this can be useful when working with Custom Elements and Shadow DOM. Fallback values aren't used to fix the browser compatibility. If the browser doesn't sup
port CSS custom Properties, the fallback value won't help. It's just a backup for the browser which sup
ports CSS Custom Properties to choose a different value if the given variable isn't defined or has an invalid value. The first argument to the function is the name of the custom property to be substituted. The second argument to the function, if provided, is a fallback value, which is used as the s...
align-content - CSS: Cascading Style Sheets
are evenly distributed within the alignment container along the cross axis. The spacing between each pair of adjacent items, the start edge and the first item, and the end edge and the last item, are all exactly the same. stretch If the combined size of the items along the cross axis is less than the size of the alignment container, any auto-sized items have their size increased equally (not pro
portionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size exactly fills the alignment container along the cross axis. safe Used alongside an alignment keyword. If the chosen keyword means that the item overflows the alignment container causing data loss, the item is instead aligned as if the alignment mode were start...
align-self - CSS: Cascading Style Sheets
aseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for first baseline is start, the one for last baseline is end. stretch If the combined size of the items along the cross axis is less than the size of the alignment container and the item is auto-sized, its size is increased equally (not pro
portionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size of all auto-sized items exactly fills the alignment container along the cross axis. safe If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start. unsafe Regardless of the relative sizes of th...
background-color - CSS: Cascading Style Sheets
Global values */ background-color: inherit; background-color: initial; background-color: unset; The background-color property is specified as a single <color> value. Values <color> The uniform color of the background. It is rendered behind any background-image that is specified, although the color will still be visible through any transparency in the image. Accessibility concerns It is im
portant to ensure that the contrast ratio between the background color and the color of the text placed over it is high enough that people experiencing low vision conditions will be able to read the content of the page. Color contrast ratio is determined by comparing the luminance of the text and background color values. In order to meet current Web Content Accessibility Guidelines (WCAG), a ratio of...
background-repeat - CSS: Cascading Style Sheets
g); background-repeat: repeat-x, repeat-y; height: 144px; } Result In this example, each list item is matched with a different value of background-repeat. Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'background-repeat' in that specification. Candidate Recommendation Adds sup
port for multiple background images, the two-value syntax allowing distinct repetition behavior for the horizontal and vertical directions, the space and round keywords, and for backgrounds on inline-level elements by precisely defining the background painting area. CSS Level 2 (Revision 1)The definition of 'background-repeat' in that specification. Recommendation No significant changes...
<basic-shape> - CSS: Cascading Style Sheets
shape, the reference box is defined by each property that uses <basic-shape> values. The coordinate system for the shape has its origin at the top-left corner of the reference box, with the x-axis running to the right and the y-axis running downwards. All the lengths expressed in percentages are resolved from the used dimensions of the reference box. Shape functions The following shapes are sup
ported. All <basic-shape> values use functional notation and are defined here using the value definition syntax. inset() inset( <shape-arg>{1,4} [round <border-radius>]? ) Defines an inset rectangle. When all of the first four arguments are supplied they represent the top, right, bottom and left offsets from the reference box inward that define the positions of the edges of the inset rectang...
box-flex - CSS: Cascading Style Sheets
flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /* Global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset; Syntax The box-flex property is specified as a <number>. If the value is 0, the box does not grow. If it is greater than 0, the box grows to fill a pro
portion of the available space. Notes The containing box allocates the available extra space in pro
portion to the flex value of each of the content elements. Content elements that have zero flex do not grow. If only one content element has nonzero flex, then it grows to fill the available space. Content elements that have the same flex grow by the same absolute amounts. If the flex value is set ...
box-lines - CSS: Cascading Style Sheets
ox elements layout in multiple rows or columns. Formal definition Initial valuesingleApplies tobox elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax single | multiple Examples Simple usage example In the original version of the spec, box-lines allowed you to specify that you wanted your flex container's children to wrap onto multiple lines. This was only sup
ported in WebKit-based browsers, with a prefix. div { display: box; box-orient: horizontal; box-lines: multiple; } The modern flexbox equivalent is flex-wrap. Specifications Not part of any standard. ...
clip-path - CSS: Cascading Style Sheets
margin-box Uses the margin box as the reference box. border-box Uses the border box as the reference box. padding-box Uses the padding box as the reference box. content-box Uses the content box as the reference box. fill-box Uses the object bounding box as the reference box. stroke-box Uses the stroke bounding box as the reference box. view-box Uses the nearest SVG view
port as the reference box. If a viewBox attribute is specified for the element creating the SVG view
port, the reference box is positioned at the origin of the coordinate system established by the viewBox attribute and the dimension of the size of the reference box is set to the width and height values of the viewBox attribute. none No clipping path is created. Note: A computed value other tha...
clip - CSS: Cascading Style Sheets
The clip property applies only to absolutely positioned elements -- that is, elements with position:absolute or position:fixed. /* Keyword value */ clip: auto; /* <shape> values */ clip: rect(1px 10em 3rem 2ch); clip: rect(1px, 10em, 3rem, 2ch); /* Global values */ clip: inherit; clip: initial; clip: unset; Syntax Note: Where possible, authors are encouraged to use the newer clip-path property instead. Values <<shape>()> A rectangular <<shape>()> of the form rect(<top> <right> <bottom> <left>). ...
color-adjust - CSS: Cascading Style Sheets
in order to optimize the output for the device it's being rendered for. For example, when printing, a browser might opt to leave out all background images and to adjust text colors to be sure the contrast is optimized for reading on white paper. This is the default. exact The element's content has been specifically and carefully crafted to use colors, images, and styles in a thoughtful and/or im
portant way, such that being altered by the browser might actually make things worse rather than better. The appearance of the content should not be changed except by the user's request. For example, a page might include a list of information with rows whose background colors alternate between white and a light grey. Removing the background color would decrease the legibility of the content. Usage n...
color - CSS: Cascading Style Sheets
/ 60%); color: hsla(30.2 100% 50% / 60%); /* Global values */ color: inherit; color: initial; color: unset; The color property is specified as a single <color> value. Note that the value must be a uniform color. It can't be a <gradient>, which is actually a type of <image>. Values <color> Sets the color of the textual and decorative parts of the element. Accessibility concerns It is im
portant to ensure that the contrast ratio between the color of the text and the background the text is placed over is high enough that people experiencing low vision conditions will be able to read the content of the page. Color contrast ratio is determined by comparing the luminosity of the text and background color values. In order to meet current Web Content Accessibility Guidelines (WCAG), a rati...
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
les and send us a pull request. Initially a part of Multi-column Layout, the definition of column-gap has been broadened to include multiple layout methods. Now specified in Box Alignment, it may be used in Multi-column, Flexible Box, and Grid layouts. CSS Grid Layout initially defined the grid-column-gap property. This prefixed property is being replaced by column-gap. However, in order to sup
port browsers that implemented grid-column-gap and not column-gap for grid, you will need to use the prefixed property. Syntax /* Keyword value */ column-gap: normal; /* <length> values */ column-gap: 3px; column-gap: 2.5em; /* <percentage> value */ column-gap: 3%; /* Global values */ column-gap: inherit; column-gap: initial; column-gap: unset; The column-gap property is specified as one of th...
counter() - CSS: Cascading Style Sheets
The counter() CSS function returns a string representing the current value of the named counter, if there is one. It is generally used with pseudo-elements, but can be used, theoretically, anywhere a <string> value is sup
ported. /* Simple usage */ counter(countername); /* changing the counter display */ counter(countername, upper-roman) A counter has no visible effect by itself. The counter() function (and counters() function) is what makes it useful by returning developer defined strings (or images). Note: The counter() function can be used with any CSS property, but sup
port for properties other than content is experimental, and sup
port for the type-or-unit parameter is sparse. Check the Browser compatibility table carefully before using this in production. Syntax Values <custom-...
<display-inside> - CSS: Cascading Style Sheets
The element behaves like a block element and lays out its content according to the flexbox model. grid The element behaves like a block element and lays out its content according to the grid model. ruby The element behaves like an inline element and lays out its content according to the ruby formatting model. It behaves like the corresponding HTML <ruby> elements. Note: Browsers that sup
port the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block. This will result in expected behavior; for example if you specify an element to be display: grid, you would expect that the box created on the grid container would be a block level box. Examples In this example the parent box has been given displ...
<display-listitem> - CSS: Cascading Style Sheets
e a bullet point) together with a principal box of the specified type for its own contents. Syntax A single value of list-item will cause the element to behave like a list item. This can be used together with list-style-type and list-style-position. list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. Note: In browsers that sup
port the two-value syntax, if no inner value is specified it will default to flow. If no outer value is specified, the principal box will have an outer display type of block. Examples HTML <div class="fake-list">I will display as a list item</div> CSS .fake-list { display: list-item; list-style-position: inside; } Result Specifications Specification Status C...
<display-outside> - CSS: Cascading Style Sheets
omes the first inline box of the block box that follows it. Run-in elements act like inlines or blocks, depending on the surrounding elements. That is: If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. Note: Browsers that sup
port the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. This will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. Examples In the following example, span element...
<easing-function> - CSS: Cascading Style Sheets
component greater than 255 or smaller than 0 will be clipped to the closest allowed value (255 and 0, respectively). Some cubic-bezier() curves exhibit this property. Syntax There are three types of easing function: linear, cubic Bezier curves, and staircase functions. The value of an <easing-function> type describes the easing function using one of those three types. Easing functions CSS sup
ports three kinds of easing functions: linear, the subset of the cubic Bezier curves that are functions, and staircase functions. The most useful of these functions are given a keyword that allows them to be easily referenced. The linear class of easing functions linear The animation moves from beginning to end at a constant rate. This keyword represents the easing function cubic-bezier(0.0, 0.0,...
flex-basis - CSS: Cascading Style Sheets
nt or a <'width'>. Values <'width'> An absolute <length>, a <percentage> of the parent flex container's main size property, or the keyword auto. Negative values are invalid. Defaults to auto. content Indicates automatic sizing, based on the flex item's content. Note: This value was not present in the initial release of Flexible Box Layout, and thus some older implementations will not sup
port it. The equivalent effect can be had by using auto together with a main size (width or height) of auto. History: Originally, flex-basis:auto meant "look at my width or height property". Then, flex-basis:auto was changed to mean automatic sizing, and "main-size" was introduced as the "look at my width or height property" keyword. It was implemented in bug 1032922. Then, that change wa...
flex-direction - CSS: Cascading Style Sheets
lumn but the main-start and main-end are permuted. Accessibility concerns Using the flex-direction property with values of row-reverse or column-reverse will create a disconnect between the visual presentation of content and DOM order. This will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader. If the visual (CSS) order is im
portant, then screen reader users will not have access to the correct reading order. Flexbox & the keyboard navigation disconnect -- Tink Source Order Matters | Adrian Roselli MDN Understanding WCAG, Guideline 1.3 explanations Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0 Formal definition Initial valuerowApplies toflex containersInheritednoComputed valueas specifiedAnima...
float - CSS: Cascading Style Sheets
This was an exception to the rule, that the name of the DOM member is the camel-case name of the dash-separated CSS name (due to the fact that "float" is a reserved word in JavaScript, as seen in the need to escape "class" as "className" and escape <label>'s "for" as "htmlF...
font-language-override - CSS: Cascading Style Sheets
h the typeface will likely know not to use the merged glyph; Turkish has two versions of the "i," one with a dot (i) and one without (i), and using the ligature would incorrectly transform a dotted "i" into a dotless "i." The font-language-override property lets you override the typeface behavior for a specific language. This is useful, for example, when the typeface you're using lacks proper sup
port for the language. For instance, if a typeface doesn't have proper rules for the Azeri language, you can force the font to use Turkish glyphs, which follow similar rules. Syntax The font-language-override property is specified as the keyword normal or a <string>. Values normal Tells the browser to use font glyphs that are appropriate for the language specified by the lang attribute. This is...
font-optical-sizing - CSS: Cascading Style Sheets
toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | none Examples Disabling optical sizing <p class="optical-sizing">This paragraph is optically sized. This is the default across browsers.</p> <p class="no-optical-sizing">This paragraph is not optically sized. You should see a difference in sup
porting browsers.</p> @font-face { src: url('AmstelvarAlpha-VF.ttf'); font-family:'Amstelvar'; font-style: normal; } p { font-size: 36px; font-family: Amstelvar; } .no-optical-sizing { font-optical-sizing: none; } Note: The font referenced above -- which includes optical sizing and is freely-licensed -- is good for testing. You can download it on GitHub. Specifications ...
font-size - CSS: Cascading Style Sheets
375em (22/16). The em is a very useful unit in CSS, since it automatically adapts its length relative to the font that the reader chooses to use. em and ex units on the font-size property are relative to the parent element's font size (unlike all other properties, where they're relative to the font size on the element). This means em units and percentages do the same thing for font-size. One im
portant fact to keep in mind: em values compound. Take the following HTML and CSS: html { font-size: 62.5%; /* font-size 1em = 10px on default browser settings */ } span { font-size: 1.6em; } <div> <span>Outer <span>inner</span> outer</span> </div> The result is: Assuming that the browser's default font-size is 16px, the words "outer" would be rendered at 16px, but the word "inner" would be...
font-style - CSS: Cascading Style Sheets
ee to which an oblique face is slanted. You can select this using the <angle> modifier for the oblique keyword. For TrueType or OpenType variable fonts, the "slnt" variation is used to implement varying slant angles for oblique, and the "ital" variation with a value of 1 is used to implement italic values. See font-variation-settings. For the example below to work, you'll need a browser that sup
ports the CSS Fonts Level 4 syntax in which font-style: oblique can accept an <angle>. HTML <header> <input type="range" id="slant" name="slant" min="-90" max="90" /> <label for="slant">Slant</label> </header> <div class="container"> <p class="sample">...it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.</p> </...
font-variation-settings - CSS: Cascading Style Sheets
r anything else they can imagine. Any axis can be used as long as it is given a unique 4-character axis. Some will end up becoming more common, and may even become registered over time. Note: Registered axis tags are identified using lower-case tags, whereas custom axes should be given upper-case tags. Note that font designers aren't forced follow this practice in any way, and some won't. The im
portant takeaway here is that axis tags are case-sensitive. In order to use variable fonts on your operating system, you need to make sure that it is up to date. For example Linux OSes need the latest Linux Freetype version, and macOS prior to 10.13 does not sup
port variable fonts. If your operating system is not up to date, you will not be able to use variable fonts in web pages or the Firefox Deve...
gap (grid-gap) - CSS: Cascading Style Sheets
a shorthand for row-gap and column-gap. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. CSS Grid Layout initially defined the grid-gap property. This prefixed property is being replaced by gap. However, in order to sup
port browsers that implemented grid-gap and not gap for grid, you will need to use the prefixed property as in the interactive example above. Syntax /* One <length> value */ gap: 20px; gap: 1em; gap: 3vmin; gap: 0.5cm; /* One <percentage> value */ gap: 16%; gap: 100%; /* Two <length> values */ gap: 20px 10px; gap: 1em 0.5em; gap: 3vmin 2vmax; gap: 0.5cm 2mm; /* One or two <percentage> values */ ...
<gradient> - CSS: Cascading Style Sheets
Repeating radial gradient</div> div { width: 240px; height: 80px; } .linear-repeat { background: repeating-linear-gradient(to top left, lightpink, lightpink 5px, white 5px, white 10px); } .radial-repeat { background: repeating-radial-gradient(powderblue, powderblue 8px, white 8px, white 16px); } Conic gradient example A simple conic gradient example. Note that this isn't sup
ported widely across browser as of yet. <div class="conic-gradient">Conic gradient</div> div { width: 200px; height: 200px; } .conic-gradient { background: conic-gradient(lightpink, white, powderblue); } Specifications Specification Status Comment CSS Images Module Level 4The definition of '<gradient>' in that specification. Working Draft Adds conic-g...
grid-auto-columns - CSS: Cascading Style Sheets
ues <length> Is a non-negative length. <percentage> Is a non-negative <percentage> value relative to the block size of the grid container. If the block size of the grid container is indefinite, the percentage value is treated like auto. <flex> Is a non-negative dimension with the unit fr specifying the track's flex factor. Each <flex>-sized track takes a share of the remaining space in pro
portion to its flex factor. When appearing outside a minmax() notation, it implies an automatic minimum (i.e. minmax(auto, <flex>)). max-content Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track. min-content Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) ...
grid-auto-rows - CSS: Cascading Style Sheets
ues <length> Is a non-negative length. <percentage> Is a non-negative <percentage> value relative to the block size of the grid container. If the block size of the grid container is indefinite, the percentage value is treated like auto. <flex> Is a non-negative dimension with the unit fr specifying the track's flex factor. Each <flex>-sized track takes a share of the remaining space in pro
portion to its flex factor. When appearing outside a minmax() notation, it implies an automatic minimum (i.e. minmax(auto, <flex>)). max-content Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track. min-content Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) ...
grid-column - CSS: Cascading Style Sheets
n as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines on the side of the explicit grid corresponding to the search direction are assumed to have that name for the purpose of counting this span. If the <integer> is omitted, it defaults to 1. Negative integers or 0 are invalid. Internet Explorer issues IE11 does not sup
port automatic placement of grid items. All items end up in the first row/col of the grid unless explicitly annotated with -ms-grid-column and -ms-grid-row. One can use a little JavaScript to enable automatic annotation: source repository. Formal definition Initial valueas each of the properties of the shorthand:grid-column-start: autogrid-column-end: autoApplies togrid items and absolutely-position...
grid-row - CSS: Cascading Style Sheets
n as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines on the side of the explicit grid corresponding to the search direction are assumed to have that name for the purpose of counting this span. If the <integer> is omitted, it defaults to 1. Negative integers or 0 are invalid. Internet Explorer issues IE11 does not sup
port automatic placement of grid items. All items end up in the first row/col of the grid unless explicitly annotated with -ms-grid-column and -ms-grid-row. One can use a little JavaScript to enable automatic annotation: source repository. Formal definition Initial valueas each of the properties of the shorthand:grid-row-start: autogrid-row-end: autoApplies togrid items and absolutely-positioned box...
height - CSS: Cascading Style Sheets
Comment CSS Box Sizing Module Level 4The definition of 'height' in that specification. Editor's Draft CSS Box Sizing Module Level 3The definition of 'height' in that specification. Working Draft Added the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'height' in that specification. Recommendation Adds sup
port for the <length> values and precises on which element it applies to. CSS Level 1The definition of 'height' in that specification. Recommendation Initial definition. ...
image-orientation - CSS: Cascading Style Sheets
correcting the orientation of images which were shot with the camera rotated. It should not be used for arbitrary rotations. For any purpose other than correcting an image's orientation due to how it was shot or scanned, use a transform property with the rotate keyword to specify rotation. This includes any user-directed changes to the orientation of the image, or changes required for printing in
portrait versus landscape orientation. If used in conjunction with other CSS properties, such as a <transform-function>, any image-orientation rotation is applied before any other transformations. Formal definition Initial value0degApplies toall elementsInheritedyesComputed valuean <angle>, rounded to the next quarter turn from 0deg and normalized, that is moduloing the value by 1turnAnimation type...
justify-content - CSS: Cascading Style Sheets
distributed within the alignment container along the main axis. The spacing between each pair of adjacent items, the main-start edge and the first item, and the main-end edge and the last item, are all exactly the same. stretch If the combined size of the items along the main axis is less than the size of the alignment container, any auto-sized items have their size increased equally (not pro
portionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size exactly fills the alignment container along the main axis. Note: stretch is not sup
ported by flexible boxes (flexbox). safe Used alongside an alignment keyword. If the chosen keyword means that the item overflows the alignment container causing data lo...
justify-items - CSS: Cascading Style Sheets
e box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for first baseline is start, the one for last baseline is end. stretch If the combined size of the items is less than the size of the alignment container, any auto-sized items have their size increased equally (not pro
portionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size exactly fills the alignment container. safe If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start. unsafe Regardless of the relative sizes of the item and alignment container, the given ali...
justify-self - CSS: Cascading Style Sheets
e box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for first baseline is start, the one for last baseline is end. stretch If the combined size of the items is less than the size of the alignment container, any auto-sized items have their size increased equally (not pro
portionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size exactly fills the alignment container. safe If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start. unsafe Regardless of the relative sizes of the item and alignment container, the given ali...
line-break - CSS: Cascading Style Sheets
k: inherit; line-break: initial; line-break: unset; Syntax Values auto Break text using the default line break rule. loose Break text using the least restrictive line break rule. Typically used for short lines, such as in newspapers. normal Break text using the most common line break rule. strict Break text using the most stringent line break rule. anywhere There is a soft wrap op
portunity around every typographic character unit, including around any punctuation character or preserved white spaces, or in the middle of words, disregarding any prohibition against line breaks, even those introduced by characters with the GL, WJ, or ZWJ character class or mandated by the word-break property. The different wrapping op
portunities must not be prioritized. Hyphenation is not applied. ...
line-height - CSS: Cascading Style Sheets
t Sets the line height to the content height of the current block. Accessibility concerns Use a minimum value of 1.5 for line-height for main paragraph content. This will help people experiencing low vision conditions, as well as people with cognitive concerns such as Dyslexia. If the page is zoomed to increase the text size, using a unitless value ensures that the line height will scale pro
portionately. W3C Understanding WCAG 2.1 Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesPercentagesrefer to the font size of the element itselfComputed valuefor percentage and length values, the absolute length, otherwise as specifiedAnimation typeeither number or length Formal syntax normal | <number> | <length> | <perc...
margin-trim - CSS: Cascading Style Sheets
uch a margin. all Trims the margins of in-flow boxes and floats whose margins coincide with the container's content edge. Formal definition Initial valuenoneApplies toBlock containers and multi-column containers. ...
margin - CSS: Cascading Style Sheets
: 2em margin */ /* Box is horizontally centered */ margin: auto; /* top and bottom: 0 margin */ /* Box is horizontally centered */ Notes Horizontal centering To center something horizontally in modern browsers, you can use display: flex; justify-content: center; . However, in older browsers like IE8-9 that do not sup
port Flexible Box Layout, these are not available. In order to center an element inside its parent, use margin: 0 auto;. Margin collapsing Elements' top and bottom margins are sometimes collapsed into a single margin that is equal to the larger of the two margins. See Mastering margin collapsing for more information. Specifications Specification Status Comment CSS Basic...
mask-border-mode - CSS: Cascading Style Sheets
ues. alpha The alpha values of the mask border image are used as the mask values. Formal definition Initial valuealphaApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax luminance | alpha Examples Basic usage This property doesn't yet seem to have sup
port anywhere. When browsers sup
port it, it will specify the type of blending mode used for the mask border -- luminance or alpha: mask-border-mode: luminance; mask-border-mode: alpha; Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask-border-mode' in that specification. Candidate Recommendation Initial definition ...
mask-clip - CSS: Cascading Style Sheets
is clipped to the content box. padding-box The painted content is clipped to the padding box. border-box The painted content is clipped to the border box. margin-box The painted content is clipped to the margin box. fill-box The painted content is clipped to the object bounding box. stroke-box The painted content is clipped to the stroke bounding box. view-box Uses the nearest SVG view
port as reference box. If a viewBox attribute is specified for the element creating the SVG view
port, the reference box is positioned at the origin of the coordinate system established by the viewBox attribute and the dimension of the reference box is set to the width and height values of the viewBox attribute. no-clip The painted content is not clipped. border This keyword behaves the same as bo...
mask-origin - CSS: Cascading Style Sheets
he padding box. For single boxes 0 0 is the upper left corner of the padding edge, 100% 100% is the lower right corner. border-box The position is relative to the border box. margin-box The position is relative to the margin box. fill-box The position is relative to the object bounding box. stroke-box The position is relative to the stroke bounding box. view-box Uses the nearest SVG view
port as reference box. If a viewBox attribute is specified for the element creating the SVG view
port, the reference box is positioned at the origin of the coordinate system established by the viewBox attribute and the dimension of the reference box is set to the width and height values of the viewBox attribute. content Same as content-box. padding Same as padding-box. border Same as border...
max() - CSS: Cascading Style Sheets
requency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. In the first above example, the width will be at least 400px, but will be wider if the the view
port is more than 2000px wide (in which case 1vw would be 20px, so 20vw would be 400px). Think of the max() value as providing the minimum value a property can have. Syntax The max() function takes one or more comma-separated expressions as its parameter, with the largest (most positive) expression value used as the value of the property to which it is assigned. The expressions can be math expressi...
min() - CSS: Cascading Style Sheets
<frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. In the first above example, the width will be at most 200px, but will be smaller if the view
port is less than 400px wide (in which case 1vw would be 4px, so 50vw would be 200px). In other words, the maximum width is 200px. Think of the min() value as providing the maximum value a property can have. Syntax The min() function takes one or more comma-separated expressions as its parameter, with the smallest (most negative) expression value result used as the value. The expressions can be mat...
minmax() - CSS: Cascading Style Sheets
tage> must be treated as auto. The user agent may adjust the intrinsic size contributions of the track to the size of the grid container and increase the final size of the track by the minimum amount that would result in honoring the percentage. <flex> A non-negative dimension with the unit fr specifying the track's flex factor. Each <flex>-sized track takes a share of the remaining space in pro
portion to its flex factor. max-content Represents the largest max-content contribution of the grid items occupying the grid track. min-content Represents the largest min-content contribution of the grid items occupying the grid track. auto As a maximum, identical to max-content. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupyin...
opacity - CSS: Cascading Style Sheets
me opacity relative to the element's background, even if they have different opacities relative to one another. Using opacity with a value other than 1 places the element in a new stacking context. If you do not want to apply opacity to child elements, use the background property instead. For example: background: rgba(0, 0, 0, 0.4); Accessibility concerns If text opacity is adjusted, it is im
portant to ensure that the contrast ratio between the color of the text and the background the text is placed over is high enough that people experiencing low vision conditions will be able to read the content of the page. Color contrast ratio is determined by comparing the luminosity of the opacity-adjusted text and background color values. In order to meet current Web Content Accessibility Guidelin...
order - CSS: Cascading Style Sheets
-visual media such as speech. Values <integer> Represents the ordinal group to be used by the item. Accessibility concerns Using the order property will create a disconnect between the visual presentation of content and DOM order. This will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader. If the visual (css) order is im
portant, then screen reader users will not have access to the correct reading order. Flexbox & the keyboard navigation disconnect -- Tink Source Order Matters | Adrian Roselli MDN Understanding WCAG, Guideline 1.3 explanations Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0 Formal definition Initial value0Applies toflex items and absolutely-positioned flex container childre...
outline - CSS: Cascading Style Sheets
ult focus style. If an element can be interacted with it must have a visible focus indicator. Provide obvious focus styling if the default focus style is removed. How to Design Useful and Usable Focus Indicators WCAG 2.1: Understanding Success Criterion 2.4.7: Focus Visible Formal definition Initial valueas each of the properties of the shorthand:outline-color: invert, for browsers sup
porting it, currentColor for the otheroutline-style: noneoutline-width: mediumApplies toall elementsInheritednoComputed valueas each of the properties of the shorthand:outline-color: For the keyword invert, the computed value is invert. For the color value, if the value is translucent, the computed value will be the rgba() corresponding one. If it isn't, it will be the rgb() corresponding one. The tra...
overflow-anchor - CSS: Cascading Style Sheets
Therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off. ...
overscroll-behavior-block - CSS: Cascading Style Sheets
inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax contain | none | auto Examples Preventing block overscrolling In this demo we have two block-level boxes, one inside the other. The outer box has a large height set on it so the page will scroll vertically. The inner box has a small width (and height) set on it so it sits comforably inside the view
port, but its content is given a large height so it will also scroll vertically. By default, when the inner box is scrolled and a scroll boundary is reached, the whole page will begin to scroll, which is probably not what we want. To avoid this happening in the block direction, we've set overscroll-behavior-block: contain on the inner box. HTML <main> <div> <div> <p><code>overscroll-beh...
overscroll-behavior-inline - CSS: Cascading Style Sheets
nline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax contain | none | auto Examples Preventing inline overscrolling In this demo we have two block-level boxes, one inside the other. The outer box has a large width set on it so the page will scroll horizontally. The inner box has a small width (and height) set on it so it sits comforably inside the view
port, but its content is given a large width so it will also scroll horizontally. By default, when the inner box is scrolled and a scroll boundary is reached, the whole page will begin to scroll, which is probably not what we want. To avoid this happening in the inline direction, we've set overscroll-behavior-inline: contain on the inner box. HTML <main> <div> <div> <p><code>overscroll-...
overscroll-behavior-x - CSS: Cascading Style Sheets
mal syntax contain | none | auto Examples Preventing an underlying element from scrolling horizontally In our simple overscroll-behavior-x example (see source code also), we have two block-level boxes, one inside the other. The outer box has a large width set on it so the page will scroll horizontally. The inner box has a small width (and height) set on it so it sits comforably inside the view
port, but its content is given a large width so it will scroll horizontally. By default, when the inner box is scrolled and a scroll boundary is reached, the whole page will begin to scroll, which is probably not what we want. To avoid this, you can set overscroll-behavior-x: contain on the inner box: main > div { height: 300px; width: 500px; overflow: auto; position: relative; top: 100px;...
place-items - CSS: Cascading Style Sheets
e box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for first baseline is start, the one for last baseline is end. stretch If the combined size of the items is less than the size of the alignment container, any auto-sized items have their size increased equally (not pro
portionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size exactly fills the alignment container. Formal definition Initial valueas each of the properties of the shorthand:align-items: normaljustify-items: legacyApplies toall elementsInheritednoComputed valueas each of the properties of the shorthand:align-items: as ...
place-self - CSS: Cascading Style Sheets
aseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for first baseline is start, the one for last baseline is end. stretch If the combined size of the items along the cross axis is less than the size of the alignment container and the item is auto-sized, its size is increased equally (not pro
portionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size of all auto-sized items exactly fills the alignment container along the cross axis. Formal definition Initial valueas each of the properties of the shorthand:align-self: autojustify-self: autoApplies toblock-level boxes, absolutely-positioned boxes, and grid ...
<position> - CSS: Cascading Style Sheets
right 8.5% bottom 12vmin right -6px 10% 20% 8rem 14px Invalid positions left right bottom top 10px 15px 20px 15px Specifications Specification Status Comment CSS Values and Units Module Level 3The definition of '<position>' in that specification. Candidate Recommendation Relists links to both definitions: if CSS Backgrounds and Borders Module Level 3 is sup
ported, its definition of <position> must also be used. CSS Backgrounds and Borders Module Level 3The definition of '<bg-position>' in that specification. Candidate Recommendation Defines <position> explicitly and extends it to sup
port offsets from any edge. CSS Level 2 (Revision 1)The definition of '<position>' in that specification. Recommendation Allows combination of ...
<ratio> - CSS: Cascading Style Sheets
Syntax In Media Queries Level 3, the <ratio> data type consisted of a strictly positive <integer> followed by a forward slash ('/', Unicode U+002F SOLIDUS) and a second strictly positive <integer>. Spaces before and after the slash are optional. The first number represents the width, while the second represents the height. In Media Queries Level 4, the <ratio> date type is updated to consist of a strictly positive <number> followed by a forward slash ('/', Unicode U+002F SOLIDUS) and a second strictly positive <number>. ...
repeat() - CSS: Cascading Style Sheets
tage> must be treated as auto. The user-agent may adjust the intrinsic size contributions of the track to the size of the grid container and increase the final size of the track by the minimum amount that would result in honoring the percentage. <flex> A non-negative dimension with the unit fr specifying the track's flex factor. Each <flex>-sized track takes a share of the remaining space in pro
portion to its flex factor. max-content Represents the largest max-content contribution of the grid items occupying the grid track. min-content Represents the largest min-content contribution of the grid items occupying the grid track. auto As a maximum, identical to max-content. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupyin...
repeating-radial-gradient() - CSS: Cascading Style Sheets
background: repeating-radial-gradient(ellipse farthest-corner at 20% 20%, red, black 5%, blue 5%, green 10%); background: repeating-radial-gradient(ellipse farthest-corner at 20% 20%, red 0 5%, green 5% 10%); } The elliptical gradient will be centered 20% from the top left, and will repeat 10 times between the center and the farthest corner (the bottom right corner). Browsers sup
porting multi position color stops will display a red and green striped ellipse. Browsers not sup
porting the syntax yet will see a gradient that goes from red to black and then from blue to green. Note: Please see Using CSS gradients for more examples. Specifications Specification Status Comment CSS Images Module Level 3The definition of 'repeating-radial-gradient()' i...
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
between an element's grid rows. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. CSS Grid Layout initially defined the grid-row-gap property. This prefixed property is being replaced by row-gap. However, in order to sup
port browsers that implemented grid-row-gap and not row-gap for grid, you will need to use the prefixed property as in the interactive example above. Syntax /* <length> values */ row-gap: 20px; row-gap: 1em; row-gap: 3vmin; row-gap: 0.5cm; /* <percentage> value */ row-gap: 10%; /* Global values */ row-gap: inherit; row-gap: initial; row-gap: unset; Values <length-percentage> Is the width of...
scroll-behavior - CSS: Cascading Style Sheets
he source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note that any other scrolls, such as those performed by the user, are not affected by this property. When this property is specified on the root element, it applies to the view
port instead. This property specified on the body element will not propagate to the view
port. User agents are allowed to ignore this property. Syntax /* Keyword values */ scroll-behavior: auto; scroll-behavior: smooth; /* Global values */ scroll-behavior: inherit; scroll-behavior: initial; scroll-behavior: unset; The scroll-behavior property is specified as one of the keyword values listed below...
scroll-margin-block-end - CSS: Cascading Style Sheets
The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
scroll-margin-block-start - CSS: Cascading Style Sheets
The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
scroll-margin-block - CSS: Cascading Style Sheets
h> values */ scroll-margin-block: 10px; scroll-margin-block: 1em .5em ; /* Global values */ scroll-margin-block: inherit; scroll-margin-block: initial; scroll-margin-block: unset; Values <length> An outset from the corresponding edge of the scroll container. Description The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snap
port. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. Formal definition Initial value0Applies toall elementsInheritednoComputed valueas specifiedAnimation typeby computed value type Formal syntax <length>{1,2} Specifications Specific...
scroll-margin-bottom - CSS: Cascading Style Sheets
The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
scroll-margin-inline-end - CSS: Cascading Style Sheets
The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
scroll-margin-inline-start - CSS: Cascading Style Sheets
The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
scroll-margin-inline - CSS: Cascading Style Sheets
lues */ scroll-margin-inline: 10px; scroll-margin-inline: 1em .5em ; /* Global values */ scroll-margin-inline: inherit; scroll-margin-inline: initial; scroll-margin-inline: unset; Values <length> An outset from the corresponding edge of the scroll container. Description The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snap
port. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. Formal definition Initial value0Applies toall elementsInheritednoComputed valueas specifiedAnimation typeby computed value type Formal syntax <length>{1,2} Examples Simple demonstration T...
scroll-margin-left - CSS: Cascading Style Sheets
The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
scroll-margin-right - CSS: Cascading Style Sheets
The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
scroll-margin-top - CSS: Cascading Style Sheets
The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
scroll-margin - CSS: Cascading Style Sheets
/ scroll-margin: inherit; scroll-margin: initial; scroll-margin: unset; Values <length> An outset from the corresponding edge of the scroll container. Description You can see the effect of scroll-margin by scrolling to a point partway between two of the "pages" of the example's content. The value specified for scroll-margin determines how much of the page that's primarily outside the snap
port should remain visible. Thus, the scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snap
port. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. Formal definition Initial value0Applie...
scroll-snap-stop - CSS: Cascading Style Sheets
The scroll-snap-stop CSS property defines whether the scroll container is allowed to "pass over" possible snap positions. /* Keyword values */ scroll-snap-stop: normal; scroll-snap-stop: always; /* Global values */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; Syntax Values normal When the visual view
port of this element's scroll container is scrolled, it may "pass over" possible snap positions. always The scroll container must not "pass over" a possible snap position; and must snap to the first of this elements' snap positions. Formal definition Initial valuenormalApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax normal | always Examples Snapping in different axes This example is dupli...
scrollbar-width - CSS: Cascading Style Sheets
to The default scrollbar width for the platform. thin A thin scrollbar width variant on platforms that provide that option, or a thinner scrollbar than the default platform scrollbar width. none No scrollbar shown, however the element will still be scrollable. Note: User Agents must apply any scrollbar-width value set on the root element to the view
port. Accessibility concerns Use this property with caution -- setting scrollbar-width to thin or none can make content hard or impossible to scroll if the author does not provide an alternative scrolling mechanism. While swiping gestures or mouse wheels can enable scrolling on such content, some devices have no scroll alternative. WCAG criterion 2.1.1 (Keyboard) has been in place for a long t...
<string> - CSS: Cascading Style Sheets
mposed of any number of Unicode characters surrounded by either double (") or single (') quotes. Most characters can be represented literally. All characters can also be represented with their respective Unicode code points in hexadecimal, in which case they are preceded by a backslash (\). For example, \22 represents a double quote, \27 a single quote ('), and \A9 the copyright symbol ((C)). Im
portantly, certain characters which would otherwise be invalid can be escaped with a backslash. These include double quotes when used inside a double-quoted string, single quotes when used inside a single-quoted string, and the backslash itself. For example, \\ will create a single backslash. To output new lines, you must escape them with a line feed character such as \A or \00000A. In your code, how...
text-combine-upright - CSS: Cascading Style Sheets
ide the range of 2-4 are invalid. Formal definition Initial valuenoneApplies tonon-replaced inline elementsInheritedyesComputed valuespecified keyword, plus integer if 'digits'Animation typediscrete Formal syntax none | all | [ digits <integer>? ] Examples Digits The digits value requires less markup than the all value when digits are being combined, but it is currently not very widely sup
ported by browsers. HTML <p lang="ja" class="exampleText">??20?4?16??</p> CSS .exampleText { writing-mode: vertical-lr; text-combine-upright: digits 2; font: 36px serif; } Results ScreenshotLive sample All The all value requires markup around every piece of horizontal text, but it is currently sup
ported by more browsers than the digits value. HTML <p lang="zh-Hant">??<span class="num"...
text-decoration-color - CSS: Cascading Style Sheets
or> values */ text-decoration-color: currentcolor; text-decoration-color: red; text-decoration-color: #00ff00; text-decoration-color: rgba(255, 128, 128, 0.5); text-decoration-color: transparent; /* Global values */ text-decoration-color: inherit; text-decoration-color: initial; text-decoration-color: unset; Values <color> The color of the line decoration. Accessibility concerns It is im
portant to ensure that the contrast ratio between the color of the text, the background the text is placed over, and the text decoration line is high enough that people experiencing low vision conditions will be able to read the content of the page. Color contrast ratio is determined by comparing the luminosity of the text and background color values. Color alone should not be used to convey meaning.
text-rendering - CSS: Cascading Style Sheets
d font size and the applied scale) and request a font of that computed size from the platform's font system. But if you request a font size of, say, 9 with a scale of 140%, the resulting font size of 12.6 doesn't explicitly exist in the font system, so the browser rounds the font size to 12 instead. This results in stair-step scaling of text. But the geometricPrecision property -- when fully sup
ported by the rendering engine -- lets you scale your text fluidly. For large scale factors, you might see less-than-beautiful text rendering, but the size is what you would expect--neither rounded up nor down to the nearest font size sup
ported by Windows or Linux. Note: WebKit precisely applies the specified value, but Gecko treats the value the same as optimizeLegibility. Formal definition In...
transform-box - CSS: Cascading Style Sheets
ce box of a <table> is the border box of its table wrapper box, not its table box. border-box The border box is used as the reference box. The reference box of a <table> is the border box of its table wrapper box, not its table box. fill-box The object bounding box is used as the reference box. stroke-box The stroke bounding box is used as the reference box. view-box The nearest SVG view
port is used as the reference box. If a viewBox attribute is specified for the SVG view
port creating element, the reference box is positioned at the origin of the coordinate system established by the viewBox attribute, and the dimension of the reference box is set to the width and height values of the viewBox attribute. Formal definition Initial valueview-boxApplies totransformable elementsInherite...
skew() - CSS: Cascading Style Sheets
s stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the horizontal and vertical directions. The coordinates of each point are modified by a value pro
portionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. Syntax The skew() function is specified with either one or two values, which represent the amount of skewing to be applied in each direction. skew(ax) skew(ax, ay) Values ax Is an <angle> representing the angle to use to distort the element a...
skewX() - CSS: Cascading Style Sheets
ample is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the horizontal direction. The abscissa coordinate of each point is modified by a value pro
portionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. Note: skewX(a) is equivalent to skew(a). Syntax skewX(a) Values a Is an <angle> representing the angle to use to distort the element along the abscissa. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian co...
skewY() - CSS: Cascading Style Sheets
example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the vertical direction. The ordinate coordinate of each point is modified by a value pro
portionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. Syntax skewY(a) Values a Is an <angle> representing the angle to use to distort the element along the ordinate. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates o...
translateZ() - CSS: Cascading Style Sheets
rd" from the screen, toward the user. This has the effect of making the element appear larger when viewed on a 2D display, or closer when viewed using a VR headset or other 3D display device. Note if the perspective() value is less than the translateZ() value, such as transform: perspective(200px) translateZ(300px); the transformed element will not be visible as it is further than the user's view
port. The smaller the difference between the perspective and transform values, the closer the user is to the element and the larger the translated element will seem. Result Specifications Specification Status Comment CSS Transforms Level 2The definition of 'transform' in that specification. Editor's Draft Adds 3D transform functions to the CSS Transforms standard...
user-select - CSS: Cascading Style Sheets
part of the element, then the selection must contain the entire element including all its descendants. If a double-click or context-click occurred in sub-elements, the highest ancestor with this value will be selected. contain Enables selection to start within the element; however, the selection will be contained by the bounds of that element. element (IE-specific alias) Same as contain. Sup
ported only in Internet Explorer. Note: CSS UI 4 renames user-select: element to contain. Formal definition Initial valueautoApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | text | none | contain | all Examples HTML <p>You should be able to select this text.</p> <p class="unselectable">Hey, you can't select this text!</p> <p class="all">...
visibility - CSS: Cascading Style Sheets
t or ending values must therefore be visible or no interpolation can happen. The value is interpolated as a discrete step, where values of the timing function between 0 and 1 map to visible and other values of the timing function (which occur only at the start/end of the transition or as a result of cubic-bezier() functions with y values outside of [0, 1]) map to the closer endpoint. Notes Sup
port for visibility: collapse is missing or partially incorrect in some modern browsers. It may not be correctly treated like visibility: hidden on elements other than table rows and columns. visibility: collapse may change the layout of a table if the table has nested tables within the cells that are collapsed, unless visibility: visible is specified explicitly on nested tables. Formal definition ...
white-space - CSS: Cascading Style Sheets
at newline characters, at <br>, and as necessary to fill line boxes. pre-line Sequences of white space are collapsed. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes. break-spaces The behavior is identical to that of pre-wrap, except that: Any sequence of preserved white space always takes up space, including at the end of the line. A line breaking op
portunity exists after every preserved white space character, including between white space characters. Such preserved spaces take up space and do not hang, and thus affect the box's intrinsic sizes (min-content size and max-content size). The following table summarizes the behavior of the various white-space values: New lines Spaces and tabs Text wrapping End-of-line sp...
writing-mode - CSS: Cascading Style Sheets
Candidate Recommendation Add sideways-lr and sideways-rl CSS Writing Modes Module Level 3The definition of 'writing-mode' in that specification. Proposed Recommendation Initial definition...
zoom - CSS: Cascading Style Sheets
reset; /* <percentage> values */ zoom: 50%; zoom: 200%; /* <number> values */ zoom: 1.1; zoom: 0.7; /* Global values */ zoom: inherit; zoom: initial; zoom: unset; Syntax Values normal Render this element at its normal size. reset Do not (de)magnify this element if the user applies non-pinch-based zooming (e.g. by pressing Ctrl-- or Ctrl++ keyboard shortcuts) to the document. Only sup
ported by WebKit (and possibly Blink). <percentage> Zoom factor. 100% is equivalent to normal. Values larger than 100% zoom in. Values smaller than 100% zoom out. <number> Zoom factor. Equivalent to the corresponding percentage (1.0 = 100% = normal). Values larger than 1.0 zoom in. Values smaller than 1.0 zoom out. Formal definition Initial valuenormalApplies toall elementsInheritednoComputed v...
CSS: Cascading Style Sheets
spacing, drop shadows, and other text features. We round off the module by looking at applying custom fonts to your page, and styling lists and links. CSS layout At this point we've already looked at CSS fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. Now it's time to look at how to place your boxes in the right place concerning the view
port, and one another. We have covered the necessary prerequisites so we can now dive deep into CSS layout, looking at different display settings, modern layout tools like flexbox, CSS grid, and positioning, and some of the legacy techniques you might still want to know about. Use CSS to solve common problems This module provides links to sections of content explaining how to use CSS to solve common...
Demos of open web technologies
This page offers links to interesting demonstrations of these technologies. If you know of a good demonstration or application of open web technology, please add a link to the appropriate section here. ...
math:min() - EXSLT
ing xsl:sort() with a data type of number. The minimum value is then the first node in the sorted list, converted into a number. Note: Syntax math:min(nodeSet) Parameters nodeSet The node-set whose lowest value is to be returned. Returns A result tree fragment representing the lowest valued node's numeric value as a string. Specifications EXSLT - MATH:MIN Browser Compatibility Sup
ported in Gecko 1.9 and later. ...
regexp:match() - EXSLT
cter flags. The character flags are: g Global match The submatches from every match in the string are returned. If this flag isn't specified, only the submatches from the first match are returned. i Case insensitive match If this flag is specified, the match is performed in a case insensitive fashion. Returns A node set of match elements, each of which has the string value equal to a
portion of the first parameter string as captured by the regular expression. If the match isn't a global one, the first match element has the value of the
portion of the string matched by the entire regular expression. For example: <xsl:for-each select="regExp:match('http://developer.mozilla.org/en/docs/Firefox_3_for_developers', '(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)'...
regexp:replace() - EXSLT
Syntax regexp:replace(originalString, regExpString, flagsString, replaceString) Parameters originalString The string perform a search-and-replace operation upon. regExpString The JavaScript style regular expression to evaluate. flagsString The string containing character flags. replaceString The string with which the matched substrings are to be replaced. ...
Regular expressions (regexp) - EXSLT
Regular Expressions package provides functions that allow testing, matching, and replacing text using JavaScript style regular expressions. The namespace for the Regular Expressions package is http://exslt.org/regular-expressions. regexp:match()regexp:match() performs regular expression matching on a string, returning the submatches found as a result.regexp:replace()regexp:replace() replaces the
portions of a string that match a given regular expression with the contents of another string.regexp:test()regexp:test() tests to see whether a string matches a specified regular expression. ...
EXSLT
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes EXSLT is a set of extensions to XSLT. There are a number of modules; those that are sup
ported by Firefox are listed below: Common (exsl)The EXSLT Common package provides basic functions that expand upon the capabilities of XSLT.Math (math)The EXSLT Math package provides functions for working with numeric values and comparing nodes.Regular expressions (regexp)The EXSLT Regular Expressions package provides functions that allow testing, matching, and replacing text using JavaScript style regular expressions.Sets (set)The EXSLT Sets package offers functions that let you perform set manipulation.Strings (str)The EXSLT Strings package provides functions that allow the manipulation of strings. EXSLT mod...
Community - Developer guides
If you know of useful mailing lists, newsgroups, forums, or other communities related to AJAX, please link to them here. ...
Guide to Web APIs - Developer guides
APIMedia Source Extensions MediaStream RecordingNNavigation TimingNetwork Information API PPage Visibility APIPayment Request APIPerformance APIPerformance Timeline APIPermissions APIPointer EventsPointer Lock APIProximity Events Push API RResize Observer APIResource Timing APISServer Sent EventsService Workers APIStorageStorage Access APIStreams TTouch EventsUURL APIVVibration APIVisual View
port WWeb AnimationsWeb Audio APIWeb Authentication APIWeb Crypto APIWeb NotificationsWeb Storage APIWeb Workers APIWebGLWebRTCWebVTTWebXR Device APIWebsockets API ...
Web Audio playbackRate explained - Developer guides
which the media resets; for example, if we change the source of the video, or (in some browsers) when an ended event is generated. So defaultPlaybackRate allows us to set the playback rate before playing the media, while playbackRate allows us to change it during media playback. There is also an event available called ratechange, which fires every time the playbackRate changes. Browser sup
port Chrome 20+ ? Firefox 20+ ? IE 9+ ? Safari 6+ ? Opera 15+ ? Mobile Chrome (Android) ? Mobile Firefox 24+ ? IE Mobile ? Mobile Safari 6+ (iOS) ? Opera Mobile ? Notes Most browsers stop playing audio outside playbackRate bounds of 0.5 and 4, leaving the video playing silently. For most applications, it's recommended that you limit the range to between 0.5 and 4. The pitch of the au...
Audio and video manipulation - Developer guides
4 + 1] = grey; frame.data[i * 4 + 2] = grey; } this.ctx1.putImageData(frame, 0, 0); return; } }; Once the page has loaded you can call processor.doLoad() Result This is a pretty simple example showing how to manipulate video frames using a canvas. For efficiency, you should consider using requestAnimationFrame() instead of setTimeout() when running on browsers that sup
port it. Note: Due to potential security issues if your video is on a different domain than your code, you'll need to enable CORS (Cross Origin Resource Sharing) on your video server. Video and WebGL WebGL is a powerful API that uses canvas to draw hardware-accelerated 3D or 2D scenes. You can combine WebGL and the <video> element to create video textures, which means you can put video inside 3D ...
Creating and triggering events - Developer guides
o the events fired by the browser itself. Creating custom events Events can be created with the Event constructor as follows: const event = new Event('build'); // Listen for the event. elem.addEventListener('build', function (e) { /* ... */ }, false); // Dispatch the event. elem.dispatchEvent(event); The above code example uses the EventTarget.dispatchEvent() method. This constructor is sup
ported in most modern browsers (with Internet Explorer being the exception). For a more verbose approach (which works with Internet Explorer), see the old-fashioned way below. Adding custom data - CustomEvent() To add more data to the event object, the CustomEvent interface exists and the detail property can be used to pass custom data. For example, the event could be created as follows: const eve...
Mouse gesture events - Developer guides
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. Gecko 1.9.1 added sup
port for several Mozilla-specific DOM events used to handle mouse gestures. These are special movements that can be made with a mouse or trackpad and can be interpreted to perform specific tasks. Note: These gesture events are available to add-ons and other browser chrome code, but are never sent to regular web page content. Note: Some operating systems, including Mac OS X and Windows 7, provide default actions when gesture events occur. If you handle a gesture event and wis...
Using device orientation with 3D transforms - Developer guides
Here's a simple code snippet to sum it up: var elem = document.getElementById("view3d"); window.addEventListener("deviceorientation", function(e) { // remember to use vendor-prefixed transform property elem.style.transform = "rotateZ(" + ( e.alpha - 180 ) + "deg) " + "rotateX(" + e.beta...
Rich-Text Editing in Mozilla - Developer guides
Note: This document is out-of-date; you are advised to consult the more up-to-date document available at Making content editable. Mozilla 1.3 introduces an implementation of Microsoft(R) Internet Explorer's designMode feature. The rich-text editing sup
port in Mozilla 1.3 sup
ports the designMode feature which turns HTML documents into rich-text editors. Starting in Firefox 3, Mozilla also sup
ports Internet Explorer's contentEditable attribute which allows any element to become editable or non-editable (the latter for when preventing change to fixed elements in an editable environment). Setting Up Rich-Text Editing Rich-text editing is initialized by setting the designMode property of a document to "On", such as the document inside an iframe. Once designMode has been set to "On", th...
Making content editable - Developer guides
ngs are somewhat more consistent. As of Firefox 60, Firefox will be updated to wrap the separate lines in <div> elements, matching the behavior of Chrome, modern Opera, Edge, and Safari. Try it out in the above example. Note: Internet Explorer, which is no longer being developed, uses <p> elements instead of <div>. If you want to use a different paragraph separator, the above browsers all sup
port document.execCommand, which provides a defaultParagraphSeparator command to allow you to change it. For example, to use <p> elements: document.execCommand("defaultParagraphSeparator", false, "p"); Additionally, Firefox sup
ports the non-standard argument, br, for defaultParagraphSeparator since Firefox 55. This is useful if your web application expects the older Firefox behavior, and you don't w...
A hybrid approach - Developer guides
es and responsive design approaches by combining them. This hybrid approach centers around breaking down mobile development into its three goals, and then applying the best techniques available to tackle each goal individually. This article presents one potential combination of techniques as an example here, but different combinations will be appropriate under different circumstances. The most im
portant concept to remember is that server-side and client-side techniques can be combined to fit your situation. The Good Responsive web design is great -- right now it is the best technique available for making layouts look as good as possible in a variety of circumstances. If your mobile and desktop use cases are similar enough, this is definitely the preferred option for layout changes. However,...
Parsing and serializing XML - Developer guides
rting them into strings containing XML. DOMParser Constructs a DOM tree by parsing a string containing XML, returning a XMLDocument or Document as appropriate based on the input data. XMLHttpRequest Loads content from a URL; XML content is returned as an XML Document object with a DOM tree built from the XML itself. XPath A technology for creating strings that contain addresses for specific
portions of an XML document, and locating XML nodes based on those addresses. Creating an XML document Using one of the following approaches to create an XML document (which is an instance of Document. Parsing strings into DOM trees This example converts an XML fragment in a string into a DOM tree using a DOMParser: var sMyString = '<a id="a"><b id="b">hey!</b></a>'; var oParser = new DOMParser...
Optimization and performance - Developer guides
When building modern Web apps and sites, it's im
portant to make your content perform well. That is, to make it work quickly and efficiently. This lets it work effectively both for users of powerful desktop systems as well as for handheld devices with less power. There are several tools available to check the performance of a website or blog. The most notable tools are listed below. Google PageSpeed Insights Lighthouse WebPageTest Browser developer tools The above resources also include web performance best practices. Making web performance a priority by considering web performance throughout the development process is im
portant in ensuring users get the best user experience possible. There are no subpages at this time. ...
Developer guides
web apps (PWAs) use modern web APIs along with traditional progressive enhancement strategy to create cross-platform web applications. These apps work everywhere and provide several features that give them the same user experience advantages as native apps. This set of guides tells you all you need to know about PWAs. Optimization and performance When building modern web apps and sites, it's im
portant to make your content work quickly and efficiently. This lets it perform effectively for both powerful desktop systems and weaker handheld devices. Parsing and serializing XML The web platform provides different methods of parsing and serializing XML, each with its pros and cons. The Web Open Font Format (WOFF) WOFF (Web Open Font Format) is a font file format that is free for anyone to use...
HTML attribute: accept - HTML: Hypertext Markup Language
Because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of specific type, or use the wild card to denote a type of any format is acceptable. ...
HTML attribute: crossorigin - HTML: Hypertext Markup Language
Depending on the element, the attribute can be a CORS settings attribute. The crossorigin content attribute on media elements is a CORS settings attribute. These attributes are enumerated, and have the following possible values: Keyword Description anonymous CORS requests for this element will have the credentials flag set to 'same-origin'. ...
HTML attribute: min - HTML: Hypertext Markup Language
big red border around invalid inputs: input:invalid { border: solid red 3px; } Then define an input with a minimum value of 7.2, omitting the step attribute, wherein it defaults to 1. <input id="myNumber" name="myNumber" type="number" min="7.2" value="8"> Because step defaults to 1, valid values include 7.2, 8.2, 9.2, and so on. The value 8 is not valid. As we included an invalid value, sup
porting browsers will show the value as invalid. If not explicitly included, step defaults to 1 for number and range, and 1 unit type (second, week, month, day) for the date/time input types. ...
HTML attribute: pattern - HTML: Hypertext Markup Language
uld be specified around the pattern text. If the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored. Tip: Use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. You should also include other explanatory text nearby. Some of the input types sup
porting the pattern attribute, notably the email and url input types, have expected value syntaxes that must be matched. If the pattern attribute isn't present, and the value doesn't match the expected syntax for that value type, the ValidityState object's read-only typeMismatch property will be true. Usability When including a pattern, provide a description of the pattern in visible text near the ...
HTML attribute: step - HTML: Hypertext Markup Language
around invalid inputs: input:invalid { border: solid red 3px; } Then define an input with a minimum value of 7.2, omitting the step attribute, wherein it defaults to 1. <input id="myNumber" name="myNumber" type="number" step="2" min="1.2"> Valid values include 1.2, 3.2, 5.2, 7.2, 9.2, 11.2, and so on. Integers and even numbers follwed by .2 are not valid. As we included an invalid value, sup
porting browsers will show the value as invalid. The number spinner, if present, will only show valid float values of 1.2 and greater Note: When the data entered by the user doesn't adhere to the stepping configuration, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses See Client-side validation and stepMismatch for more informati...
<aside>: The Aside element - HTML: Hypertext Markup Language
Asides are frequently presented as sidebars or call-out boxes. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, sectioning content, palpable content. Permitted content Flow content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts flow content. ...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
ntent. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes Like all other HTML elements, this element sup
ports the global attributes, except that the dir attribute behaves differently than normal: it defaults to auto, meaning its value is never inherited from the parent element. This means that unless you specify a value of either rtl or ltr for dir, the user agent will determine the correct directionality to use based on the contents of the <bdi>. Examples No <bdi> with only LTR This example lists th...
<blink>: The Blinking Text element (obsolete) - HTML: Hypertext Markup Language
The HTML Blink Element (<blink>) is a non-standard element which causes the enclosed text to flash slowly. Do not use this element as it is obsolete and is bad design practice. Blinking text is frowned upon by several accessibility standards and the CSS specification allows browsers to ignore the <blink> element. DOM interface This element is unsup
ported and thus implements the HTMLUnknownElement interface. Example <blink>Why would somebody use this?</blink> Result (toned down!) Specification This element is non-standard and not part of any specification. If you don't believe us, see for yourself in the HTML spec. CSS polyfill If you really do need a polyfill, then you can use the following CSS polyfill. Works in IE10+. blink { -webkit-animation: 2s linear infinite ...
<button>: The Button element - HTML: Hypertext Markup Language
te the wrong interactive content. Spacing may be created using CSS properties such as margin. Hand tremors and the giant-button-problem - Axess Lab Firefox Firefox will add a small dotted border on a focused button. This border is declared through CSS in the browser stylesheet, but you can override it to add your own focused style using button::-moz-focus-inner { }. If overridden, it is im
portant to ensure that the state change when focus is moved to the button is high enough that people experiencing low vision conditions will be able to perceive it. Color contrast ratio is determined by comparing the luminosity of the button text and background color values compared to the background the button is placed on. In order to meet current Web Content Accessibility Guidelines (WCAG), a rati...
<cite>: The Citation element - HTML: Hypertext Markup Language
des the global attributes. Usage notes In the context of the <cite> element, a creative work that might be cited could be, for example, one of the following: A book A research paper An essay A poem A musical score A song A play or film script A film A television show A game A sculpture A painting A theatrical production A play An opera A musical An exhibition A legal case re
port A computer program A web site A web page A blog post or comment A forum post or comment A tweet A Facebook post A written or oral statement And so forth. It's worth noting that the W3C specification says that a reference to a creative work, as included within a <cite> element, may include the name of the work's author. However, the WHATWG specification for <cite> says the opposite: th...
<command>: The HTML Command element - HTML: Hypertext Markup Language
The HTML Command element (<command>) represents a command which the user can invoke. Commands are often used as part of a context menu or toolbar. However, they can be used anywhere on the page. The <command> element is included in the W3C specification, but not in the WHATWG specification, and browser sup
port is nonexistent. You should use the <menuitem> element instead, although that element is non-standard and only sup
ported in Edge and Firefox. Content categories Flow content, phrasing content, metadata content. Permitted content None, it is an empty element. Tag omission The start tag is mandatory, but, as it is a void element, the use of an end tag is forbidden. Permitted parent elements <colgroup> only, though it can be implicitly d...
<del>: The Deleted Text element - HTML: Hypertext Markup Language
, del::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } del::before { content: " [deletion start] "; } del::after { content: " [deletion end] "; } Some people who use screen readers deliberately disable announcing content that creates extra verbosity. Because of this, it is im
portant to not abuse this technique and only apply it in situations where not knowing content has been deleted would adversely affect understanding. Short note on making your mark (more accessible) | The Paciello Group Tweaking Text Level Styles | Adrian Roselli Specifications Specification Status Comment HTML Living StandardThe definition of '<del>' in that specific...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
'); var outputBox = document.querySelector('output'); var selectEl = document.querySelector('select'); var confirmBtn = document.getElementById('confirmBtn'); // "Update details" button opens the <dialog> modally updateButton.addEventListener('click', function onOpen() { if (typeof favDialog.showModal === "function") { favDialog.showModal(); } else { alert("The <dialog> API is not sup
ported by this browser"); } }); // "Favorite animal" input sets the value of the submit button selectEl.addEventListener('change', function onSelect(e) { confirmBtn.value = selectEl.value; }); // "Confirm" button of form triggers "close" on dialog because of [method="dialog"] favDialog.addEventListener('close', function onClose() { outputBox.value = favDialog.returnValue + " button clicked - " +...
<dir>: The Directory element (obsolete) - HTML: Hypertext Markup Language
container for a directory of files and/or folders, potentially with styles and icons applied by the user agent. Do not use this obsolete element; instead, you should use the <ul> element for lists, including lists of files. Usage note: Do not use this element. Though present in early HTML specifications, it has been deprecated in HTML 4, and has since been removed entirely. No major browsers sup
port this element. DOM interface This element implements the HTMLDirectoryElement interface. Attributes Like all other HTML elements, this element sup
ports the global attributes. compact This Boolean attribute hints that the list should be rendered in a compact style. The interpretation of this attribute depends on the user agent and it doesn't work in all browsers. Usage note: Do not use thi...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: This topic documents only the element that is defined as part of HTML5. It does not address earlier, non-standardized implementation of the element. Keep in mind that most modern browsers have deprecated and removed sup
port for browser plug-ins, so relying upon <embed> is generally not wise if you want your site to be operable on the average user's browser. Content categories Flow content, phrasing content, embedded content, interactive content, palpable content. Permitted content None, it is an empty element. Tag omission Must have a start tag, and must not have an end tag. ...
<frame> - HTML: Hypertext Markup Language
efines a particular area in which another HTML document can be displayed. A frame should be used within a <frameset>. Using the <frame> element is not encouraged because of certain disadvantages such as performance problems and lack of accessibility for users with screen readers. Instead of the <frame> element, <iframe> may be preferred. Attributes Like all other HTML elements, this element sup
ports the global attributes. src This attribute specifies the document that will be displayed by the frame. name This attribute is used for labeling frames. Without labeling, every link will open in the frame that it's in - the closest parent frame. See the target attribute for more information. noresize This attribute prevents resizing of frames by users. scrolling This attribute defines th...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
pearance. A browser will typically still display the contents of the <i> element in italic type, but is, by definition, no longer required to do so. To display text in italic type, authors should use the CSS font-style property. Be sure the text in question is not actually more appropriately marked up with another element. Use <em> to indicate stress emphasis. Use <strong> to indicate im
portance, seriousness, or urgency. Use <mark> to indicate relevance. Use <cite> to mark up the name of a work, such as a book, play, or song. Use <dfn> to mark up the defining instance of a term. Examples This example demonstrates using the <i> element to mark text that is in another language. <p>The Latin phrase <i>Veni, vidi, vici</i> is often mentioned in music, art, and literatur...
<input type="button"> - HTML: Hypertext Markup Language
send us a pull request. Note: While <input> elements of type button are still perfectly valid HTML, the newer <button> element is now the favored way to create buttons. Given that a <button>'s label text is inserted between the opening and closing tags, you can include HTML in the label, even images. Value A DOMString used as the button's label Events click Sup
ported common attributes type, and value IDL attributes value Methods None Value An <input type="button"> elements' value attribute contains a DOMString that is used as the button's label. <input type="button" value="Click Me"> If you don't specify a value, you get an empty button: <input type="button"> Using buttons <input type="button"> elements have n...
<input type="datetime"> - HTML: Hypertext Markup Language
The HTML <input type="datetime"> was a control for entering a date and time (hour, minute, second, and fraction of a second) as well as a timezone. This feature has been removed from WHATWG HTML, and is no longer sup
ported in browsers. Instead, browsers are implementing (and developers are encouraged to use) <input type="datetime-local">. The format of the date and time value used by this input type is described in Format of a valid global date and time string in Date and time formats used in HTML. ...
<input type="reset"> - HTML: Hypertext Markup Language
roject, please clone https://github.com/mdn/interactive-examples and send us a pull request. You should usually avoid including reset buttons in your forms. They're rarely useful, and are instead more likely to frustrate users who click them by mistake (often while trying to click the submit button). Value A DOMString used as the button's label Events click Sup
ported common attributes type and value IDL attributes value Methods None Value An <input type="reset"> element's value attribute contains a DOMString that is used as the button's label. Buttons such as reset don't have a value otherwise. <input type="reset" value="Reset the form"> If you don't specify a value, you get an button with the default label (typicall...
<ins> - HTML: Hypertext Markup Language
ins::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } ins::before { content: " [insertion start] "; } ins::after { content: " [insertion end] "; } Some people who use screen readers deliberately disable announcing content that creates extra verbosity. Because of this, it is im
portant to not abuse this technique and only apply it in situations where not knowing content has been inserted would adversely affect understanding. Short note on making your mark (more accessible) | The Paciello Group Tweaking Text Level Styles | Adrian Roselli Specifications Specification Status Comment HTML Living StandardThe definition of '<ins>' in that specifi...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Other elements can be used in tandem with <kbd> to represent more specific scenarios: Nesting a <kbd> element within another <kbd> element represents an actual key or other unit of input as a
portion of a larger input. See Representing keystrokes within an input below. Nesting a <kbd> element inside a <samp> element represents input that has been echoed back to the user by the system. See Echoed input, below, for an example. Nesting a <samp> element inside a <kbd> element, on the other hand, represents input which is based on text presented by the system, such as the names of menus and m...
<main> - HTML: Hypertext Markup Language
for apple pies.</p> <p>... </p> <p>... </p> </article> </main> <!-- other content --> Accessibility concerns Landmark The <main> element behaves like a main landmark role. Landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. Prefer using the <main> element over declaring role="main", unless there are legacy browser sup
port concerns. Skip navigation Skip navigation, also known as "skipnav", is a technique that allows an assistive technology user to quickly bypass large sections of repeated content (main navigation, info banners, etc.). This lets the user access the main content of the page faster. Adding an id attribute to the <main> element lets it be a target of a skip navigation link. <body> <a href="#main-...
<noembed>: The Embed Fallback element (Obsolete) - HTML: Hypertext Markup Language
The <noembed> element is an obsolete, non-standard way to provide alternative, or "fallback", content for browsers that do not sup
port the <embed> element or do not sup
port the type of embedded content an author wishes to use. This element was deprecated in HTML 4.01 and above in favor of placing fallback content between the opening and closing tags of an <object> element. While this element currently still works in many browsers, it is obsolete and should not be used. Use <object> instead, with fallback content between the opening and closing tags of the element. Examples The message inside <noembed> tag will appear only when your browser does not sup
port <embed> tag. Show an alternative content <embed type="vide/webm" src="/media/examples/flower.mp4" width="200" height="20...
<noscript> - HTML: Hypertext Markup Language
Content categories Metadata content, flow content, phrasing content. Permitted content When scripting is disabled and when it is a descendant of the <head> element: in any order, zero or more <link> elements, zero or more <style> elements, and zero or more <meta> elements. When scripting is disabled and when it isn't a descendant of the <head> element: any transparent content, but no <noscript> element must be among its descendants. Otherwise: flow content or phrasing content. ...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
display with a preceding marker, such as a number or letter. The <ol> and <ul> elements may nest as deeply as desired, alternating between <ol> and <ul> however you like. The <ol> and <ul> elements both represent a list of items. The difference is with the <ol> element, the order is meaningful. For example: Steps in a recipe Turn-by-turn directions The list of ingredients in decreasing pro
portion on nutrition information labels To determine which list to use, try changing the order of the list items; if the meaning changes, use the <ol> element -- otherwise you can use <ul>. Examples Simple example <ol> <li>Fee</li> <li>Fi</li> <li>Fo</li> <li>Fum</li> </ol> The above HTML will output: Using Roman Numeral type <ol type="i"> <li>Introduction</li> <li>List of Greiv...
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
text parts annotated completely separately. In this case we don't need to include <rb> elements: <ruby> ? <rp>(</rp><rt>Kan</rt><rp>)</rp> ? <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> <ruby> <rb>?<rb>? <rp>(</rp><rt>kan<rt>ji<rp>)</rp> </ruby> body { font-size: 22px; } The output looks like so: The HTML above might look something like this when rendered by a browser without ruby sup
port: ?? (kan ji) body { font-size: 22px; } Note: See the article about the <ruby> element for further examples. Specifications Specification Status Comment HTML5The definition of '<rb>' in that specification. Recommendation ...
<rt>: The Ruby Text element - HTML: Hypertext Markup Language
RIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Examples This simple example provides Romaji transliteration for the kanji characters within the <ruby> element: <ruby> ? <rt>Kan</rt> ? <rt>ji</rt> </ruby> body { font-size: 22px; } The output looks like this in your browser: On a browser without ruby sup
port, this example might look like this: ? Kan ? ji body { font-size: 22px; } Specifications Specification Status Comment HTML Living StandardThe definition of '<rt>' in that specification. Living Standard HTML5The definition of '<rt>' in that specification. Recommendation ...
<s> - HTML: Hypertext Markup Language
{ clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } s::before { content: " [start of stricken text] "; } s::after { content: " [end of stricken text] "; } Some people who use screen readers deliberately disable announcing content that creates extra verbosity. Because of this, it is im
portant to not abuse this technique and only apply it in situations where not knowing content has been struck out would adversely affect understanding. Short note on making your mark (more accessible) | The Paciello Group Tweaking Text Level Styles | Adrian Roselli Specifications Specification Status Comment HTML Living StandardThe definition of 's element' in that s...
<samp>: The Sample Output element - HTML: Hypertext Markup Language
Note also the use of <kbd> to represent the command the user entered at the prompt in the sample text. CSS The CSS that achieves the appearance we want is: .prompt { color: #b00; } samp > kbd { font-weight: bold; } .cursor { color: #00b; } This simply gives the prompt and cursor fairly subtle colorization and emboldens t...
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
lement that accepts flow content. Permitted ARIA roles None DOM interface HTMLShadowElement Attributes This element includes the global attributes. Example Here is a simple example of using the <shadow> element. It is an HTML file with everything needed in it. Note: This is an experimental technology. For this code to work, the browser you display it in must sup
port Web Components. See Enabling Web Components in Firefox. <html> <head></head> <body> <!-- This <div> will hold the shadow roots. --> <div> <!-- This heading will not be displayed --> <h4>My Original Heading</h4> </div> <script> // Get the <div> above with its content var origContent = document.querySelector('div'); // Create the first shadow root var shadowr...
<spacer> - HTML: Hypertext Markup Language
<spacer> is an obsolete HTML element which allowed insertion of empty spaces on pages. It was devised by Netscape to accomplish the same effect as a single-pixel layout image, which was something web designers used to use to add white spaces to web pages without actually using an image. However, <spacer> no longer sup
ported by any major browser and the same effects can now be achieved using simple CSS. Firefox, which is the descendant of Netscape's browsers, removed sup
port for <spacer> in version 4. Attributes Like all other HTML elements, this element sup
ports the global attributes. type This attribute determines type of spacer. Possible values are horizontal, vertical and block. size This attribute can be used for defining size of spacer in pixels when type is horizont...
<span> - HTML: Hypertext Markup Language
, or any element that accepts flow content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLSpanElement (before HTML5, the interface was HTMLElement) Attributes This element only includes the global attributes. Example Example 1 HTML <p><span>Some text</span></p> Result Example 2 HTML <li><span> <a href="
portfolio.html" target="_blank">See my
portfolio</a> </span></li> CSS li span { background: gold; } Result Specifications Specification Status Comment HTML Living StandardThe definition of '<span>' in that specification. Living Standard HTML5The definition of '<span>' in that specification. Recommendation The DOM interface is now HTMLSpanEl...
<sup>: The Superscript element - HTML: Hypertext Markup Language
ics is <var>E</var>=<var>m</var><var>c</var><sup>2</sup>.<p> The resulting output looks like this: Superior lettering Superior lettering is not technically the same thing as superscript. However, it is common to use <sup> to present superior lettering in HTML. ...
<time> - HTML: Hypertext Markup Language
t. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLTimeElement Attributes Like all other HTML elements, this element sup
ports the global attributes. datetime This attribute indicates the time and/or date of the element and must be in one of the formats described below. Usage notes This element is for presenting dates and times in a machine readable format. For example, this can help a user agent offer to add an event to a user's calendar. This element should not be used for dates prior to the introduction of th...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
viewer. For example dialogue or text that is not English in an English language film. Subtitles may contain additional content, usually extra background information. For example the text at the beginning of the Star Wars films, or the date, time, and location of a scene. captions Closed captions provide a transcription and possibly a translation of audio. It may include im
portant non-verbal information such as music cues or sound effects. It may indicate the cue's source (e.g. music, text, character). Suitable for users who are deaf or when the sound is muted. descriptions Textual description of the video content. Suitable for users who are blind or where the video cannot be seen. chapters Chapter titles are intended to be used...
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
Chinese text, and other forms of annotation. You should not use <u> to simply underline text for presentation purposes, or to denote titles of books. Other elements to consider using In most cases, you should use an element other than <u>, such as: <em> to denote stress emphasis <b> to draw attention to text <mark> to mark key words or phrases <strong> to indicate that text has strong im
portance <cite> to mark the titles of books or other publications <i> to denote technical terms, transliterations, thoughts, or names of vessels in Western texts To provide textual annotations (as opposed to the non-textual annotations created with <u>), use the <ruby> element. To apply an underlined appearance without any semantic meaning, use the text-decoration property's value underline. Exa...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
ed: use CSS instead. To give a similar effect as the compact attribute, the CSS property line-height can be used with a value of 80%. type This attribute sets the bullet style for the list. The values defined under HTML3.2 and the transitional version of HTML 4.0/4.01 are: circle disc square A fourth bullet type has been defined in the WebTV interface, but not all browsers sup
port it: triangle. If not present and if no CSS list-style-type property applies to the element, the user agent selects a bullet type depending on the nesting level of the list. Warning: Do not use this attribute, as it has been deprecated; use the CSS list-style-type property instead. Usage notes The <ul> element is for grouping a collection of items that do not have a numerical ordering, ...
<wbr> - HTML: Hypertext Markup Language
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content. Permitted content Empty Tag omission It is an empty element; it must have a start tag, but must not have an end tag. Permitted parents Any element that accepts phrasing content. ...
class - HTML: Hypertext Markup Language
f 'class' in that specification. Recommendation Snapshot of HTML Living Standard, no change from HTML5 HTML5The definition of 'class' in that specification. Recommendation Snapshot of HTML Living Standard. From HTML 4.01 Specification, class is now a true global attribute. HTML 4.01 SpecificationThe definition of 'class' in that specification. Recommendation Sup
ported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>. ...
id - HTML: Hypertext Markup Language
cation. Recommendation Snapshot of HTML Living Standard, no change from HTML5 HTML5The definition of 'id' in that specification. Recommendation Snapshot of HTML Living Standard, now accept '_', '-' and '.' if not at the beginning of the id. It is also a true global attribute. HTML 4.01 SpecificationThe definition of 'id' in that specification. Recommendation Sup
ported on all elements but <base>, <head>, <html>, <meta>, <script>, <style>, and <title>. ...
itemid - HTML: Hypertext Markup Language
The itemid global attribute provides microdata in the form of a unique, global identifier of an item. An itemid attribute can only be specified for an element that has both itemscope and itemtype attributes. Also, itemid can only be specified on elements that possess an itemscope attribute whose corresponding itemtype refers to or defines a vocabulary that sup
ports global identifiers. The exact meaning of an itemtype's global identifier is provided by the definition of that identifier within the specified vocabulary. The vocabulary defines whether several items with the same global identifier can coexist and, if so, how items with the same identifier are handled. Note: The WHATWG definition specifies that an itemid must be a URL. However, the following example correctly illustrates that a U...
itemprop - HTML: Hypertext Markup Language
y elements are the a, area, audio, embed, iframe, img, link, object, source, track, and video elements. Name order Names are unordered relative to each other, but if a particular name has multiple values, they do have a relative order. ...
spellcheck - HTML: Hypertext Markup Language
may also be inherited, which means that the element content will be checked for spelling errors only if its nearest ancestor has a spellcheck state of true. This attribute is merely a hint for the browser: browsers are not required to check for spelling errors. Typically non-editable elements are not checked for spelling errors, even if the spellcheck attribute is set to true and the browser sup
ports spellchecking. Specifications Specification Status Comment HTML Living StandardThe definition of 'spellcheck' in that specification. Living Standard No change from latest snapshot, HTML 5.1 HTML 5.1The definition of 'spellcheck' in that specification. Recommendation Snapshot of HTML Living Standard, initial definition ...
style - HTML: Hypertext Markup Language
n of 'style' in that specification. Recommendation Snapshot of HTML Living Standard, no change from HTML5 HTML5The definition of 'style' in that specification. Recommendation Snapshot of HTML Living Standard. From HTML 4.01 Specification, it is now a true global attribute. HTML 4.01 SpecificationThe definition of 'style' in that specification. Recommendation Sup
ported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>. CSS Style Attributes Recommendation Defines the content of the style attribute. ...
tabindex - HTML: Hypertext Markup Language
specification. Living Standard No change from latest snapshot, HTML 5.1. HTML 5.1The definition of 'tabindex' in that specification. Recommendation Snapshot of HTML Living Standard, no change from HTML5. HTML5The definition of 'tabindex' in that specification. Recommendation Snapshot of HTML Living Standard. From HTML 4.01 Specification, the attribute is now sup
ported on all elements (global attributes). HTML 4.01 SpecificationThe definition of 'tabindex' in that specification. Recommendation Only sup
ported on <a>, <area>, <button>, <input>, <object>, <select>, and <textarea>. ...
translate - HTML: Hypertext Markup Language
the following values: empty string or "yes", which indicates that the element should be translated when the page is localized. "no", which indicates that the element must not be translated. Although not all browsers recognize this attribute, it is respected by automatic translation systems such as Google Translate, and may also be respected by tools used by human translators. As such it's im
portant that web authors use this attribute to mark content that should not be translated. Examples In this example, the translate attribute is used to ask translation tools not to translate the company's brand name in the footer. <footer> <small>(C) 2020 <span translate="no">BrandName</span></small> </footer> Specifications Specification Status Comment HTML Living Stand...
x-ms-format-detection - HTML: Hypertext Markup Language
ther data formats within the element's text, like phone numbers, are automatically converted to followable links. Existing links, such as ones with the tel: scheme, are unaffected. Links created through format detection do not appear in the DOM. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax <html x-ms-format-detection="none"> Value all All sup
ported data formats are detected. none Format detection is turned off. phone Phone number patterns are autolinked. ...
HTTP authentication - HTTP
ch is introduced in more detail below. IANA maintains a list of authentication schemes, but there are other schemes offered by host services, such as Amazon AWS. Common authentication schemes include: Basic See RFC 7617, base64-encoded credentials. More information below. Bearer See RFC 6750, bearer tokens to access OAuth 2.0-protected resources Digest See RFC 7616, only md5 hashing is sup
ported in Firefox, see bug 472823 for SHA encryption sup
port HOBA See RFC 7486, Section 3, HTTP Origin-Bound Authentication, digital-signature-based Mutual See RFC 8120 AWS4-HMAC-SHA256 See AWS docs Basic authentication scheme The "Basic" HTTP authentication scheme is defined in RFC 7617, which transmits credentials as user ID/password pairs, encoded using base64. Security of basic authentic...
Choosing between www and non-www URLs - HTTP
have as your canonical location is yours, but if you choose one, stick with it. It will make your website appear more consistent to your users and to search engines. This includes always linking to the chosen domain (which shouldn't be hard if you're using relative URLs in your website) and always sharing links (by email/social networks, etc.) to the same domain. No, you can have two. What is im
portant is that you are coherent and consistent with which one is the official domain. This official domain is called the canonical name. All your absolute links should use it. But even so, you can still have the other domain working: HTTP allows two techniques so that it is clear for your users, or search engines, which domain is the canonical one, while still allowing the non-canonical domain to wor...
Basics of HTTP - HTTP
sponses have a very clear structure. This introductory article describes this structure, its purpose, and its possibilities. Frame and message structure in HTTP/2 HTTP/2 encapsulates and represents HTTP/1.x messages in a binary frame. This article explains the frame structure, its purpose, and the way it's encoded. Connection management in HTTP/1.x HTTP/1.1 was the first version of HTTP to sup
port persistent connection and pipelining. This article explains both concepts. Connection management in HTTP/2 HTTP/2 completely revisited how connections are created and maintained. This article explains how HTTP frames allow multiplexing and solve the 'head-of-line' blocking problem of former HTTP versions. Content Negotiation HTTP introduces a set of headers, starting with Accept as a way for ...
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Methods’ - HTTP
Reason Reason: invalid token 'xyz' in CORS header 'Access-Control-Allow-Methods' What went wrong? The response to the CORS request that was sent by the server includes an Access-Control-Allow-Methods header which includes at least one invalid method name. The Access-Control-Allow-Methods header is sent by the server to let the client know what HTTP request methods it sup
ports for CORS requests. The header's value is a comma-delineated string of HTTP method names, such as GET, POST, or HEAD. If any of the specified values are not recognized by the client user agent, this error occurs. This is a problem that most likely can only be fixed on the server side, by modifying the server's configuration to no longer send the invalid or unknown method name with the Access-Control-Allow-Methods hea...
Cross-Origin Resource Policy (CORP) - HTTP
ource-Policy HTTP response header, which accepts one of three values: same-site Only requests from the same Site can read the resource. Warning: This is less secure than an origin. The algorithm for checking if two origins are same site is defined in the HTML standard and involves checking the registrable domain. same-origin Only requests from the same origin (i.e. scheme + host +
port) can read the resource. cross-origin Requests from any origin (both same-site and cross-site) can read the resource. Cross-Origin-Resource-Policy: same-site | same-origin | cross-origin During a cross-origin resource policy check, if the header is set, the browser will deny no-cors requests issued from a different origin/site. ...
Using Feature Policy - HTTP
e use of the sub-optimal functionality requires explicitly specifying a policy that disables the features. For new content, you can start developing with a policy that disables all the features. This approach ensures that none of the functionality is introduced. When applying a policy to existing content, testing is likely required to verify it continues to work as expected. This is especially im
portant for embedded or third-party content that you do not control. To turn on the enforcement of all the best practices, specify the policy as below. Send the following the HTTP header: Feature-Policy: layout-animations 'none'; unoptimized-images 'none'; oversized-images 'none'; sync-script 'none'; sync-xhr 'none'; unsized-media 'none'; Using the <iframe> allow attribute: <iframe src="https://e...
Feature Policy - HTTP
r certain features. Examples of what you can do with Feature Policy: Change the default behavior of autoplay on mobile and third party videos. Restrict a site from using sensitive APIs like camera or microphone. Allow iframes to use the fullscreen API. Block the use of outdated APIs like synchronous XHR and document.write(). Ensure images are sized properly and are not too big for the view
port. Concepts and usage Feature Policy allows you to control which origins can use which features, both in the top-level page and in embedded frames. Essentially, you write a policy, which is an allowed list of origins for each feature. For every feature controlled by Feature Policy, the feature is only enabled in the current document or frame if its origin matches the allowed list of origins. Fo...
Accept-CH-Lifetime - HTTP
ts headers client should include in subsequent requests. Header type Response header Forbidden header name ? Note: Client Hints are accessible only on secure origins (via TLS). Accept-CH and Accept-CH-Lifetime headers should be persisted for all secure requests to ensure Client Hints are sent reliably. Syntax Accept-CH-Lifetime: <age> Examples Accept-CH: View
port-Width, DPR Accept-CH-Lifetime: 86400 ...
Accept-CH - HTTP
ient should include in subsequent requests. Header type Response header Forbidden header name ? Note: Client Hints are accessible only on secure origins (via TLS). Accept-CH and Accept-CH-Lifetime headers should be persisted for all secure requests to ensure Client Hints are sent reliably. Syntax Accept-CH: <list of client hints> Examples Accept-CH: DPR, View
port-Width Accept-CH: Width Accept-CH-Lifetime: 86400 Vary: DPR, View
port-Width, Width Note: Remember to vary the response based on the accepted client hints. ...
Accept-Charset - HTTP
ny character encoding from this request header, it can theoretically send back a 406 Not Acceptable error code. But for a better user experience, this is rarely done and the Accept-Charset header is ignored. In early versions of HTTP/1.1, a default character encoding was defined: ISO-8859-1. This is no longer recommended, and now each content-type may have its own default. UTF-8 is now well-sup
ported and the overwhelmingly preferred character encoding. To guarantee better privacy through less configuration-based entropy, all browsers omit the Accept-Charset header: Internet Explorer 8+, Safari 5+, Opera 11+, Firefox 10+ and Chrome 27+ no longer send it. Header type Request header Forbidden header name yes Syntax Accept-Charset: <charset> // Multiple types,...
Accept-Patch - HTTP
The Accept-Patch response HTTP header advertises which media-type the server is able to understand. Accept-Patch in response to any method means that PATCH is allowed on the resource identified by the Request-URI. Two common cases lead to this: A server receiving a PATCH request with an unsup
ported media type could reply with 415 Unsup
ported Media Type and an Accept-Patch header referencing one or more sup
ported media types. Notes: An IANA registry maintains a complete list of official content encodings. Two others content encoding, bzip and bzip2, are sometimes used, though not standard. They implement the algorithm used by these two UNIX programs. Note that the first one was discontinued due to patent licensing problems. Header type Response header For...
Access-Control-Allow-Origin - HTTP
rigin> Access-Control-Allow-Origin: null Directives * For requests without credentials, the literal value "*" can be specified, as a wildcard; the value tells browsers to allow requesting code from any origin to access the resource. Attempting to use the wildcard with credentials will result in an error. <origin> Specifies an origin. Only a single origin can be specified. If the server sup
ports clients from multiple origins, it must return the origin for the specific client making the request. null Specifies the origin "null". Note: null should not be used: "It may seem safe to return Access-Control-Allow-Origin: "null", but the serialization of the Origin of any resource that uses a non-hierarchical scheme (such as data: or file:) and sandboxed documents is defined to be "null". Ma...
Allow - HTTP
This header must be sent if the server responds with a 405 Method Not Allowed status code to indicate which request methods can be used. An empty Allow header indicates that the resource allows no request methods, which might occur temporarily for a given resource, for example. Header type Entity header Forbidden header name no Syntax Allow: <http-methods> Directives <http-methods> The comma-separated list of allowed HTTP request methods. ...
Alt-Svc - HTTP
The Alt-Svc HTTP response header is used to advertise alternative services through which the same resource can be reached. An alternative service is defined by a protocol/host/
port combination. Syntax Alt-Svc: clear Alt-Svc: <protocol-id>=<alt-authority>; ma=<max-age> Alt-Svc: <protocol-id>=<alt-authority>; ma=<max-age>; persist=1 clear The special value ''clear" indicates that the origin requests all alternatives for that origin to be invalidated. <protocol-id> The ALPN protocol identifier. Examples include h2 for HTTP/2 and h3-25 for draft 25 of the HTTP/3 protocol. <alt-authority> The quoted string specifying the alternative authority which consists of an optional host override, a colon, and a mandatory
port number. ma=<max-age>Optional The number of seconds for which the alter...
Cache-Control - HTTP
idate Cache-Control: no-cache Cache-Control: no-store Cache-Control: no-transform Cache-Control: public Cache-Control: private Cache-Control: proxy-revalidate Cache-Control: max-age=<seconds> Cache-Control: s-maxage=<seconds> Extension Cache-Control directives Extension Cache-Control directives are not part of the core HTTP caching standards document. Check the compatibility table for their sup
port; user-agents that don't recognize them should ignore them. Cache-Control: immutable Cache-Control: stale-while-revalidate=<seconds> Cache-Control: stale-if-error=<seconds> Directives Cacheability A response is normally cached by the browser if: it has a status code of 301, 302, 307, 308, or 410 and Cache-Control does not have no-store, or if proxy, does not have private and Authorizatio...
Content-Encoding - HTTP
compress Content-Encoding: deflate Content-Encoding: identity Content-Encoding: br // Multiple, in the order in which they were applied Content-Encoding: gzip, identity Content-Encoding: deflate, gzip Directives gzip A format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC. This is the original format of the UNIX gzip program. The HTTP/1.1 standard also recommends that the servers sup
porting this content-encoding should recognize x-gzip as an alias, for compatibility purposes. compress A format using the Lempel-Ziv-Welch (LZW) algorithm. The value name was taken from the UNIX compress program, which implemented this algorithm. Like the compress program, which has disappeared from most UNIX distributions, this content-encoding is not used by many browsers today, partly because of...
CSP: sandbox - HTTP
-Security-Policy (CSP) sandbox directive enables a sandbox for the requested resource similar to the <iframe> sandbox attribute. It applies restrictions to a page's actions including preventing popups, preventing the execution of plugins and scripts, and enforcing a same-origin policy. CSP version 1.1 / 2 Directive type Document directive This directive is not sup
ported in the <meta> element or by the Content-Security-policy-Re
port-Only header field. Syntax Content-Security-Policy: sandbox; Content-Security-Policy: sandbox <value>; where <value> can optionally be one of the following values: allow-downloads-without-user-activation Allows for downloads to occur without a gesture from the user. allow-forms Allows the page to submit forms. If...
Digest - HTTP
ssage body (for example, in a response to a HEAD request) partially contained in the message body (for example, in a response to a range request). Header type Response header Forbidden header name no Syntax Digest: <digest-algorithm>=<digest-value> Digest: <digest-algorithm>=<digest-value>,<digest-algorithm>=<digest-value> Directives <digest-algorithm> Sup
ported digest algorithms are defined in RFC 3230 and RFC 5843, and include SHA-256 and SHA-512. Some of the sup
ported algorithms, including unixsum and MD5 are subject to collisions and are thus not suitable for applications in which collision-resistance is im
portant. <digest-value> The result of applying the digest algorithm to the resource representation and encoding the result. The choice of dige...
Feature-Policy: xr-spatial-tracking - HTTP
The HTTP Feature-Policy header xr-spatial-tracking directive controls whether the current document is allowed to use the WebXR Device API. This policy controls whether navigator.xr.requestSession() can return XRSession that requires spatial tracking and whether user agent can indicate sup
port for sessions sup
porting spatial tracking via navigator.xr.isSessionSup
ported() and devicechange event on navigator.xr object. Syntax Feature-Policy: xr-spatial-tracking <allowlist>; <allowlist> An allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: The feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': The feature will be allowed in this document, and in all nested browsin...
Feature-Policy - HTTP
her the current document is allowed to use the Encrypted Media Extensions API (EME). When this policy is disabled, the Promise returned by Navigator.requestMediaKeySystemAccess() will reject with a DOMException. execution-while-not-rendered Controls whether tasks should execute in frames while they're not being rendered (e.g. if an iframe is hidden or display: none). execution-while-out-of-view
port Controls whether tasks should execute in frames while they're outside of the visible view
port. fullscreen Controls whether the current document is allowed to use Element.requestFullScreen(). When this policy is disabled, the returned Promise rejects with a TypeError. geolocation Controls whether the current document is allowed to use the Geolocation Interface. When this policy is disabled...
Host - HTTP
The Host request header specifies the host and
port number of the server to which the request is being sent. If no
port is included, the default
port for the service requested (e.g., 443 for an HTTPS URL, and 80 for an HTTP URL) is implied. A Host header field must be sent in all HTTP/1.1 request messages. A 400 (Bad Request) status code may be sent to any HTTP/1.1 request message that lacks a Host header field or that contains more than one. Header type Request header Forbidden header name yes Syntax Host: <host>:<
port> Directives <host> the domain name of the server (for virtual hosting). <
port> Optional TCP
port number on which the server is listening. Examples Host: developer.cdn.mozilla.net Specifications Specification Title ...
If-Modified-Since - HTTP
n last modified after the given date. If the request has not been modified since, the response will be a 304 without any body; the Last-Modified response header of a previous request will contain the date of last modification. Unlike If-Unmodified-Since, If-Modified-Since can only be used with a GET or HEAD. When used in combination with If-None-Match, it is ignored, unless the server doesn't sup
port If-None-Match. The most common use case is to update a cached entity that has no associated ETag. Header type Request header Forbidden header name no Syntax If-Modified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT Directives <day-name> One of "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", or "Sun" (case-sensitive). <day> 2 digit day num...
If-None-Match - HTTP
mparison with the stored ETag uses the weak comparison algorithm, meaning two files are considered identical if the content is equivalent -- they don't have to be identical byte for byte. For example, two pages that differ by the date of generation in the footer would still be considered as identical. When used in combination with If-Modified-Since, If-None-Match has precedence (if the server sup
ports it). There are two common use cases: For GET and HEAD methods, to update a cached entity that has an associated ETag. For other methods, and in particular for PUT, If-None-Match used with the * value can be used to save a file not known to exist, guaranteeing that another upload didn't happen before, losing the data of the previous put; this problem is a variation of the lost update problem...
Keep-Alive - HTTP
Directives parameters A comma-separated list of parameters, each consisting of an identifier and a value separated by the equal sign ('='). The following identifiers are possible: timeout: indicating the minimum amount of time an idle connection has to be kept opened (in seconds). Note that timeouts longer than the TCP timeout may be ignored if no keep-alive TCP message is set at the trans
port level. max: indicating the maximum number of requests that can be sent on this connection before closing it. Unless 0, this value is ignored for non-pipelined connections as another request will be sent in the next response. An HTTP pipeline can use it to limit the pipelining. Examples A response containing a Keep-Alive header: HTTP/1.1 200 OK Connection: Keep-Alive Content-Encoding: gz...
Origin - HTTP
ests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path. Note: The Origin header is not set on Fetch requests with a method of HEAD or GET (this behavior was corrected in Firefox 65 -- see bug 1508661). Header type Request header Forbidden header name yes Syntax Origin: null Origin: <scheme> "://" <hostname> [ ":" <
port> ] Directives <scheme> The protocol that is used. Usually it is the HTTP protocol or its secured version, HTTPS. <hostname> The domain name of the server (for virtual hosting) or the IP. <
port> Optional TCP
port number on which the server is listening. If no
port is given, the default
port for the service requested (e.g., "80" for an HTTP URL) is implied. Examples Origin: https://dev...
Referer - HTTP
The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example. Im
portant: Although this header has many innocent uses it can have undesirable consequences for user security and privacy. See Referer header: privacy and security concerns for more information and mitigations. Note that referer is actually a misspelling of the word "referrer". See HTTP referer on Wikipedia for more details. A Referer header is not sent by browsers if: The referring resource is a local "file" or "data" URI. An unsecured HTTP request is used and the referring page was recei...
Retry-After - HTTP
ponse header Forbidden header name no Syntax Retry-After: <http-date> Retry-After: <delay-seconds> Directives <http-date> A date after which to retry. See the Date header for more details on the HTTP date format. <delay-seconds> A non-negative decimal integer indicating the seconds to delay after the response is received. Examples Dealing with scheduled downtime Sup
port for the Retry-After header on both clients and servers is still inconsistent. However, some crawlers and spiders, like the Googlebot, honor the Retry-After header. It is useful to send it along with a 503 (Service Unavailable) response, so that search engines will keep indexing your site when the downtime is over. Retry-After: Wed, 21 Oct 2015 07:28:00 GMT Retry-After: 120 Specifications ...
Sec-Fetch-Dest - HTTP
idden header name yes, since it has prefix Sec- CORS-safelisted request header Syntax Sec-Fetch-Dest: audio Sec-Fetch-Dest: audioworklet Sec-Fetch-Dest: document Sec-Fetch-Dest: embed Sec-Fetch-Dest: empty Sec-Fetch-Dest: font Sec-Fetch-Dest: image Sec-Fetch-Dest: manifest Sec-Fetch-Dest: nested-document Sec-Fetch-Dest: object Sec-Fetch-Dest: paintworklet Sec-Fetch-Dest: re
port Sec-Fetch-Dest: script Sec-Fetch-Dest: serviceworker Sec-Fetch-Dest: sharedworker Sec-Fetch-Dest: style Sec-Fetch-Dest: track Sec-Fetch-Dest: video Sec-Fetch-Dest: worker Sec-Fetch-Dest: xslt Sec-Fetch-Dest: audioworklet Sec-Fetch-Dest: audioworklet Values audio audioworklet document embed empty font image manifest object paintworklet re
port script servic...
Timing-Allow-Origin - HTTP
Header type Response header Forbidden header name no Syntax Timing-Allow-Origin: * Timing-Allow-Origin: <origin>[, <origin>]* Directives * The server may specify "*" as a wildcard, thereby allowing any origin to see timing resources. <origin> Specifies a URI that may see the timing resources. You can specify multiple origins, separated by commas. ...
Upgrade-Insecure-Requests - HTTP
e-Requests request header sends a signal to the server expressing the client's preference for an encrypted and authenticated response, and that it can successfully handle the upgrade-insecure-requests CSP directive. Header type Request header Forbidden header name no Syntax Upgrade-Insecure-Requests: 1 Examples A client's request signals to the server that it sup
ports the upgrade mechanisms of upgrade-insecure-requests: GET / HTTP/1.1 Host: example.com Upgrade-Insecure-Requests: 1 The server can now redirect to a secure version of the site. A Vary header can be used so that the site isn't served by caches to clients that don't sup
port the upgrade mechanism. Location: https://example.com/ Vary: Upgrade-Insecure-Requests Specifications Specificati...
Upgrade - HTTP
For example, it can be used by a client to upgrade a connection from HTTP 1.1 to HTTP 2.0, or an HTTP or HTTPS connection into a WebSocket. HTTP/2 explicitly disallows the use of this mechanism/header; it is specific to HTTP/1.1. ...
Via - HTTP
orward and reverse proxies, and can appear in the request headers and the response headers. It is used for tracking message forwards, avoiding request loops, and identifying the protocol capabilities of senders along the request/response chain. Header type General header Forbidden header name yes Syntax Via: [ <protocol-name> "/" ] <protocol-version> <host> [ ":" <
port> ] or Via: [ <protocol-name> "/" ] <protocol-version> <pseudonym> Directives <protocol-name> Optional. The name of the protocol used, such as "HTTP". <protocol-version> The version of the protocol used, such as "1.1". <host> and <
port> Public proxy URL and
port. <pseudonym> Name/alias of an internal proxy. Examples Via: 1.1 vegur Via: HTTP/1.1 GWA Via: 1.0 fred, 1.1 p.example.net ...
X-DNS-Prefetch-Control - HTTP
rformed in the background, so that the DNS is likely to have been resolved by the time the referenced items are needed. This reduces latency when the user clicks a link. Header type Response header Forbidden header name no Syntax X-DNS-Prefetch-Control: on X-DNS-Prefetch-Control: off Directives on Enables DNS prefetching. This is what browsers do, if they sup
port the feature, when this header is not present off Disables DNS prefetching. This is useful if you don't control the link on the pages, or know that you don't want to leak information to these domains. Description DNS requests are very small in terms of bandwidth, but latency can be quite high, especially on mobile networks. By speculatively prefetching DNS results, latency can be reduced sign...
X-Forwarded-Host - HTTP
This header is used for debugging, statistics, and generating location-dependent content and by design it exposes privacy sensitive information, such as the IP address of the client. Therefore the user's privacy must be kept in mind when deploying this header. ...
OPTIONS - HTTP
od, or an asterisk (*) to refer to the entire server. ...
PATCH - HTTP
rd "idempotent" means that any number of repeated, identical requests will leave the resource in the same state. For example if an auto-incrementing counter field is an integral part of the resource, then a PUT will naturally overwrite it (since it overwrites everything), but not necessarily so for PATCH. PATCH (like PUT) may have side-effects on other resources. To find out whether a server sup
ports PATCH, a server can advertise its sup
port by adding it to the list in the Allow or Access-Control-Allow-Methods (for CORS) response headers. Another (implicit) indication that PATCH is allowed, is the presence of the Accept-Patch header, which specifies the patch document formats accepted by the server. Request has body Yes Successful response has body Yes Safe...
Proxy servers and tunneling - HTTP
itself (not about the client connecting to it), the Via header can be used. Via Added by proxies, both forward and reverse proxies, and can appear in the request headers and the response headers. HTTP tunneling Tunneling transmits private network data and protocol information through public network by encapsulating the data. HTTP tunneling is using a protocol of higher level (HTTP) to trans
port a lower level protocol (TCP). The HTTP protocol specifies a request method called CONNECT. It starts two-way communications with the requested resource and can be used to open a tunnel. This is how a client behind an HTTP proxy can access websites using SSL (i.e. HTTPS,
port 443). Note, however, that not all proxy servers sup
port the CONNECT method or limit it to
port 443 only. See also the HTT...
Redirections in HTTP - HTTP
this case, browsers will detect it and display an error message. Firefox displays: Firefox has detected that the server is redirecting the request for this address in a way that will never complete. ...while Chrome displays: This Webpage has a redirect loop In both cases, the user can't do much (unless a corruption is happening on their side, like a mismatch of cache or cookies). It is im
portant to avoid redirection loops, as they completely break the user experience. ...
405 Method Not Allowed - HTTP
The HyperText Transfer Protocol (HTTP) 405 Method Not Allowed response status code indicates that the request method is known by the server but is not sup
ported by the target resource. The server MUST generate an Allow header field in a 405 response containing a list of the target resource's currently sup
ported methods. Status 405 Method Not Allowed Specifications Specification Title RFC 7231, section 6.5.5: 405 Method Not Allowed Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content ...
422 Unprocessable Entity - HTTP
The HyperText Transfer Protocol (HTTP) 422 Unprocessable Entity response status code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions. Im
portant: The client should not repeat this request without modification. Status 422 Unprocessable Entity Specifications Specification Title RFC 4918, section 11.2: 422 Unprocessable Entity HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV) ...
451 Unavailable For Legal Reasons - HTTP
<p>This request may not be serviced in the Roman Province of Judea due to the Lex Julia Majestatis, which disallows access to resources hosted on servers deemed to be operated by the People's Front of Judea.</p> </body> </html> Specifications Specification Title RFC 7725: 451 Unavailable For Legal Reasons An HTTP Status Code to Re
port Legal Obstacles ...
501 Not Implemented - HTTP
The HyperText Transfer Protocol (HTTP) 501 Not Implemented server error response code means that the server does not sup
port the functionality required to fulfill the request. This status can also send a Retry-After header, telling the requester when to check back to see if the functionality is sup
ported by then. 501 is the appropriate response when the server does not recognize the request method and is incapable of sup
porting it for any resource. The only methods that servers are required to sup
port (and therefore that must not return 501) are GET and HEAD. If the server does recognize the method, but intentionally does not sup
port it, the appropriate response is 405 Method Not Allowed. A 501 error is not something you can fix, but requires a fix by the web server you are trying to a...
506 Variant Also Negotiates - HTTP
The HyperText Transfer Protocol (HTTP) 506 Variant Also Negotiates response status code may be given in the context of Transparent Content Negotiation (see RFC 2295). This protocol enables a client to retrieve the best variant of a given resource, where the server sup
ports multiple variants. The Variant Also Negotiates status code indicates an internal server configuration error in which the chosen variant is itself configured to engage in content negotiation, so is not a proper negotiation endpoint. Status 506 Variant Also Negotiates Specifications Specification Title RFC 2295, section 8.1: 506 Variant Also Negotiates Transparent Content Negotiation in HTTP ...
510 Not Extended - HTTP
The HyperText Transfer Protocol (HTTP) 510 Not Extended response status code is sent in the context of the HTTP Extension Framework, defined in RFC 2774. In that specification a client may send a request that contains an extension declaration, that describes the extension to be used. If the server receives such a request, but any described extensions are not sup
ported for the request, then the server responds with the 510 status code. Status 510 Not Extended Specifications Specification Title RFC 2774, section 7: 510 Not Extended An HTTP Extension Framework ...
511 Network Authentication Required - HTTP
hentication Required response status code indicates that the client needs to authenticate to gain network access. This status is not generated by origin servers, but by intercepting proxies that control access to the network. Network operators sometimes require some authentication, acceptance of terms, or other user interaction before granting access (for example in an internet cafe or at an air
port). They often identify clients who have not done so using their Media Access Control (MAC) addresses. Status 511 Network Authentication Required Specifications Specification Title RFC 6585, section 6: 511 Network Authentication Required Additional HTTP Status Codes ...
HTTP
n web browsers and web servers, but it can also be used for other purposes. HTTP follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. HTTP is a stateless protocol, meaning that the server does not keep any data (state) between two requests. Though often based on a TCP/IP layer, it can be used on any reliable trans
port layer, that is, a protocol that doesn't lose messages silently like UDP does. RUDP -- the reliable update of UDP -- is a suitable alternative. Tutorials Learn how to use HTTP with guides and tutorials. Overview of HTTP The basic features of the client-server protocol: what it can do and its intended uses. HTTP Cache Caching is very im
portant for fast Web sites. This article describes di...
CSS Houdini
ect Model with types and methods, exposing values as JavaScript objects making for more intuitive CSS manipulation than previous string based HTMLElement.style manipulations. Every element and style sheet rule has a style map which is accessible via its StylePropertyMap. A feature of CSS Houdini is the Worklet. With worklets, you can create modular CSS, requiring a single line of JavaScript to im
port configureable components: no pre-processors, post-processors or JavaScript frameworks needed. <script> CSS.paintWorklet.addModule('csscomponent.js'); </script> This added module contains registerPaint() functions, which register completely configurable worklets. The CSS paint() function parameters include the name of the worklet, along with optional parameters. The worklet also has access t...
Indexed collections - JavaScript
let arr = [42] // Creates an array with only one element: // the number 42. let arr = Array(42) // Creates an array with no elements // and arr.length set to 42. // // This is equivalent to: let arr = [] arr.length = 42 Calling Array(N) results in a RangeError, if N is a non-whole number whose fractional
portion is non-zero. The following example illustrates this behavior. let arr = Array(9.3) // RangeError: Invalid array length If your code needs to create arrays with single elements of an arbitrary data type, it is safer to use array literals. Alternatively, create an empty array first before adding the single element to it. In ES2015, you can use the Array.of static method to create arrays wi...
Keyed collections - JavaScript
ect, or to hide implementation details. The following example is from Nick Fitzgerald's blog post "Hiding Implementation Details with ECMAScript 6 WeakMaps". The private data and methods belong inside the object and are stored in the privates WeakMap object. Everything exposed on the instance and prototype is public; everything else is inaccessible from the outside world because privates is not ex
ported from the module. const privates = new WeakMap(); function Public() { const me = { // Private data goes here }; privates.set(this, me); } Public.prototype.method = function () { const me = privates.get(this); // Do stuff with private data in `me`... }; module.ex
ports = Public; Sets Set object Set objects are collections of values. You can iterate its elements in insertion or...
Numbers and dates - JavaScript
; // 2139095040 var FLT_MANTISSA = 0B00000000011111111111111111111111; // 8388607 Octal numbers Octal number syntax uses a leading zero. If the digits after the 0 are outside the range 0 through 7, the number will be interpreted as a decimal number. var n = 0755; // 493 var m = 0644; // 420 Strict mode in ECMAScript 5 forbids octal syntax. Octal syntax isn't part of ECMAScript 5, but it's sup
ported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%". In ECMAScript 2015, octal numbers are sup
ported if they are prefixed with 0o, e.g.: var a = 0o10; // ES2015: 8 Hexadecimal numbers Hexadecimal number syntax uses a leading zero followed by a lowercase or uppercase Latin letter "X" (0x or 0X). If the digits after 0x are outside the range (0123456789A...
Regular expression syntax cheatsheet - JavaScript
ing group: Matches x and remembers the match. For example, /(foo)/ matches and remembers "foo" in "foo bar". A regular expression may have multiple capturing groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes im
portant when capturing groups are nested. Matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). String.match() won't return groups if the /.../g flag is s...
Unicode property escapes - JavaScript
s or scripts), etc. Note: For Unicode property escapes to work, a regular expression must use the u flag which indicates a string must be considered as a series of Unicode code points. See also RegExp.prototype.unicode. Note: Some Unicode properties encompasses much more characters than some character classes (such as \w which matches only latin letters, a to z) but the latter is better sup
ported among browsers (as of January 2020). Syntax The following section is also duplicated on this cheatsheet. Do not forget to edit it as well, thanks! // Non-binary values \p{UnicodePropertyValue} \p{UnicodePropertyName=UnicodePropertyValue} // Binary and non-binary values \p{UnicodeBinaryPropertyName} // Negation: \P is negated \p \P{UnicodePropertyValue} \P{UnicodeBinaryPropertyName} Ge...
Working with objects - JavaScript
on howOldAmI (){ console.log('I am ' + this.age + ' years old.') } Manager.howOldAmI = howOldAmI; Manager.howOldAmI() // I am 27 years old. Defining getters and setters A getter is a method that gets the value of a specific property. A setter is a method that sets the value of a specific property. You can define getters and setters on any predefined core object or user-defined object that sup
ports the addition of new properties. Getters and setters can be either defined using object initializers, or added later to any object at any time using a getter or setter adding method. When defining getters and setters using object initializers all you need to do is to prefix a getter method with get and a setter method with set. Of course, the getter method must not expect a parameter, whi...
JavaScript Guide - JavaScript
Defining methods Getter and setter Details of the object model Prototype-based OOP Creating object hierarchies Inheritance Promises Guarantees Chaining Error propagation Composition Timing Iterators and generators Iterators Iterables Generators Meta programming Proxy Handlers and traps Revocable Proxy Reflect JavaScript modules Ex
porting Im
porting Default ex
ports Renaming features Aggregating modules Dynamic module loading Next >> ...
JavaScript technologies overview - JavaScript
umber, string, function, object, ...) The global object. In a browser, this global object is the window object, but ECMAScript only defines the APIs not specific to browsers, e.g. parseInt, parseFloat, decodeURI, encodeURI... A prototype-based inheritance mechanism Built-in objects and functions (JSON, Math, Array.prototype methods, Object introspection methods, etc.) Strict mode Browser sup
port As of October 2016, the current versions of the major Web browsers implement ECMAScript 5.1 and ECMAScript 2015, but older versions (still in use) implement ECMAScript 5 only. Future The major 6th Edition of ECMAScript was officially approved and published as a standard on June 17, 2015 by the ECMA General Assembly. Since then ECMAScript Editions are published on a yearly basis. International...
JavaScript language resources - JavaScript
2. ECMA-262 3rd Edition PDF December 1999 ECMAScript Language Specification. This is the third revision of the ECMAScript standard; corresponds to JavaScript 1.5. See also the errata ECMA-262 5th Edition PDF December 2009 ECMAScript Language Specification. This is the fifth revision of the ECMAScript standard. See also the ES5 errata and ECMAScript 5 sup
port in Mozilla ECMA-357 PDF June 2004 ECMAScript for XML (E4X). See also the E4X errata. ECMA-262 5.1 Edition PDF, HTML June 2011 This version is fully aligned with the 3rd edition of the international standard ISO/IEC 16262:2011. It includes ES5 errata fixes, no new features. ECMA-402 1st Edition PDF, HTML December 2012 ECMAScript Interna...
Public class fields - JavaScript
See the compat information below. Both static and instance public fields are writable, enumerable, and configurable properties. As such, unlike their private counterparts, they participate in prototype inheritance. ...
Warning: Date.prototype.toLocaleFormat is deprecated - JavaScript
n won't be halted. What went wrong? The non-standard Date.prototype.toLocaleFormat method is deprecated and shouldn't be used anymore. It uses a format string in the same format expected by the strftime() function in C. The function is no longer available in Firefox 58+. Examples Deprecated syntax The Date.prototype.toLocaleFormat method is deprecated and will be removed (no cross-browser sup
port, available in Firefox only). var today = new Date(); var date = today.toLocaleFormat('%A, %e. %B %Y'); console.log(date); // In German locale // "Freitag, 10. Marz 2017" Alternative standard syntax using the ECMAScript Intl API The ECMA-402 (ECMAScript Intl API) standard specifies standard objects and methods that enable language sensitive date and time formatting (available in Chrome 24+, Fi...
SyntaxError: illegal character - JavaScript
" occurs when there is an invalid or unexpected token that doesn't belong at this position in the code. Message SyntaxError: Invalid character (Edge) SyntaxError: illegal character (Firefox) SyntaxError: Invalid or unexpected token (Chrome) Error type SyntaxError What went wrong? There is an invalid or unexpected token that doesn't belong at this position in the code. Use an editor that sup
ports syntax highlighting and carefully check your code against mismatches like a minus sign ( - ) versus a dash ( - ) or simple quotes ( " ) vs non-standard quotation marks ( " ). Examples Mismatched characters Some characters look similar, but will cause the parser to fail interpreting your code. Famous examples of this are quotes, the minus or semicolon (greek questionmark (U+37e) looks same). ...
TypeError: "x" is not a constructor - JavaScript
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor, but that object or variable is not a constructor. Message TypeError: Object doesn't sup
port this action (Edge) TypeError: "x" is not a constructor TypeError: Math is not a constructor TypeError: JSON is not a constructor TypeError: Symbol is not a constructor TypeError: Reflect is not a constructor TypeError: Intl is not a constructor TypeError: Atomics is not a constructor Error type TypeError What went wrong? There was an attempt to use an object or a variable as a constructor, but that object or variable is not a constructor. See constructor or the new operator for more information on what a constructor is. There are many global objects, like String or ...
SyntaxError: "x" is a reserved identifier - JavaScript
r package = ["potatoes", "rice", "fries"]; // SyntaxError: package is a reserved identifier You'll need to rename these variables. var colorEnum = { RED: 0, GREEN: 1, BLUE: 2 }; var list = ["potatoes", "rice", "fries"]; Update older browsers If you are using an older browser that does not yet implement let or class, for example, you should update to a more recent browser version that does sup
port these new language features. "use strict"; class DocArchiver {} // SyntaxError: class is a reserved identifier // (throws in older browsers only, e.g. Firefox 44 and older) ...
JavaScript error reference - JavaScript
The pages below will provide additional details about these errors. Each error is an object based upon the Error object, and has a name and a message. Errors displayed in the Web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code. For a beginner's introductory tutorial on fixing JavaScript errors, see What went wrong? Troubleshooting JavaScript. ...
Arrow function expressions - JavaScript
onal when there's only one parameter name: (singleParam) => { statements } singleParam => { statements } // The parameter list for a function with no parameters should be written with a pair of parentheses. () => { statements } Advanced syntax // Parenthesize the body of a function to return an object literal expression: params => ({foo: bar}) // Rest parameters and default parameters are sup
ported (param1, param2, ...rest) => { statements } (param1 = defaultValue1, param2, ..., paramN = defaultValueN) => { statements } // Destructuring within the parameter list is also sup
ported var f = ([a, b] = [1, 2], {x: c} = {x: a + b}) => a + b + c; f(); // 6 Description See also "ES6 In Depth: Arrow functions" on hacks.mozilla.org. Two factors influenced the introduction of arrow functions: t...
Method definitions - JavaScript
ou try to instantiate them. const objA = { method() {} } new objA.method // TypeError: obj.method is not a constructor const objB = { * g() {} } new objB.g // TypeError: obj.g is not a constructor (changed in ES2016) Examples Simple test case const obj = { a: 'foo', b() { return this.a } }; console.log(obj.b()) // "foo" Computed property names The shorthand syntax also sup
ports computed property names. const bar = { foo0: function() { return 0 }, foo1() { return 1 }, ['foo' + 2]() { return 2 } } console.log(bar.foo0()) // 0 console.log(bar.foo1()) // 1 console.log(bar.foo2()) // 2 // A global function function foo() { return 1 } let name = 'foo' console.log(window[name]()) // 1 Specifications Specification ECMAScript (ECMA-262...
arguments[@@iterator]() - JavaScript
The initial value of the @@iterator property is the same function object as the initial value of the Array.prototype.values property. Syntax arguments[Symbol.iterator]() Examples Iteration using for...of loop function f() { // your browser must sup
port for..of loop // and let-scoped variables in for loops for (let letter of arguments) { console.log(letter); } } f('w', 'y', 'k', 'o', 'p'); Specifications Specification ECMAScript (ECMA-262)The definition of 'CreateUnmappedArgumentsObject' in that specification. ECMAScript (ECMA-262)The definition of 'CreateMappedArgumentsObject' in that specification. ...
AggregateError - JavaScript
Constructor AggregateError() Creates a new AggregateError object. Instance properties AggregateError.prototype.message Error message, defaults to "". AggregateError.prototype.name Error name, defaults to AggregateError. ...
Array.prototype.reduce() - JavaScript
Let kValue be ? Get(O, Pk). // ii. Let accumulator be ? Call( // callbackfn, undefined, // << accumulator, kValue, k, O >>). if (k in o) { value = callback(value, o[k], k, o); } // d. Increase k by 1. k++; } // 9. Return accumulator. return value; } }); } Caution: If you need to sup
port truly obsolete JavaScript engines that do not sup
port Object.defineProperty(), it is best not to polyfill Array.prototype methods at all, as you cannot make them non-enumerable. Examples Sum all the values of an array let sum = [0, 1, 2, 3].reduce(function (accumulator, currentValue) { return accumulator + currentValue }, 0) // sum is 6 Alternatively written with an arrow function: let ...
Array.prototype.reduceRight() - JavaScript
3, 4] 20 The value returned by reduceRight this time would be, of course, 20. Polyfill reduceRight was added to the ECMA-262 standard in the 5th edition; as such it may not be present in all implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of reduceRight in implementations which do not natively sup
port it. // Production steps of ECMA-262, Edition 5, 15.4.4.22 // Reference: http://es5.github.io/#x15.4.4.22 if ('function' !== typeof Array.prototype.reduceRight) { Array.prototype.reduceRight = function(callback /*, initialValue*/) { 'use strict'; if (null === this || 'undefined' === typeof this) { throw new TypeError('Array.prototype.reduce called on null or undefined'); } ...
Array.prototype.every() - JavaScript
returns true. (It is vacuously true that all elements of the empty set satisfy any given condition.) Polyfill every was added to the ECMA-262 standard in the 5th edition, and it may not be present in other implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of every in implementations which do not natively sup
port it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming Object and TypeError have their original values, and that callbackfn.call evaluates to the original value of Function.prototype.call. if (!Array.prototype.every) { Array.prototype.every = function(callbackfn, thisArg) { 'use strict'; var T, k; if (this == null) { throw new TypeError('this is ...
Array.prototype.fill() - JavaScript
0. var end = arguments[2]; var relativeEnd = end === undefined ? len : end >> 0; // Step 11. var finalValue = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len); // Step 12. while (k < finalValue) { O[k] = value; k++; } // Step 13. return O; } }); } If you need to sup
port truly obsolete JavaScript engines that don't sup
port Object.defineProperty, it's best not to polyfill Array.prototype methods at all, as you can't make them non-enumerable. Examples Using fill [1, 2, 3].fill(4) // [4, 4, 4] [1, 2, 3].fill(4, 1) // [1, 4, 4] [1, 2, 3].fill(4, 1, 2) // [1, 4, 3] [1, 2, 3].fill(4, 1, 1) // [1, 2, 3] [1, 2, 3].fill(4, ...
Array.prototype.filter() - JavaScript
sting elements of the array are deleted in the same way they will not be visited. Polyfill filter() was added to the ECMA-262 standard in the 5th edition. Therefore, it may not be present in all implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of filter() in ECMA-262 implementations which do not natively sup
port it. This algorithm is exactly equivalent to the one specified in ECMA-262, 5th edition, assuming that fn.call evaluates to the original value of Function.prototype.bind(), and that Array.prototype.push() has its original value. if (!Array.prototype.filter){ Array.prototype.filter = function(func, thisArg) { 'use strict'; if ( ! ((typeof func === 'Function' || typeof func === 'function'...
Array.prototype.find() - JavaScript
lean(? Call(predicate, T, << kValue, k, O >>)). // d. If testResult is true, return kValue. var kValue = o[k]; if (predicate.call(thisArg, kValue, k, o)) { return kValue; } // e. Increase k by 1. k++; } // 7. Return undefined. return undefined; }, configurable: true, writable: true }); } If you need to sup
port truly obsolete JavaScript engines that don't sup
port Object.defineProperty, it is best not to polyfill Array.prototype at all, as you cannot make it non-enumerable. Examples Find an object in an array by one of its properties const inventory = [ {name: 'apples', quantity: 2}, {name: 'bananas', quantity: 0}, {name: 'cherries', quantity: 5} ]; function isCherries(fruit) { return fruit.n...
Array.prototype.findIndex() - JavaScript
Let testResult be ToBoolean(? Call(predicate, T, << kValue, k, O >>)). // d. If testResult is true, return k. var kValue = o[k]; if (predicate.call(thisArg, kValue, k, o)) { return k; } // e. Increase k by 1. k++; } // 7. Return -1. return -1; }, configurable: true, writable: true }); } If you need to sup
port truly obsolete JavaScript engines that do not sup
port Object.defineProperty, it is best not to polyfill Array.prototype methods at all, as you cannot make them non-enumerable. Examples Find the index of a prime number in an array The following example returns the index of the first element in the array that is a prime number, or -1 if there is no prime number. function isPrime(num) { for (l...
Array.prototype.indexOf() - JavaScript
method used by the === or triple-equals operator). Note: For the String method, see String.prototype.indexOf(). Polyfill indexOf() was added to the ECMA-262 standard in the 5th edition; as such it may not be present in all browsers. You can work around this by utilizing the following code at the beginning of your scripts. This will allow you to use indexOf() when there is still no native sup
port. This algorithm matches the one specified in ECMA-262, 5th edition, assuming TypeError and Math.abs() have their original values. // This version tries to optimize by only checking for "in" when looking for undefined and // skipping the definitely fruitless NaN search. Other parts are merely cosmetic conciseness. // Whether it is actually faster remains to be seen. if (!Array.prototype.indexOf) ...
Array.prototype.lastIndexOf() - JavaScript
using strict equality (the same method used by the ===, or triple-equals, operator). Polyfill lastIndexOf was added to the ECMA-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of lastIndexOf in implementations which do not natively sup
port it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming Object, TypeError, Number, Math.floor, Math.abs, and Math.min have their original values. // Production steps of ECMA-262, Edition 5, 15.4.4.15 // Reference: http://es5.github.io/#x15.4.4.15 if (!Array.prototype.lastIndexOf) { Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) { 'use stric...
Array.prototype.push() - JavaScript
ted into a number, the index used is 0. This includes the possibility of length being nonexistent, in which case length will also be created. Although strings are native, Array-like objects, they are not suitable in applications of this method, as strings are immutable. Similarly for the native, Array-like object arguments. Examples Adding elements to an array The following code creates the s
ports array containing two elements, then appends two elements to it. The total variable contains the new length of the array. let s
ports = ['soccer', 'baseball'] let total = s
ports.push('football', 'swimming') console.log(s
ports) // ['soccer', 'baseball', 'football', 'swimming'] console.log(total) // 4 Merging two arrays This example uses apply() to push all elements from a second array. Do ...
Array.prototype.some() - JavaScript
ed are not visited. Caution: Calling this method on an empty array returns false for any condition! Polyfill some() was added to the ECMA-262 standard in the 5th edition, and it may not be present in all implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of some() in implementations which do not natively sup
port it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming Object and TypeError have their original values and that fun.call evaluates to the original value of Function.prototype.call(). // Production steps of ECMA-262, Edition 5, 15.4.4.17 // Reference: http://es5.github.io/#x15.4.4.17 if (!Array.prototype.some) { Array.prototype.some = function(fun, thisArg) { 'u...
Array.prototype.toLocaleString() - JavaScript
// << locales, options >> // ) // ) r = nextElement == null ? '' : nextElement.toLocaleString(locales, options); // e. Let R be a String value produced by // concatenating S and R. r = s + r; // f. Increase k by 1. k++; } // 10. Return R. return r; } }); } If you need to sup
port truly obsolete JavaScript engines that don't sup
port Object.defineProperty, it's best not to polyfill Array.prototype methods at all, as you can't make them non-enumerable. Examples Using locales and options The elements of the array are converted to strings using their toLocaleString methods. Object: Object.prototype.toLocaleString() Number: Number.prototype.toLocaleString() Date: Date.
BigInt.prototype.toLocaleString() - JavaScript
.toLocaleString('ar-EG')); // -> ??????????????????????? // India uses thousands/lakh/crore separators console.log(bigint.toLocaleString('en-IN')); // -> 1,23,45,67,89,12,34,56,789 // the nu extension key requests a numbering system, e.g. ...
DataView - JavaScript
of the executing computer's endianness. var littleEndian = (function() { var buffer = new ArrayBuffer(2); new DataView(buffer).setInt16(0, 256, true /* littleEndian */); // Int16Array uses the platform's endianness. return new Int16Array(buffer)[0] === 256; })(); console.log(littleEndian); // true or false 64-bit Integer Values Because JavaScript does not currently include standard sup
port for 64-bit integer values, DataView does not offer native 64-bit operations. As a workaround, you could implement your own getUint64() function to obtain a value with precision up to Number.MAX_SAFE_INTEGER, which could suffice for certain cases. function getUint64(dataview, byteOffset, littleEndian) { // split 64-bit number into two 32-bit (4-byte) parts const left = dataview.getUint32(byt...
Date() constructor - JavaScript
ateString A string value representing a date, specified in a format recognized by the Date.parse() method. (These formats are IETF-compliant RFC 2822 timestamps, and also strings in a version of ISO8601.) Note: Parsing of date strings with the Date constructor (and Date.parse(), which works the same way) is strongly discouraged due to browser differences and inconsistencies. Sup
port for RFC 2822 format strings is by convention only. Sup
port for ISO 8601 formats differs in that date-only strings (e.g. "1970-01-01") are treated as UTC, not local. Individual date and time component values Given at least a year and month, this form of Date() returns a Date object whose component values (year, month, day, hour, minute, second, and millisecond) all come...
Date.prototype.getMilliseconds() - JavaScript
b repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.getMilliseconds() Return value A number, between 0 and 999, representing the milliseconds for the given date according to local time. Examples Using getMilliseconds() The following example assigns the milliseconds
portion of the current time to the variable milliseconds: var today = new Date(); var milliseconds = today.getMilliseconds(); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.getMilliseconds' in that specification. ...
Date.prototype.getUTCDate() - JavaScript
The getUTCDate() method returns the day (date) of the month in the specified date according to universal time. Syntax dateObj.getUTCDate() Return value An integer number, between 1 and 31, representing the day of the month in the given date according to universal time. Examples Using getUTCDate() The following example assigns the day
portion of the current date to the variable day. var today = new Date(); var day = today.getUTCDate(); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.getUTCDate' in that specification. ...
Date.prototype.getUTCDay() - JavaScript
ute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.getUTCDay() Return value An integer number corresponding to the day of the week for the given date, according to universal time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on. Examples Using getUTCDay() The following example assigns the weekday
portion of the current date to the variable weekday. var today = new Date(); var weekday = today.getUTCDay(); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.getUTCDay' in that specification. ...
Date.prototype.getUTCHours() - JavaScript
in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.getUTCHours() Return value An integer number, between 0 and 23, representing the hours in the given date according to universal time. Examples Using getUTCHours() The following example assigns the hours
portion of the current time to the variable hours. var today = new Date(); var hours = today.getUTCHours(); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.getUTCHours' in that specification. ...
Date.prototype.getUTCMilliseconds() - JavaScript
The getUTCMilliseconds() method returns the milliseconds
portion of the time object's value. Syntax dateObj.getUTCMilliseconds() Return value An integer number, between 0 and 999, representing the milliseconds
portion of the given date object. This method is a companion to the other UTC based methods that give hour
portion, minute
portion, etc.; this method gives milliseconds
portion. Not to be confused with Unix epoch time. To get total milliseconds since 1970/01/01, use the method ".getTime()". Examples Using getUTCMilliseconds() The following example assigns the milliseconds
portion of the current time to the variable milliseconds. var today = new Date(); var milliseconds = today.getUTCMilliseconds(); Specifications Specification ECMAScript (ECMA-262)The...
Date.prototype.getUTCMinutes() - JavaScript
The getUTCMinutes() method returns the minutes in the specified date according to universal time. Syntax dateObj.getUTCMinutes() Return value An integer number, between 0 and 59, representing the minutes in the given date according to universal time. Examples Using getUTCMinutes() The following example assigns the minutes
portion of the current time to the variable minutes. var today = new Date(); var minutes = today.getUTCMinutes(); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.getUTCMinutes' in that specification. ...
Date.prototype.getUTCMonth() - JavaScript
interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.getUTCMonth() Return value An integer number, between 0 and 11, corresponding to the month of the given date according to universal time. 0 for January, 1 for February, 2 for March, and so on. Examples Using getUTCMonth() The following example assigns the month
portion of the current date to the variable month. var today = new Date(); var month = today.getUTCMonth(); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.getUTCMonth' in that specification. ...
Date.prototype.getUTCSeconds() - JavaScript
The getUTCSeconds() method returns the seconds in the specified date according to universal time. Syntax dateObj.getUTCSeconds() Return value An integer number, between 0 and 59, representing the seconds in the given date according to universal time. Examples Using getUTCSeconds() The following example assigns the seconds
portion of the current time to the variable seconds. var today = new Date(); var seconds = today.getUTCSeconds(); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.getUTCSeconds' in that specification. ...
Date.now() - JavaScript
The static Date.now() method returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. Syntax var timeInMs = Date.now(); Return value A Number representing the milliseconds elapsed since the UNIX epoch. Polyfill This method was standardized in ECMA-262 5th edition. Engines which have not been updated to sup
port this method can work around the absence of this method using the following shim: if (!Date.now) { Date.now = function now() { return new Date().getTime(); }; } Examples Reduced time precision To offer protection against timing attacks and fingerprinting, the precision of Date.now() might get rounded depending on browser settings. In Firefox, the privacy.reduceTimerPrecision preference is enabled by default and defaults to 20us in Firefox 59;...
Date.parse() - JavaScript
ss implementations. Given a non-standard date string of "March 7, 2014", parse() assumes a local time zone, but given a simplification of the ISO 8601 calendar date extended format such as "2014-03-07", it will assume a time zone of UTC (ES5 and ECMAScript 2015). Therefore Date objects produced using those strings may represent different moments in time depending on the version of ECMAScript sup
ported unless the system is set with a local time zone of UTC. This means that two date strings that appear equivalent may result in two different values depending on the format of the string that is being converted. Examples Using Date.parse() The following calls all return 1546300800000. The first according to ES5 will imply UTC time, and the others are specifying UTC timezone via the ISO date sp...
Date.prototype.toISOString() - JavaScript
itory. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.toISOString() Return value A string representing the given date in the ISO 8601 format according to universal time. Polyfill This method was standardized in ECMA-262 5th edition. ...
Error.prototype.lineNumber - JavaScript
he line number in the file that raised this error. Examples Using lineNumber var e = new Error('Could not parse input'); throw e; console.log(e.lineNumber) // 2 Alternative example using error event window.addEventListener('error', function(e) { console.log(e.lineNumber); // 5 }); var e = new Error('Could not parse input'); throw e; This is not a standard feature and lacks widespread sup
port. See the browser compatability table below. Specifications Not part of any standard. ...
FinalizationRegistry.prototype.register() - JavaScript
cannot be the target object. unregisterToken Optional A token that may be used with the unregister method later to unregister the target object. If provided (and not undefined), this must be an object. If not provided, the target cannot be unregistered. Return value undefined. Notes See the Avoid where possible and Notes on cleanup callbacks sections of the FinalizationRegistry page for im
portant caveats. Examples Using register The following registers the target object referenced by target, passing in the held value "some value" and passing the target object itself as the unregistration token: registry.register(target, "some value", target); The following registers the target object referenced by target, passing in another object as the held value, and not passing in any unregis...
FinalizationRegistry - JavaScript
ct. Instance methods FinalizationRegistry.prototype.register() Registers an object with the registry in order to get a cleanup callback when/if the object is garbage-collected. FinalizationRegistry.prototype.unregister() Unregisters an object from the registry. Avoid where possible Correct use of FinalizationRegistry takes careful thought, and it's best avoided if possible. It's also im
portant to avoid relying on any specific behaviors not guaranteed by the specification. When, how, and whether garbage collection occurs is down to the implementation of any given JavaScript engine. Any behavior you observe in one engine may be different in another engine, in another version of the same engine, or even in a slightly different situation with the same version of the same engine. Garbage...
Function.prototype.apply() - JavaScript
ar outcome can be achieved using the array spread syntax. You can assign a different this object when calling an existing function. this refers to the current object (the calling object). With apply, you can write a method once, and then inherit it in another object, without having to rewrite the method for the new object. apply is very similar to call(), except for the type of arguments it sup
ports. You use an arguments array instead of a list of arguments (parameters). With apply, you can also use an array literal, for example, func.apply(this, ['eat', 'bananas']), or an Array object, for example, func.apply(this, new Array('eat', 'bananas')). You can also use arguments for the argsArray parameter. arguments is a local variable of a function. It can be used for all unspecified arguments ...
Intl.Collator() constructor - JavaScript
ld be ignored. Possible values are true and false; the default is false. numeric Whether numeric collation should be used, such that "1" < "2" < "10". Possible values are true and false; the default is false. This option can be set through an options property or through a Unicode extension key; if both are provided, the options property takes precedence. Implementations are not required to sup
port this property. caseFirst Whether upper case or lower case should sort first. Possible values are "upper", "lower", or "false" (use the locale's default); the default is "false". This option can be set through an options property or through a Unicode extension key; if both are provided, the options property takes precedence. Implementations are not required to sup
port this property. Exam...
Intl.Collator - JavaScript
The Intl.Collator objects enable language sensitive string comparison. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.Collator() Creates a new Collator object. Static methods Intl.Collator.sup
portedLocalesOf() Returns an array containing those of the provided locales that are sup
ported without having to fall back to the runtime's default locale. Instance methods Intl.Collator.prototype.compare Getter function that compares two strings according to the sort order of this Intl.Collator object. Intl.Collator.prototype.resolvedOptions() Returns a new object with properties reflecting ...
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
ocale and date and time formatting options computed during the initialization of the given DateTimeFormat object. Description The resulting object has the following properties: locale The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are sup
ported for this locale are included in locale. calendar E.g. "gregory" numberingSystem The values requested using the Unicode extension keys "ca" and "nu" or filled in as default values. timeZone The value provided for this property in the options argument; undefined (representing the runtime's default time zone) if none was provided. Warning: Applications should not rely on undefined being retu...
Intl.DisplayNames.prototype.resolvedOptions() - JavaScript
ale and formatting options computed during the construction of the given DisplayNames object. Description The object returned by resolvedOptions() has the following properties: locale The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are sup
ported for this locale are included in locale. style The value provided for this property in the options argument of the constructor or the default value ("long"). Its value is either "long", "short", or "narrow". type The value provided for this property in the options argument of the constructor or the default value ("language"). Its value is either "language", "region", "script", or "currency".
Intl.DisplayNames - JavaScript
nslation of language, region and script display names. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.DisplayNames() Creates a new Intl.DisplayNames object. Static methods Intl.DisplayNames.sup
portedLocalesOf() Returns an array containing those of the provided locales that are sup
ported without having to fall back to the runtime's default locale. Instance methods Intl.DisplayNames.prototype.of() This method receives a code and returns a string based on the locale and options provided when instantiating Intl.DisplayNames. Intl.DisplayNames.prototype.resolvedOptions() Returns a new o...
Intl​.List​Format​.prototype​.resolvedOptions() - JavaScript
ocale and formatting options computed during the construction of the given ListFormat object. Description The object returned by resolvedOptions() has the following properties: locale The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are sup
ported for this locale are included in locale. style The value provided for this property in the options argument of the constructor or the default value ("long"). Its value is either "long", "short", or "narrow". type The value provided for this property in the options argument of the constructor or the default value ("conjunction"). Its value is either "conjunction", "disjunction", or "unit". ...
Intl.ListFormat - JavaScript
uctor for objects that enable language-sensitive list formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.ListFormat() Creates a new ListFormat object. Static methods Intl.ListFormat.sup
portedLocalesOf() Returns an array containing those of the provided locales that are sup
ported without having to fall back to the runtime's default locale. Instance methods Intl.ListFormat.prototype.format() Returns a language-specific formatted string representing the elements of the list. Intl.ListFormat.prototype.formatToParts() Returns an array of objects representing the different compon...
Intl.Locale.prototype.script - JavaScript
ndicates the set of symbols, or glyphs, that are used to write a particular language. For instance, the script associated with English is Latin, whereas the script typically associated with Korean is Hangul. In many cases, denoting a script is not strictly necessary, since the language (which is necessary) is only written in a single script. There are exceptions to this rule, however, and it is im
portant to indicate the script whenever possible, in order to have a complete Unicode language identifier. Examples Setting the script in the locale identifer string argument The script is the second part of a valid Unicode language identifier string, and can be set by adding it to the locale identifier string that is passed into the Locale constructor. Note that the script is not a required part o...
Intl.NumberFormat.prototype.resolvedOptions() - JavaScript
ing the locale and number formatting options computed during the initialization of the given NumberFormat object. Description The resulting object has the following properties: locale The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are sup
ported for this locale are included in locale. numberingSystem The value provided for this properties in the options argument, if present, or the value requested using the Unicode extension key "nu" or filled in as a default. notation The value provided for this property in the options argument, if present, or "standard filled in as a default. compactDisplay The value provided for this property ...
Intl.PluralRules.prototype.resolvedOptions() - JavaScript
ting the locale and plural formatting options computed during the initialization of the given PluralRules object. Description The resulting object has the following properties: locale The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are sup
ported for this locale are included in locale. pluralCategories An Array of plural categories used by the given locale, seleced from the list "zero", "one", "two", "few", "many" and "other". type The type used (cardinal or ordinal). Only one of the following two groups of properties is included: minimumIntegerDigits minimumFractionDigits maximumFractionDigits The values provided for these ...
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
e locale and number formatting options computed during the initialization of the given RelativeTimeFormat object. Description The resulting object has the following properties: locale The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are sup
ported for this locale are included in locale. style The length of the internationalized message. Possible values are: "long" (default, e.g., in 1 month) "short" (e.g., in 1 mo.), or "narrow" (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales. numeric The format of output message. Possible values are: "always" (default, e.g., 1 day ago), or "a...
Intl.RelativeTimeFormat - JavaScript
time formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.RelativeTimeFormat.RelativeTimeFormat() Creates a new Intl.RelativeTimeFormat object. Static methods Intl.RelativeTimeFormat.sup
portedLocalesOf() Returns an array containing those of the provided locales that are sup
ported without having to fall back to the runtime's default locale. Instance methods Intl.RelativeTimeFormat.prototype.format() Formats a value and a unit according to the locale and formatting options of the given Intl.RelativeTimeFormat object. Intl.RelativeTimeFormat.prototype.formatToParts() Returns an...
Math.fround() - JavaScript
it of the mantissa, and sets all following mantissa bits to 0. If the number is outside the range of a 32-bit float, Infinity or -Infinity is returned. Because fround() is a static method of Math, you always use it as Math.fround(), rather than as a method of a Math object you created (Math is not a constructor). Polyfill This can be emulated with the following function, if Float32Array are sup
ported: Math.fround = Math.fround || (function (array) { return function(x) { return array[0] = x, array[0]; }; })(new Float32Array(1)); Sup
porting older browsers is slower, but also possible: if (!Math.fround) Math.fround = function(arg) { arg = Number(arg); // Return early for +-0 and NaN. if (!arg) return arg; var sign = arg < 0 ? -1 : 1; if (sign < 0) arg = -arg; // Compute...
Math.round() - JavaScript
st integer. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Math.round(x) Parameters x A number. Return value The value of the given number rounded to the nearest integer. Description If the fractional
portion of the argument is greater than 0.5, the argument is rounded to the integer with the next higher absolute value. If it is less than 0.5, the argument is rounded to the integer with the lower absolute value. If the fractional
portion is exactly 0.5, the argument is rounded to the next integer in the direction of +?. Note that this differs from many languages' round() functions, which often ro...
Math - JavaScript
er x rounded to the nearest integer. Math.sign(x) Returns the sign of the x, indicating whether x is positive, negative, or zero. Math.sin(x) Returns the sine of x. Math.sinh(x) Returns the hyperbolic sine of x. Math.sqrt(x) Returns the positive square root of x. Math.tan(x) Returns the tangent of x. Math.tanh(x) Returns the hyperbolic tangent of x. Math.trunc(x) Returns the integer
portion of x, removing any fractional digits. Examples Converting between degrees and radians The trigonometric functions sin(), cos(), tan(), asin(), acos(), atan(), and atan2() expect (and return) angles in radians. Since humans tend to think in degrees, and some functions (such as CSS transforms) can accept degrees, it is a good idea to keep functions handy that convert between the two: funct...
Number.prototype.toExponential() - JavaScript
digits as necessary to specify the number. Return value A string representing the given Number object in exponential notation with one digit before the decimal point, rounded to fractionDigits digits after the decimal point. Exceptions RangeError If fractionDigits is too small or too large. Values between 0 and 20, inclusive, will not cause a RangeError. Implementations are allowed to sup
port larger and smaller values as well. TypeError If this method is invoked on an object that is not a Number. Description If the fractionDigits argument is omitted, the number of digits after the decimal point defaults to the number of digits necessary to represent the value uniquely. If you use the toExponential() method for a numeric literal and the numeric literal has no exponent and no deci...
Number.prototype.toFixed() - JavaScript
xample is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax numObj.toFixed([digits]) Parameters digits Optional The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally sup
port a larger range of values. If this argument is omitted, it is treated as 0. Return value A string representing the given number using fixed-point notation. Exceptions RangeError If digits is too small or too large. Values between 0 and 100, inclusive, will not cause a RangeError. Implementations are allowed to sup
port larger and smaller values as chosen. TypeError If this method is invok...
Number.prototype.toPrecision() - JavaScript
n the description of the Number.prototype.toFixed() method, which also applies to toPrecision(). If the precision argument is omitted, behaves as Number.prototype.toString(). If the precision argument is a non-integer value, it is rounded to the nearest integer. Exceptions RangeError If precision is not between 1 and 100 (inclusive), a RangeError is thrown. Implementations are allowed to sup
port larger and smaller values as well. ECMA-262 only requires a precision of up to 21 significant digits. Examples Using toPrecision let numObj = 5.123456 console.log(numObj.toPrecision()) // logs '5.123456' console.log(numObj.toPrecision(5)) // logs '5.1235' console.log(numObj.toPrecision(2)) // logs '5.1' console.log(numObj.toPrecision(1)) // logs '5' numObj = 0.000123 console.log(n...
Object.assign() - JavaScript
bject.getOwnPropertyDescriptor() and Object.defineProperty() instead. Both String and Symbol properties are copied. In case of an error, for example if a property is non-writable, a TypeError is raised, and the target object is changed if any properties are added before the error is raised. Note: Object.assign() does not throw on null or undefined sources. ...
Object.defineProperty() - JavaScript
12 }); // throws a TypeError // ('value' can be changed when 'configurable' is false but not in this case due to 'get' accessor) console.log(o.a); // logs 1 delete o.a; // Nothing happens console.log(o.a); // logs 1 If the configurable attribute of o.a had been true, none of the errors would be thrown and the property would be deleted at the end. Adding properties and default values It is im
portant to consider the way default values of attributes are applied. There is often a difference between simply using dot notation to assign a value and using Object.defineProperty(), as shown in the example below. var o = {}; o.a = 1; // is equivalent to: Object.defineProperty(o, 'a', { value: 1, writable: true, configurable: true, enumerable: true }); // On the other hand, Object.defineP...
Object.isExtensible() - JavaScript
ctive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Object.isExtensible(obj) Parameters obj The object which should be checked. Return value A Boolean indicating whether or not the given object is extensible. Description Objects are extensible by default: they can have new properties added to them, and (in engines that sup
port __proto__) their __proto__ property can be modified. An object can be marked as non-extensible using Object.preventExtensions(), Object.seal(), or Object.freeze(). Examples Using Object.isExtensible // New objects are extensible. var empty = {}; Object.isExtensible(empty); // === true // ...but that can be changed. Object.preventExtensions(empty); Object.isExtensible(empty); // === false // ...
Object.values() - JavaScript
rty values are to be returned. Return value An array containing the given object's own enumerable property values. Description Object.values() returns an array whose elements are the enumerable property values found on the object. The ordering of the properties is the same as that given by looping over the property values of the object manually. Polyfill To add compatible Object.values sup
port in older environments that do not natively sup
port it, you can find a Polyfill in the tc39/proposal-object-values-entries or in the es-shims/Object.values repositories. Examples Using Object.values const obj = { foo: 'bar', baz: 42 }; console.log(Object.values(obj)); // ['bar', 42] // Array-like object const arrayLikeObj1 = { 0: 'a', 1: 'b', 2: 'c' }; console.log(Object.values(arrayLikeObj1 )...
Promise.any() - JavaScript
single promise that resolves with the value from that promise. If no promises in the iterable fulfil (if all of the given promises are rejected), then the returned promise is rejected with an AggregateError, a new subclass of Error that groups together individual errors. Essentially, this method is the opposite of Promise.all(). Warning! The Promise.any() method is experimental and not fully sup
ported by all browsers and platforms. It is currently in stage 4 of the TC39 process. Syntax Promise.any(iterable); Parameters iterable An iterable object, such as an Array. Return value An already resolved Promise if the iterable passed is empty. An asynchronously resolved Promise if the iterable passed contains no promises. A pending Promise in all other cases. This returned promise...
handler.get() - JavaScript
alue The get() method can return any value. Description The handler.get() method is a trap for getting a property value. Interceptions This trap can intercept these operations: Property access: proxy[foo]and proxy.bar Inherited property access: Object.create(proxy)[foo] Reflect.get() Invariants If the following invariants are violated, the proxy will throw a TypeError: The value re
ported for a property must be the same as the value of the corresponding target object property if the target object property is a non-writable, non-configurable own data property. The value re
ported for a property must be undefined if the corresponding target object property is a non-configurable own accessor property that has undefined as its [[Get]] attribute. Examples Trap for getting a proper...
handler.has() - JavaScript
a boolean value. Description The handler.has() method is a trap for the in operator. Interceptions This trap can intercept these operations: Property query: foo in proxy Inherited property query: foo in Object.create(proxy) with check: with(proxy) { (foo); } Reflect.has() Invariants If the following invariants are violated, the proxy will throw a TypeError: A property cannot be re
ported as non-existent, if it exists as a non-configurable own property of the target object. A property cannot be re
ported as non-existent, if it exists as an own property of the target object and the target object is not extensible. Examples Trapping the in operator The following code traps the in operator. const p = new Proxy({}, { has: function(target, prop) { console.log('called: ' + ...
Reflect.construct() - JavaScript
When using Object.create() and Function.prototype.apply(), the new.target operator will point to undefined within the function used as the constructor, since the new keyword is not being used to create the object. When invoking Reflect.construct(), on the other hand, the new.target operator will point to the newTarget parameter if supplied, or target if not. functi...
RegExp.prototype[@@replace]() - JavaScript
repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax regexp[Symbol.replace](str, newSubStr|function) Parameters str A String that is a target of the replacement. newSubStr (replacement) The String that replaces the substring. A number of special replacement patterns are sup
ported; see the Specifying a string as a parameter section in String.prototype.replace() page. function (replacement) A function to be invoked to create the new substring. The arguments supplied to this function are described in the Specifying a function as a parameter section in String.prototype.replace() page. Return value A new string with some or all matches of a pattern replaced by a replace...
String.prototype.charAt() - JavaScript
ogate without preceding high surrogate' } let prev = str.charCodeAt(i - 1) // (could change last hex to 0xDB7F to treat high private surrogates // as single characters) if (0xD800 > prev || prev > 0xDBFF) { throw 'Low surrogate without preceding high surrogate' } // Return the next character instead (and increment) return [str.charAt(i + 1), i + 1] } Fixing charAt() to sup
port non-Basic-Multilingual-Plane (BMP) characters While the previous example may be more useful for programs that must sup
port non-BMP characters (since it does not require the caller to know where any non-BMP character might appear), in the event that one does wish, in choosing a character by index, to treat the surrogate pairs within a string as the single characters they represent, one can use th...
String.prototype.match() - JavaScript
e returned, each its own element in the array. const str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; const regexp = /[A-E]/gi; const matches_array = str.match(regexp); console.log(matches_array); // ['A', 'B', 'C', 'D', 'E', 'a', 'b', 'c', 'd', 'e'] Note: See also String.prototype.matchAll() and Advanced searching with flags. Using named capturing groups In browsers which sup
port named capturing groups, the following code captures "fox" or "cat" into a group named "animal": const paragraph = 'The quick brown fox jumps over the lazy dog. It barked.'; const capturingRegex = /(?<animal>fox|cat) jumps over/; const found = paragraph.match(capturingRegex); console.log(found.groups); // {animal: "fox"} Using match() with no parameter const str = "Nothing will come of nothin...
String.prototype.normalize() - JavaScript
In the example above the normalization is appropriate for search, because it enables a user to find the string by searching for "f". But it may not be appropriate for display, because the visual representation is different. As with canonical normalization, you can ask for...
Symbol() constructor - JavaScript
It may be used as the value of an extends clause of a class definition but a super call to it will cause an exception. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Symbol([description]) Parameters description Optional A string. ...
TypedArray.prototype[@@iterator]() - JavaScript
The initial value of the @@iterator property is the same function object as the initial value of the values property. Syntax arr[Symbol.iterator]() Return value The array iterator function, which is the values() function by default. ...
TypedArray.prototype.entries() - JavaScript
xample is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax arr.entries() Return value A new Array Iterator object. ...
TypedArray.from() - JavaScript
s them from the iterator, then sets its length at the end. When Array.from() gets an array-like which isn't an iterator, it respects holes. TypedArray.from() will ensure the result is dense. Polyfill You can partially work around this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of from() in implementations that do not natively sup
port it. if (!Int8Array.__proto__.from) { (function () { Int8Array.__proto__.from = function (obj, func, thisObj) { var typedArrayClass = Int8Array.__proto__; if(typeof this !== 'function') { throw new TypeError('# is not a constructor'); } if (this.__proto__ !== typedArrayClass) { throw new TypeError('this i...
TypedArray.prototype.join() - JavaScript
,"). Return value A string with all array elements joined. Polyfill Since there is no global object with the name TypedArray, polyfilling must be done on an "as needed" basis. // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join if (!Uint8Array.prototype.join) { Object.defineProperty(Uint8Array.prototype, 'join', { value: Array.prototype.join }); } If you need to sup
port truly obsolete JavaScript engines that don't sup
port Object.defineProperty, it's best not to polyfill Array.prototype methods at all, as you can't make them non-enumerable. Examples Using join var uint8 = new Uint8Array([1,2,3]); uint8.join(); // '1,2,3' uint8.join(' / '); // '1 / 2 / 3' uint8.join(''); // '123' Specifications Specification ECMAScript (ECMA-262)Th...
TypedArray.prototype.keys() - JavaScript
tive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax arr.keys() Return value A new Array Iterator object. ...
TypedArray.prototype.some() - JavaScript
. some does not mutate the typed array on which it is called. Polyfill Since there is no global object with the name TypedArray, polyfilling must be done on an "as needed" basis. // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some if (!Uint8Array.prototype.some) { Object.defineProperty(Uint8Array.prototype, 'some', { value: Array.prototype.some }); } If you need to sup
port truly obsolete JavaScript engines that don't sup
port Object.defineProperty, it's best not to polyfill Array.prototype methods at all, as you can't make them non-enumerable. Examples Testing size of all typed array elements The following example tests whether any element in the typed array is bigger than 10. function isBiggerThan10(element, index, array) { return element > 10; } new Uint8Ar...
TypedArray.prototype.toString() - JavaScript
as. For example, the following code creates a typed array and uses toString to convert the array to a string. var numbers = new Uint8Array([2, 5, 8, 1, 4]) numbers.toString(); // "2,5,8,1,4" JavaScript calls the toString method automatically when a typed array is to be represented as a text value or when an array is referred to in a string concatenation. Compatibility If a browser doesn't sup
port the TypedArray.prototype.toString() method yet, JavaScript will call the toString method of Object: var numbers = new Uint8Array([2, 5, 8, 1, 4]) numbers.toString(); // "[object Uint8Array]" Specifications Specification ECMAScript (ECMA-262)The definition of 'Array.prototype.toString' in that specification. ...
TypedArray.prototype.values() - JavaScript
example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax arr.values() Return value A new Array Iterator object. ...
TypedArray - JavaScript
constructors inherit common properties from the %TypedArray% constructor function. Additionally, all typed array prototypes (TypedArray.prototype) have %TypedArray%.prototype as their [[Prototype]]. The %TypedArray% constructor on its own is not particularly useful. Calling it or using it in a new expression will throw a TypeError, except when used during object creation in JS engines that sup
port subclassing. There are at present no such engines, so %TypedArray% is only useful to polyfill functions or properties onto all TypedArray constructors. When creating an instance of a TypedArray (e.g. Int8Array), an array buffer is created internally in memory or, if an ArrayBuffer object is given as constructor argument, then this is used instead. The buffer address is saved as an internal pro...
WeakRef - JavaScript
rect use of WeakRef takes careful thought, and it's best avoided if possible. Constructor WeakRef() Creates a new WeakRef object. Instance methods WeakRef.prototype.deref() Returns the WeakRef object's target object, or undefined if the target object has been reclaimed. Avoid where possible Correct use of WeakRef takes careful thought, and it's best avoided if possible. It's also im
portant to avoid relying on any specific behaviors not guaranteed by the specification. When, how, and whether garbage collection occurs is down to the implementation of any given JavaScript engine. Any behavior you observe in one engine may be different in another engine, in another version of the same engine, or even in a slightly different situation with the same version of the same engine. Garbage...
eval() - JavaScript
ause `x` is undefined (0, eval)('x + y'); // another example of Indirect call } Never use eval()! eval() is a dangerous function, which executes the code it's passed with the privileges of the caller. If you run eval() with a string that could be affected by a malicious party, you may end up running malicious code on the user's machine with the permissions of your webpage / extension. More im
portantly, a third-party code can see the scope in which eval() was invoked, which can lead to possible attacks in ways to which the similar Function is not susceptible. eval() is also slower than the alternatives, since it has to invoke the JavaScript interpreter, while many other constructs are optimized by modern JS engines. Additionally, modern javascript interpreters convert javascript to machi...
globalThis - JavaScript
name, just remember that in global scope the this value is globalThis. HTML and the WindowProxy In many engines globalThis will be a reference to the actual global object, but in web browsers, due to iframe and cross-window security considerations, it references a Proxy around the actual global object (which you can't directly access). This distinction is rarely relevant in common usage, but im
portant to be aware of. Naming Several other popular name choices such as self and global were removed from consideration because of their potential to break compatibility with existing code. See the language proposal's "naming" document for more details. Examples Search for the global across environments Prior to globalThis, the only reliable cross-platform way to get the global object for an en...
Standard built-in objects - JavaScript
ject. They include the basic Error type, as well as several specialized error types. Error AggregateError EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Numbers and dates These are the base objects representing numbers, dates, and mathematical calculations. Number BigInt Math Date Text processing These objects represent strings and sup
port manipulating them. String RegExp Indexed collections These objects represent collections of data which are ordered by an index value. This includes (typed) arrays and array-like constructs. Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array BigInt64Array BigUint64Array Keyed collections These objects re...
Unary plus (+) - JavaScript
ption Although unary negation (-) also can convert non-numbers, unary plus is the fastest and preferred way of converting something into a number, because it does not perform any other operations on the number. It can convert string representations of integers and floats, as well as the non-string values true, false, and null. Integers in both decimal and hexadecimal (0x-prefixed) formats are sup
ported. Negative numbers are sup
ported (though not for hex). Using the operator on BigInt values throws a TypeError. If it cannot parse a particular value, it will evaluate to NaN. Examples Usage with numbers const x = 1; const y = -1; console.log(+x); // 1 console.log(+y); // -1 Usage with non-numbers +true // 1 +false // 0 +null // 0 +function(val){ return val } // NaN +1n // throws TypeE...
this - JavaScript
cution context, it remains as undefined, as shown in the following example: function f2() { 'use strict'; // see strict mode return this; } f2() === undefined; // true In the second example, this should be undefined, because f2 was called directly and not as a method or property of an object (e.g. window.f2()). This feature wasn't implemented in some browsers when they first started to sup
port strict mode. As a result, they incorrectly returned the window object. To set the value of this to a particular value when calling a function, use call(), or apply() as in the examples below. Class context The behavior of this in classes and functions is similar, since classes are functions under the hood. But there are some differences and caveats. Within a class constructor, this is a regul...
const - JavaScript
constant variable. MY_FAV = 20; // MY_FAV is 7 console.log('my favorite number is: ' + MY_FAV); // trying to redeclare a constant throws an error // Uncaught SyntaxError: Identifier 'MY_FAV' has already been declared const MY_FAV = 20; // the name MY_FAV is reserved for constant above, so this will fail too var MY_FAV = 20; // this throws an error too let MY_FAV = 20; Block scoping It's im
portant to note the nature of block scoping. if (MY_FAV === 7) { // this is fine and creates a block scoped MY_FAV variable // (works equally well with let to declare a block scoped non const variable) let MY_FAV = 20; // MY_FAV is now 20 console.log('my favorite number is ' + MY_FAV); // this gets hoisted into the global context and throws an error var MY_FAV = 20; } // MY_FAV is st...
for await...of - JavaScript
); if (done) { return; } yield value; } } finally { reader.releaseLock(); } } // Fetches data from url and calculates response size using the async generator. async function getResponseSize(url) { const response = await fetch(url); // Will hold the size of the response, in bytes. let responseSize = 0; // The for-await-of loop. Async iterates over each
portion of the response. for await (const chunk of streamAsyncIterable(response.body)) { // Incrementing the total response length. responseSize += chunk.length; } console.log(`Response Size: ${responseSize} bytes`); // expected output: "Response Size: 1071472" return responseSize; } getResponseSize('https://jsonplaceholder.typicode.com/photos'); Iterating over sync iterables and g...
let - JavaScript
above. Redeclarations Redeclaring the same variable within the same function or block scope raises a SyntaxError. if (x) { let foo; let foo; // SyntaxError thrown. } You may encounter errors in switch statements because there is only one block. let x = 1; switch(x) { case 0: let foo; break; case 1: let foo; // SyntaxError for redeclaration. break; } However, it's im
portant to point out that a block nested inside a case clause will create a new block scoped lexical environment, which will not produce the redeclaration errors shown above. let x = 1; switch(x) { case 0: { let foo; break; } case 1: { let foo; break; } } Temporal dead zone Unlike variables declared with var, which will start with the value undefined, let variables are not ...
switch - JavaScript
Take a look at this example: const action = 'say_hello'; switch (action) { case 'say_hello': let message = 'hello'; console.log(message); break; case 'say_hi': let message = 'hi'; console.log(message); break; default: ...
var - JavaScript
ariable declaration is moved to the top of the function or global code. bla = 2; var bla; // ...is implicitly understood as: var bla; bla = 2; For that reason, it is recommended to always declare variables at the top of their scope (the top of global code and the top of function code) so it's clear which variables are function scoped (local) and which are resolved on the scope chain. It's im
portant to point out that the hoisting will affect the variable declaration, but not its value's initialization. The value will be indeed assigned when the assignment statement is reached: function do_something() { console.log(bar); // undefined var bar = 111; console.log(bar); // 111 } // ...is implicitly understood as: function do_something() { var bar; console.log(bar); // undefined ...
Statements and declarations - JavaScript
iteration hook with statements to be executed for the value of each distinct property. while Creates a loop that executes a specified statement as long as the test condition evaluates to true. The condition is evaluated before executing the statement. Others debugger Invokes any available debugging functionality. If no debugging functionality is available, this statement has no effect. ex
port Used to ex
port functions to make them available for im
ports in external modules, and other scripts. im
port Used to im
port functions ex
ported from an external module, another script. im
port.meta An object exposing context-specific metadata to a JavaScript module. label Provides a statement with an identifier that you can refer to using a break or continue statement. with Extends the s...
JavaScript reference - JavaScript
Primary expressionsthis function class function* yield yield* async function await [] {} /ab+c/i ( ) null Left-hand-side expressions Property accessors new new.target super ...obj Increment & decrement A++ A-- ++A --A Unary operators delete void ...
JavaScript shells - JavaScript
standalone JavaScript shell for writing cross-platform JavaScript applications. It can use wxWidgets for GUI apps and was formerly called wxJavaScript. jspl - A standalone JavaScript shell enhanced by Perl. Can use Perl modules directly from JavaScript: DBI for database integration, GTK2 for GUI apps, POSIX for system programming, etc. The best of CPAN now for JavaScript programmers. ShellJS -
Portable Unix shell commands for Node.js List of JavaScript shells The following JavaScript shells work with Mozilla. Firefox has a built-in JavaScript console, which sup
port multi-line editing. JavaScript Shell (js) - A command line interpreter for JavaScript xpcshell is an XPConnect - enabled shell, sometimes useful for Mozilla development. Babel REPL - A browser-based REPL for experimentin...
icons - Web app manifests
values: Member Description sizes A string containing space-separated image dimensions. src The path to the image file. If src is a relative URL, the base URL will be the URL of the manifest. type A hint as to the media type of the image. The purpose of this member is to allow a user agent to quickly ignore images with media types it does not sup
port. purpose Defines the purpose of the image, for example if the image is intended to serve some special purpose in the context of the host OS (i.e., for better integration). purpose can have one or more of the following values, separated by spaces: monochrome: A user agent can present this icon where a monochrome icon with a solid fill is needed. The color informati...
Web app manifests
} Deploying a manifest Web app manifests are deployed in your HTML pages using a <link> element in the <head> of a document: <link rel="manifest" href="/manifest.webmanifest"> Note: The .webmanifest extension is specified in the Media type registration section of the specification (the response of the manifest file should return Content-Type: application/manifest+json). Browsers generally sup
port manifests with other appropriate extensions like .json (Content-Type: application/json). Note: If the manifest requires credentials to fetch - the crossorigin attribute must be set to use-credentials, even if the manifest file is in the same origin as the current page. Splash screens In Chrome 47 and later, a splash screen is displayed for sites launched from a homescreen. This splashscreen...
<mfenced> - MathML
Use the <mrow> and <mo> elements instead. Attributes class, id, style Provided for use with stylesheets. close A string for the closing delimiter. The default value is ")" and any white space is trimmed. ...
MathML documentation index - MathML
14 <mfenced> Deprecated, MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The deprecated MathML <mfenced> element used to provide the possibility to add custom opening and closing parentheses (such as brackets) and separators (such as commas or semicolons) to an expression. It has been removed from the latest MathML standard and modern browsers no longer sup
port it. 15 <mfrac> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <mfrac> element is used to display fractions. 16 <mglyph> MathML, MathML Reference, MathML:Element The MathML <mglyph> element is used to display non-standard symbols where existing Unicode characters are not available. It may be used within token elements. ...
Digital video concepts - Web media technologies
Encoding color Representing the colors in an image or video requires several values for each pixel. What those values are depends on how you "split up" the color when converting it to numeric form. There are several color models, and video codec makes use of one or more of these to represent their pixels during the encoding process as well as after decoding the video frames. ...
Understanding latency - Web Performance
This article explains what latency is, how it impacts performance, how to measure latency, and how to reduce it. What is Latency? Latency is generally considered to be the amount of time it takes from when a request is made by the user to the time it takes for the response to get back to that user. ...
SVG Conditional Processing Attributes - SVG: Scalable Vector Graphics
tensions requiredFeatures systemLanguage Attributes externalResourcesRequired Deprecated since SVG 2 If set to true, it indicates that the browser must wait for all the external resources necessary to render that element to be loaded before processing the associated element. Value: false|true; Animatable: No requiredExtensions List all the browser specific capabilities that must be sup
ported by the borwser to be allowed to render the associated element. Value: A list of space-separated URI; Animatable: No requiredFeatures Deprecated since SVG 2 List all the features, as defined is the SVG 1.1 specification, that must be sup
ported by the borwser to be allowed to render the associated element.. Value: A list of space-separated URI; Animatable: No systemLanguage Indicates which ...
SVG Core Attributes - SVG: Scalable Vector Graphics
to HTML's lang, but in conforming XML 1.0 documents, it does not allow the use of a null attribute value (xml:lang="") to indicate an unknown language. Instead, use xml:lang="und". SVG 2 introduce the new lang attributes. If both lang and xml:lang attribute are used, xml:lang has priority over lang. Value: Any valid language ID; Animatable: No xml:space Deprecated since SVG 2 SVG sup
ports the standard XML attribute xml:space to specify the handling of white space characters within a given <text> element's character data. Note: Instead of using the xml:space attribute you should use the white-space CSS property. Value: default | preserve; Animatable: No ...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
o|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical|inherit; Animatable: Yes baseline-shift It allows repositioning of the dominant-baseline relative to the dominant-baseline of the parent text content element. Value: auto|baseline|super|sub|<percentage>|<length>|inherit; Animatable: Yes clip Deprecated It defines what
portion of an element is visible. Value: auto|<shape()>|inherit; Animatable: Yes clip-path It binds the element it is applied to with a given <clipPath> element. Value: none|<FuncIRI>|inherit; Animatable: Yes clip-rule It indicates how to determine what side of a path is inside a shape in order to know how a <clipPath> should clip its target. Value: nonezero|evenodd|inherit; Animatable: Yes co...
accumulate - SVG: Scalable Vector Graphics
eColor>, <animateMotion>, and <animateTransform> Usage notes Value none | sum Default value none Animatable No sum Specifies that each repeat iteration after the first builds upon the last value of the previous iteration. none Specifies that repeat iterations are not cumulative. This attribute is ignored if the target attribute value does not sup
port addition, or if the animation element does not repeat. This attribute will be ignored if the animation function is specified with only the to attribute. Specifications Specification Status Comment SVG Animations Level 2The definition of 'accumulate' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The ...
begin - SVG: Scalable Vector Graphics
ation element. An optional offset value as defined in <offset-value> can be appended. <event-value> This value defines an event and an optional offset that determines the time at which the element's animation should begin. The animation start time is defined relative to the time that the specified event is fired. A valid event-value consists of an element ID followed by a dot and one of the sup
ported events for that element. All valid events (not necessarily sup
ported by all elements) are defined by the DOM and HTML specifications. Those are: focus, blur, focusin, focusout, activate, auxclick, click, dblclick, mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup, wheel, beforeinput, input, keydown, keyup, compositionstart, compositionupdate, compositionend, load, unloa...
class - SVG: Scalable Vector Graphics
he <list-of-Ts> syntax: list-of-Ts ::= T | T, list-of-Ts Within the SVG DOM, values of a <list-of-Ts> type are represented by an interface specific for the particular type T. For example, a <list-of-lengths> is represented in the SVG DOM using an SVGLengthList or SVGAnimatedLengthList object. ...
clip-path - SVG: Scalable Vector Graphics
Note: For more details on the clip-path syntax, see the CSS property clip-path reference page. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSa...
color-rendering - SVG: Scalable Vector Graphics
optimizeSpeed Indicates that the user agent shall emphasize rendering speed over quality. For RGB display devices, this option will sometimes cause the user agent to perform color interpolation and compositing in the device RGB color space. optimizeQuality Indicates that the user agent shall emphasize quality over rendering speed. ...
contentStyleType - SVG: Scalable Vector Graphics
ecifies a media type, per MIME Part Two: Media Types [RFC2046]. Usage notes Value One of the content types specified in the Media Types Default value text/css Animatable No Since CSS is the only widely deployed style sheet language for online styling and it's already defined as default value if contentStyleType is ommitted, the attribute is not well sup
ported in user agents. If other style sheet languages become more popular they might not use the style attribute, instead it could be easily declared which style language is used in the <style>'s type attribute. The use of contentStyleType is therefore deprecated. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definitio...
d - SVG: Scalable Vector Graphics
It is sometimes easier to draw highly regular curves with an elliptical arc than with a Bezier curve. Command Parameters Notes A (rx ry angle large-arc-flag sweep-flag x y)+ Draw an Arc curve from the current point to the coordinate x,y. The center of the ellipse used to draw the arc is determined automatically based on the other parameters of...
end - SVG: Scalable Vector Graphics
animation element. An optional offset value as defined in <offset-value> can be appended. <event-value> This value defines an event and an optional offset that determines the time at which the element's animation should end. The animation end time is defined relative to the time that the specified event is fired. A valid event-value consists of an element ID followed by a dot and one of the sup
ported events for that element. All valid events (not necessarily sup
ported by all elements) are defined by the DOM and HTML specifications. Those are: focus, blur, focusin, focusout, activate, auxclick, click, dblclick, mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup, wheel, beforeinput, input, keydown, keyup, compositionstart, compositionupdate, compositionend, load, unlo...
fill-opacity - SVG: Scalable Vector Graphics
Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet Explore...
font-size-adjust - SVG: Scalable Vector Graphics
mber> Choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. This means that the first-choice font, when available, will appear the same size in browsers, whether or not they sup
port font-size-adjust. 0 yields text of zero height (hidden text). Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-size-adjust' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-size-adjust' in that specification. Recommenda...
format - SVG: Scalable Vector Graphics
re using this attribute: <altGlyph> and <glyphRef> Context notes Value <string> Default value None Animatable No <string> This value specifies the format of the given font. ...
gradientUnits - SVG: Scalable Vector Graphics
ues in the coordinate system that results from taking the current user coordinate system in place at the time when the gradient element is referenced (i.e., the user coordinate system for the element referencing the gradient element via a fill or stroke property) and then applying the transform specified by attribute gradientTransform. Percentages represent values relative to the current SVG view
port. objectBoundingBox This value indicates that the user coordinate system for the attributes is established using the bounding box of the element to which the gradient is applied and then applying the transform specified by attribute gradientTransform. Percentages represent values relative to the bounding box for the object. With this value and gradientTransform being the identity matrix, the n...
height - SVG: Scalable Vector Graphics
ht defines the vertical length for the rectangle. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, height is a Geometry Property meaning this attribute can also be used as a CSS property for rectangles. svg For <svg>, height defines the vertical length for the rendering area of the SVG view
port. Note: In an HTML document if both the viewBox and height attributes are omitted, the svg element will be rendered with a height of 150px Value auto | <length> | <percentage> Default value auto (treated as 100%) Animatable Yes Note: Starting with SVG2, height is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>...
href - SVG: Scalable Vector Graphics
lar, see SMIL Animation: Specifying the animation target. Value <url> Default value None Animatable No discard For <discard>, href defines a URL referring the target element to discard. See the definition of href on animation elements for details on identifying a target element. Note: Unlike other animation elements, the <discard> element does not sup
port the deprecated xlink:href attribute. Note that if the target element is not part of the current SVG document fragment, then whether the target element will be removed or not is defined by the host language. If the href attribute is not provided, then the target element will be the immediate parent element of the <discard> element. Value <url> Default value None ...
image-rendering - SVG: Scalable Vector Graphics
rmation. As a presentation attribute, it can be applied to any element but it has effect only on the following element: <image> Usage notes Value auto | optimizeSpeed | optimizeQuality Default value auto Animatable Yes auto Indicates that the user agent shall make appropriate tradeoffs to balance speed and quality, but quality shall be given more im
portance than speed. optimizeSpeed Indicates that the user agent shall emphasize rendering speed over quality. optimizeQuality Indicates that the user agent shall emphasize quality over rendering speed. Specifications Specification Status Comment CSS Images Module Level 3The definition of 'image-rendering' in that specification. Candidate Recommendation Definit...
in - SVG: Scalable Vector Graphics
g this filter primitive can be referenced by an in attribute on a subsequent filter primitive within the same filter element. If no value is provided, the output will only be available for re-use as the implicit input into the next filter primitive if that filter primitive provides no value for its in attribute. Workaround for BackgroundImage Instead of using in="BackgroundImage", we need to im
port one of the images to blend inside the filter itself, using an <feImage> element. HTML <div style="width: 420px; height: 220px;"> <svg style="width:200px; height:200px; display: inline;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="backgroundMultiply"> <!-- This will not work. --> <feBlend in="BackgroundImage" in2="SourceGrap...
keyTimes - SVG: Scalable Vector Graphics
The keyTimes attribute represents a list of time values used to control the pacing of the animation. Each time in the list corresponds to a value in the values attribute list, and defines when the value is used in the animation. Each time value in the keyTimes list is specified as a floating point value between 0 and 1 (inclusive), representing a pro
portional offset into the duration of the animation element. Four elements are using this attribute: <animate>, <animateColor>, <animateMotion>, and <animateTransform> html, body, svg { height: 100%; } <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="10" r="10"> <animate attributeName="cx" dur="4s" repeatCount="indefinite" values="60 ; 110 ; 60 ; 10 ; 60" keyTimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/...
markerHeight - SVG: Scalable Vector Graphics
Only one element is using this attribute: <marker> Usage notes Value <length-percentage> | <number> Default value 3 Animatable Yes <length-percentage> This value defines either an absolute or a relative height of the marker. Relative values refer to the height specified via the viewBox and preserveAspectRatio attributes. <number> This value defines the height of the marker in the units defined by the markerUnits attribute. ...
markerWidth - SVG: Scalable Vector Graphics
Only one element is using this attribute: <marker> Usage notes Value <length-percentage> | <number> Default value 3 Animatable Yes <length-percentage> This value defines either an absolute or a relative width of the marker. Relative values refer to the width specified via the viewBox and preserveAspectRatio attributes. <number> This value defines the width of the marker in the units defined by the markerUnits attribute. A value of zero disables rendering of the element and negative values are an error. ...
overflow - SVG: Scalable Vector Graphics
an element's content is too big to fit in its block formatting context. It has the same parameter values and meaning as the css overflow property, however, the following additional points apply: If it has a value of visible, the attribute has no effect (i.e., a clipping rectangle is not created). If the overflow property has the value hidden or scroll, a clip of the exact size of the SVG view
port is applied. When scroll is specified on an <svg> element, a scrollbar or panner is normally shown for the SVG view
port whether or not any of its content is clipped. Within SVG content, the value auto implies that all rendered content for child elements must be visible, either through a scrolling mechanism, or by rendering with no clip. Although the initial value for overflow is auto, it is ov...
refX - SVG: Scalable Vector Graphics
e effect of the x attribute and any transformations on the <symbol> and its host <use> element. Unlike other positioning attributes, refX is interpreted as being in the coordinate system of the symbol contents, after application of the viewBox and preserveAspectRatio attributes. If the attribute is not specified, no horizontal adjustment is made, and the left side of the symbol's rectangular view
port region (regardless of the viewBox coordinate) is positioned at the x coordinate. For backwards compatibility, the behavior when refX is not specified on a <symbol> element is different from when it is specified with a value of 0, and therefore different from the behavior when an equivalent attribute is not specified on a <marker> element. Value <length> | left | center | right ...
refY - SVG: Scalable Vector Graphics
tive effect of the y attribute and any transformations on the <symbol> and its host <use> element. Unlike other positioning attributes, refY is interpreted as being in the coordinate system of the symbol contents, after application of the viewBox and preserveAspectRatio attributes. If the attribute is not specified, no vertical adjustment is made, and the top side of the symbol's rectangular view
port region (regardless of the viewBox coordinate) is positioned at the y coordinate. For backwards compatibility, the behavior when refY is not specified on a <symbol> element is different from when it is specified with a value of 0, and therefore different from the behavior when an equivalent attribute is not specified on a <marker> element. Value <length> | top | center | bottom ...
repeatCount - SVG: Scalable Vector Graphics
<animate attributeType="XML" attributeName="y" from="0" to="50" dur="1s" repeatCount="indefinite"/> </rect> </svg> Usage notes Value <number> | indefinite Default value None Animatable No <number> This value specifies the number of iterations. It can include partial iterations expressed as fraction values. A fractional value describes a
portion of the simple duration. Values must be greater than 0. indefinite This value indicates that the animation will be repeated indefinitely (i.e. until the document ends). Specifications Specification Status Comment SVG Animations Level 2The definition of 'repeatCount' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1...
requiredExtensions - SVG: Scalable Vector Graphics
ied by an URL reference. Usage notes Value <list-of-extensions> Default value None Animatable No <list-of-extensions> The value is a list of references (IRI references in SVG 1, URL References in SVG 2) which identify the required extensions, with the individual values separated by white space. Determines whether all of the named extensions are sup
ported by the user agent. If all of the given extensions are sup
ported, then the attribute evaluates to true; otherwise, the current element and its children are skipped and thus will not be rendered. Note: If a given extension reference contains white space within itself, that white space must be escaped. requiredExtensions is often used in conjunction with the <switch> element. If the attribute i...
shape-rendering - SVG: Scalable Vector Graphics
optimizeSpeed This value indicates that the user agent shall emphasize rendering speed over geometric precision and crisp edges. This option will sometimes cause the user agent to turn off shape anti-aliasing. crispEdges This value indicates that the user agent shall attempt to emphasize the contrast between clean edges of artwork over rendering speed and geome...
stroke-dashoffset - SVG: Scalable Vector Graphics
of the dash array for each line --> <path d="M0,5 h-3 M0,7 h3 M0,9 h-1" stroke="rgba(255,0,0,.5)" /> </svg> Usage notes Value <percentage> | <length> Default value 0 Animatable Yes The offset is usually expressed in user units resolved against the pathLength but if a <percentage> is used, the value is resolved as a percentage of the current view
port. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetstroke-dashoffse...
target - SVG: Scalable Vector Graphics
replaced by the linked content, if it exists and can be securely accessed from this document. _top The content of the full active window or tab is replaced by the linked content, if it exists and can be securely accessed from this document _blank A new un-named window or tab is requested for the display of the linked content, if this document can securely do so. If the user agent does not sup
port multiple windows/tabs, the result is the same as _top. <XML-Name> Specifies the name of the browsing context (tab, inline frame, object, etc.) for display of the linked content. If a context with this name already exists, and can be securely accessed from this document, it is re-used, replacing the existing content. If it does not exist, it is created (the same as '_blank', except that it now h...
text-rendering - SVG: Scalable Vector Graphics
optimizeSpeed This value indicates that the user agent shall emphasize rendering speed over legibility and geometric precision. This option will sometimes cause some user agents to turn off text anti-aliasing. optimizeLegibility This value indicates that the user agent shall emphasize legibility over rendering speed and geometric precision. The user age...
transform - SVG: Scalable Vector Graphics
for the specific syntax to use in that case. As a presentation attribute, transform can be used by any element (in SVG 1.1, only these 16 elements were allowed to use it: <a>, <circle>, <clipPath>, <defs>, <ellipse>, <foreignObject>, <g>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <switch>, <text>, and <use>). Also, as a legacy from SVG 1.1, <linearGradient> and <radialGradient> sup
port the gradientTransform attribute, and <pattern> sup
ports the patternTransform attribute, both of which act exactly like the transform attribute. Value <transform-list> Default value none Animatable Yes Transform functions The following transform functions can be used by the transform attribute <transform-list> Warning: As per the spec, you should be ab...
Clipping and masking - SVG: Scalable Vector Graphics
ow stroke is set to 50% opacity, which leads effectively to a double-color stroke. Using well-known CSS techniques One of the most powerful tools in a web developer's toolbox is display: none. It is therefore little surprise, that it was decided to take this CSS property into SVG as well, together with visibility and clip as defined by CSS 2. For reverting a previously set display: none it is im
portant to know, that the initial value for all SVG elements is inline. << PreviousNext >> ...
Getting started - SVG: Scalable Vector Graphics
ext "SVG" is drawn. The interior of each letter is filled in with white. The text is positioned by setting an anchor where we want the midpoint to be: in this case, the midpoint should correspond to the center of the green circle. Fine adjustments can be made to the font size and vertical position to ensure the final result is aesthetically pleasing. Basic properties of SVG files The first im
portant thing to notice is the order of rendering elements. The globally valid rule for SVG files is, that later elements are rendered atop previous elements. The further down an element is the more it will be visible. SVG files on the web can be displayed directly in the browser or embedded in HTML files via several methods: If the HTML is XHTML and is delivered as type application/xhtml+xml, ...
Other content in SVG - SVG: Scalable Vector Graphics
<< PreviousNext >> Apart from graphic primitives like rectangles and circles, SVG offers a set of elements to embed other types of content in images as well. Embedding raster images Much like the img element in HTML SVG has an image element to serve the same purpose. You can use it to embed arbitrary raster (and vector) images. The specification requests applications to sup
port at least PNG, JPEG and SVG format files. The embedded picture becomes a normal SVG element. This means, that you can use clips, masks, filters, rotations and all other tools of SVG on the content: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"> <image x="90" y="-65" width="128" height="146" transform="rotate(45)" ...
Paths - SVG: Scalable Vector Graphics
ines, curves, arcs, and more. Paths create complex shapes by combining multiple straight lines or curved lines. Complex shapes composed only of straight lines can be created as <polyline>s. While <polyline>s and <path>s can create similar-looking shapes, <polyline>s require a lot of small straight lines to simulate curves, and don't scale well to larger sizes. A good understanding of paths is im
portant when drawing SVGs. While creating complex paths using an XML editor or text editor is not recommended, understanding how they work will allow to identify and repair display issues in SVGs. The shape of a <path> element is defined by one parameter: d. (See more in basic shapes.) The d attribute contains a series of commands and parameters used by those commands. Each of the commands is instan...
Positions - SVG: Scalable Vector Graphics
To explicitly change this behaviour, there are several possibilities in SVG. We start with the svg root element: <svg width="100" height="100"> The above element defines a simple SVG canvas with 100x100px. One user unit equals one screen unit. <svg width="200" height="200" viewBox="0 0 100 100"> The whole SVG canvas here is 200px by 200px in size. However, the viewBox attribute defines the
portion of that canvas to display. These 200x200 pixels display an area that starts at user unit (0,0) and spans 100x100 user units to the right and to the bottom. This effectively zooms in on the 100x100 unit area and enlarges the image to double size. The current mapping (for a single element or the whole image) of user units to screen units is called user coordinate system. Apart from scaling the ...
SVG: Scalable Vector Graphics
asked questions regarding SVG and Mozilla SVG as an image SVG animation with SMIL SVG art gallery Animation and interactions Like HTML, SVG has a document model (DOM) and events, and is accessible from JavaScript. This allows developers to create rich animations and interactive images. Some real eye-candy SVG at svg-wow.org Firefox extension (Grafox) to add a subset of SMIL animation sup
port Interactive photos manipulation HTML transformations using SVG's foreignObject Mapping, charting, games & 3D experiments While a little SVG can go a long way to enhanced web content, here are some examples of heavy SVG usage. Connect 4 jVectorMap (interactive maps for data visualization) JointJS (JavaScript diagramming library) D3 ( JavaScript library for visualizing data with HTML, SV...
Information Security Basics - Web security
A basic understanding of information security can help you avoid unnecessarily leaving your software and sites insecure and vulnerable to weaknesses that can be exploited for financial gain or other malicious reasons. These articles can help you learn what you need to know. With this information, you can be aware of the role and im
portance of security throughout the web development cycle and beyond into deployment of your content. Confidentiality, Integrity, and Availability Describes the primary security objectives, which are absolutely fundamental to understanding security Security Controls Defines major categories of security controls and discusses their potential disadvantages TCP/IP Security An overview of the TCP/IP model, ...
How to fix a website with blocked mixed content - Web security
er, it is very likely that if your website works in both of these browsers, it will work equally well in Firefox with mixed content blocking. In any case, the best way to know if something is broken in Firefox is to download the latest Firefox Edition, open different pages on your website with the web console open (enable the "Security" messages) and see if anything related to mixed content is re
ported. Or use a free online crawler like SSL-check or Missing Padlock, a desktop crawler like HTTPSChecker, or a CLI tool like mcdetect to check your website recursively and find links to insecure content. If nothing is said about mixed content, your website is in good shape: Keep making excellent websites! How to fix your website The best strategy to avoid mixed content blocking is to serve all th...
Secure contexts - Web security
ntexts specification. A particular document is considered to be in a secure context when it is the active document of a top-level browsing context (basically, a containing window or tab) that is a secure context. For example, even for a document delivered over TLS within an <iframe>, its context is not considered secure if it has an ancestor that was not also delivered over TLS. However, it's im
portant to note that if a non-secure context causes a new window to be created (with or without specifying noopener), then the fact that the opener was insecure has no effect on whether the new window is considered secure. That's because the determination of whether or not a particular document is in a secure context is based only on considering it within the top-level browsing context with which it i...
How to turn off form autocompletion - Web security
ser to choose a master password that the browser will use to encrypt stored login details. Even without a master password, in-browser password management is generally seen as a net gain for security. Since users do not have to remember passwords that the browser stores for them, they are able to choose stronger passwords than they would otherwise. For this reason, many modern browsers do not sup
port autocomplete="off" for login fields: If a site sets autocomplete="off" for a <form>, and the form includes username and password input fields, then the browser still offers to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits the page. If a site sets autocomplete="off" for username and password <input> fields, then the browser st...
Subdomain takeovers - Web security
into it, everything is fine. However, if you remove your appliance from the outlet (or haven't plugged one in yet), someone can plug in a different one. You must cut power at the breaker or fuse box (DNS) to prevent the outlet from being used by someone else. How do they happen? If the process of provisioning or deprovisioning (removing) a virtual host is not handled properly, there can be an op
portunity for an attacker to take over a subdomain. During provisioning An attacker sets up a virtual host for a subdomain name you bought on the hosting provider, before you get to do it. Suppose you control the domain example.com. You want to add a blog at blog.example.com, and you decide to use a hosting provider who maintains a blogging platform. (For "blog", you can substitute "e-commerce plat...
Weak signature algorithms - Web security
certificate. This article provides some information about signature algorithms known to be weak, so you can avoid them when appropriate. Weaknesses in hash algorithms can lead to situations in which attackers can create or obtain fraudulent certificates. As new attacks are found and improvements in available technology make attacks more feasible, the use of older algorithms is discouraged and sup
port for them is eventually removed. SHA-1 SHA-1 certificates will no longer be treated as secure by major browser manufacturers beginning in 2017. Certificates employing more secure hash algorithms (such as SHA-256 or SHA-512) should be used instead. MD5 Sup
port for MD5 based signatures was removed in early 2012. ...
Using custom elements - Web Components
One of the key features of the Web Components standard is the ability to create custom elements that encapsulate your functionality on an HTML page, rather than having to make do with a long, nested batch of elements that together provide a custom page feature. This article introduces the use of the Custom Elements API. Note: Custom elements are sup
ported by default in Firefox, Chrome, and Edge (76). Opera and Safari so far sup
port only autonomous custom elements. High-level view The controller of custom elements on a web document is the CustomElementRegistry object -- this object allows you to register a custom element on the page, return information on what custom elements are registered, etc. To register a custom element on the page, you use the CustomElementRegistry.define() method.
Using shadow DOM - Web Components
An im
portant aspect of web components is encapsulation -- being able to keep the markup structure, style, and behavior hidden and separate from other code on the page so that different parts do not clash, and the code can be kept nice and clean. The Shadow DOM API is a key part of this, providing a way to attach a hidden separated DOM to an element. This article covers the basics of using the Shadow DOM. Note: Shadow DOM is sup
ported by default in Firefox (63 and onwards), Chrome, Opera, and Safari. The new Chromium-based Edge (75 and onwards) sup
ports it too; the old Edge didn't. High-level view This article assumes you are already familiar with the concept of the DOM (Document Object Model) -- a tree-like structure of connected nodes that represents the different elements and strings o...
Index - XPath
The following axis indicates all the nodes that appear after the context node, except any descendant, attribute, and namespace nodes. 10 following-sibling Axe, XPath The following-sibling axis indicates all the nodes that have the same parent as the context node and appear after the context node in the source document. 11 namespace Axe, XPath (not sup
ported) 12 parent Axe, XPath The parent axis indicates the single node that is the parent of the context node. It can be abbreviated as two periods (..). 13 preceding Axe, XPath The preceding axis indicates all the nodes that precede the context node in the document except any ancestor, attribute and namespace nodes. 14 preceding-sibling Axe, XP...
XPath snippets - XPath
Scripts in a Web document which might be accessed by Edge or Internet Explorer users should replace the call to new XPathEvaluator() with the following fragment: // XPathEvaluator is implemented on objects that implement Document var xpe = aNode.ownerDocument || aNode; In that case the creation of the XPathNSReso...
XPath
g XPathExpression, such as HTML and SVG, instead of relying on the Document.getElementById() or ParentNode.querySelectorAll() methods, the Node.childNodes properties, and other DOM Core features. XPath uses a path notation (as in URLs) for navigating through the hierarchical structure of an XML document. It uses a non-XML syntax so that it can be used in URIs and XML attribute values. Note: Sup
port for XPath varies widely; it's sup
ported reasonably well in Firefox (although there are no plans to improve sup
port further), while other browsers implement it to a lesser extent, if at all. If you need a polyfill, you may consider js-xpath or wicked-good-xpath. Documentation Introduction to using XPath in JavaScript Describes a non-XSLT use of XPath. XPath:Axes List and definition of th...
Common XSLT Errors - XSLT: Extensible Stylesheet Language Transformations
e usually tell the mime type. In Firefox 6 and forward, you can also use the official XSLT mimetype: application/xslt+xml. Namespace The XSLT 1.0 namespace is http://www.w3.org/1999/XSL/Transform. Older versions of IE used a different namespace. However these versions also used a draft version of XSLT which is incompatible with what eventually became the XSLT 1.0 specification. Firefox only sup
ports the official XSLT 1.0 version. Missing features There are some features in the XSLT 1.0 specification which Firefox unfortunately does not yet sup
port. Specifically: The namespace:: axis in XPath expressions. Sup
port for this will hopefully be available in the future. The disable-output-escaping attribute. This feature controls how serializing the constructed output document works. However...
<xsl:attribute-set> - XSLT: Extensible Stylesheet Language Transformations
the attribute set. The name must be a valid QName. Optional Attributes use-attribute-sets Builds an attribute set from other attribute sets. The names of the contributing sets must be separated with whitespace characters and must not directly or indirectly embed themselves. Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 7.1.4. Gecko sup
port Sup
ported. ...
<xsl:copy> - XSLT: Extensible Stylesheet Language Transformations
current node. Syntax <xsl:copy use-attribute-sets=LIST-OF-NAMES> TEMPLATE </xsl:copy> Required Attributes None. Optional Attributes use-attribute-sets Lists attribute sets that should be applied to the output node, if it is an element. Names of the sets should be separated with whitespace characters. Type Instruction, appears within a template. Defined XSLT, section 7.5. Gecko sup
port Sup
ported. ...
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
character. The default is (0). digit Specifies the character used in the format pattern to stand for a digit. The default is (#). pattern-separator Specifies the character separating positive and negative subpatterns in a format pattern. The default is the semi-colon (;). Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 12.3. Gecko sup
port Sup
ported as of 1.0 (Mozilla 1.0, Netscape 7.0). ...
<xsl:element> - XSLT: Extensible Stylesheet Language Transformations
e must be a valid QName. Optional Attributes namespace Specifies the namespace of the output element. use-attribute-sets A whitespace-separated list of attribute-set element names to be applied to the element element's output element. Applied attributes can be overridden via nested attribute elements. Type Instruction, appears within a template. Defined XSLT, section 7.1.2. Gecko sup
port Sup
ported. ...
<xsl:fallback> - XSLT: Extensible Stylesheet Language Transformations
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The <xsl:fallback> element specifies what template to use if a given extension (or, eventually, newer version) element is not sup
ported. Syntax <xsl:fallback> TEMPLATE </xsl:fallback> Required Attributes None. Optional Attributes None. Type Instruction, appears within a template. Defined XSLT, section 15 Gecko sup
port Not sup
ported at this time. ...
<xsl:if> - XSLT: Extensible Stylesheet Language Transformations
ax <xsl:if test=EXPRESSION> TEMPLATE </xsl:if> Required Attributes test Contains an XPath expression that can be evaluated (using the rules defined for boolean( ) if necessary) to a Boolean value. If the value is true, the template is processed; if it is not, no action is taken. Optional Attributes None. Type Instruction, appears within a template. Defined XSL section 9.1. Gecko sup
port Sup
ported ...
<xsl:include> - XSLT: Extensible Stylesheet Language Transformations
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The <xsl:include> element merges the contents of one stylesheet with another. Unlike the case of <xsl:im
port>, the contents of an included stylesheet have exactly the same precedence as the contents of the including stylesheet. Syntax <xsl:include href=URI /> Required Attributes href Specifies the URI of the stylesheet to include. Optional Attributes None. Type Top-level, may appear in any order as a child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 2.6.1. Gecko sup
port Sup
ported. ...
<xsl:message> - XSLT: Extensible Stylesheet Language Transformations
can be useful for debugging. Syntax <xsl:message terminate="yes" | "no" > TEMPLATE </xsl:message> Required Attributes None. Optional Attributes terminate Set to "yes", indicates that execution should be terminated. The default value is "no", in which case the message is output and execution continues. Type Instruction, appears within a template. Defined XSLT, section 13. Gecko sup
port Sup
ported. ...
<xsl:namespace-alias> - XSLT: Extensible Stylesheet Language Transformations
LT namespace in the output tree. Syntax <xsl:namespace-alias stylesheet-prefix=NAME result-prefix=NAME /> Required Attributes stylesheet-prefix Specifies the temporary namespace. result-prefix Specifies the desired namespace for the output tree. Optional Attributes None. Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 7.1.1 Gecko sup
port Not sup
ported at this time. ...
<xsl:param> - XSLT: Extensible Stylesheet Language Transformations
t child element of the template. Syntax <xsl:param name=NAME select=EXPRESSION> TEMPLATE </xsl:param> Required Attributes name Names the parameter. This must be a QName. Optional Attributes select Uses an XPath expression to provide a default value if none is specified. Type Instruction, can appear as a top-level element or within a template. Defined XSLT, section 11. Gecko sup
port Sup
ported. ...
<xsl:template> - XSLT: Extensible Stylesheet Language Transformations
:apply-templates> element. This is useful for processing the same information in multiple ways. priority Specifies a numeric priority for this template. This can be any number other than Infinity. The processor uses this number when more than one template matches the same node. Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 5.3. Gecko sup
port Sup
ported. ...